Commit 318e44b9 authored by Tom Perkins's avatar Tom Perkins
Browse files

Refactoring some in-and-out functions in MantidWidgets

re #15286
parent 5e8c6cdb
......@@ -609,7 +609,7 @@ MDHistoWorkspace::getLineData(const Mantid::Kernel::VMD &start,
line.x.push_back(length);
line.y.push_back(std::numeric_limits<signal_t>::quiet_NaN());
line.e.push_back(std::numeric_limits<signal_t>::quiet_NaN());
return;
return line;
} else {
// Get the first point
std::set<coord_t>::iterator it;
......
......@@ -73,7 +73,7 @@ namespace MantidQt
// is a point in real space masked by any of the shapes
bool isMasked(double x, double y)const;
// collect all screen pixels that are masked by the shapes
void getMaskedPixels(QList<QPoint>& pixels)const;
QList<QPoint> getMaskedPixels()const;
// set the bounding rect of the current shape such that its real rect is given by the argument
void setCurrentBoundingRectReal(const QRectF& rect);
......
......@@ -23,7 +23,7 @@ namespace MantidQt
RenameParDialog(const std::vector<std::string>& old_params,
const std::vector<std::string>& new_params,
QWidget *parent=NULL);
void setOutput(std::vector<std::string>& out)const;
std::vector<std::string> setOutput() const;
protected slots:
void uniqueIndexedNames(bool);
void doNotRename(bool);
......
......@@ -273,8 +273,7 @@ namespace MantidQt
m_instrActor->cacheDetPos();
// find the layer of visible detectors
QList<QPoint> pixels;
m_maskShapes.getMaskedPixels(pixels);
QList<QPoint> pixels = m_maskShapes.getMaskedPixels();
double zmin = 1.0;
double zmax = 0.0;
QSet<int> ids;
......
......@@ -702,9 +702,8 @@ namespace MantidQt
return false;
}
void Shape2DCollection::getMaskedPixels(QList<QPoint>& pixels)const
{
pixels.clear();
QList<QPoint> Shape2DCollection::getMaskedPixels() const {
QList<QPoint> pixels;
QTransform inv = m_transform.inverted();
for (int i = m_viewport.left(); i <= m_viewport.right(); ++i)
{
......@@ -721,6 +720,7 @@ namespace MantidQt
}
}
}
return pixels;
}
/**
......
......@@ -96,16 +96,17 @@ QString RenameParDialog::makeUniqueIndexedName(const QString& name)
/**
* Output the new names to a vector
* @param out :: Reference to a vector for output
* @returns :: new names in a vector
*/
void RenameParDialog::setOutput(std::vector<std::string>& out)const
std::vector<std::string> RenameParDialog::setOutput() const
{
out.clear();
std::vector<std::string> out;
QAbstractItemModel* model = m_uiForm.tableWidget->model();
for(int row=0;row< m_uiForm.tableWidget->rowCount(); ++row)
{
out.push_back(model->data(model->index(row,1)).toString().toStdString());
}
return out;
}
void RenameParDialog::uniqueIndexedNames(bool ok)
......
......@@ -244,8 +244,7 @@ void UserFunctionDialog::checkParameters(QString& expr)
RenameParDialog dlg(all,common);
if (dlg.exec() == QDialog::Accepted)
{
std::vector<std::string> vars_new;
dlg.setOutput(vars_new);
auto vars_new = dlg.setOutput();
std::vector<std::string>::const_iterator v_old = common.begin();
std::vector<std::string>::const_iterator v_new = vars_new.begin();
for(; v_old != common.end(); ++v_old,++v_new)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment