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

Re #25299 qt modernize-use-auto

parent aaf83ba1
......@@ -214,7 +214,7 @@ PropertyWidget::PropertyWidget(Mantid::Kernel::Property *prop, QWidget *parent,
this->lower();
}
QWidget *infoWidget = new QWidget();
auto *infoWidget = new QWidget();
infoWidget->setLayout(new QHBoxLayout(this));
infoWidget->layout()->setSpacing(1);
infoWidget->layout()->setContentsMargins(0, 0, 0, 0);
......@@ -392,7 +392,7 @@ void PropertyWidget::addReplaceWSButton() {
if (m_replaceWSButton)
return;
IWorkspaceProperty *wsProp = dynamic_cast<IWorkspaceProperty *>(m_prop);
auto *wsProp = dynamic_cast<IWorkspaceProperty *>(m_prop);
if (wsProp && (m_prop->direction() == Direction::Output)) {
m_replaceWSButton =
new QPushButton(QIcon(":/data_replace.png"), "", m_parent);
......
......@@ -43,9 +43,8 @@ PropertyWidget *
PropertyWidgetFactory::createWidget(Mantid::Kernel::Property *prop,
QWidget *parent, QGridLayout *layout,
int row) {
Mantid::API::FileProperty *fileType =
dynamic_cast<Mantid::API::FileProperty *>(prop);
Mantid::API::MultipleFileProperty *multipleFileType =
auto *fileType = dynamic_cast<Mantid::API::FileProperty *>(prop);
auto *multipleFileType =
dynamic_cast<Mantid::API::MultipleFileProperty *>(prop);
PropertyWithValue<bool> *boolProp =
dynamic_cast<PropertyWithValue<bool> *>(prop);
......
......@@ -25,7 +25,7 @@ DoubleDialogEditor::DoubleDialogEditor(QtProperty *property, QWidget *parent,
bool hasOption, bool isOptionSet)
: QWidget(parent), m_property(property), m_hasOption(hasOption),
m_isOptionSet(isOptionSet) {
QHBoxLayout *layout = new QHBoxLayout;
auto *layout = new QHBoxLayout;
m_editor = new DoubleEditor(property, this);
layout->addWidget(m_editor);
setFocusProxy(m_editor);
......
......@@ -32,18 +32,18 @@ void StringDialogEditorFactory::disconnectPropertyManager(
*/
StringDialogEditor::StringDialogEditor(QtProperty *property, QWidget *parent)
: QWidget(parent), m_property(property) {
QHBoxLayout *layout = new QHBoxLayout;
auto *layout = new QHBoxLayout;
m_lineEdit = new QLineEdit(this);
layout->addWidget(m_lineEdit);
setFocusProxy(m_lineEdit);
connect(m_lineEdit, SIGNAL(editingFinished()), this, SLOT(updateProperty()));
QtStringPropertyManager *mgr =
auto *mgr =
dynamic_cast<QtStringPropertyManager *>(property->propertyManager());
if (mgr) {
m_lineEdit->setText(mgr->value(property));
}
QPushButton *button = new QPushButton("...", this);
auto *button = new QPushButton("...", this);
button->setMaximumSize(20, 1000000);
connect(button, SIGNAL(clicked()), this, SLOT(runDialog()));
layout->addWidget(button);
......@@ -72,7 +72,7 @@ StringDialogEditor::~StringDialogEditor() {}
* Slot which sets the property with the current text in the editor.
*/
void StringDialogEditor::updateProperty() {
QtStringPropertyManager *mgr =
auto *mgr =
dynamic_cast<QtStringPropertyManager *>(m_property->propertyManager());
if (mgr) {
mgr->setValue(m_property, m_lineEdit->text());
......
......@@ -15,7 +15,7 @@ QWidget *StringEditorFactory::createEditorForManager(
StringEditor::StringEditor(QtProperty *property, QWidget *parent)
: QLineEdit(parent), m_property(property) {
connect(this, SIGNAL(editingFinished()), this, SLOT(updateProperty()));
QtStringPropertyManager *mgr =
auto *mgr =
dynamic_cast<QtStringPropertyManager *>(property->propertyManager());
if (mgr) {
setText(mgr->value(property));
......@@ -23,7 +23,7 @@ StringEditor::StringEditor(QtProperty *property, QWidget *parent)
}
void StringEditor::updateProperty() {
QtStringPropertyManager *mgr =
auto *mgr =
dynamic_cast<QtStringPropertyManager *>(m_property->propertyManager());
if (mgr) {
mgr->setValue(m_property, this->text());
......
......@@ -99,7 +99,7 @@ QT_BEGIN_NAMESPACE
QToolButton *
QtButtonPropertyBrowserPrivate::createButton(QWidget *parent) const {
QToolButton *button = new QToolButton(parent);
auto *button = new QToolButton(parent);
button->setCheckable(true);
button->setSizePolicy(
QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed));
......@@ -242,7 +242,7 @@ void QtButtonPropertyBrowserPrivate::propertyInserted(
WidgetItem *afterItem = m_indexToItem.value(afterIndex);
WidgetItem *parentItem = m_indexToItem.value(index->parent());
WidgetItem *newItem = new WidgetItem();
auto *newItem = new WidgetItem();
newItem->parent = parentItem;
QGridLayout *layout = nullptr;
......@@ -277,7 +277,7 @@ void QtButtonPropertyBrowserPrivate::propertyInserted(
} else {
l = m_mainLayout;
}
QFrame *container = new QFrame();
auto *container = new QFrame();
container->setFrameShape(QFrame::Panel);
container->setFrameShadow(QFrame::Raised);
parentItem->container = container;
......
......@@ -378,7 +378,7 @@ void QtSliderFactory::connectPropertyManager(QtIntPropertyManager *manager) {
QWidget *QtSliderFactory::createEditorForManager(QtIntPropertyManager *manager,
QtProperty *property,
QWidget *parent) {
QSlider *editor = new QSlider(Qt::Horizontal, parent);
auto *editor = new QSlider(Qt::Horizontal, parent);
d_ptr->initializeEditor(property, editor);
editor->setSingleStep(manager->singleStep(property));
editor->setRange(manager->minimum(property), manager->maximum(property));
......@@ -516,7 +516,7 @@ void QtScrollBarFactory::connectPropertyManager(QtIntPropertyManager *manager) {
*/
QWidget *QtScrollBarFactory::createEditorForManager(
QtIntPropertyManager *manager, QtProperty *property, QWidget *parent) {
QScrollBar *editor = new QScrollBar(Qt::Horizontal, parent);
auto *editor = new QScrollBar(Qt::Horizontal, parent);
d_ptr->initializeEditor(property, editor);
editor->setSingleStep(manager->singleStep(property));
editor->setRange(manager->minimum(property), manager->maximum(property));
......@@ -1367,7 +1367,7 @@ void QtKeySequenceEditorFactory::disconnectPropertyManager(
QtCharEdit::QtCharEdit(QWidget *parent)
: QWidget(parent), m_lineEdit(new QLineEdit(this)) {
QHBoxLayout *layout = new QHBoxLayout(this);
auto *layout = new QHBoxLayout(this);
layout->addWidget(m_lineEdit);
layout->setMargin(0);
m_lineEdit->installEventFilter(this);
......@@ -1379,7 +1379,7 @@ QtCharEdit::QtCharEdit(QWidget *parent)
bool QtCharEdit::eventFilter(QObject *o, QEvent *e) {
if (o == m_lineEdit && e->type() == QEvent::ContextMenu) {
QContextMenuEvent *c = static_cast<QContextMenuEvent *>(e);
auto *c = static_cast<QContextMenuEvent *>(e);
QMenu *menu = m_lineEdit->createStandardContextMenu();
QList<QAction *> actions = menu->actions();
QListIterator<QAction *> itAction(actions);
......@@ -1395,7 +1395,7 @@ bool QtCharEdit::eventFilter(QObject *o, QEvent *e) {
QAction *actionBefore = nullptr;
if (actions.count() > 0)
actionBefore = actions[0];
QAction *clearAction = new QAction(tr("Clear Char"), menu);
auto *clearAction = new QAction(tr("Clear Char"), menu);
menu->insertAction(actionBefore, clearAction);
menu->insertSeparator(actionBefore);
clearAction->setEnabled(!m_value.isNull());
......@@ -1897,7 +1897,7 @@ void QtCursorEditorFactory::disconnectPropertyManager(
QtColorEditWidget::QtColorEditWidget(QWidget *parent)
: QWidget(parent), m_pixmapLabel(new QLabel), m_label(new QLabel),
m_button(new QToolButton) {
QHBoxLayout *lt = new QHBoxLayout(this);
auto *lt = new QHBoxLayout(this);
setupTreeViewEditorMargin(lt);
lt->setSpacing(0);
lt->addWidget(m_pixmapLabel);
......@@ -2059,7 +2059,7 @@ void QtColorEditorFactory::disconnectPropertyManager(
QtFontEditWidget::QtFontEditWidget(QWidget *parent)
: QWidget(parent), m_pixmapLabel(new QLabel), m_label(new QLabel),
m_button(new QToolButton) {
QHBoxLayout *lt = new QHBoxLayout(this);
auto *lt = new QHBoxLayout(this);
setupTreeViewEditorMargin(lt);
lt->setSpacing(0);
lt->addWidget(m_pixmapLabel);
......
......@@ -168,7 +168,7 @@ void QtGroupBoxPropertyBrowserPrivate::propertyInserted(
WidgetItem *afterItem = m_indexToItem.value(afterIndex);
WidgetItem *parentItem = m_indexToItem.value(index->parent());
WidgetItem *newItem = new WidgetItem();
auto *newItem = new WidgetItem();
newItem->parent = parentItem;
QGridLayout *layout = nullptr;
......
......@@ -1315,7 +1315,7 @@ void QtAbstractPropertyBrowserPrivate::createBrowserIndexes(
QtBrowserItem *QtAbstractPropertyBrowserPrivate::createBrowserIndex(
QtProperty *property, QtBrowserItem *parentIndex,
QtBrowserItem *afterIndex) {
QtBrowserItem *newIndex = new QtBrowserItem(q_ptr, property, parentIndex);
auto *newIndex = new QtBrowserItem(q_ptr, property, parentIndex);
if (parentIndex) {
parentIndex->d_ptr->addChild(newIndex, afterIndex);
} else {
......
......@@ -304,7 +304,7 @@ QString QtPropertyBrowserUtils::fontValueText(const QFont &f) {
QtBoolEdit::QtBoolEdit(QWidget *parent)
: QWidget(parent), m_checkBox(new QCheckBox(this)), m_textVisible(true) {
QHBoxLayout *lt = new QHBoxLayout;
auto *lt = new QHBoxLayout;
if (QApplication::layoutDirection() == Qt::LeftToRight)
lt->setContentsMargins(4, 0, 0, 0);
else
......@@ -359,7 +359,7 @@ void QtBoolEdit::mousePressEvent(QMouseEvent *event) {
QtKeySequenceEdit::QtKeySequenceEdit(QWidget *parent)
: QWidget(parent), m_num(0), m_lineEdit(new QLineEdit(this)) {
QHBoxLayout *layout = new QHBoxLayout(this);
auto *layout = new QHBoxLayout(this);
layout->addWidget(m_lineEdit);
layout->setMargin(0);
m_lineEdit->installEventFilter(this);
......@@ -371,7 +371,7 @@ QtKeySequenceEdit::QtKeySequenceEdit(QWidget *parent)
bool QtKeySequenceEdit::eventFilter(QObject *o, QEvent *e) {
if (o == m_lineEdit && e->type() == QEvent::ContextMenu) {
QContextMenuEvent *c = static_cast<QContextMenuEvent *>(e);
auto *c = static_cast<QContextMenuEvent *>(e);
QMenu *menu = m_lineEdit->createStandardContextMenu();
const QList<QAction *> actions = menu->actions();
QListIterator<QAction *> itAction(actions);
......@@ -387,7 +387,7 @@ bool QtKeySequenceEdit::eventFilter(QObject *o, QEvent *e) {
QAction *actionBefore = nullptr;
if (actions.count() > 0)
actionBefore = actions[0];
QAction *clearAction = new QAction(tr("Clear Shortcut"), menu);
auto *clearAction = new QAction(tr("Clear Shortcut"), menu);
menu->insertAction(actionBefore, clearAction);
menu->insertSeparator(actionBefore);
clearAction->setEnabled(!m_keySequence.isEmpty());
......
......@@ -381,7 +381,7 @@ QSize QtPropertyEditorDelegate::sizeHint(const QStyleOptionViewItem &option,
bool QtPropertyEditorDelegate::eventFilter(QObject *object, QEvent *event) {
if (event->type() == QEvent::FocusOut) {
QFocusEvent *fe = static_cast<QFocusEvent *>(event);
auto *fe = static_cast<QFocusEvent *>(event);
if (fe->reason() == Qt::ActiveWindowFocusReason)
return false;
}
......@@ -426,7 +426,7 @@ static QIcon drawIndicatorIcon(const QPalette &palette, QStyle *style) {
void QtTreePropertyBrowserPrivate::init(QWidget *parent,
const QStringList &options,
bool darkTopLevel) {
QHBoxLayout *layout = new QHBoxLayout(parent);
auto *layout = new QHBoxLayout(parent);
layout->setMargin(0);
m_treeWidget = new QtPropertyEditorView(parent, darkTopLevel);
m_treeWidget->setEditorPrivate(this);
......
......@@ -42,7 +42,7 @@ RenameParDialog::RenameParDialog(const std::vector<std::string> &old_params,
* m_old_names and in column #1 of the table widget
*/
bool RenameParDialog::isUnique(const QString &name) const {
std::vector<std::string>::const_iterator it =
auto it =
std::find(m_old_params.begin(), m_old_params.end(), name.toStdString());
if (it != m_old_params.end())
return false;
......
......@@ -223,7 +223,7 @@ QVariant RepoModel::data(const QModelIndex &index, int role) const {
using namespace Mantid::API;
if (!index.isValid())
return QVariant();
RepoItem *item = static_cast<RepoItem *>(index.internalPointer());
auto *item = static_cast<RepoItem *>(index.internalPointer());
try {
const QString &path = item->path();
Mantid::API::ScriptInfo inf;
......@@ -446,7 +446,7 @@ bool RepoModel::setData(const QModelIndex &index, const QVariant &value,
// the path can not be changed
return false;
int count_changed = 0;
RepoItem *item = static_cast<RepoItem *>(index.internalPointer());
auto *item = static_cast<RepoItem *>(index.internalPointer());
std::string path = item->path().toStdString();
bool ret = false;
......@@ -494,7 +494,7 @@ bool RepoModel::setData(const QModelIndex &index, const QVariant &value,
return false;
};
UploadForm *form = new UploadForm(QString::fromStdString(path), father);
auto *form = new UploadForm(QString::fromStdString(path), father);
QSettings settings;
settings.beginGroup("Mantid/ScriptRepository");
QString email = settings.value("UploadEmail", QString()).toString();
......@@ -555,8 +555,7 @@ bool RepoModel::setData(const QModelIndex &index, const QVariant &value,
return false;
}
// query the user if he wants to delete only locally or remote as well.
DeleteQueryBox *box =
new DeleteQueryBox(QString::fromStdString(path), father);
auto *box = new DeleteQueryBox(QString::fromStdString(path), father);
if (box->exec() != QMessageBox::Yes) {
// the user gave up deleting this entry, release memory
......@@ -718,7 +717,7 @@ QModelIndex RepoModel::parent(const QModelIndex &index) const {
if (!index.isValid())
return QModelIndex();
// the child is the RepoItem pointed by the index.
RepoItem *childItem = static_cast<RepoItem *>(index.internalPointer());
auto *childItem = static_cast<RepoItem *>(index.internalPointer());
// the parent is the parent of the RepoItem.
RepoItem *parentItem = childItem->parent();
// the root item does not have a parent
......@@ -758,7 +757,7 @@ int RepoModel::columnCount(const QModelIndex & /*parent*/) const { return 4; }
/** Return the description of the file for a defined entry
**/
QString RepoModel::fileDescription(const QModelIndex &index) {
RepoItem *item = static_cast<RepoItem *>(index.internalPointer());
auto *item = static_cast<RepoItem *>(index.internalPointer());
if (!item)
return "";
QString desc;
......@@ -772,7 +771,7 @@ QString RepoModel::fileDescription(const QModelIndex &index) {
}
QString RepoModel::author(const QModelIndex &index) {
RepoItem *item = static_cast<RepoItem *>(index.internalPointer());
auto *item = static_cast<RepoItem *>(index.internalPointer());
QString author = "Not defined";
if (!item)
return author;
......@@ -790,7 +789,7 @@ QString RepoModel::author(const QModelIndex &index) {
@return The operative system path or empty string
*/
QString RepoModel::filePath(const QModelIndex &index) {
RepoItem *item = static_cast<RepoItem *>(index.internalPointer());
auto *item = static_cast<RepoItem *>(index.internalPointer());
// qDebug() << "Get file path from : " << item->path()<< '\n';
Mantid::API::SCRIPTSTATUS state =
repo_ptr->fileStatus(item->path().toStdString());
......@@ -958,8 +957,7 @@ void RepoModel::downloadFinished(void) {
QString("<html><body><p>%1</p></body></html>").arg(info));
}
downloading_path = nofile_flag;
RepoItem *repo_item =
static_cast<RepoItem *>(download_index.internalPointer());
auto *repo_item = static_cast<RepoItem *>(download_index.internalPointer());
QModelIndex top_left = createIndex(0, 0, repo_item);
QModelIndex bottom_right = createIndex(0, 3, repo_item);
emit dataChanged(top_left, bottom_right);
......@@ -967,7 +965,7 @@ void RepoModel::downloadFinished(void) {
}
bool RepoModel::isDownloading(const QModelIndex &index) const {
RepoItem *item = static_cast<RepoItem *>(index.internalPointer());
auto *item = static_cast<RepoItem *>(index.internalPointer());
if (item)
return item->path() == downloading_path;
return false;
......@@ -988,7 +986,7 @@ void RepoModel::uploadFinished(void) {
}
uploading_path = nofile_flag;
RepoItem *repo_item = static_cast<RepoItem *>(upload_index.internalPointer());
auto *repo_item = static_cast<RepoItem *>(upload_index.internalPointer());
QModelIndex top_left = createIndex(0, 0, repo_item);
QModelIndex bottom_right = createIndex(0, 3, repo_item);
emit dataChanged(top_left, bottom_right);
......@@ -996,7 +994,7 @@ void RepoModel::uploadFinished(void) {
}
bool RepoModel::isUploading(const QModelIndex &index) const {
RepoItem *item = static_cast<RepoItem *>(index.internalPointer());
auto *item = static_cast<RepoItem *>(index.internalPointer());
if (item)
return item->path() == uploading_path;
return false;
......@@ -1030,21 +1028,21 @@ RepoModel::UploadForm::UploadForm(const QString &file2upload, QWidget *parent)
// setup the layout
QGroupBox *personalGroupBox = new QGroupBox("Personal Group Box");
QFormLayout *personalLayout = new QFormLayout();
auto *personalGroupBox = new QGroupBox("Personal Group Box");
auto *personalLayout = new QFormLayout();
personalLayout->addRow("Author", author_le);
personalLayout->addRow("Email", email_le);
QVBoxLayout *gpBox = new QVBoxLayout();
auto *gpBox = new QVBoxLayout();
gpBox->addWidget(save_ck);
gpBox->addLayout(personalLayout);
personalGroupBox->setLayout(gpBox);
QLabel *cmLabel = new QLabel("Comment");
QDialogButtonBox *buttonBox = new QDialogButtonBox();
auto *buttonBox = new QDialogButtonBox();
buttonBox->setStandardButtons(QDialogButtonBox::Cancel |
QDialogButtonBox::Ok);
QVBoxLayout *layout = new QVBoxLayout();
auto *layout = new QVBoxLayout();
layout->addWidget(personalGroupBox);
layout->addWidget(cmLabel);
layout->addWidget(comment_te);
......
......@@ -71,12 +71,12 @@ SaveWorkspaces::SaveWorkspaces(QWidget *parent, const QString &suggFname,
setWindowTitle("Save Workspaces");
// the form is split into 3 lines of controls in horizontal layouts
QHBoxLayout *lineOne = new QHBoxLayout;
auto *lineOne = new QHBoxLayout;
setupLine1(lineOne);
QHBoxLayout *lineTwo = new QHBoxLayout;
auto *lineTwo = new QHBoxLayout;
setupLine2(lineTwo, defSavs);
QVBoxLayout *dialogLayout = new QVBoxLayout;
auto *dialogLayout = new QVBoxLayout;
dialogLayout->addLayout(lineOne);
dialogLayout->addLayout(lineTwo);
......@@ -92,9 +92,9 @@ void SaveWorkspaces::initLayout() {}
* @param lineOne :: the layout on to which the controls will be placed
*/
void SaveWorkspaces::setupLine1(QHBoxLayout *const lineOne) {
QLabel *fNameLabel = new QLabel("Filename:");
auto *fNameLabel = new QLabel("Filename:");
m_fNameEdit = new QLineEdit();
QPushButton *fNameButton = new QPushButton("Browse");
auto *fNameButton = new QPushButton("Browse");
connect(fNameButton, SIGNAL(clicked()), this, SLOT(saveFileBrowse()));
lineOne->addWidget(fNameLabel);
......@@ -128,14 +128,14 @@ void SaveWorkspaces::setupLine2(
connect(m_workspaces, SIGNAL(currentRowChanged(int)), this,
SLOT(setFileName(int)));
QPushButton *save = new QPushButton("Save");
auto *save = new QPushButton("Save");
connect(save, SIGNAL(clicked()), this, SLOT(saveSel()));
QPushButton *cancel = new QPushButton("Cancel");
auto *cancel = new QPushButton("Cancel");
connect(cancel, SIGNAL(clicked()), this, SLOT(close()));
QCheckBox *saveRKH = new QCheckBox("RKH (1D/2D)");
QCheckBox *saveNXcanSAS = new QCheckBox("NXcanSAS (1D/2D)");
QCheckBox *saveCan = new QCheckBox("CanSAS (1D)");
auto *saveRKH = new QCheckBox("RKH (1D/2D)");
auto *saveNXcanSAS = new QCheckBox("NXcanSAS (1D/2D)");
auto *saveCan = new QCheckBox("CanSAS (1D)");
// link the save option tick boxes to their save algorithm
m_savFormats.insert(saveRKH, "SaveRKH");
......@@ -147,17 +147,17 @@ void SaveWorkspaces::setupLine2(
// place controls into the layout, which places them on the form and takes
// care of deleting them
QVBoxLayout *ly_saveConts = new QVBoxLayout;
auto *ly_saveConts = new QVBoxLayout;
ly_saveConts->addWidget(save);
ly_saveConts->addWidget(cancel);
ly_saveConts->addWidget(m_append);
ly_saveConts->addStretch();
QVBoxLayout *ly_saveFormats = new QVBoxLayout;
auto *ly_saveFormats = new QVBoxLayout;
ly_saveFormats->addWidget(saveRKH);
ly_saveFormats->addWidget(saveNXcanSAS);
ly_saveFormats->addWidget(saveCan);
QGroupBox *gb_saveForms = new QGroupBox(tr("Save Formats"));
auto *gb_saveForms = new QGroupBox(tr("Save Formats"));
gb_saveForms->setLayout(ly_saveFormats);
ly_saveConts->addWidget(gb_saveForms);
......
......@@ -513,7 +513,7 @@ void ScriptEditor::dropEvent(QDropEvent *de) {
*/
void ScriptEditor::print() {
QPrinter printer(QPrinter::HighResolution);
QPrintDialog *print_dlg = new QPrintDialog(&printer, this);
auto *print_dlg = new QPrintDialog(&printer, this);
print_dlg->setWindowTitle(tr("Print Script"));
if (print_dlg->exec() != QDialog::Accepted) {
return;
......@@ -564,9 +564,9 @@ void ScriptEditor::forwardKeyPressToBase(QKeyEvent *event) {
// not appear, you have to delete the ( and type it again
// This does that for you!
if (event->text() == "(") {
QKeyEvent *backspEvent =
auto *backspEvent =
new QKeyEvent(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier);
QKeyEvent *bracketEvent = new QKeyEvent(*event);
auto *bracketEvent = new QKeyEvent(*event);
QsciScintilla::keyPressEvent(bracketEvent);
QsciScintilla::keyPressEvent(backspEvent);
......
......@@ -78,7 +78,7 @@ SelectWorkspacesDialog::SelectWorkspacesDialog(
m_wsList->addItems(tmp);
m_wsList->setSelectionMode(QAbstractItemView::MultiSelection);
QDialogButtonBox *btnBox = new QDialogButtonBox(Qt::Horizontal);
auto *btnBox = new QDialogButtonBox(Qt::Horizontal);
if (!customButtonLabel.empty()) {
m_customButton = new QPushButton(QString::fromStdString(customButtonLabel));
......@@ -87,13 +87,13 @@ SelectWorkspacesDialog::SelectWorkspacesDialog(
}
m_okButton = new QPushButton("Select");
QPushButton *cancelButton = new QPushButton("Cancel");
auto *cancelButton = new QPushButton("Cancel");
btnBox->addButton(m_okButton, QDialogButtonBox::AcceptRole);
btnBox->addButton(cancelButton, QDialogButtonBox::RejectRole);
connect(btnBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(btnBox, SIGNAL(rejected()), this, SLOT(reject()));
QVBoxLayout *vLayout = new QVBoxLayout();
auto *vLayout = new QVBoxLayout();
vLayout->addWidget(m_wsList);
vLayout->addWidget(btnBox);
......
......@@ -150,7 +150,7 @@ void SlicingAlgorithmDialog::cleanLayoutOfDimensions(QLayout *layout) {
QWidget *pWidget = pLayoutItem->widget();
if (pWidget != nullptr) {
// The label text contains the property name.
QLabel *propertyLabel =
auto *propertyLabel =
dynamic_cast<QLabel *>(pWidget->layout()->itemAt(0)->widget());
untie(propertyLabel->text());
pWidget->setHidden(true);
......@@ -326,10 +326,10 @@ void SlicingAlgorithmDialog::makeDimensionInputs(
// Configure the default input.
const QString dimensionInfo = format(dim);
QLineEdit *txtDimension = new QLineEdit(dimensionInfo);
auto *txtDimension = new QLineEdit(dimensionInfo);
// Create a widget to contain the dimension components.
QHBoxLayout *layout = new QHBoxLayout;
auto *layout = new QHBoxLayout;
QWidget *w = new QWidget;
w->setLayout(layout);
......@@ -482,7 +482,7 @@ void SlicingAlgorithmDialog::resestAlignedDimProperty(size_t index,
return;
}
QLineEdit *edit = dynamic_cast<QLineEdit *>(widget);
auto *edit = dynamic_cast<QLineEdit *>(widget);
if (!edit) {
return;
......
......@@ -332,8 +332,7 @@ void UserFunctionDialog::saveFunction() {
cur_category = "";
}
InputFunctionNameDialog *dlg =
new InputFunctionNameDialog(this, cur_category);
auto *dlg = new InputFunctionNameDialog(this, cur_category);
if (dlg->exec() == QDialog::Accepted) {
QString cat;
QString fun;
......@@ -423,7 +422,7 @@ QStringList UserFunctionDialog::categories() const {
bool UserFunctionDialog::eventFilter(QObject *obj, QEvent *ev) {
if (ev->type() == QEvent::KeyPress) {
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(ev);
auto *keyEvent = static_cast<QKeyEvent *>(ev);
if (keyEvent->key() == Qt::Key_Return) {
return true;
}
......@@ -520,7 +519,7 @@ void UserFunctionDialog::helpClicked() {
InputFunctionNameDialog::InputFunctionNameDialog(QWidget *parent,
const QString &category)
: QDialog(parent) {
QVBoxLayout *layout = new QVBoxLayout();
auto *layout = new QVBoxLayout();
layout->addWidget(new QLabel("Enter new or select a category"));
QStringList cats = ((UserFunctionDialog *)parent)->categories();
cats.removeOne("Base");
......@@ -542,7 +541,7 @@ InputFunctionNameDialog::InputFunctionNameDialog(QWidget *parent,
m_comment = new QTextEdit();
layout->addWidget(m_comment);
QDialogButtonBox *buttons = new QDialogButtonBox();
auto *buttons = new QDialogButtonBox();
buttons->addButton("OK", QDialogButtonBox::AcceptRole);
buttons->addButton("Cancel", QDialogButtonBox::RejectRole);
buttons->setCenterButtons(true);
......
......@@ -154,7 +154,7 @@ QString UserSubWindow::openFileDialog(const bool save,
* @param parent :: a pointer to an object that will look after it deleting it