Commit 29549da6 authored by Giovanni Di Siena's avatar Giovanni Di Siena
Browse files

Re #25299 qt modernize-use-auto

parent aaf83ba1
......@@ -80,7 +80,7 @@ AlgExecSummaryGrpBox::AlgExecSummaryGrpBox(QString title, QWidget *w)
if (m_Datelabel)
m_Datelabel->setBuddy(m_execDateTimeEdit);
QFormLayout *formLayout = new QFormLayout;
auto *formLayout = new QFormLayout;
if (formLayout) {
formLayout->addRow(m_execDurationlabel, m_execDurationEdit);
formLayout->addRow(m_Datelabel, m_execDateTimeEdit);
......@@ -165,7 +165,7 @@ AlgEnvHistoryGrpBox::AlgEnvHistoryGrpBox(QString title, QWidget *w)
if (m_frmworkVersionLabel)
m_frmworkVersionLabel->setBuddy(m_frmwkVersnEdit);
QFormLayout *formLayout = new QFormLayout();
auto *formLayout = new QFormLayout();
if (formLayout) {
formLayout->addRow(m_osNameLabel, m_osNameEdit);
formLayout->addRow(m_osVersionLabel, m_osVersionEdit);
......@@ -262,7 +262,7 @@ AlgorithmHistoryWindow::AlgorithmHistoryWindow(
SLOT(doRoll(int)));
// The tree and the history details layout
QHBoxLayout *treeLayout = new QHBoxLayout;
auto *treeLayout = new QHBoxLayout;
treeLayout->addWidget(m_Historytree, 3); // History stretches 1
treeLayout->addWidget(m_histPropWindow->m_histpropTree,
5); // Properties gets more space
......@@ -275,7 +275,7 @@ AlgorithmHistoryWindow::AlgorithmHistoryWindow(
m_envHistGrpBox =
createEnvHistGrpBox(wsptr->getHistory().getEnvironmentHistory());
QHBoxLayout *environmentLayout = new QHBoxLayout;
auto *environmentLayout = new QHBoxLayout;
environmentLayout->addWidget(m_execSumGrpBox, 1);
environmentLayout->addWidget(m_envHistGrpBox, 2);
......@@ -297,7 +297,7 @@ AlgorithmHistoryWindow::AlgorithmHistoryWindow(
connect(m_scriptButtonClipboard, SIGNAL(clicked()), this,
SLOT(copytoClipboard()));
QHBoxLayout *buttonLayout = new QHBoxLayout;
auto *buttonLayout = new QHBoxLayout;
buttonLayout->addStretch(1); // Align the button to the right
buttonLayout->addWidget(m_scriptVersionLabel);
buttonLayout->addWidget(m_scriptComboMode);
......
......@@ -47,7 +47,7 @@ AlgorithmPropertiesWidget::AlgorithmPropertiesWidget(QWidget *parent)
m_viewport = new QWidget(this);
// Put everything in a vertical box and put it inside the m_scroll area
QVBoxLayout *mainLay = new QVBoxLayout();
auto *mainLay = new QVBoxLayout();
m_viewport->setLayout(mainLay);
// The property boxes
mainLay->addLayout(m_inputGrid);
......@@ -64,7 +64,7 @@ AlgorithmPropertiesWidget::AlgorithmPropertiesWidget(QWidget *parent)
m_scroll->setAlignment(Qt::Alignment(Qt::AlignLeft & Qt::AlignTop));
// Add a layout for the whole widget, containing just the m_scroll area
QVBoxLayout *dialog_layout = new QVBoxLayout();
auto *dialog_layout = new QVBoxLayout();
dialog_layout->addWidget(m_scroll);
setLayout(dialog_layout);
......
......@@ -33,7 +33,7 @@ AlgorithmSelectorWidget::AlgorithmSelectorWidget(QWidget *parent)
m_updateObserver(*this,
&AlgorithmSelectorWidget::handleAlgorithmFactoryUpdate),
m_updateInProgress(false) {
QHBoxLayout *buttonLayout = new QHBoxLayout();
auto *buttonLayout = new QHBoxLayout();
m_tree = new AlgorithmTreeWidget(this);
m_tree->setHeaderLabel("Algorithms");
......@@ -249,7 +249,7 @@ void AlgorithmTreeWidget::mouseMoveEvent(QMouseEvent *e) {
// Start dragging
QDrag *drag = new QDrag(this);
QMimeData *mimeData = new QMimeData;
auto *mimeData = new QMimeData;
mimeData->setText("Algorithm");
drag->setMimeData(mimeData);
......
......@@ -1049,7 +1049,7 @@ void CatalogSearch::addCheckBoxColumn(QTableWidget *table) {
// Add a checkbox to all rows in the first column.
for (int row = 0; row < table->rowCount(); row++) {
QTableWidgetItem *newItem = new QTableWidgetItem();
auto *newItem = new QTableWidgetItem();
// Allow the widget to take on checkbox functionality.
newItem->setCheckState(Qt::Unchecked);
// Allow the user to select and check the box.
......@@ -1368,7 +1368,7 @@ void CatalogSearch::sortByFileSize(int column) {
// Convert cell value to int within the datamodel.
// This allows us to sort by the specific column.
for (int row = 0; row < table->rowCount(); row++) {
QTableWidgetItem *item = new QTableWidgetItem;
auto *item = new QTableWidgetItem;
item->setData(Qt::EditRole, table->item(row, byteColumn)->text().toInt());
table->setItem(row, byteColumn, item);
}
......
......@@ -131,7 +131,7 @@ void QDataProcessorWidget::createTable() {
ui.setupUi(this);
// Allow rows and columns to be reordered
QHeaderView *header = new QHeaderView(Qt::Horizontal);
auto *header = new QHeaderView(Qt::Horizontal);
header->setStretchLastSection(true);
header->setStyleSheet("QHeaderView {font-size:11pt;}");
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
......
......@@ -58,7 +58,7 @@ DiagResults::DiagResults(QWidget *parent)
row = addRow(col1, col2);
}
row++;
QPushButton *close = new QPushButton("Close");
auto *close = new QPushButton("Close");
m_Grid->addWidget(close, row, 1);
connect(close, SIGNAL(clicked()), this, SLOT(close()));
......
......@@ -193,7 +193,7 @@ RangeLimitBox::RangeLimitBox(LimitType type, QWidget *parent)
d_spin_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
d_spin_box->setEnabled(false);
QHBoxLayout *l = new QHBoxLayout(this);
auto *l = new QHBoxLayout(this);
l->setMargin(0);
l->setSpacing(0);
l->addWidget(d_checkbox);
......
......@@ -90,8 +90,7 @@ void FilePropertyWidget::browseClicked() {
* @return full path to the file(s) to load/save
*/
QString FilePropertyWidget::openFileDialog(Mantid::Kernel::Property *baseProp) {
Mantid::API::FileProperty *prop =
dynamic_cast<Mantid::API::FileProperty *>(baseProp);
auto *prop = dynamic_cast<Mantid::API::FileProperty *>(baseProp);
if (!prop)
return "";
......@@ -139,8 +138,7 @@ QStringList
FilePropertyWidget::openMultipleFileDialog(Mantid::Kernel::Property *baseProp) {
if (!baseProp)
return QStringList();
Mantid::API::MultipleFileProperty *prop =
dynamic_cast<Mantid::API::MultipleFileProperty *>(baseProp);
auto *prop = dynamic_cast<Mantid::API::MultipleFileProperty *>(baseProp);
if (!prop)
return QStringList();
......
......@@ -146,9 +146,8 @@ FindFilesWorker::getFilesFromAlgorithm() {
Property *prop = algorithm->getProperty(propName);
std::string valueForProperty = prop->value();
FileProperty *fileProp = dynamic_cast<FileProperty *>(prop);
MultipleFileProperty *multiFileProp =
dynamic_cast<MultipleFileProperty *>(prop);
auto *fileProp = dynamic_cast<FileProperty *>(prop);
auto *multiFileProp = dynamic_cast<MultipleFileProperty *>(prop);
if (fileProp) {
filenames.emplace_back(fileProp->value());
......
......@@ -34,7 +34,7 @@ FindReplaceDialog::FindReplaceDialog(ScriptEditor *editor)
* Create the widgets and lay them out
*/
void FindReplaceDialog::initLayout() {
QGroupBox *gb1 = new QGroupBox();
auto *gb1 = new QGroupBox();
m_topLayout = new QGridLayout(gb1);
m_topLayout->addWidget(new QLabel(tr("Find")), 0, 0);
......@@ -55,9 +55,9 @@ void FindReplaceDialog::initLayout() {
addReplaceBox();
QGroupBox *gb2 = new QGroupBox();
QGridLayout *bottomLayout = new QGridLayout(gb2);
QButtonGroup *find_options = new QButtonGroup(this);
auto *gb2 = new QGroupBox();
auto *bottomLayout = new QGridLayout(gb2);
auto *find_options = new QButtonGroup(this);
find_options->setExclusive(false);
boxCaseSensitive = new QCheckBox(tr("&Match case"));
......@@ -87,7 +87,7 @@ void FindReplaceDialog::initLayout() {
connect(find_options, SIGNAL(buttonClicked(int)), this,
SLOT(resetSearchFlags()));
QVBoxLayout *vb1 = new QVBoxLayout();
auto *vb1 = new QVBoxLayout();
vb1->addWidget(gb1);
vb1->addWidget(gb2);
......@@ -106,7 +106,7 @@ void FindReplaceDialog::initLayout() {
m_vb2->addStretch();
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
QHBoxLayout *hb = new QHBoxLayout(this);
auto *hb = new QHBoxLayout(this);
hb->addLayout(vb1);
hb->addLayout(m_vb2);
}
......
......@@ -55,7 +55,7 @@ FitOptionsBrowser::FitOptionsBrowser(QWidget *parent, FittingType fitType)
createBrowser();
createProperties();
QVBoxLayout *layout = new QVBoxLayout(this);
auto *layout = new QVBoxLayout(this);
layout->addWidget(m_browser);
layout->setContentsMargins(0, 0, 0, 0);
}
......@@ -74,11 +74,11 @@ void FitOptionsBrowser::createBrowser() {
m_groupManager = new QtGroupPropertyManager(this);
// create editor factories
QtSpinBoxFactory *spinBoxFactory = new QtSpinBoxFactory(this);
DoubleEditorFactory *doubleEditorFactory = new DoubleEditorFactory(this);
QtLineEditFactory *lineEditFactory = new QtLineEditFactory(this);
QtCheckBoxFactory *checkBoxFactory = new QtCheckBoxFactory(this);
QtEnumEditorFactory *comboBoxFactory = new QtEnumEditorFactory(this);
auto *spinBoxFactory = new QtSpinBoxFactory(this);
auto *doubleEditorFactory = new DoubleEditorFactory(this);
auto *lineEditFactory = new QtLineEditFactory(this);
auto *checkBoxFactory = new QtCheckBoxFactory(this);
auto *comboBoxFactory = new QtEnumEditorFactory(this);
m_browser = new QtTreePropertyBrowser(nullptr, QStringList(), false);
// assign factories to property managers
......
......@@ -301,7 +301,7 @@ void FitPropertyBrowser::initLayout(QWidget *w) { initBasicLayout(w); }
* @return push botton for the fit menu
*/
QPushButton *FitPropertyBrowser::createFitMenuButton(QWidget *w) {
QPushButton *btnFit = new QPushButton("Fit");
auto *btnFit = new QPushButton("Fit");
m_tip = new QLabel("", w);
m_fitMapper = new QSignalMapper(this);
......@@ -390,11 +390,11 @@ void FitPropertyBrowser::initBasicLayout(QWidget *w) {
connect(m_vectorSizeManager, SIGNAL(propertyChanged(QtProperty *)), this,
SLOT(vectorSizeChanged(QtProperty *)));
QVBoxLayout *layout = new QVBoxLayout(w);
auto *layout = new QVBoxLayout(w);
layout->setObjectName("vlayout");
QGridLayout *buttonsLayout = new QGridLayout();
auto *buttonsLayout = new QGridLayout();
QPushButton *btnDisplay = new QPushButton("Display");
auto *btnDisplay = new QPushButton("Display");
btnDisplay->setObjectName("button_Display");
QMenu *displayMenu = new QMenu(this);
displayMenu->setObjectName("menu_Display");
......@@ -424,7 +424,7 @@ void FitPropertyBrowser::initBasicLayout(QWidget *w) {
displayMenu->addAction(m_displayActionQuality);
btnDisplay->setMenu(displayMenu);
QPushButton *btnSetup = new QPushButton("Setup");
auto *btnSetup = new QPushButton("Setup");
btnSetup->setObjectName("button_Setup");
QMenu *setupMenu = new QMenu(this);
setupMenu->setObjectName("menu_Setup");
......@@ -1143,7 +1143,7 @@ void FitPropertyBrowser::setWorkspaceName(const QString &wsName) {
} catch (Mantid::Kernel::Exception::NotFoundError &) {
}
if (mws) {
size_t wi = static_cast<size_t>(workspaceIndex());
auto wi = static_cast<size_t>(workspaceIndex());
if (wi < mws->getNumberHistograms() && !mws->x(wi).empty()) {
setStartX(mws->x(wi).front());
setEndX(mws->x(wi).back());
......@@ -2560,7 +2560,7 @@ QtProperty *FitPropertyBrowser::addStringProperty(const QString &name) const {
*/
void FitPropertyBrowser::setStringPropertyValue(QtProperty *prop,
const QString &value) const {
QtStringPropertyManager *manager =
auto *manager =
dynamic_cast<QtStringPropertyManager *>(prop->propertyManager());
if (manager) {
manager->setValue(prop, value);
......@@ -2568,7 +2568,7 @@ void FitPropertyBrowser::setStringPropertyValue(QtProperty *prop,
}
QString FitPropertyBrowser::getStringPropertyValue(QtProperty *prop) const {
QtStringPropertyManager *manager =
auto *manager =
dynamic_cast<QtStringPropertyManager *>(prop->propertyManager());
if (manager)
return manager->value(prop);
......@@ -2861,7 +2861,7 @@ void FitPropertyBrowser::removeLogValue() {
}
void FitPropertyBrowser::sequentialFit() {
SequentialFitDialog *dlg = new SequentialFitDialog(this, m_mantidui);
auto *dlg = new SequentialFitDialog(this, m_mantidui);
std::string wsName = workspaceName();
if (!wsName.empty() &&
dlg->addWorkspaces(QStringList(QString::fromStdString(wsName)))) {
......@@ -3015,7 +3015,7 @@ QStringList FitPropertyBrowser::getWorkspaceNames() { return m_workspaceNames; }
* Call MultifitSetupDialog to populate MultiBG function.
*/
void FitPropertyBrowser::setupMultifit() {
MultifitSetupDialog *dlg = new MultifitSetupDialog(this);
auto *dlg = new MultifitSetupDialog(this);
dlg->exec();
QStringList ties = dlg->getParameterTies();
......
......@@ -154,7 +154,7 @@ int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const {
if (!parent) {
return -1;
} else if (parent->isWidgetType()) {
QWidget *pw = static_cast<QWidget *>(parent);
auto *pw = static_cast<QWidget *>(parent);
return pw->style()->pixelMetric(pm, nullptr, pw);
} else {
return static_cast<QLayout *>(parent)->spacing();
......
......@@ -66,7 +66,7 @@ GenericDialog::~GenericDialog() {}
void GenericDialog::initLayout() {
// Add a layout for QDialog
QVBoxLayout *dialog_layout = new QVBoxLayout();
auto *dialog_layout = new QVBoxLayout();
setLayout(dialog_layout);
// Add the helpful summary message
if (isMessageAvailable())
......
......@@ -776,8 +776,7 @@ MWRunFiles::getFileExtensionsFromAlgorithm(const QString &algName,
algorithm->initialize();
Property *prop = algorithm->getProperty(propName.toStdString());
FileProperty *fileProp = dynamic_cast<FileProperty *>(prop);
MultipleFileProperty *multiFileProp =
dynamic_cast<MultipleFileProperty *>(prop);
auto *multiFileProp = dynamic_cast<MultipleFileProperty *>(prop);
std::vector<std::string> allowed;
QString preferredExt;
......
......@@ -122,7 +122,7 @@ void MantidTreeWidget::mouseMoveEvent(QMouseEvent *e) {
// Start dragging - Qt docs say not to delete the QDrag object
// manually
QDrag *drag = new QDrag(this);
QMimeData *mimeData = new QMimeData;
auto *mimeData = new QMimeData;
drag->setMimeData(mimeData);
mimeData->setObjectName("MantidWorkspace");
mimeData->setText(wsNames.join("\n"));
......
......@@ -38,8 +38,7 @@ bool MantidTreeWidgetItem::operator<(const QTreeWidgetItem &other) const {
// what the user has seletected in terms of order or scheme.
bool thisShouldBeSorted = m_sortPos == 0;
const MantidTreeWidgetItem *mantidOther =
dynamic_cast<const MantidTreeWidgetItem *>(&other);
const auto *mantidOther = dynamic_cast<const MantidTreeWidgetItem *>(&other);
int otherSortPos = mantidOther ? mantidOther->getSortPos() : 0;
bool otherShouldBeSorted = otherSortPos == 0;
......
......@@ -1338,7 +1338,7 @@ QValidator::State IntervalListValidator::validate(QString &input,
MantidWSIndexWidget::QLineEditWithErrorMark::QLineEditWithErrorMark(
QWidget *parent)
: QWidget(parent) {
QGridLayout *layout = new QGridLayout();
auto *layout = new QGridLayout();
_lineEdit = new QLineEdit();
m_validLbl = new QLabel("*"); // make it red
QPalette pal = m_validLbl->palette();
......
......@@ -78,10 +78,10 @@ QColor MdSettings::getUserSettingBackgroundColor() {
QSettings settings;
settings.beginGroup(m_vsiGroup);
QColor backgroundColor = settings
.value(m_lblUserSettingBackgroundColor,
m_mdConstants.getDefaultBackgroundColor())
.value<QColor>();
auto backgroundColor = settings
.value(m_lblUserSettingBackgroundColor,
m_mdConstants.getDefaultBackgroundColor())
.value<QColor>();
settings.endGroup();
return backgroundColor;
......@@ -99,10 +99,10 @@ QColor MdSettings::getLastSessionBackgroundColor() {
QSettings settings;
settings.beginGroup(m_vsiGroup);
QColor backgroundColor = settings
.value(m_lblLastSessionBackgroundColor,
m_mdConstants.getDefaultBackgroundColor())
.value<QColor>();
auto backgroundColor = settings
.value(m_lblLastSessionBackgroundColor,
m_mdConstants.getDefaultBackgroundColor())
.value<QColor>();
settings.endGroup();
return backgroundColor;
......
......@@ -210,7 +210,7 @@ void MuonFitPropertyBrowser::init() {
SLOT(currentItemChanged(QtBrowserItem *)));
m_btnGroup = new QGroupBox(tr("Reselect Data"));
QHBoxLayout *btnLayout = new QHBoxLayout;
auto *btnLayout = new QHBoxLayout;
m_reselectGroupBtn = new QPushButton("Groups/Pairs");
m_reselectPeriodBtn = new QPushButton("Periods");
m_generateBtn = new QPushButton("Combine Periods");
......@@ -1470,7 +1470,7 @@ void MuonFitPropertyBrowser::genGroupWindow() {
QtGroupPropertyManager *groupManager =
new QtGroupPropertyManager(m_groupWindow);
QVBoxLayout *layout = new QVBoxLayout(m_groupWindow);
QtTreePropertyBrowser *groupBrowser = new QtTreePropertyBrowser();
auto *groupBrowser = new QtTreePropertyBrowser();
QtProperty *groupSettings = groupManager->addProperty("Group/Pair selection");
for (auto iter = m_groupBoxes.constBegin(); iter != m_groupBoxes.constEnd();
++iter) {
......@@ -1763,7 +1763,7 @@ void MuonFitPropertyBrowser::genPeriodWindow() {
QtGroupPropertyManager *groupManager =
new QtGroupPropertyManager(m_periodWindow);
QVBoxLayout *layout = new QVBoxLayout(m_periodWindow);
QtTreePropertyBrowser *groupBrowser = new QtTreePropertyBrowser();
auto *groupBrowser = new QtTreePropertyBrowser();
QtProperty *groupSettings = groupManager->addProperty("Period selection");
for (auto iter = m_periodBoxes.constBegin(); iter != m_periodBoxes.constEnd();
++iter) {
......@@ -1785,14 +1785,14 @@ void MuonFitPropertyBrowser::genCombinePeriodWindow() {
// reset combine window
m_comboWindow = new QDialog(this);
QVBoxLayout *layout = new QVBoxLayout(m_comboWindow);
QFormLayout *formLayout = new QFormLayout;
auto *formLayout = new QFormLayout;
m_positiveCombo = new QLineEdit();
m_negativeCombo = new QLineEdit();
formLayout->addRow(new QLabel(tr("Combine:")), m_positiveCombo);
formLayout->addRow(new QLabel(tr(" - ")), m_negativeCombo);
layout->addLayout(formLayout);
QPushButton *applyBtn = new QPushButton("Apply");
auto *applyBtn = new QPushButton("Apply");
connect(applyBtn, SIGNAL(released()), this, SLOT(combineBtnPressed()));
......
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