From b97b01d63cfde8ea3cf764d6eae42a45e1f3c3f7 Mon Sep 17 00:00:00 2001 From: scorpio810 Date: Thu, 19 Jul 2018 16:27:20 +0000 Subject: [PATCH] Apply clang-tidy's modernize-use-auto git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5449 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- .../elementcollectionitem.cpp | 8 +- .../elementscollectionmodel.cpp | 30 +++---- .../elementscollectionwidget.cpp | 12 +-- .../ElementsCollection/elementstreeview.cpp | 8 +- .../fileelementcollectionitem.cpp | 10 +-- .../xmlprojectelementcollectionitem.cpp | 8 +- .../qpropertyundocommand.cpp | 2 +- .../qetgraphicshandleritem.cpp | 2 +- sources/aboutqet.cpp | 16 ++-- sources/autoNum/ui/selectautonumw.cpp | 4 +- sources/bordertitleblock.cpp | 4 +- sources/configdialog.cpp | 6 +- sources/configpages.cpp | 10 +-- sources/diagram.cpp | 46 +++++----- sources/diagramcommands.cpp | 4 +- sources/diagramcontent.cpp | 18 ++-- sources/diagramcontextwidget.cpp | 2 +- .../diagramevent/diagrameventaddelement.cpp | 2 +- sources/diagramevent/diagrameventaddtext.cpp | 2 +- sources/diagramfoliolist.cpp | 6 +- sources/diagramprintdialog.cpp | 4 +- sources/diagramschooser.cpp | 2 +- sources/diagramview.cpp | 20 ++--- sources/editor/arceditor.cpp | 6 +- sources/editor/elementprimitivedecorator.cpp | 8 +- sources/editor/elementscene.cpp | 18 ++-- sources/editor/elementview.cpp | 10 +-- sources/editor/ellipseeditor.cpp | 6 +- sources/editor/graphicspart/partarc.cpp | 2 +- sources/editor/graphicspart/partellipse.cpp | 2 +- sources/editor/graphicspart/partline.cpp | 2 +- sources/editor/graphicspart/partpolygon.cpp | 2 +- sources/editor/graphicspart/partrectangle.cpp | 2 +- sources/editor/lineeditor.cpp | 8 +- sources/editor/polygoneditor.cpp | 6 +- sources/editor/qetelementeditor.cpp | 22 ++--- sources/editor/styleeditor.cpp | 8 +- sources/editor/terminaleditor.cpp | 8 +- sources/editor/texteditor.cpp | 14 +-- sources/editor/ui/dynamictextfieldeditor.cpp | 2 +- .../ui/elementpropertieseditorwidget.cpp | 2 +- sources/editor/ui/rectangleeditor.cpp | 4 +- sources/elementdialog.cpp | 6 +- sources/elementscategoryeditor.cpp | 4 +- sources/elementsmover.cpp | 4 +- sources/elementspanel.cpp | 8 +- sources/elementspanelwidget.cpp | 2 +- sources/elementtextpattern.cpp | 2 +- sources/elementtextsmover.cpp | 2 +- sources/exportdialog.cpp | 26 +++--- sources/exportpropertieswidget.cpp | 10 +-- sources/genericpanel.cpp | 6 +- sources/nameslistwidget.cpp | 6 +- sources/newelementwizard.cpp | 16 ++-- sources/projectconfigpages.cpp | 8 +- sources/projectview.cpp | 12 +-- sources/qet.cpp | 2 +- sources/qetapp.cpp | 16 ++-- sources/qetdiagrameditor.cpp | 24 ++--- sources/qetgraphicsitem/conductor.cpp | 4 +- sources/qetgraphicsitem/conductortextitem.cpp | 2 +- sources/qetgraphicsitem/customelement.cpp | 18 ++-- .../dynamicelementtextitem.cpp | 2 +- sources/qetgraphicsitem/element.cpp | 16 ++-- .../qetgraphicsitem/elementtextitemgroup.cpp | 6 +- sources/qetgraphicsitem/qetshapeitem.cpp | 2 +- sources/qetgraphicsitem/terminal.cpp | 12 +-- sources/qetprintpreviewdialog.cpp | 2 +- sources/qetproject.cpp | 6 +- sources/qtextorientationspinboxwidget.cpp | 2 +- sources/recentfiles.cpp | 2 +- sources/richtext/richtexteditor.cpp | 10 +-- sources/titleblock/dimensionwidget.cpp | 4 +- sources/titleblock/qettemplateeditor.cpp | 12 +-- sources/titleblock/templatecellwidget.cpp | 10 +-- sources/titleblock/templatecommands.cpp | 10 +-- sources/titleblock/templatelogomanager.cpp | 8 +- sources/titleblock/templatescollection.cpp | 6 +- sources/titleblock/templateview.cpp | 32 +++---- sources/titleblocktemplate.cpp | 4 +- sources/ui/conductorpropertiesdialog.cpp | 2 +- sources/ui/diagrampropertiesdialog.cpp | 4 +- .../ui/diagrampropertieseditordockwidget.cpp | 4 +- sources/ui/diagramselection.cpp | 4 +- sources/ui/dynamicelementtextitemeditor.cpp | 6 +- sources/ui/dynamicelementtextmodel.cpp | 90 +++++++++---------- sources/ui/elementpropertieswidget.cpp | 20 ++--- sources/ui/importelementdialog.cpp | 4 +- sources/ui/linksingleelementwidget.cpp | 8 +- sources/ui/masterpropertieswidget.cpp | 6 +- sources/ui/multipastedialog.cpp | 2 +- sources/ui/potentialselectordialog.cpp | 4 +- sources/ui/projectpropertiesdialog.cpp | 6 +- sources/undocommand/addelementtextcommand.cpp | 2 +- .../changeelementinformationcommand.cpp | 2 +- sources/undocommand/linkelementcommand.cpp | 2 +- .../undocommand/rotateselectioncommand.cpp | 2 +- sources/undocommand/rotatetextscommand.cpp | 4 +- 98 files changed, 427 insertions(+), 427 deletions(-) diff --git a/sources/ElementsCollection/elementcollectionitem.cpp b/sources/ElementsCollection/elementcollectionitem.cpp index 4aa708e60..e36bf305b 100644 --- a/sources/ElementsCollection/elementcollectionitem.cpp +++ b/sources/ElementsCollection/elementcollectionitem.cpp @@ -75,7 +75,7 @@ ElementCollectionItem *ElementCollectionItem::childWithCollectionName(const QStr { rowCount(); foreach (QStandardItem *qsi, directChilds()) { - ElementCollectionItem *eci = static_cast(qsi); + auto *eci = static_cast(qsi); if (eci->name() == name) return eci; } @@ -167,7 +167,7 @@ QList ElementCollectionItem::elementsDirectChild() cons QList element_child; foreach (QStandardItem *qsi, directChilds()) { - ElementCollectionItem *eci = static_cast(qsi); + auto *eci = static_cast(qsi); if (eci->isElement()) element_child.append(eci); } @@ -184,7 +184,7 @@ QList ElementCollectionItem::directoriesDirectChild() c QList dir_child; foreach (QStandardItem *qsi, directChilds()) { - ElementCollectionItem *eci = static_cast(qsi); + auto *eci = static_cast(qsi); if (eci->isDir()) dir_child.append(eci); } @@ -231,7 +231,7 @@ QList ElementCollectionItem::items() const QList list; for (int i=0 ; i(child(i)); + auto *eci = static_cast(child(i)); list.append(eci); list.append(eci->items()); } diff --git a/sources/ElementsCollection/elementscollectionmodel.cpp b/sources/ElementsCollection/elementscollectionmodel.cpp index 11426db7b..69ca0e337 100644 --- a/sources/ElementsCollection/elementscollectionmodel.cpp +++ b/sources/ElementsCollection/elementscollectionmodel.cpp @@ -68,9 +68,9 @@ QMimeData *ElementsCollectionModel::mimeData(const QModelIndexList &indexes) con QModelIndex index = indexes.first(); if (index.isValid()) { - ElementCollectionItem *item = static_cast(itemFromIndex(index)); + auto *item = static_cast(itemFromIndex(index)); - QMimeData *mime_data = new QMimeData(); + auto *mime_data = new QMimeData(); mime_data->setText(item->collectionPath()); if (item->isElement()) @@ -120,7 +120,7 @@ bool ElementsCollectionModel::canDropMimeData(const QMimeData *data, Qt::DropAct if (static_cast(qsi)->isCommonCollection()) return false; - ElementCollectionItem *eci = static_cast(qsi); + auto *eci = static_cast(qsi); if (data->hasFormat("application/x-qet-element-uri") || data->hasFormat("application/x-qet-category-uri")) { @@ -156,7 +156,7 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction if (qsi->type() == FileElementCollectionItem::Type) { - FileElementCollectionItem *feci = static_cast(qsi); + auto *feci = static_cast(qsi); if (feci->isCommonCollection()) return false; @@ -185,7 +185,7 @@ bool ElementsCollectionModel::dropMimeData(const QMimeData *data, Qt::DropAction return false; } else if (qsi->type() == XmlProjectElementCollectionItem::Type) { - XmlProjectElementCollectionItem *xpeci = static_cast(qsi); + auto *xpeci = static_cast(qsi); if (xpeci->isElement() && xpeci->parent() && xpeci->parent()->type() == XmlProjectElementCollectionItem::Type) xpeci = static_cast(xpeci->parent()); @@ -254,7 +254,7 @@ void ElementsCollectionModel::loadCollections(bool common_collection, bool custo */ void ElementsCollectionModel::addCommonCollection(bool set_data) { - FileElementCollectionItem *feci = new FileElementCollectionItem(); + auto *feci = new FileElementCollectionItem(); if (feci->setRootPath(QETApp::commonElementsDirN(), set_data, m_hide_element)) { invisibleRootItem()->appendRow(feci); if (set_data) @@ -270,7 +270,7 @@ void ElementsCollectionModel::addCommonCollection(bool set_data) */ void ElementsCollectionModel::addCustomCollection(bool set_data) { - FileElementCollectionItem *feci = new FileElementCollectionItem(); + auto *feci = new FileElementCollectionItem(); if (feci->setRootPath(QETApp::customElementsDirN(), set_data, m_hide_element)) { invisibleRootItem()->appendRow(feci); if (set_data) @@ -313,7 +313,7 @@ void ElementsCollectionModel::addLocation(const ElementsLocation& location) foreach(ElementCollectionItem *eci, child_list) { if (eci->type() == FileElementCollectionItem::Type) { - FileElementCollectionItem *feci = static_cast(eci); + auto *feci = static_cast(eci); if (feci->isCustomCollection()) { last_item = feci->lastItemForPath(location.collectionPath(false), collection_name); @@ -341,7 +341,7 @@ void ElementsCollectionModel::addProject(QETProject *project, bool set_data) m_project_list.append(project); int row = m_project_list.indexOf(project); - XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem(); + auto *xpeci = new XmlProjectElementCollectionItem(); m_project_hash.insert(project, xpeci); xpeci->setProject(project, set_data); @@ -419,7 +419,7 @@ QList ElementsCollectionModel::items() const QList list; for (int i=0 ; i(item(i)); + auto *eci = static_cast(item(i)); list.append(eci); list.append(eci->items()); } @@ -478,7 +478,7 @@ QModelIndex ElementsCollectionModel::indexFromLocation(const ElementsLocation &l ElementCollectionItem *match_eci = nullptr; if (eci->type() == FileElementCollectionItem::Type) { - if (FileElementCollectionItem *feci = static_cast(eci)) { + if (auto *feci = static_cast(eci)) { if ( (location.isCommonCollection() && feci->isCommonCollection()) || (location.isCustomCollection() && !feci->isCommonCollection()) ) { match_eci = feci->itemAtPath(location.collectionPath(false)); @@ -486,7 +486,7 @@ QModelIndex ElementsCollectionModel::indexFromLocation(const ElementsLocation &l } } else if (eci->type() == XmlProjectElementCollectionItem::Type) { - if (XmlProjectElementCollectionItem *xpeci = static_cast(eci)) { + if (auto *xpeci = static_cast(eci)) { match_eci = xpeci->itemAtPath(location.collectionPath(false)); } } @@ -507,7 +507,7 @@ QModelIndex ElementsCollectionModel::indexFromLocation(const ElementsLocation &l void ElementsCollectionModel::elementIntegratedToCollection(const QString& path) { QObject *object = sender(); - XmlElementCollection *collection = static_cast (object); + auto *collection = static_cast (object); if (!collection) return; @@ -540,7 +540,7 @@ void ElementsCollectionModel::elementIntegratedToCollection(const QString& path) void ElementsCollectionModel::itemRemovedFromCollection(const QString& path) { QObject *object = sender(); - XmlElementCollection *collection = static_cast (object); + auto *collection = static_cast (object); if (!collection) return; @@ -568,7 +568,7 @@ void ElementsCollectionModel::itemRemovedFromCollection(const QString& path) void ElementsCollectionModel::updateItem(const QString& path) { QObject *object = sender(); - XmlElementCollection *collection = static_cast (object); + auto *collection = static_cast (object); if (!collection) return; diff --git a/sources/ElementsCollection/elementscollectionwidget.cpp b/sources/ElementsCollection/elementscollectionwidget.cpp index 9ff46af7a..d8556b7cd 100644 --- a/sources/ElementsCollection/elementscollectionwidget.cpp +++ b/sources/ElementsCollection/elementscollectionwidget.cpp @@ -242,7 +242,7 @@ void ElementsCollectionWidget::customContextMenu(const QPoint &point) if (eci->type() == FileElementCollectionItem::Type) { add_open_dir = true; - FileElementCollectionItem *feci = static_cast(eci); + auto *feci = static_cast(eci); if (!feci->isCommonCollection()) { if (feci->isDir()) @@ -261,7 +261,7 @@ void ElementsCollectionWidget::customContextMenu(const QPoint &point) } if (eci->type() == XmlProjectElementCollectionItem::Type) { - XmlProjectElementCollectionItem *xpeci = static_cast(eci); + auto *xpeci = static_cast(eci); if (xpeci->isCollectionRoot()) add_open_dir = true; } @@ -404,7 +404,7 @@ void ElementsCollectionWidget::editDirectory() if (eci->type() != FileElementCollectionItem::Type) return; - FileElementCollectionItem *feci = static_cast(eci); + auto *feci = static_cast(eci); if(feci->isCommonCollection()) return; ElementsLocation location(feci->collectionPath()); @@ -424,7 +424,7 @@ void ElementsCollectionWidget::newDirectory() if (eci->type() != FileElementCollectionItem::Type) return; - FileElementCollectionItem *feci = static_cast(eci); + auto *feci = static_cast(eci); if(feci->isCommonCollection()) return; ElementsLocation location(feci->collectionPath()); @@ -445,7 +445,7 @@ void ElementsCollectionWidget::newElement() return; } - FileElementCollectionItem *feci = static_cast(eci); + auto *feci = static_cast(eci); if(feci->isCommonCollection()) { return; } @@ -533,7 +533,7 @@ void ElementsCollectionWidget::dirProperties() void ElementsCollectionWidget::reload() { m_progress_bar->show(); - ElementsCollectionModel *new_model = new ElementsCollectionModel(m_tree_view); + auto *new_model = new ElementsCollectionModel(m_tree_view); QList project_list; project_list.append(m_waiting_project); diff --git a/sources/ElementsCollection/elementstreeview.cpp b/sources/ElementsCollection/elementstreeview.cpp index ecf4f1807..861e0090d 100644 --- a/sources/ElementsCollection/elementstreeview.cpp +++ b/sources/ElementsCollection/elementstreeview.cpp @@ -50,8 +50,8 @@ void ElementsTreeView::startDrag(Qt::DropActions supportedActions) return; } - if (QStandardItemModel *qsim = static_cast(model())) { - if (ElementCollectionItem *eci = static_cast(qsim->itemFromIndex(index))) { + if (auto *qsim = static_cast(model())) { + if (auto *eci = static_cast(qsim->itemFromIndex(index))) { ElementsLocation loc (eci->collectionPath()); if (loc.exist()) { startElementDrag(loc); @@ -72,10 +72,10 @@ void ElementsTreeView::startElementDrag(const ElementsLocation &location) if (!location.exist()) return; - QDrag *drag = new QDrag(this); + auto *drag = new QDrag(this); QString location_str = location.toString(); - QMimeData *mime_data = new QMimeData(); + auto *mime_data = new QMimeData(); mime_data->setText(location_str); if (location.isDirectory()) diff --git a/sources/ElementsCollection/fileelementcollectionitem.cpp b/sources/ElementsCollection/fileelementcollectionitem.cpp index 3115517f8..f297368f6 100644 --- a/sources/ElementsCollection/fileelementcollectionitem.cpp +++ b/sources/ElementsCollection/fileelementcollectionitem.cpp @@ -58,7 +58,7 @@ QString FileElementCollectionItem::fileSystemPath() const if (isCollectionRoot()) return m_path; - FileElementCollectionItem *feci = static_cast (parent()); + auto *feci = static_cast (parent()); if (feci) return feci->fileSystemPath() + "/" + m_path; else @@ -172,7 +172,7 @@ QString FileElementCollectionItem::collectionPath() const return "custom://"; } else if (parent() && parent()->type() == FileElementCollectionItem::Type) { - ElementCollectionItem *eci = static_cast(parent()); + auto *eci = static_cast(parent()); if (eci->isCollectionRoot()) return eci->collectionPath() + m_path; else @@ -222,7 +222,7 @@ void FileElementCollectionItem::addChildAtPath(const QString &collection_name) if (collection_name.isEmpty()) return; - FileElementCollectionItem *feci = new FileElementCollectionItem(); + auto *feci = new FileElementCollectionItem(); insertRow(rowForInsertItem(collection_name), feci); feci->setPathName(collection_name); feci->setUpData(); @@ -299,7 +299,7 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element) //Get all directory in this directory. foreach(QString str, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name)) { - FileElementCollectionItem *feci = new FileElementCollectionItem(); + auto *feci = new FileElementCollectionItem(); appendRow(feci); feci->setPathName(str, set_data, hide_element); if (set_data) @@ -313,7 +313,7 @@ void FileElementCollectionItem::populate(bool set_data, bool hide_element) dir.setNameFilters(QStringList() << "*.elmt"); foreach(QString str, dir.entryList(QDir::Files | QDir::NoDotAndDotDot, QDir::Name)) { - FileElementCollectionItem *feci = new FileElementCollectionItem(); + auto *feci = new FileElementCollectionItem(); appendRow(feci); feci->setPathName(str, set_data); if (set_data) diff --git a/sources/ElementsCollection/xmlprojectelementcollectionitem.cpp b/sources/ElementsCollection/xmlprojectelementcollectionitem.cpp index 9a51e0536..66bdcab10 100644 --- a/sources/ElementsCollection/xmlprojectelementcollectionitem.cpp +++ b/sources/ElementsCollection/xmlprojectelementcollectionitem.cpp @@ -102,7 +102,7 @@ QString XmlProjectElementCollectionItem::embeddedPath() const if (isCollectionRoot()) return "embed://"; else if (parent()){ - XmlProjectElementCollectionItem *xpeci = static_cast(parent()); + auto *xpeci = static_cast(parent()); if (xpeci->isCollectionRoot()) return xpeci->embeddedPath() + name(); @@ -143,7 +143,7 @@ void XmlProjectElementCollectionItem::addChildAtPath(const QString &collection_n while (!child_element.isNull()) { if (child_element.attribute("name") == collection_name) { - XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem (); + auto *xpeci = new XmlProjectElementCollectionItem (); insertRow(rowForInsertItem(collection_name), xpeci); xpeci->setXmlElement(child_element, m_project); xpeci->setUpData(); @@ -229,7 +229,7 @@ void XmlProjectElementCollectionItem::populate(bool set_data, bool hide_element) foreach (QDomElement element, dom_category) { - XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem(); + auto *xpeci = new XmlProjectElementCollectionItem(); appendRow(xpeci); xpeci->setXmlElement(element, m_project, set_data, hide_element); if (set_data) @@ -244,7 +244,7 @@ void XmlProjectElementCollectionItem::populate(bool set_data, bool hide_element) foreach (QDomElement element, dom_elements) { - XmlProjectElementCollectionItem *xpeci = new XmlProjectElementCollectionItem(); + auto *xpeci = new XmlProjectElementCollectionItem(); appendRow(xpeci); xpeci->setXmlElement(element, m_project, set_data); if (set_data) diff --git a/sources/QPropertyUndoCommand/qpropertyundocommand.cpp b/sources/QPropertyUndoCommand/qpropertyundocommand.cpp index 0a65c852d..41d680e98 100644 --- a/sources/QPropertyUndoCommand/qpropertyundocommand.cpp +++ b/sources/QPropertyUndoCommand/qpropertyundocommand.cpp @@ -100,7 +100,7 @@ void QPropertyUndoCommand::setAnimated(bool animate, bool first_time) bool QPropertyUndoCommand::mergeWith(const QUndoCommand *other) { if (id() != other->id() || other->childCount()) return false; - QPropertyUndoCommand const *undo = static_cast(other); + auto const *undo = static_cast(other); if (m_object != undo->m_object || m_property_name != undo->m_property_name) return false; m_new_value = undo->m_new_value; return true; diff --git a/sources/QetGraphicsItemModeler/qetgraphicshandleritem.cpp b/sources/QetGraphicsItemModeler/qetgraphicshandleritem.cpp index 1e1a046d1..2f9a47e60 100644 --- a/sources/QetGraphicsItemModeler/qetgraphicshandleritem.cpp +++ b/sources/QetGraphicsItemModeler/qetgraphicshandleritem.cpp @@ -82,7 +82,7 @@ QVector QetGraphicsHandlerItem::handlerForPoint(const QVector list_; for (QPointF point : points) { - QetGraphicsHandlerItem *qghi = new QetGraphicsHandlerItem(size); + auto *qghi = new QetGraphicsHandlerItem(size); qghi->setPos(point); list_ << qghi; } diff --git a/sources/aboutqet.cpp b/sources/aboutqet.cpp index 1204627cc..9dddad7d1 100644 --- a/sources/aboutqet.cpp +++ b/sources/aboutqet.cpp @@ -40,7 +40,7 @@ AboutQET::AboutQET(QWidget *parent) : setModal(true); - QTabWidget *tabs = new QTabWidget(); + auto *tabs = new QTabWidget(); tabs -> addTab(aboutTab(), tr("À &propos", "tab title")); tabs -> addTab(authorsTab(), tr("A&uteurs", "tab title")); tabs -> addTab(translatorsTab(), tr("&Traducteurs", "tab title")); @@ -52,11 +52,11 @@ AboutQET::AboutQET(QWidget *parent) : connect(buttons, SIGNAL(accepted()), this, SLOT(accept())); connect(buttons, SIGNAL(rejected()), this, SLOT(accept())); - QVBoxLayout *vlayout = new QVBoxLayout(this); + auto *vlayout = new QVBoxLayout(this); vlayout->addWidget(tabs); vlayout->addWidget(buttons); - QScrollArea* scrollArea = new QScrollArea(this); + auto* scrollArea = new QScrollArea(this); scrollArea->setWidgetResizable(true); scrollArea->setFixedSize (590, 590); scrollArea->setWidget(tabs); @@ -135,7 +135,7 @@ QWidget *AboutQET::authorsTab() const { authors -> setTextFormat(Qt::RichText); QWidget *authors_widget = new QWidget(); - QHBoxLayout *authors_layout = new QHBoxLayout(authors_widget); + auto *authors_layout = new QHBoxLayout(authors_widget); authors_layout -> addWidget(authors, 0, Qt::AlignCenter); return(authors_widget); } @@ -175,7 +175,7 @@ QWidget *AboutQET::translatorsTab() const { translators -> setTextFormat(Qt::RichText); QWidget *translators_widget = new QWidget(); - QHBoxLayout *translators_layout = new QHBoxLayout(translators_widget); + auto *translators_layout = new QHBoxLayout(translators_widget); translators_layout -> addWidget(translators, 0, Qt::AlignCenter); return(translators_widget); } @@ -207,7 +207,7 @@ QWidget *AboutQET::contributorsTab() const { contributors -> setTextFormat(Qt::RichText); QWidget *contributors_widget = new QWidget(); - QHBoxLayout *contributors_layout = new QHBoxLayout(contributors_widget); + auto *contributors_layout = new QHBoxLayout(contributors_widget); contributors_layout -> addWidget(contributors, 0, Qt::AlignCenter); return(contributors_widget); } @@ -221,12 +221,12 @@ QWidget *AboutQET::licenseTab() const { QLabel *title_license = new QLabel(tr("Ce programme est sous licence GNU/GPL.")); // Text of the GNU/GPL in a scrollable text box not editable - QTextEdit *text_license = new QTextEdit(); + auto *text_license = new QTextEdit(); text_license -> setPlainText(QET::license()); text_license -> setReadOnly(true); // All in a vertical arrangement - QVBoxLayout *license_layout = new QVBoxLayout(); + auto *license_layout = new QVBoxLayout(); license_layout -> addWidget(title_license); license_layout -> addWidget(text_license); license -> setLayout(license_layout); diff --git a/sources/autoNum/ui/selectautonumw.cpp b/sources/autoNum/ui/selectautonumw.cpp index 45dbb618f..6e57e6a50 100644 --- a/sources/autoNum/ui/selectautonumw.cpp +++ b/sources/autoNum/ui/selectautonumw.cpp @@ -94,7 +94,7 @@ void SelectAutonumW::setContext(const NumerotationContext &context) { } else { for (int i=0; i editor_layout -> addWidget(part); @@ -125,7 +125,7 @@ NumerotationContext SelectAutonumW::toNumContext() const { void SelectAutonumW::on_add_button_clicked() { applyEnable(false); - NumPartEditorW *part = new NumPartEditorW(m_edited_type, this); + auto *part = new NumPartEditorW(m_edited_type, this); connect (part, SIGNAL(changed()), this, SLOT(applyEnable())); num_part_list_ << part; ui -> editor_layout -> addWidget(part); diff --git a/sources/bordertitleblock.cpp b/sources/bordertitleblock.cpp index 9b1545aae..4edef2ebb 100644 --- a/sources/bordertitleblock.cpp +++ b/sources/bordertitleblock.cpp @@ -673,8 +673,8 @@ DiagramPosition BorderTitleBlock::convertPosition(const QPointF &pos) return (DiagramPosition("", 0)); QPointF relative_pos = pos - insideBorderRect().topLeft(); - int row_number = int(ceil(relative_pos.x() / columnsWidth())); - int column_number = int(ceil(relative_pos.y() / rowsHeight())); + auto row_number = int(ceil(relative_pos.x() / columnsWidth())); + auto column_number = int(ceil(relative_pos.y() / rowsHeight())); QString letter = "A"; for (int i = 1 ; i < column_number ; ++ i) diff --git a/sources/configdialog.cpp b/sources/configdialog.cpp index b07c7878c..d45db0a4a 100644 --- a/sources/configdialog.cpp +++ b/sources/configdialog.cpp @@ -41,11 +41,11 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) { buttons = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel); // layouts - QHBoxLayout *hlayout1 = new QHBoxLayout(); + auto *hlayout1 = new QHBoxLayout(); hlayout1 -> addWidget(pages_list); hlayout1 -> addWidget(pages_widget); - QVBoxLayout *vlayout1 = new QVBoxLayout(); + auto *vlayout1 = new QVBoxLayout(); vlayout1 -> addLayout(hlayout1); vlayout1 -> addWidget(buttons); setLayout(vlayout1); @@ -80,7 +80,7 @@ void ConfigDialog::buildPagesList() { Add the \a page ConfigPage to this configuration dialog. */ void ConfigDialog::addPageToList(ConfigPage *page) { - QListWidgetItem *new_button = new QListWidgetItem(pages_list); + auto *new_button = new QListWidgetItem(pages_list); new_button -> setIcon(page -> icon()); new_button -> setText(page -> title()); new_button -> setTextAlignment(Qt::AlignHCenter); diff --git a/sources/configpages.cpp b/sources/configpages.cpp index 278640625..8872052da 100644 --- a/sources/configpages.cpp +++ b/sources/configpages.cpp @@ -73,9 +73,9 @@ NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent, ProjectProp connect(ipw,SIGNAL(openAutoNumFolioEditor(QString)),this,SLOT(changeToAutoFolioTab())); // main tab widget - QTabWidget *tab_widget = new QTabWidget(this); + auto *tab_widget = new QTabWidget(this); QWidget *diagram_widget = new QWidget(); - QVBoxLayout *diagram_layout = new QVBoxLayout(diagram_widget); + auto *diagram_layout = new QVBoxLayout(diagram_widget); diagram_layout -> addWidget(bpw); diagram_layout -> addWidget(ipw); @@ -85,7 +85,7 @@ NewDiagramPage::NewDiagramPage(QETProject *project, QWidget *parent, ProjectProp tab_widget -> addTab (rpw, tr("Reports de folio")); tab_widget -> addTab (xrefpw, tr("Références croisées")); - QVBoxLayout *vlayout1 = new QVBoxLayout(); + auto *vlayout1 = new QVBoxLayout(); vlayout1->addWidget(tab_widget); setLayout(vlayout1); @@ -235,7 +235,7 @@ ExportConfigPage::ExportConfigPage(QWidget *parent) : ConfigPage(parent) { epw = new ExportPropertiesWidget(ExportProperties::defaultExportProperties()); // layout vertical contenant le titre, une ligne horizontale et epw - QVBoxLayout *vlayout1 = new QVBoxLayout(); + auto *vlayout1 = new QVBoxLayout(); QLabel *title = new QLabel(this -> title()); vlayout1 -> addWidget(title); @@ -283,7 +283,7 @@ PrintConfigPage::PrintConfigPage(QWidget *parent) : ConfigPage(parent) { epw -> setPrintingMode(true); // layout vertical contenant le titre, une ligne horizontale et epw - QVBoxLayout *vlayout1 = new QVBoxLayout(); + auto *vlayout1 = new QVBoxLayout(); QLabel *title = new QLabel(this -> title()); vlayout1 -> addWidget(title); diff --git a/sources/diagram.cpp b/sources/diagram.cpp index c6c887412..d23c8427d 100644 --- a/sources/diagram.cpp +++ b/sources/diagram.cpp @@ -159,9 +159,9 @@ void Diagram::drawBackground(QPainter *p, const QRectF &r) { qreal limite_x = rect.x() + rect.width(); qreal limite_y = rect.y() + rect.height(); - int g_x = (int)ceil(rect.x()); + auto g_x = (int)ceil(rect.x()); while (g_x % xGrid) ++ g_x; - int g_y = (int)ceil(rect.y()); + auto g_y = (int)ceil(rect.y()); while (g_y % yGrid) ++ g_y; QPolygon points; @@ -649,23 +649,23 @@ QDomDocument Diagram::toXml(bool whole_content) { ; // Determine les elements a "XMLiser" foreach(QGraphicsItem *qgi, list_items) { - if (Element *elmt = qgraphicsitem_cast(qgi)) { + if (auto *elmt = qgraphicsitem_cast(qgi)) { if (whole_content) list_elements << elmt; else if (elmt -> isSelected()) list_elements << elmt; - } else if (Conductor *f = qgraphicsitem_cast(qgi)) { + } else if (auto *f = qgraphicsitem_cast(qgi)) { if (whole_content) list_conductors << f; // lorsqu'on n'exporte pas tout le diagram, il faut retirer les conducteurs non selectionnes // et pour l'instant, les conducteurs non selectionnes sont les conducteurs dont un des elements n'est pas selectionne else if (f -> terminal1 -> parentItem() -> isSelected() && f -> terminal2 -> parentItem() -> isSelected()) { list_conductors << f; } - } else if (IndependentTextItem *iti = qgraphicsitem_cast(qgi)) { + } else if (auto *iti = qgraphicsitem_cast(qgi)) { if (whole_content) list_texts << iti; else if (iti -> isSelected()) list_texts << iti; - } else if (DiagramImageItem *dii = qgraphicsitem_cast(qgi)) { + } else if (auto *dii = qgraphicsitem_cast(qgi)) { if (whole_content) list_images << dii; else if (dii -> isSelected()) list_images << dii; - } else if (QetShapeItem *dsi = qgraphicsitem_cast(qgi)) { + } else if (auto *dsi = qgraphicsitem_cast(qgi)) { if (whole_content) list_shapes << dsi; else if (dsi -> isSelected()) list_shapes << dsi; } @@ -920,7 +920,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf // Load text QList added_texts; foreach (QDomElement text_xml, QET::findInDomElement(root, "inputs", "input")) { - IndependentTextItem *iti = new IndependentTextItem(); + auto *iti = new IndependentTextItem(); iti -> fromXml(text_xml); addItem(iti); added_texts << iti; @@ -929,7 +929,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf // Load image QList added_images; foreach (QDomElement image_xml, QET::findInDomElement(root, "images", "image")) { - DiagramImageItem *dii = new DiagramImageItem (); + auto *dii = new DiagramImageItem (); dii -> fromXml(image_xml); addItem(dii); added_images << dii; @@ -959,7 +959,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf Terminal *p2 = table_adr_id.value(id_p2); if (p1 != p2) { - Conductor *c = new Conductor(p1, p2); + auto *c = new Conductor(p1, p2); if (c->isValid()) { addItem(c); @@ -1069,7 +1069,7 @@ void Diagram::addItem(QGraphicsItem *item) { case Conductor::Type: { - Conductor *conductor = static_cast(item); + auto *conductor = static_cast(item); conductor->terminal1->addConductor(conductor); conductor->terminal2->addConductor(conductor); conductor->calculateTextItemPosition(); @@ -1078,7 +1078,7 @@ void Diagram::addItem(QGraphicsItem *item) case IndependentTextItem::Type: { - const IndependentTextItem *text = static_cast(item); + const auto *text = static_cast(item); connect(text, &IndependentTextItem::diagramTextChanged, this, &Diagram::diagramTextChanged); } } @@ -1098,13 +1098,13 @@ void Diagram::removeItem(QGraphicsItem *item) { case Element::Type: { - Element *elmt = static_cast(item); + auto *elmt = static_cast(item); elmt->unlinkAllElements(); } break; case Conductor::Type: { - Conductor *conductor = static_cast(item); + auto *conductor = static_cast(item); conductor->terminal1->removeConductor(conductor); conductor->terminal2->removeConductor(conductor); } @@ -1112,7 +1112,7 @@ void Diagram::removeItem(QGraphicsItem *item) case IndependentTextItem::Type: { - const IndependentTextItem *text = static_cast(item); + const auto *text = static_cast(item); disconnect(text, &IndependentTextItem::diagramTextChanged, this, &Diagram::diagramTextChanged); } } @@ -1456,7 +1456,7 @@ QString Diagram::title() const { QList Diagram::customElements() const { QList elements_list; foreach(QGraphicsItem *qgi, items()) { - if (CustomElement *elmt = qgraphicsitem_cast(qgi)) { + if (auto *elmt = qgraphicsitem_cast(qgi)) { elements_list << elmt; } } @@ -1466,7 +1466,7 @@ QList Diagram::customElements() const { QList Diagram::elements() const { QList element_list; foreach (QGraphicsItem *qgi, items()) { - if (Element *elmt = qgraphicsitem_cast(qgi)) + if (auto *elmt = qgraphicsitem_cast(qgi)) element_list < Diagram::elements() const { QList Diagram::conductors() const { QList cnd_list; foreach (QGraphicsItem *qgi, items()) { - if (Conductor *cnd = qgraphicsitem_cast(qgi)) + if (auto *cnd = qgraphicsitem_cast(qgi)) cnd_list <(qgi)) { + if (auto *t = qgraphicsitem_cast(qgi)) { t -> setVisible(dt); } } @@ -1683,7 +1683,7 @@ void Diagram::setDrawColoredConductors(bool dcc) { QSet Diagram::selectedConductors() const { QSet conductors_set; foreach(QGraphicsItem *qgi, selectedItems()) { - if (Conductor *c = qgraphicsitem_cast(qgi)) { + if (auto *c = qgraphicsitem_cast(qgi)) { conductors_set << c; } } @@ -1761,11 +1761,11 @@ bool Diagram::isReadOnly() const DiagramContent Diagram::content() const { DiagramContent dc; foreach(QGraphicsItem *qgi, items()) { - if (Element *e = qgraphicsitem_cast(qgi)) { + if (auto *e = qgraphicsitem_cast(qgi)) { dc.m_elements << e; - } else if (IndependentTextItem *iti = qgraphicsitem_cast(qgi)) { + } else if (auto *iti = qgraphicsitem_cast(qgi)) { dc.m_text_fields << iti; - } else if (Conductor *c = qgraphicsitem_cast(qgi)) { + } else if (auto *c = qgraphicsitem_cast(qgi)) { dc.m_conductors_to_move << c; } } diff --git a/sources/diagramcommands.cpp b/sources/diagramcommands.cpp index 26cbfbdfd..c66ac0902 100644 --- a/sources/diagramcommands.cpp +++ b/sources/diagramcommands.cpp @@ -260,7 +260,7 @@ void MoveElementsCommand::move(const QPointF &actual_movement) setupAnimation(qgi->toGraphicsObject(), "pos", qgi->pos(), qgi->pos() + actual_movement); else if(qgi->type() == QGraphicsItemGroup::Type) //ElementTextItemGroup is a QObject but not a QGraphicsObject { - if(ElementTextItemGroup *etig = dynamic_cast(qgi)) + if(auto *etig = dynamic_cast(qgi)) setupAnimation(etig, "pos", etig->pos(), etig->pos() + actual_movement); } else qgi -> setPos(qgi->pos() + actual_movement); @@ -286,7 +286,7 @@ void MoveElementsCommand::move(const QPointF &actual_movement) void MoveElementsCommand::setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant& start, const QVariant& end) { //create animation group if not yet. if (m_anim_group == nullptr) m_anim_group = new QParallelAnimationGroup(); - QPropertyAnimation *animation = new QPropertyAnimation(target, propertyName); + auto *animation = new QPropertyAnimation(target, propertyName); animation->setDuration(300); animation->setStartValue(start); animation->setEndValue(end); diff --git a/sources/diagramcontent.cpp b/sources/diagramcontent.cpp index f05469659..480caec71 100644 --- a/sources/diagramcontent.cpp +++ b/sources/diagramcontent.cpp @@ -44,11 +44,11 @@ DiagramContent::DiagramContent(Diagram *diagram) : //Get the selected items for (QGraphicsItem *item : m_selected_items) { - if (Element *elmt = qgraphicsitem_cast(item)) + if (auto *elmt = qgraphicsitem_cast(item)) m_elements << elmt; - else if (IndependentTextItem *iti = qgraphicsitem_cast(item)) + else if (auto *iti = qgraphicsitem_cast(item)) m_text_fields << iti; - else if (Conductor *c = qgraphicsitem_cast(item)) + else if (auto *c = qgraphicsitem_cast(item)) { //Get the isolated selected conductor (= not movable, but deletable) if (!c->terminal1->parentItem()->isSelected() &&\ @@ -56,14 +56,14 @@ DiagramContent::DiagramContent(Diagram *diagram) : m_other_conductors << c; } } - else if (DiagramImageItem *dii = qgraphicsitem_cast(item)) + else if (auto *dii = qgraphicsitem_cast(item)) m_images << dii; - else if (QetShapeItem *dsi = qgraphicsitem_cast(item)) + else if (auto *dsi = qgraphicsitem_cast(item)) m_shapes << dsi; - else if (DynamicElementTextItem *deti = qgraphicsitem_cast(item)) + else if (auto *deti = qgraphicsitem_cast(item)) m_element_texts << deti; - else if (QGraphicsItemGroup *group = qgraphicsitem_cast(item)) - if(ElementTextItemGroup *etig = dynamic_cast(group)) + else if (auto *group = qgraphicsitem_cast(item)) + if(auto *etig = dynamic_cast(group)) m_texts_groups << etig; } @@ -147,7 +147,7 @@ QList DiagramContent::selectedTextsGroup() const for(QGraphicsItem *qgi : m_selected_items) if(qgi->type() == QGraphicsItemGroup::Type) - if(ElementTextItemGroup *grp = dynamic_cast(qgi)) + if(auto *grp = dynamic_cast(qgi)) groups << grp; return groups; diff --git a/sources/diagramcontextwidget.cpp b/sources/diagramcontextwidget.cpp index 336adb67a..30f8a0029 100644 --- a/sources/diagramcontextwidget.cpp +++ b/sources/diagramcontextwidget.cpp @@ -183,7 +183,7 @@ void DiagramContextWidget::initWidgets() { Initialize the layout of this widget. */ void DiagramContextWidget::initLayout() { - QVBoxLayout *vlayout0 = new QVBoxLayout(); + auto *vlayout0 = new QVBoxLayout(); vlayout0 -> setContentsMargins(0, 0, 0, 0); vlayout0 -> addWidget(format_label); vlayout0 -> addWidget(table_); diff --git a/sources/diagramevent/diagrameventaddelement.cpp b/sources/diagramevent/diagrameventaddelement.cpp index 54032e354..23083ab48 100644 --- a/sources/diagramevent/diagrameventaddelement.cpp +++ b/sources/diagramevent/diagrameventaddelement.cpp @@ -230,7 +230,7 @@ void DiagramEventAddElement::addElement() { QPair pair = element -> AlignedFreeTerminals().takeFirst(); - Conductor *conductor = new Conductor(pair.first, pair.second); + auto *conductor = new Conductor(pair.first, pair.second); new AddItemCommand(conductor, m_diagram, QPointF(), undo_object); //Autonum the new conductor, the undo command associated for this, have for parent undo_object diff --git a/sources/diagramevent/diagrameventaddtext.cpp b/sources/diagramevent/diagrameventaddtext.cpp index 0646c178e..244d22811 100644 --- a/sources/diagramevent/diagrameventaddtext.cpp +++ b/sources/diagramevent/diagrameventaddtext.cpp @@ -45,7 +45,7 @@ bool DiagramEventAddText::mousePressEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) { - IndependentTextItem *text = new IndependentTextItem(); + auto *text = new IndependentTextItem(); m_diagram -> undoStack().push(new AddItemCommand(text, m_diagram, event->scenePos())); text->setTextInteractionFlags(Qt::TextEditorInteraction); text->setFocus(Qt::MouseFocusReason); diff --git a/sources/diagramfoliolist.cpp b/sources/diagramfoliolist.cpp index 7759d43d3..40ebc6ddf 100644 --- a/sources/diagramfoliolist.cpp +++ b/sources/diagramfoliolist.cpp @@ -236,16 +236,16 @@ void DiagramFolioList::buildGrid(QPainter *qp, const QRectF &rect, int rows, int qreal y0 = tablesSpacing + rect.topLeft().y(); for (int i = 0; i < tables; ++i) { - QRectF *tableRect = new QRectF(x0, y0, tableWidth, rect.height() - 2*tablesSpacing); + auto *tableRect = new QRectF(x0, y0, tableWidth, rect.height() - 2*tablesSpacing); qp->drawRect(*tableRect); list_rectangles_.push_back(tableRect); for (int j = 1; j < rows; ++j) { - QLineF *line = new QLineF(x0, y0 + j*rowHeight, x0 + tableWidth,y0 + j*rowHeight); + auto *line = new QLineF(x0, y0 + j*rowHeight, x0 + tableWidth,y0 + j*rowHeight); qp->drawLine(*line); list_lines_.push_back(line); } for (int j = 0; j < cols-1; ++j) { - QLineF *line = new QLineF(x0 + colWidths[j]*tableWidth, y0, x0 + colWidths[j]*tableWidth,y0 + rows*rowHeight); + auto *line = new QLineF(x0 + colWidths[j]*tableWidth, y0, x0 + colWidths[j]*tableWidth,y0 + rows*rowHeight); qp->drawLine(*line); list_lines_.push_back(line); x0 += colWidths[j]*tableWidth; diff --git a/sources/diagramprintdialog.cpp b/sources/diagramprintdialog.cpp index a4e2241a0..4eac66b03 100644 --- a/sources/diagramprintdialog.cpp +++ b/sources/diagramprintdialog.cpp @@ -187,7 +187,7 @@ int DiagramPrintDialog::horizontalPagesCount(Diagram *diagram, const ExportPrope QRect printable_area = fullpage ? printer_ -> paperRect() : printer_ -> pageRect(); QRect diagram_rect = diagramRect(diagram, options); - int h_pages_count = int(ceil(qreal(diagram_rect.width()) / qreal(printable_area.width()))); + auto h_pages_count = int(ceil(qreal(diagram_rect.width()) / qreal(printable_area.width()))); return(h_pages_count); } @@ -203,7 +203,7 @@ int DiagramPrintDialog::verticalPagesCount(Diagram *diagram, const ExportPropert QRect printable_area = fullpage ? printer_ -> paperRect() : printer_ -> pageRect(); QRect diagram_rect = diagramRect(diagram, options); - int v_pages_count = int(ceil(qreal(diagram_rect.height()) / qreal(printable_area.height()))); + auto v_pages_count = int(ceil(qreal(diagram_rect.height()) / qreal(printable_area.height()))); return(v_pages_count); } diff --git a/sources/diagramschooser.cpp b/sources/diagramschooser.cpp index eec88de96..2b0b9d33a 100644 --- a/sources/diagramschooser.cpp +++ b/sources/diagramschooser.cpp @@ -164,7 +164,7 @@ void DiagramsChooser::updateList() { QString diagram_title = diagram -> title(); if (diagram_title.isEmpty()) diagram_title = tr("Folio sans titre"); - QCheckBox *checkbox = new QCheckBox(diagram_title); + auto *checkbox = new QCheckBox(diagram_title); checkbox -> setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum)); checkbox -> setChecked(selected_diagrams.contains(diagram)); connect(checkbox, SIGNAL(toggled(bool)), this, SIGNAL(selectionChanged())); diff --git a/sources/diagramview.cpp b/sources/diagramview.cpp index af1b4f3ac..fff3c38d8 100644 --- a/sources/diagramview.cpp +++ b/sources/diagramview.cpp @@ -227,7 +227,7 @@ void DiagramView::handleTitleBlockDrop(QDropEvent *e) { QString integrated_template_name = tbt_loc.name(); if (mustIntegrateTitleBlockTemplate(tbt_loc)) { - IntegrationMoveTitleBlockTemplatesHandler *handler = new IntegrationMoveTitleBlockTemplatesHandler(this); + auto *handler = new IntegrationMoveTitleBlockTemplatesHandler(this); //QString error_message; integrated_template_name = m_diagram->project()->integrateTitleBlockTemplate(tbt_loc, handler); @@ -507,7 +507,7 @@ bool DiagramView::gestureEvent(QGestureEvent *event) { if (QGesture *gesture = event->gesture(Qt::PinchGesture)) { - QPinchGesture *pinch = static_cast(gesture); + auto *pinch = static_cast(gesture); if (pinch->changeFlags() & QPinchGesture::ScaleFactorChanged) { qreal value = gesture->property("scaleFactor").toReal(); @@ -831,7 +831,7 @@ void DiagramView::editConductorColor(Conductor *edited_conductor) ConductorProperties initial_properties = edited_conductor -> properties(); // prepare a color dialog showing the initial conductor color - QColorDialog *color_dialog = new QColorDialog(this); + auto *color_dialog = new QColorDialog(this); color_dialog -> setWindowTitle(tr("Choisir la nouvelle couleur de ce conducteur")); #ifdef Q_OS_MAC color_dialog -> setWindowFlags(Qt::Sheet); @@ -850,7 +850,7 @@ void DiagramView::editConductorColor(Conductor *edited_conductor) initial_properties.color = new_color; new_value.setValue(initial_properties); - QPropertyUndoCommand *undo = new QPropertyUndoCommand(edited_conductor, "properties", old_value, new_value); + auto *undo = new QPropertyUndoCommand(edited_conductor, "properties", old_value, new_value); undo->setText(tr("Modifier les propriétés d'un conducteur", "undo caption")); diagram() -> undoStack().push(undo); } @@ -958,11 +958,11 @@ bool DiagramView::isCtrlShifting(QInputEvent *e) { // note: QInputEvent::modifiers and QKeyEvent::modifiers() do not return the // same values, hence the casts if (e -> type() == QEvent::KeyPress || e -> type() == QEvent::KeyRelease) { - if (QKeyEvent *ke = static_cast(e)) { + if (auto *ke = static_cast(e)) { result = (ke -> modifiers() == (Qt::ControlModifier | Qt::ShiftModifier)); } } else if (e -> type() >= QEvent::MouseButtonPress && e -> type() <= QEvent::MouseMove) { - if (QMouseEvent *me = static_cast(e)) { + if (auto *me = static_cast(e)) { result = (me -> modifiers() == (Qt::ControlModifier | Qt::ShiftModifier)); } } @@ -992,11 +992,11 @@ void DiagramView::editSelection() { //We use dynamic_cast instead of qgraphicsitem_cast for QetGraphicsItem //because they haven't got they own type(). //Use qgraphicsitem_cast will have weird behavior for this class. - if (IndependentTextItem *iti = qgraphicsitem_cast(item)) + if (auto *iti = qgraphicsitem_cast(item)) iti -> edit(); - else if (QetGraphicsItem *qgi = dynamic_cast (item)) + else if (auto *qgi = dynamic_cast (item)) qgi -> editProperty(); - else if (Conductor *c = qgraphicsitem_cast(item)) + else if (auto *c = qgraphicsitem_cast(item)) c -> editProperty(); } @@ -1084,7 +1084,7 @@ void DiagramView::contextMenuEvent(QContextMenuEvent *e) QList list = contextMenuActions(); if(!list.isEmpty()) { - QMenu *context_menu = new QMenu(this); + auto *context_menu = new QMenu(this); context_menu->addActions(list); context_menu->popup(e->globalPos()); e->accept(); diff --git a/sources/editor/arceditor.cpp b/sources/editor/arceditor.cpp index 854109210..18605b64b 100644 --- a/sources/editor/arceditor.cpp +++ b/sources/editor/arceditor.cpp @@ -47,9 +47,9 @@ ArcEditor::ArcEditor(QETElementEditor *editor, PartArc *arc, QWidget *parent) : h->setRange(-5000, 5000); v->setRange(-5000, 5000); - QVBoxLayout *v_layout = new QVBoxLayout(this); + auto *v_layout = new QVBoxLayout(this); - QGridLayout *grid = new QGridLayout(); + auto *grid = new QGridLayout(); grid -> addWidget(new QLabel(tr("Centre : ")), 0, 0); grid -> addWidget(new QLabel("x"), 1, 0, Qt::AlignRight); grid -> addWidget(x, 1, 1); @@ -99,7 +99,7 @@ bool ArcEditor::setPart(CustomElementPart *new_part) return(true); } - if (PartArc *part_arc = dynamic_cast(new_part)) + if (auto *part_arc = dynamic_cast(new_part)) { if (part == part_arc) return true; if (part) diff --git a/sources/editor/elementprimitivedecorator.cpp b/sources/editor/elementprimitivedecorator.cpp index 7f1cd49fa..0fb9a3ebe 100644 --- a/sources/editor/elementprimitivedecorator.cpp +++ b/sources/editor/elementprimitivedecorator.cpp @@ -122,7 +122,7 @@ void ElementPrimitiveDecorator::setItems(const QList &items) QList primitives; for(QGraphicsItem *item : items) { - if (CustomElementPart *part_item = dynamic_cast(item)) + if (auto *part_item = dynamic_cast(item)) { primitives << part_item; } @@ -143,7 +143,7 @@ QList ElementPrimitiveDecorator::items() const { QList ElementPrimitiveDecorator::graphicsItems() const { QList list; foreach (CustomElementPart *part_item, decorated_items_) { - if (QGraphicsItem *item = dynamic_cast(part_item)) { + if (auto *item = dynamic_cast(part_item)) { list << item; } } @@ -555,7 +555,7 @@ void ElementPrimitiveDecorator::handlerMouseReleaseEvent(QetGraphicsHandlerItem ElementEditionCommand *command = nullptr; if (current_operation_square_ > QET::NoOperation) { - ScalePartsCommand *scale_command = new ScalePartsCommand(); + auto *scale_command = new ScalePartsCommand(); scale_command -> setScaledPrimitives(items()); scale_command -> setTransformation( mapToScene(original_bounding_rect_).boundingRect(), @@ -717,7 +717,7 @@ bool ElementPrimitiveDecorator::sceneEventFilter(QGraphicsItem *watched, QEvent //Watched must be an handler if(watched->type() == QetGraphicsHandlerItem::Type) { - QetGraphicsHandlerItem *qghi = qgraphicsitem_cast(watched); + auto *qghi = qgraphicsitem_cast(watched); if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize { diff --git a/sources/editor/elementscene.cpp b/sources/editor/elementscene.cpp index dc03397e7..788802dff 100644 --- a/sources/editor/elementscene.cpp +++ b/sources/editor/elementscene.cpp @@ -416,7 +416,7 @@ const QDomDocument ElementScene::toXml(bool all_parts) { //If the export concerns only the selection, the not selected part is ignored if (!all_parts && !qgi -> isSelected()) continue; - if (CustomElementPart *ce = dynamic_cast(qgi)) + if (auto *ce = dynamic_cast(qgi)) { if (ce -> isUseless()) continue; description.appendChild(ce -> toXml(xml_document)); @@ -492,7 +492,7 @@ QRectF ElementScene::elementSceneGeometricRect() const{ if (qgi->type() == ElementPrimitiveDecorator::Type) continue; if (qgi->type() == QGraphicsRectItem::Type) continue; if (qgi->type() == PartDynamicTextField::Type) continue; - if (CustomElementPart *cep = dynamic_cast (qgi)) { + if (auto *cep = dynamic_cast (qgi)) { esgr |= cep -> sceneGeometricRect(); } } @@ -675,7 +675,7 @@ void ElementScene::slot_editAuthorInformations() { #endif dialog_author.setMinimumSize(400, 260); dialog_author.setWindowTitle(tr("Éditer les informations sur l'auteur", "window title")); - QVBoxLayout *dialog_layout = new QVBoxLayout(&dialog_author); + auto *dialog_layout = new QVBoxLayout(&dialog_author); // ajoute un champ explicatif au dialogue QLabel *information_label = new QLabel(tr("Vous pouvez utiliser ce champ libre pour mentionner les auteurs de l'élément, sa licence, ou tout autre renseignement que vous jugerez utile.")); @@ -684,7 +684,7 @@ void ElementScene::slot_editAuthorInformations() { dialog_layout -> addWidget(information_label); // ajoute un QTextEdit au dialogue - QTextEdit *text_field = new QTextEdit(); + auto *text_field = new QTextEdit(); text_field -> setAcceptRichText(false); text_field -> setPlainText(informations()); text_field -> setReadOnly(is_read_only); @@ -738,7 +738,7 @@ void ElementScene::slot_editNames() { dialog.setModal(true); dialog.setMinimumSize(400, 330); dialog.setWindowTitle(tr("Éditer les noms", "window title")); - QVBoxLayout *dialog_layout = new QVBoxLayout(&dialog); + auto *dialog_layout = new QVBoxLayout(&dialog); // ajoute un champ explicatif au dialogue QLabel *information_label = new QLabel(tr("Vous pouvez spécifier le nom de l'élément dans plusieurs langues.")); @@ -747,7 +747,7 @@ void ElementScene::slot_editNames() { dialog_layout -> addWidget(information_label); // ajoute un NamesListWidget au dialogue - NamesListWidget *names_widget = new NamesListWidget(); + auto *names_widget = new NamesListWidget(); names_widget -> setNames(m_names_list); names_widget -> setReadOnly(is_read_only); dialog_layout -> addWidget(names_widget); @@ -772,7 +772,7 @@ void ElementScene::slot_editNames() { QList ElementScene::primitives() const { QList primitives_list; foreach (QGraphicsItem *item, items()) { - if (CustomElementPart *primitive = dynamic_cast(item)) { + if (auto *primitive = dynamic_cast(item)) { primitives_list << primitive; } } @@ -1001,7 +1001,7 @@ ElementContent ElementScene::loadContent(const QDomDocument &xml_document) else if (qde.tagName() == "input") cep = pdtf = new PartDynamicTextField(m_element_editor); else continue; - if (QGraphicsItem *qgi = dynamic_cast(cep)) + if (auto *qgi = dynamic_cast(cep)) { if (!qgi->zValue()) qgi->setZValue(z++); @@ -1180,7 +1180,7 @@ void ElementScene::stackAction(ElementEditionCommand *command) { if (!command -> elementView()) { foreach (QGraphicsView *view, views()) { - if (ElementView *element_view = dynamic_cast(view)) { + if (auto *element_view = dynamic_cast(view)) { command -> setElementView(element_view); break; } diff --git a/sources/editor/elementview.cpp b/sources/editor/elementview.cpp index 01cb5ecb1..91c6865b8 100644 --- a/sources/editor/elementview.cpp +++ b/sources/editor/elementview.cpp @@ -296,7 +296,7 @@ ElementContent ElementView::paste(const QDomDocument &xml_document, const QPoint // si quelque chose a effectivement ete ajoute au schema, on cree un objet d'annulation if (content_pasted.count()) { m_scene -> clearSelection(); - PastePartsCommand *undo_object = new PastePartsCommand(this, content_pasted); + auto *undo_object = new PastePartsCommand(this, content_pasted); m_scene -> undoStack().push(undo_object); } return(content_pasted); @@ -343,7 +343,7 @@ ElementContent ElementView::pasteWithOffset(const QDomDocument &xml_document) { // si quelque chose a effectivement ete ajoute au schema, on cree un objet d'annulation if (content_pasted.count()) { m_scene -> clearSelection(); - PastePartsCommand *undo_object = new PastePartsCommand(this, content_pasted); + auto *undo_object = new PastePartsCommand(this, content_pasted); undo_object -> setOffset(offset_paste_count_ - 1, old_start_top_left_corner, offset_paste_count_, start_top_left_corner_); m_scene -> undoStack().push(undo_object); } @@ -446,7 +446,7 @@ bool ElementView::event(QEvent *e) { */ bool ElementView::gestureEvent(QGestureEvent *event){ if (QGesture *gesture = event->gesture(Qt::PinchGesture)) { - QPinchGesture *pinch = static_cast(gesture); + auto *pinch = static_cast(gesture); if (pinch->changeFlags() & QPinchGesture::ScaleFactorChanged){ qreal value = gesture->property("scaleFactor").toReal(); if (value > 1){ @@ -515,9 +515,9 @@ void ElementView::drawBackground(QPainter *p, const QRectF &r) { qreal limite_x = r.x() + r.width(); qreal limite_y = r.y() + r.height(); - int g_x = (int)ceil(r.x()); + auto g_x = (int)ceil(r.x()); while (g_x % drawn_x_grid) ++ g_x; - int g_y = (int)ceil(r.y()); + auto g_y = (int)ceil(r.y()); while (g_y % drawn_y_grid) ++ g_y; for (int gx = g_x ; gx < limite_x ; gx += drawn_x_grid) { diff --git a/sources/editor/ellipseeditor.cpp b/sources/editor/ellipseeditor.cpp index c396185d2..d0281dc6d 100644 --- a/sources/editor/ellipseeditor.cpp +++ b/sources/editor/ellipseeditor.cpp @@ -44,9 +44,9 @@ EllipseEditor::EllipseEditor(QETElementEditor *editor, PartEllipse *ellipse, QWi h->setRange(-5000, 5000); v->setRange(-5000, 5000); - QVBoxLayout *v_layout = new QVBoxLayout(this); + auto *v_layout = new QVBoxLayout(this); - QGridLayout *grid = new QGridLayout(); + auto *grid = new QGridLayout(); grid -> addWidget(new QLabel(tr("Centre : ")), 0, 0); grid -> addWidget(new QLabel("x"), 1, 0, Qt::AlignRight); grid -> addWidget(x, 1, 1); @@ -88,7 +88,7 @@ bool EllipseEditor::setPart(CustomElementPart *new_part) style_ -> setPart(nullptr); return(true); } - if (PartEllipse *part_ellipse = dynamic_cast(new_part)) + if (auto *part_ellipse = dynamic_cast(new_part)) { if (part == part_ellipse) return true; if (part) diff --git a/sources/editor/graphicspart/partarc.cpp b/sources/editor/graphicspart/partarc.cpp index 03bce321f..e365933e2 100644 --- a/sources/editor/graphicspart/partarc.cpp +++ b/sources/editor/graphicspart/partarc.cpp @@ -218,7 +218,7 @@ bool PartArc::sceneEventFilter(QGraphicsItem *watched, QEvent *event) //Watched must be an handler if(watched->type() == QetGraphicsHandlerItem::Type) { - QetGraphicsHandlerItem *qghi = qgraphicsitem_cast(watched); + auto *qghi = qgraphicsitem_cast(watched); if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize { diff --git a/sources/editor/graphicspart/partellipse.cpp b/sources/editor/graphicspart/partellipse.cpp index 97ae2a718..71d4af2cf 100644 --- a/sources/editor/graphicspart/partellipse.cpp +++ b/sources/editor/graphicspart/partellipse.cpp @@ -214,7 +214,7 @@ bool PartEllipse::sceneEventFilter(QGraphicsItem *watched, QEvent *event) //Watched must be an handler if(watched->type() == QetGraphicsHandlerItem::Type) { - QetGraphicsHandlerItem *qghi = qgraphicsitem_cast(watched); + auto *qghi = qgraphicsitem_cast(watched); if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize { diff --git a/sources/editor/graphicspart/partline.cpp b/sources/editor/graphicspart/partline.cpp index 05ed70612..ab981b8e3 100644 --- a/sources/editor/graphicspart/partline.cpp +++ b/sources/editor/graphicspart/partline.cpp @@ -190,7 +190,7 @@ bool PartLine::sceneEventFilter(QGraphicsItem *watched, QEvent *event) //Watched must be an handler if(watched->type() == QetGraphicsHandlerItem::Type) { - QetGraphicsHandlerItem *qghi = qgraphicsitem_cast(watched); + auto *qghi = qgraphicsitem_cast(watched); if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize { diff --git a/sources/editor/graphicspart/partpolygon.cpp b/sources/editor/graphicspart/partpolygon.cpp index c1c4c1486..8207f9d70 100644 --- a/sources/editor/graphicspart/partpolygon.cpp +++ b/sources/editor/graphicspart/partpolygon.cpp @@ -308,7 +308,7 @@ bool PartPolygon::sceneEventFilter(QGraphicsItem *watched, QEvent *event) //Watched must be an handler if(watched->type() == QetGraphicsHandlerItem::Type) { - QetGraphicsHandlerItem *qghi = qgraphicsitem_cast(watched); + auto *qghi = qgraphicsitem_cast(watched); if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize { diff --git a/sources/editor/graphicspart/partrectangle.cpp b/sources/editor/graphicspart/partrectangle.cpp index 5f04abfd0..70645b41a 100644 --- a/sources/editor/graphicspart/partrectangle.cpp +++ b/sources/editor/graphicspart/partrectangle.cpp @@ -322,7 +322,7 @@ bool PartRectangle::sceneEventFilter(QGraphicsItem *watched, QEvent *event) //Watched must be an handler if(watched->type() == QetGraphicsHandlerItem::Type) { - QetGraphicsHandlerItem *qghi = qgraphicsitem_cast(watched); + auto *qghi = qgraphicsitem_cast(watched); if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize { diff --git a/sources/editor/lineeditor.cpp b/sources/editor/lineeditor.cpp index ce1845f70..34f9b0427 100644 --- a/sources/editor/lineeditor.cpp +++ b/sources/editor/lineeditor.cpp @@ -62,7 +62,7 @@ LineEditor::LineEditor(QETElementEditor *editor, PartLine *line, QWidget *parent end1_length = new QDoubleSpinBox(); end2_length = new QDoubleSpinBox(); - QGridLayout *grid = new QGridLayout(); + auto *grid = new QGridLayout(); grid -> addWidget(new QLabel("x1"), 0, 0); grid -> addWidget(x1, 0, 1); grid -> addWidget(new QLabel("y1"), 0, 2); @@ -72,7 +72,7 @@ LineEditor::LineEditor(QETElementEditor *editor, PartLine *line, QWidget *parent grid -> addWidget(new QLabel("y2"), 1, 2); grid -> addWidget(y2, 1, 3); - QGridLayout *grid2 = new QGridLayout(); + auto *grid2 = new QGridLayout(); grid2 -> addWidget(new QLabel(tr("Fin 1")), 0, 0); grid2 -> addWidget(end1_type, 0, 1); grid2 -> addWidget(end1_length, 0, 2); @@ -80,7 +80,7 @@ LineEditor::LineEditor(QETElementEditor *editor, PartLine *line, QWidget *parent grid2 -> addWidget(end2_type, 1, 1); grid2 -> addWidget(end2_length, 1, 2); - QVBoxLayout *v_layout = new QVBoxLayout(this); + auto *v_layout = new QVBoxLayout(this); v_layout -> addWidget(style_); v_layout -> addLayout(grid); v_layout -> addLayout(grid2); @@ -115,7 +115,7 @@ bool LineEditor::setPart(CustomElementPart *new_part) style_ -> setPart(nullptr); return(true); } - if (PartLine *part_line = dynamic_cast(new_part)) + if (auto *part_line = dynamic_cast(new_part)) { if (part == part_line) return true; if (part) diff --git a/sources/editor/polygoneditor.cpp b/sources/editor/polygoneditor.cpp index aecd69105..60916d6e0 100644 --- a/sources/editor/polygoneditor.cpp +++ b/sources/editor/polygoneditor.cpp @@ -45,7 +45,7 @@ PolygonEditor::PolygonEditor(QETElementEditor *editor, PartPolygon *p, QWidget * updateForm(); // layout - QVBoxLayout *layout = new QVBoxLayout(this); + auto *layout = new QVBoxLayout(this); layout -> addWidget(style_); layout -> addWidget(new QLabel(tr("Points du polygone :"))); layout -> addWidget(&points_list); @@ -106,7 +106,7 @@ void PolygonEditor::updateForm() { point = part -> mapToScene(point); QStringList qsl; qsl << QString("%1").arg(point.x()) << QString("%1").arg(point.y()); - QTreeWidgetItem *qtwi = new QTreeWidgetItem(qsl); + auto *qtwi = new QTreeWidgetItem(qsl); qtwi -> setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsSelectable); points_list.addTopLevelItem(qtwi); } @@ -135,7 +135,7 @@ bool PolygonEditor::setPart(CustomElementPart *new_part) style_ -> setPart(nullptr); return(true); } - if (PartPolygon *part_polygon = dynamic_cast(new_part)) + if (auto *part_polygon = dynamic_cast(new_part)) { if (part == part_polygon) return true; if (part) diff --git a/sources/editor/qetelementeditor.cpp b/sources/editor/qetelementeditor.cpp index e1c35fbc2..52f037f9f 100644 --- a/sources/editor/qetelementeditor.cpp +++ b/sources/editor/qetelementeditor.cpp @@ -537,7 +537,7 @@ void QETElementEditor::setupInterface() m_undo_dock -> setFeatures(QDockWidget::AllDockWidgetFeatures); m_undo_dock -> setMinimumWidth(290); addDockWidget(Qt::RightDockWidgetArea, m_undo_dock); - QUndoView* undo_view = new QUndoView(&(m_elmt_scene -> undoStack()), this); + auto* undo_view = new QUndoView(&(m_elmt_scene -> undoStack()), this); undo_view -> setEmptyLabel(tr("Aucune modification")); m_undo_dock -> setWidget(undo_view); @@ -596,7 +596,7 @@ void QETElementEditor::slot_updateInformations() style_editable = true; foreach (QGraphicsItem *qgi, selected_qgis) { - if (CustomElementPart *cep = dynamic_cast(qgi)) + if (auto *cep = dynamic_cast(qgi)) cep_list << cep; else style_editable = false; @@ -609,11 +609,11 @@ void QETElementEditor::slot_updateInformations() if(selected_qgis.size() == 1) { QGraphicsItem *qgi = selected_qgis.first(); - if (CustomElementPart *selection = dynamic_cast(qgi)) + if (auto *selection = dynamic_cast(qgi)) { if (QWidget *widget = m_tools_dock_stack->widget(1)) { - if (ElementItemEditor *editor = dynamic_cast(widget)) + if (auto *editor = dynamic_cast(widget)) { if(editor->currentPart() == selection) return; @@ -626,11 +626,11 @@ void QETElementEditor::slot_updateInformations() if (selected_qgis.size() == 1) { QGraphicsItem *qgi = selected_qgis.first(); - if (CustomElementPart *selection = dynamic_cast(qgi)) + if (auto *selection = dynamic_cast(qgi)) { //The current editor already edit the selected part if (QWidget *widget = m_tools_dock_stack->widget(1)) - if (ElementItemEditor *editor = dynamic_cast(widget)) + if (auto *editor = dynamic_cast(widget)) if(editor->currentPart() == selection) return; @@ -1065,7 +1065,7 @@ QString program = (QDir::homePath() + "/.qet/DXFtoQET.app"); QString program = (QDir::homePath() + "/.qet/DXFtoQET"); #endif QStringList arguments; -QProcess *DXF = new QProcess(qApp); +auto *DXF = new QProcess(qApp); DXF->start(program,arguments); } @@ -1336,9 +1336,9 @@ void QETElementEditor::slot_createPartsList() { if (qgis.count() <= QET_MAX_PARTS_IN_ELEMENT_EDITOR_LIST) { for (int j = qgis.count() - 1 ; j >= 0 ; -- j) { QGraphicsItem *qgi = qgis[j]; - if (CustomElementPart *cep = dynamic_cast(qgi)) { + if (auto *cep = dynamic_cast(qgi)) { QString part_desc = cep -> name(); - QListWidgetItem *qlwi = new QListWidgetItem(part_desc); + auto *qlwi = new QListWidgetItem(part_desc); QVariant v; v.setValue(qgi); qlwi -> setData(42, v); @@ -1382,7 +1382,7 @@ void QETElementEditor::slot_updateSelectionFromPartsList() { m_parts_list -> blockSignals(true); for (int i = 0 ; i < m_parts_list -> count() ; ++ i) { QListWidgetItem *qlwi = m_parts_list -> item(i); - QGraphicsItem *qgi = qlwi -> data(42).value(); + auto *qgi = qlwi -> data(42).value(); if (qgi) { qgi -> setSelected(qlwi -> isSelected()); } @@ -1578,7 +1578,7 @@ void QETElementEditor::updateCurrentPartEditor() { if (!m_tools_dock_stack -> currentIndex()) return; // s'il y a un widget d'edition affiche, on le met a jour - if (ElementItemEditor *current_editor = dynamic_cast(m_tools_dock_stack->widget(1))) { + if (auto *current_editor = dynamic_cast(m_tools_dock_stack->widget(1))) { current_editor -> updateForm(); } } diff --git a/sources/editor/styleeditor.cpp b/sources/editor/styleeditor.cpp index 1a6139b11..b7e15cf26 100644 --- a/sources/editor/styleeditor.cpp +++ b/sources/editor/styleeditor.cpp @@ -98,7 +98,7 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p, main_layout -> addWidget(new QLabel("" + tr("Apparence :") + " ")); - QHBoxLayout *color_layout = new QHBoxLayout(); + auto *color_layout = new QHBoxLayout(); color_layout -> addWidget(new QLabel(tr("Contour :")), 0, Qt::AlignRight); color_layout -> addWidget(outline_color); color_layout -> addSpacing(10); @@ -106,7 +106,7 @@ StyleEditor::StyleEditor(QETElementEditor *editor, CustomElementGraphicPart *p, color_layout -> addWidget(filling_color); main_layout -> addLayout(color_layout); - QHBoxLayout *style_layout = new QHBoxLayout(); + auto *style_layout = new QHBoxLayout(); style_layout -> addWidget(new QLabel(tr("Style : ")), 0, Qt::AlignRight); style_layout -> addWidget(line_style); style_layout -> addSpacing(10); @@ -205,7 +205,7 @@ bool StyleEditor::setPart(CustomElementPart *new_part) { return(true); } - if (CustomElementGraphicPart *part_graphic = dynamic_cast(new_part)) + if (auto *part_graphic = dynamic_cast(new_part)) { part = part_graphic; updateForm(); @@ -237,7 +237,7 @@ bool StyleEditor::setParts(QList part_list) foreach (CustomElementPart *cep, part_list) { - if (CustomElementGraphicPart *cegp = dynamic_cast(cep)) + if (auto *cegp = dynamic_cast(cep)) m_part_list << cegp; else return false; diff --git a/sources/editor/terminaleditor.cpp b/sources/editor/terminaleditor.cpp index 29e9fc2a4..664c436f9 100644 --- a/sources/editor/terminaleditor.cpp +++ b/sources/editor/terminaleditor.cpp @@ -48,17 +48,17 @@ TerminalEditor::TerminalEditor(QETElementEditor *editor, PartTerminal *term, QWi orientation -> addItem(QET::Icons::South, tr("Sud"), Qet::South); orientation -> addItem(QET::Icons::West, tr("Ouest"), Qet::West); - QVBoxLayout *main_layout = new QVBoxLayout(); + auto *main_layout = new QVBoxLayout(); main_layout -> addWidget(new QLabel(tr("Position : "))); - QHBoxLayout *position = new QHBoxLayout(); + auto *position = new QHBoxLayout(); position -> addWidget(new QLabel(tr("x : "))); position -> addWidget(qle_x ); position -> addWidget(new QLabel(tr("y : "))); position -> addWidget(qle_y ); main_layout -> addLayout(position); - QHBoxLayout *ori = new QHBoxLayout(); + auto *ori = new QHBoxLayout(); ori -> addWidget(new QLabel(tr("Orientation : "))); ori -> addWidget(orientation ); main_layout -> addLayout(ori); @@ -91,7 +91,7 @@ bool TerminalEditor::setPart(CustomElementPart *new_part) part = nullptr; return(true); } - if (PartTerminal *part_terminal = dynamic_cast(new_part)) + if (auto *part_terminal = dynamic_cast(new_part)) { if(part == part_terminal) return true; if (part) diff --git a/sources/editor/texteditor.cpp b/sources/editor/texteditor.cpp index c2e3e45eb..133ba91dc 100644 --- a/sources/editor/texteditor.cpp +++ b/sources/editor/texteditor.cpp @@ -51,33 +51,33 @@ TextEditor::TextEditor(QETElementEditor *editor, PartText *text, QWidget *parent qle_x -> setRange(-5000, 5000); qle_y -> setRange(-5000, 5000); - QVBoxLayout *main_layout = new QVBoxLayout(); + auto *main_layout = new QVBoxLayout(); main_layout -> addWidget(new QLabel(tr("Position : "))); - QHBoxLayout *position = new QHBoxLayout(); + auto *position = new QHBoxLayout(); position -> addWidget(new QLabel(tr("x : "))); position -> addWidget(qle_x ); position -> addWidget(new QLabel(tr("y : "))); position -> addWidget(qle_y ); main_layout -> addLayout(position); - QHBoxLayout *fs = new QHBoxLayout(); + auto *fs = new QHBoxLayout(); fs -> addWidget(new QLabel(tr("Taille : "))); fs -> addWidget(font_size); main_layout -> addLayout(fs); - QHBoxLayout *color_layout = new QHBoxLayout(); + auto *color_layout = new QHBoxLayout(); color_layout -> addWidget(new QLabel(tr("Couleur : "))); color_layout -> addWidget(black_color_); color_layout -> addWidget(white_color_); color_layout -> addStretch(); main_layout -> addLayout(color_layout); - QHBoxLayout *t = new QHBoxLayout(); + auto *t = new QHBoxLayout(); t -> addWidget(new QLabel(tr("Texte : "))); t -> addWidget(qle_text); - QHBoxLayout *rotation_angle_layout = new QHBoxLayout(); + auto *rotation_angle_layout = new QHBoxLayout(); rotation_angle_layout -> addWidget(rotation_angle_label); rotation_angle_layout -> addWidget(rotation_angle_); @@ -110,7 +110,7 @@ bool TextEditor::setPart(CustomElementPart *new_part) part = nullptr; return(true); } - if (PartText *part_text = dynamic_cast(new_part)) + if (auto *part_text = dynamic_cast(new_part)) { if (part == part_text) return true; part = part_text; diff --git a/sources/editor/ui/dynamictextfieldeditor.cpp b/sources/editor/ui/dynamictextfieldeditor.cpp index 1c9e3e34e..87856313a 100644 --- a/sources/editor/ui/dynamictextfieldeditor.cpp +++ b/sources/editor/ui/dynamictextfieldeditor.cpp @@ -228,7 +228,7 @@ void DynamicTextFieldEditor::on_m_frame_cb_clicked() void DynamicTextFieldEditor::on_m_width_sb_editingFinished() { - qreal width = (qreal)ui->m_width_sb->value(); + auto width = (qreal)ui->m_width_sb->value(); if(width != m_text_field.data()->textWidth()) { diff --git a/sources/editor/ui/elementpropertieseditorwidget.cpp b/sources/editor/ui/elementpropertieseditorwidget.cpp index 3d82306b6..68138cc6b 100644 --- a/sources/editor/ui/elementpropertieseditorwidget.cpp +++ b/sources/editor/ui/elementpropertieseditorwidget.cpp @@ -156,7 +156,7 @@ void ElementPropertiesEditorWidget::populateTree() for(const QString& key : keys) { - QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_tree); + auto *qtwi = new QTreeWidgetItem(ui->m_tree); qtwi->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable); qtwi->setData(0, Qt::DisplayRole, QETApp::elementTranslatedInfoKey(key)); qtwi->setData(0, Qt::UserRole, key); diff --git a/sources/editor/ui/rectangleeditor.cpp b/sources/editor/ui/rectangleeditor.cpp index 7443edfc1..a15b661cf 100644 --- a/sources/editor/ui/rectangleeditor.cpp +++ b/sources/editor/ui/rectangleeditor.cpp @@ -68,7 +68,7 @@ bool RectangleEditor::setPart(CustomElementPart *part) return(true); } - if (PartRectangle *part_rectangle = dynamic_cast(part)) + if (auto *part_rectangle = dynamic_cast(part)) { if (m_part == part_rectangle) { return true; @@ -147,7 +147,7 @@ void RectangleEditor::editingFinished() } m_locked = true; - QUndoCommand *undo = new QUndoCommand(); + auto *undo = new QUndoCommand(); undo->setText(tr("Modifier un rectangle")); QRectF rect(editedTopLeft(), QSizeF(ui->m_width_sb->value(), ui->m_height_sb->value())); diff --git a/sources/elementdialog.cpp b/sources/elementdialog.cpp index 14f0d4e7c..1eedd5085 100644 --- a/sources/elementdialog.cpp +++ b/sources/elementdialog.cpp @@ -53,7 +53,7 @@ void ElementDialog::setUpWidget() setWindowFlags(Qt::Sheet); #endif - QVBoxLayout *layout = new QVBoxLayout(this); + auto *layout = new QVBoxLayout(this); QString title_, label_; switch (m_mode) @@ -142,7 +142,7 @@ void ElementDialog::setUpConnection() */ void ElementDialog::indexClicked(const QModelIndex &index) { - ElementCollectionItem *eci = static_cast (m_model->itemFromIndex(index)); + auto *eci = static_cast (m_model->itemFromIndex(index)); m_location = ElementsLocation(eci->collectionPath()); checkCurrentLocation(); } @@ -300,7 +300,7 @@ ElementsLocation ElementDialog::getSaveElementLocation(QWidget *parentWidget) { */ ElementsLocation ElementDialog::execConfiguredDialog(int mode, QWidget *parentWidget) { - ElementDialog *element_dialog = new ElementDialog(mode, parentWidget); + auto *element_dialog = new ElementDialog(mode, parentWidget); element_dialog->exec(); ElementsLocation location = element_dialog->location(); delete element_dialog; diff --git a/sources/elementscategoryeditor.cpp b/sources/elementscategoryeditor.cpp index 16a396e0c..132d52383 100644 --- a/sources/elementscategoryeditor.cpp +++ b/sources/elementscategoryeditor.cpp @@ -99,7 +99,7 @@ ElementsLocation ElementsCategoryEditor::createdLocation() const */ void ElementsCategoryEditor::setUpWidget() { - QVBoxLayout *editor_layout = new QVBoxLayout(); + auto *editor_layout = new QVBoxLayout(); setLayout(editor_layout); m_names_list = new NamesListWidget(); @@ -109,7 +109,7 @@ void ElementsCategoryEditor::setUpWidget() m_buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(m_buttons, SIGNAL(rejected()), this, SLOT(reject())); - QHBoxLayout *internal_name_layout = new QHBoxLayout(); + auto *internal_name_layout = new QHBoxLayout(); internal_name_layout -> addWidget(m_file_name); internal_name_layout -> addWidget(m_file_line_edit); diff --git a/sources/elementsmover.cpp b/sources/elementsmover.cpp index bd12740bd..1ac8222c5 100644 --- a/sources/elementsmover.cpp +++ b/sources/elementsmover.cpp @@ -128,7 +128,7 @@ void ElementsMover::endMovement() if (!movement_running_) return; //empty command to be used has parent of commands below - QUndoCommand *undo_object = new QUndoCommand(); + auto *undo_object = new QUndoCommand(); //Create undo move if there is a movement if (!current_movement_.isNull()) { @@ -151,7 +151,7 @@ void ElementsMover::endMovement() { QPair pair = elmt -> AlignedFreeTerminals().takeFirst(); - Conductor *conductor = new Conductor(pair.first, pair.second); + auto *conductor = new Conductor(pair.first, pair.second); //Create an undo object for each new auto conductor, with undo_object for parent new AddItemCommand(conductor, diagram_, QPointF(), undo_object); diff --git a/sources/elementspanel.cpp b/sources/elementspanel.cpp index b578dbae7..aff407d3e 100644 --- a/sources/elementspanel.cpp +++ b/sources/elementspanel.cpp @@ -98,11 +98,11 @@ void ElementsPanel::startDrag(Qt::DropActions supportedActions) { void ElementsPanel::startTitleBlockTemplateDrag(const TitleBlockTemplateLocation &location) { QString location_string = location.toString(); - QMimeData *mime_data = new QMimeData(); + auto *mime_data = new QMimeData(); mime_data -> setText(location_string); mime_data -> setData("application/x-qet-titleblock-uri", location_string.toLatin1()); - QDrag *drag = new QDrag(this); + auto *drag = new QDrag(this); drag -> setMimeData(mime_data); drag -> setPixmap(QET::Icons::TitleBlock.pixmap(22, 16)); drag -> start(Qt::CopyAction); @@ -232,10 +232,10 @@ void ElementsPanel::reload(bool reload_collections) { void ElementsPanel::slot_doubleClick(QTreeWidgetItem *qtwi, int) { int qtwi_type = qtwi -> type(); if (qtwi_type == QET::Project) { - QETProject *project = valueForItem(qtwi); + auto *project = valueForItem(qtwi); emit(requestForProject(project)); } else if (qtwi_type == QET::Diagram) { - Diagram *diagram = valueForItem(qtwi); + auto *diagram = valueForItem(qtwi); emit(requestForDiagram(diagram)); } else if (qtwi_type == QET::TitleBlockTemplate) { TitleBlockTemplateLocation tbt = valueForItem(qtwi); diff --git a/sources/elementspanelwidget.cpp b/sources/elementspanelwidget.cpp index 26cfb89c2..ad645da0a 100644 --- a/sources/elementspanelwidget.cpp +++ b/sources/elementspanelwidget.cpp @@ -99,7 +99,7 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) { ); // disposition verticale - QVBoxLayout *vlayout = new QVBoxLayout(this); + auto *vlayout = new QVBoxLayout(this); vlayout -> setMargin(0); vlayout -> setSpacing(0); vlayout -> addWidget(filter_textfield); diff --git a/sources/elementtextpattern.cpp b/sources/elementtextpattern.cpp index e4b3a6ef0..e13ef8d60 100644 --- a/sources/elementtextpattern.cpp +++ b/sources/elementtextpattern.cpp @@ -238,7 +238,7 @@ void ImportElementTextPattern::apply(QString name) const //Add the texts to element for(const QDomElement& text : texts) { - DynamicElementTextItem *deti = new DynamicElementTextItem(m_element); + auto *deti = new DynamicElementTextItem(m_element); undo_stack.push(new AddElementTextCommand(m_element, deti)); deti->fromXml(text); } diff --git a/sources/elementtextsmover.cpp b/sources/elementtextsmover.cpp index 04c158f35..93980b36a 100644 --- a/sources/elementtextsmover.cpp +++ b/sources/elementtextsmover.cpp @@ -119,7 +119,7 @@ void ElementTextsMover::endMovement() for (QGraphicsItem *qgi : m_items_hash.keys()) { - if(QObject *object = dynamic_cast(qgi)) + if(auto *object = dynamic_cast(qgi)) { QPropertyUndoCommand *child_undo = new QPropertyUndoCommand(object, "pos", m_items_hash.value(qgi), qgi->pos(), undo); child_undo->enableAnimation(); diff --git a/sources/exportdialog.cpp b/sources/exportdialog.cpp index 27530f924..206430548 100644 --- a/sources/exportdialog.cpp +++ b/sources/exportdialog.cpp @@ -71,7 +71,7 @@ ExportDialog::ExportDialog(QETProject *project, QWidget *parent) : QDialog(paren // disposition des elements - QHBoxLayout *hLayout = new QHBoxLayout(); + auto *hLayout = new QHBoxLayout(); hLayout -> addWidget(new QLabel(tr("Choisissez les folios que vous désirez exporter ainsi que leurs dimensions :"))); selectAll = new QPushButton(); deSelectAll = new QPushButton(); @@ -83,7 +83,7 @@ ExportDialog::ExportDialog(QETProject *project, QWidget *parent) : QDialog(paren connect(deSelectAll, SIGNAL(clicked()), this, SLOT(slot_deSelectAllClicked())); - QVBoxLayout *layout = new QVBoxLayout(this); + auto *layout = new QVBoxLayout(this); layout -> addLayout(hLayout); layout -> addWidget(initDiagramsListPart(), 1); layout -> addWidget(epw); @@ -177,7 +177,7 @@ QWidget *ExportDialog::initDiagramsListPart() { QWidget *widget_diagrams_list = new QWidget(); widget_diagrams_list -> setLayout(diagrams_list_layout_); - QScrollArea *scroll_diagrams_list = new QScrollArea(); + auto *scroll_diagrams_list = new QScrollArea(); scroll_diagrams_list -> setWidget(widget_diagrams_list); return(scroll_diagrams_list); @@ -426,7 +426,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee //QList list_ellipses; QList list_shapes; - DiagramFolioList *ptr = dynamic_cast(diagram); + auto *ptr = dynamic_cast(diagram); if (ptr) { list_lines = ptr -> lines(); list_rectangles = ptr -> rectangles(); @@ -469,15 +469,15 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee } else { // Determine les elements a "XMLiser" foreach(QGraphicsItem *qgi, diagram -> items()) { - if (Element *elmt = qgraphicsitem_cast(qgi)) { + if (auto *elmt = qgraphicsitem_cast(qgi)) { list_elements << elmt; - } else if (Conductor *f = qgraphicsitem_cast(qgi)) { + } else if (auto *f = qgraphicsitem_cast(qgi)) { list_conductors << f; - } else if (IndependentTextItem *iti = qgraphicsitem_cast(qgi)) { + } else if (auto *iti = qgraphicsitem_cast(qgi)) { list_texts << iti; - } else if (DiagramImageItem *dii = qgraphicsitem_cast(qgi)) { + } else if (auto *dii = qgraphicsitem_cast(qgi)) { list_images << dii; - } else if (QetShapeItem *dii = qgraphicsitem_cast(qgi)) { + } else if (auto *dii = qgraphicsitem_cast(qgi)) { list_shapes << dii; } } @@ -909,14 +909,14 @@ void ExportDialog::slot_previewDiagram(int diagram_id) { preview_dialog.setWindowTitle(tr("Aperçu")); preview_dialog.setWindowState(preview_dialog.windowState() | Qt::WindowMaximized); - QGraphicsScene *preview_scene = new QGraphicsScene(); + auto *preview_scene = new QGraphicsScene(); preview_scene -> setBackgroundBrush(Qt::lightGray); - QGraphicsView *preview_view = new QGraphicsView(preview_scene); + auto *preview_view = new QGraphicsView(preview_scene); preview_view -> setDragMode(QGraphicsView::ScrollHandDrag); QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok); connect(buttons, SIGNAL(accepted()), &preview_dialog, SLOT(accept())); - QVBoxLayout *vboxlayout1 = new QVBoxLayout(); + auto *vboxlayout1 = new QVBoxLayout(); vboxlayout1 -> addWidget(preview_view); vboxlayout1 -> addWidget(buttons); preview_dialog.setLayout(vboxlayout1); @@ -1050,7 +1050,7 @@ ExportDialog::ExportDiagramLine::~ExportDiagramLine() { taille d'un schema avant son export. */ QBoxLayout *ExportDialog::ExportDiagramLine::sizeLayout() { - QHBoxLayout *layout = new QHBoxLayout(); + auto *layout = new QHBoxLayout(); layout -> addWidget(width); layout -> addWidget(x_label); layout -> addWidget(height); diff --git a/sources/exportpropertieswidget.cpp b/sources/exportpropertieswidget.cpp index 457c96a42..335f27ed6 100644 --- a/sources/exportpropertieswidget.cpp +++ b/sources/exportpropertieswidget.cpp @@ -118,14 +118,14 @@ void ExportPropertiesWidget::slot_chooseADirectory() { */ void ExportPropertiesWidget::build() { // le dialogue est un empilement vertical d'elements - QVBoxLayout *vboxLayout = new QVBoxLayout(); + auto *vboxLayout = new QVBoxLayout(); vboxLayout -> setContentsMargins(0, 0, 0, 0); /* le dialogue comprend une ligne permettant d'indiquer un chemin de dossier (hboxLayout) */ - QHBoxLayout *hboxLayout = new QHBoxLayout(); + auto *hboxLayout = new QHBoxLayout(); dirpath_label = new QLabel(tr("Dossier cible :"), this); dirpath = new QLineEdit(this); - QCompleter *completer = new QCompleter(this); + auto *completer = new QCompleter(this); completer -> setModel(new QDirModel(completer)); dirpath -> setCompleter(completer); button_browse = new QPushButton(tr("Parcourir"), this); @@ -137,7 +137,7 @@ void ExportPropertiesWidget::build() { vboxLayout -> addLayout(hboxLayout); /* une ligne permettant de choisir le format (hboxLayout1) */ - QHBoxLayout *hboxLayout1 = new QHBoxLayout(); + auto *hboxLayout1 = new QHBoxLayout(); format_label = new QLabel(tr("Format :"), this); hboxLayout1 -> addWidget(format_label); hboxLayout1 -> addWidget(format = new QComboBox(this)); @@ -152,7 +152,7 @@ void ExportPropertiesWidget::build() { /* un cadre permettant de specifier les options de l'image finale */ QGroupBox *groupbox_options = new QGroupBox(tr("Options de rendu", "groupbox title")); - QGridLayout *optionshlayout = new QGridLayout(groupbox_options); + auto *optionshlayout = new QGridLayout(groupbox_options); // Choix de la zone du schema a exporter exported_content_choices = new QButtonGroup(groupbox_options); diff --git a/sources/genericpanel.cpp b/sources/genericpanel.cpp index 28d7f5d5c..c2f258572 100644 --- a/sources/genericpanel.cpp +++ b/sources/genericpanel.cpp @@ -579,7 +579,7 @@ void GenericPanel::projectDiagramsOrderChanged(QETProject *project, int from, in QTreeWidgetItem *qtwi_diagram = qtwi_project -> child(i); if (!qtwi_diagram) continue; - Diagram *diagram = valueForItem(qtwi_diagram); + auto *diagram = valueForItem(qtwi_diagram); if (diagram) updateDiagramItem(qtwi_diagram, diagram); } @@ -665,7 +665,7 @@ QIcon GenericPanel::defaultIcon(QET::ItemType type) { @return the create QTreeWidgetItem */ QTreeWidgetItem *GenericPanel::makeItem(QET::ItemType type, QTreeWidgetItem *parent, const QString &label, const QIcon &icon) { - QTreeWidgetItem *qtwi = new QTreeWidgetItem(parent, type); + auto *qtwi = new QTreeWidgetItem(parent, type); qtwi -> setText(0, label.isEmpty() ? defaultText(type) : label); qtwi -> setIcon(0, icon.isNull() ? defaultIcon(type) : icon); return(qtwi); @@ -745,7 +745,7 @@ template void GenericPanel::removeObsoleteItems(const QList &expected_items, QTreeWidgetItem *item, QET::ItemType type, bool recursive) { // remove items not found in expected_items foreach (QTreeWidgetItem *child_item, childItems(item, type, recursive)) { - T child_value = valueForItem(child_item); + auto child_value = valueForItem(child_item); if (!expected_items.contains(child_value)) { deleteItem(child_item); } diff --git a/sources/nameslistwidget.cpp b/sources/nameslistwidget.cpp index 1ae8c9f59..9241d3618 100644 --- a/sources/nameslistwidget.cpp +++ b/sources/nameslistwidget.cpp @@ -24,7 +24,7 @@ @param parent QWidget parent de la liste de noms */ NamesListWidget::NamesListWidget(QWidget *parent) : QWidget(parent), read_only(false) { - QVBoxLayout *names_list_layout = new QVBoxLayout(); + auto *names_list_layout = new QVBoxLayout(); setLayout(names_list_layout); tree_names = new QTreeWidget(); @@ -70,7 +70,7 @@ NamesListWidget::~NamesListWidget() { void NamesListWidget::addLine() { clean(); if (read_only) return; - QTreeWidgetItem *qtwi = new QTreeWidgetItem(); + auto *qtwi = new QTreeWidgetItem(); qtwi -> setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable); tree_names -> addTopLevelItem(qtwi); tree_names -> setCurrentItem(qtwi); @@ -137,7 +137,7 @@ void NamesListWidget::setNames(const NamesList &provided_names) { QString value = provided_names[lang]; QStringList values; values << lang << value; - QTreeWidgetItem *qtwi = new QTreeWidgetItem(values); + auto *qtwi = new QTreeWidgetItem(values); if (!read_only) qtwi -> setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable); tree_names -> addTopLevelItem(qtwi); tree_names -> sortItems(0, Qt::AscendingOrder); diff --git a/sources/newelementwizard.cpp b/sources/newelementwizard.cpp index 190572718..14731da7a 100644 --- a/sources/newelementwizard.cpp +++ b/sources/newelementwizard.cpp @@ -74,11 +74,11 @@ void NewElementWizard::preselectedLocation(const ElementsLocation &location) */ QWizardPage *NewElementWizard::buildStep1() { - QWizardPage *page = new QWizardPage(); + auto *page = new QWizardPage(); page -> setProperty("WizardState", Category); page -> setTitle(tr("Étape 1/3 : Catégorie parente", "wizard page title")); page -> setSubTitle(tr("Sélectionnez une catégorie dans laquelle enregistrer le nouvel élément.", "wizard page subtitle")); - QVBoxLayout *layout = new QVBoxLayout(); + auto *layout = new QVBoxLayout(); m_tree_view = new QTreeView(this); @@ -100,11 +100,11 @@ QWizardPage *NewElementWizard::buildStep1() * @return */ QWizardPage *NewElementWizard::buildStep2() { - QWizardPage *page = new QWizardPage(); + auto *page = new QWizardPage(); page -> setProperty("WizardState", Filename); page -> setTitle(tr("Étape 2/3 : Nom du fichier", "wizard page title")); page -> setSubTitle(tr("Indiquez le nom du fichier dans lequel enregistrer le nouvel élément.", "wizard page subtitle")); - QVBoxLayout *layout = new QVBoxLayout(); + auto *layout = new QVBoxLayout(); m_qle_filename = new QFileNameEdit(tr("nouvel_element")); m_qle_filename -> selectAll(); @@ -124,11 +124,11 @@ QWizardPage *NewElementWizard::buildStep2() { * @return */ QWizardPage *NewElementWizard::buildStep3() { - QWizardPage *page = new QWizardPage(); + auto *page = new QWizardPage(); page -> setProperty("WizardState", Names); page -> setTitle(tr("Étape 3/3 : Noms de l'élément", "wizard page title")); page -> setSubTitle(tr("Indiquez le ou les noms de l'élément.", "wizard page subtitle")); - QVBoxLayout *layout = new QVBoxLayout(); + auto *layout = new QVBoxLayout(); m_names_list = new NamesListWidget(); NamesList hash_name; @@ -170,7 +170,7 @@ bool NewElementWizard::validStep1() QModelIndex index = m_tree_view->currentIndex(); if (index.isValid()) { - ElementCollectionItem *eci = static_cast(m_model->itemFromIndex(index)); + auto *eci = static_cast(m_model->itemFromIndex(index)); if (eci && eci->isDir()) { ElementsLocation loc(eci->collectionPath()); if (loc.exist()) { @@ -226,7 +226,7 @@ bool NewElementWizard::validStep2() { * Lauch an element editor for create the new element */ void NewElementWizard::createNewElement() { - QETElementEditor *edit_new_element = new QETElementEditor(parentWidget()); + auto *edit_new_element = new QETElementEditor(parentWidget()); edit_new_element -> setNames(m_names_list -> names()); ElementsLocation loc_ = m_chosen_location; diff --git a/sources/projectconfigpages.cpp b/sources/projectconfigpages.cpp index 121ffa48a..a30e01ccc 100644 --- a/sources/projectconfigpages.cpp +++ b/sources/projectconfigpages.cpp @@ -179,8 +179,8 @@ void ProjectMainConfigPage::initWidgets() { Initialize the layout of this page. */ void ProjectMainConfigPage::initLayout() { - QVBoxLayout *main_layout0 = new QVBoxLayout(); - QHBoxLayout *title_layout0 = new QHBoxLayout(); + auto *main_layout0 = new QVBoxLayout(); + auto *title_layout0 = new QHBoxLayout(); title_layout0 -> addWidget(title_label_); title_layout0 -> addWidget(title_value_); main_layout0 -> addLayout(title_layout0); @@ -255,7 +255,7 @@ void ProjectAutoNumConfigPage::applyProjectConf() {} */ void ProjectAutoNumConfigPage::initWidgets() { - QTabWidget *tab_widget = new QTabWidget(this); + auto *tab_widget = new QTabWidget(this); //Management tab m_amw = new AutoNumberingManagementW(project()); @@ -277,7 +277,7 @@ void ProjectAutoNumConfigPage::initWidgets() m_faw = new FolioAutonumberingW(project()); tab_widget->addTab(m_faw, tr("Folio autonumérotation")); - QHBoxLayout *main_layout = new QHBoxLayout(); + auto *main_layout = new QHBoxLayout(); main_layout->addWidget(tab_widget); setLayout(main_layout); } diff --git a/sources/projectview.cpp b/sources/projectview.cpp index 8fa8f8262..417bc733d 100644 --- a/sources/projectview.cpp +++ b/sources/projectview.cpp @@ -348,7 +348,7 @@ void ProjectView::addNewDiagram() { if (m_project -> isReadOnly()) return; Diagram *new_diagram = m_project -> addNewDiagram(); - DiagramView *new_diagram_view = new DiagramView(new_diagram); + auto *new_diagram_view = new DiagramView(new_diagram); addDiagram(new_diagram_view); if (m_project -> diagrams().size() % 58 == 1 && m_project -> getFolioSheetsQuantity() != 0) @@ -365,7 +365,7 @@ void ProjectView::addNewDiagramFolioList() { int i = 1; //< Each new diagram is added to the end of the project. //< We use @i to move the folio list at second position in the project foreach (Diagram *d, m_project -> addNewDiagramFolioList()) { - DiagramView *new_diagram_view = new DiagramView(d); + auto *new_diagram_view = new DiagramView(d); addDiagram(new_diagram_view); showDiagram(new_diagram_view); m_tab->tabBar()->moveTab(diagram_views().size()-1, i); @@ -751,7 +751,7 @@ int ProjectView::cleanProject() { #endif clean_dialog.setWindowTitle(tr("Nettoyer le projet", "window title")); - QVBoxLayout *clean_dialog_layout = new QVBoxLayout(); + auto *clean_dialog_layout = new QVBoxLayout(); clean_dialog_layout -> addWidget(clean_tbt); clean_dialog_layout -> addWidget(clean_elements); clean_dialog_layout -> addWidget(clean_categories); @@ -807,7 +807,7 @@ void ProjectView::initWidgets() { m_tab = new QTabWidget(this); m_tab -> setMovable(true); - QToolButton *add_new_diagram_button = new QToolButton; + auto *add_new_diagram_button = new QToolButton; add_new_diagram_button -> setDefaultAction(add_new_diagram_); add_new_diagram_button -> setAutoRaise(true); m_tab -> setCornerWidget(add_new_diagram_button, Qt::TopRightCorner); @@ -824,7 +824,7 @@ void ProjectView::initWidgets() { Initialize layout for this widget. */ void ProjectView::initLayout() { - QVBoxLayout *fallback_widget_layout_ = new QVBoxLayout(fallback_widget_); + auto *fallback_widget_layout_ = new QVBoxLayout(fallback_widget_); fallback_widget_layout_ -> addWidget(fallback_label_); layout_ = new QVBoxLayout(this); @@ -868,7 +868,7 @@ void ProjectView::loadDiagrams() dialog->setProgressBar(dialog->progressBarValue()+1); } - DiagramView *sv = new DiagramView(diagram); + auto *sv = new DiagramView(diagram); addDiagram(sv); } diff --git a/sources/qet.cpp b/sources/qet.cpp index 7733b1825..685789d4f 100644 --- a/sources/qet.cpp +++ b/sources/qet.cpp @@ -626,7 +626,7 @@ QET::QetCollection QET::qetCollectionFromString(const QString &str) */ QActionGroup *QET::depthActionGroup(QObject *parent) { - QActionGroup *action_group = new QActionGroup(parent); + auto *action_group = new QActionGroup(parent); QAction *edit_forward = new QAction(QET::Icons::BringForward, QObject::tr("Amener au premier plan"), action_group); QAction *edit_raise = new QAction(QET::Icons::Raise, QObject::tr("Rapprocher"), action_group); diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp index 38b6e888a..7c74fd463 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -440,7 +440,7 @@ TitleBlockTemplatesCollection *QETApp::titleBlockTemplatesCollection(const QStri @return le nom de l'utilisateur courant */ QString QETApp::userName() { - QProcess * process = new QProcess(); + auto * process = new QProcess(); QString str; #ifndef Q_OS_WIN32 // return(QString(getenv("USER"))); @@ -907,7 +907,7 @@ QList QETApp::titleBlockTemplateEditors(QETProjec @see QTextOrientationSpinBoxWidget */ QTextOrientationSpinBoxWidget *QETApp::createTextOrientationSpinBoxWidget() { - QTextOrientationSpinBoxWidget *widget = new QTextOrientationSpinBoxWidget(); + auto *widget = new QTextOrientationSpinBoxWidget(); widget -> orientationWidget() -> setFont(QETApp::diagramTextsFont()); widget -> orientationWidget() -> setUsableTexts(QList() << QETApp::tr("Q", "Single-letter example text - translate length, not meaning") @@ -924,7 +924,7 @@ QTextOrientationSpinBoxWidget *QETApp::createTextOrientationSpinBoxWidget() { */ TitleBlockTemplate *QETApp::defaultTitleBlockTemplate() { if (!QETApp::default_titleblock_template_) { - TitleBlockTemplate *titleblock_template = new TitleBlockTemplate(QETApp::instance()); + auto *titleblock_template = new TitleBlockTemplate(QETApp::instance()); if (titleblock_template -> loadFromXmlFile(":/titleblocks/default.titleblock")) { QETApp::default_titleblock_template_ = titleblock_template; } @@ -1034,7 +1034,7 @@ void QETApp::setMainWindowVisible(QMainWindow *window, bool visible) { @param window fenetre a afficher / cacher */ void QETApp::invertMainWindowVisibility(QWidget *window) { - if (QMainWindow *w = qobject_cast(window)) setMainWindowVisible(w, !w -> isVisible()); + if (auto *w = qobject_cast(window)) setMainWindowVisible(w, !w -> isVisible()); } /** @@ -1206,7 +1206,7 @@ void QETApp::openElementFiles(const QStringList &files_list) { } if (!already_opened_in_existing_element_editor) { // ce fichier n'est ouvert dans aucun editeur - QETElementEditor *element_editor = new QETElementEditor(); + auto *element_editor = new QETElementEditor(); element_editor -> fromFile(element_file); } } @@ -1238,7 +1238,7 @@ void QETApp::openElementLocations(const QList &locations_list) } if (!already_opened_in_existing_element_editor) { // cet emplacement n'est ouvert dans aucun editeur - QETElementEditor *element_editor = new QETElementEditor(); + auto *element_editor = new QETElementEditor(); element_editor -> fromLocation(element_location); } } @@ -1253,7 +1253,7 @@ void QETApp::openElementLocations(const QList &locations_list) @see QETTitleBlockTemplateEditor::setOpenForDuplication() */ void QETApp::openTitleBlockTemplate(const TitleBlockTemplateLocation &location, bool duplicate) { - QETTitleBlockTemplateEditor *qet_template_editor = new QETTitleBlockTemplateEditor(); + auto *qet_template_editor = new QETTitleBlockTemplateEditor(); qet_template_editor -> setOpenForDuplication(duplicate); qet_template_editor -> edit(location); qet_template_editor -> show(); @@ -1264,7 +1264,7 @@ void QETApp::openTitleBlockTemplate(const TitleBlockTemplateLocation &location, @param filepath Path of the .titleblock file to be opened */ void QETApp::openTitleBlockTemplate(const QString &filepath) { - QETTitleBlockTemplateEditor *qet_template_editor = new QETTitleBlockTemplateEditor(); + auto *qet_template_editor = new QETTitleBlockTemplateEditor(); qet_template_editor -> edit(filepath); qet_template_editor -> show(); } diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp index 1aff1dd8c..d78e65738 100644 --- a/sources/qetdiagrameditor.cpp +++ b/sources/qetdiagrameditor.cpp @@ -184,7 +184,7 @@ void QETDiagramEditor::setUpElementsCollectionWidget() */ void QETDiagramEditor::setUpUndoStack() { - QUndoView *undo_view = new QUndoView(&undo_group, this); + auto *undo_view = new QUndoView(&undo_group, this); undo_view -> setEmptyLabel (tr("Aucune modification")); undo_view -> setStatusTip (tr("Cliquez sur une action pour revenir en arrière dans l'édition de votre schéma", "Status tip")); @@ -849,7 +849,7 @@ void QETDiagramEditor::saveAs() { */ bool QETDiagramEditor::newProject() { // create new project without diagram - QETProject *new_project = new QETProject(0); + auto *new_project = new QETProject(0); // Set default properties for new diagram new_project -> setDefaultBorderProperties (BorderProperties:: defaultProperties()); @@ -1009,7 +1009,7 @@ bool QETDiagramEditor::openAndAddProject(const QString &filepath, bool interacti //Create the project DialogWaiting::instance(this); - QETProject *project = new QETProject(filepath); + auto *project = new QETProject(filepath); if (project -> state() != QETProject::Ok) { if (interactive && project -> state() != QETProject::FileOpenDiscard) @@ -1048,7 +1048,7 @@ bool QETDiagramEditor::addProject(QETProject *project, bool update_panel) { QETApp::registerProject(project); // cree un ProjectView pour visualiser le projet - ProjectView *project_view = new ProjectView(project); + auto *project_view = new ProjectView(project); addProjectView(project_view); undo_group.addStack(project -> undoStack()); @@ -1072,7 +1072,7 @@ QList QETDiagramEditor::openedProjects() const { QList result; QList window_list(m_workspace.subWindowList()); foreach(QMdiSubWindow *window, window_list) { - if (ProjectView *project_view = qobject_cast(window -> widget())) { + if (auto *project_view = qobject_cast(window -> widget())) { result << project_view; } } @@ -1090,7 +1090,7 @@ ProjectView *QETDiagramEditor::currentProjectView() const { QWidget *current_widget = current_window -> widget(); if (!current_widget) return(nullptr); - if (ProjectView *project_view = qobject_cast(current_widget)) { + if (auto *project_view = qobject_cast(current_widget)) { return(project_view); } return(nullptr); @@ -1284,7 +1284,7 @@ void QETDiagramEditor::addItemGroupTriggered(QAction *action) diagram_event = new DiagramEventAddShape (d, QetShapeItem::Polygon); else if (value == "image") { - DiagramEventAddImage *deai = new DiagramEventAddImage(d); + auto *deai = new DiagramEventAddImage(d); if (deai->isNull()) { delete deai; @@ -1326,7 +1326,7 @@ void QETDiagramEditor::selectionGroupTriggered(QAction *action) } else if (value == "rotate_selection") { - RotateSelectionCommand *c = new RotateSelectionCommand(diagram); + auto *c = new RotateSelectionCommand(diagram); if(c->isValid()) diagram->undoStack().push(c); } @@ -1697,7 +1697,7 @@ ProjectView *QETDiagramEditor::acessCurrentProject (){ QWidget *current_widget = current_window -> widget(); if (!current_widget) return(nullptr); - if (ProjectView *project_view = qobject_cast(current_widget)) { + if (auto *project_view = qobject_cast(current_widget)) { return(project_view); } return(nullptr); @@ -1752,7 +1752,7 @@ void QETDiagramEditor::slot_updateWindowsMenu() { m_previous_window -> setEnabled(windows.count() > 1); if (!windows.isEmpty()) windows_menu -> addSeparator(); - QActionGroup *windows_actions = new QActionGroup(this); + auto *windows_actions = new QActionGroup(this); foreach(ProjectView *project_view, windows) { QString pv_title = project_view -> windowTitle(); QAction *action = windows_menu -> addAction(pv_title); @@ -2072,7 +2072,7 @@ void QETDiagramEditor::removeDiagramFromProject() { // remove one (last) folio sheet. } else if (current_project -> diagram_views().size() % 58 == 0) { foreach (DiagramView *diag, current_project -> diagram_views()) { - DiagramFolioList *ptr = dynamic_cast(diag -> diagram()); + auto *ptr = dynamic_cast(diag -> diagram()); if (ptr && ptr -> getId() == current_project -> project() -> getFolioSheetsQuantity() - 1) { current_project -> removeDiagram(diag); } @@ -2170,7 +2170,7 @@ void QETDiagramEditor::selectionChanged() void QETDiagramEditor::generateTerminalBlock() { bool success; - QProcess *process = new QProcess(qApp); + auto *process = new QProcess(qApp); // If launched under control: //connect(process, SIGNAL(errorOcurred(int error)), this, SLOT(slot_generateTerminalBlock_error())); diff --git a/sources/qetgraphicsitem/conductor.cpp b/sources/qetgraphicsitem/conductor.cpp index b723f9755..99b31a543 100644 --- a/sources/qetgraphicsitem/conductor.cpp +++ b/sources/qetgraphicsitem/conductor.cpp @@ -696,7 +696,7 @@ bool Conductor::sceneEventFilter(QGraphicsItem *watched, QEvent *event) //Watched must be an handler if(watched->type() == QetGraphicsHandlerItem::Type) { - QetGraphicsHandlerItem *qghi = qgraphicsitem_cast(watched); + auto *qghi = qgraphicsitem_cast(watched); if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize { @@ -1352,7 +1352,7 @@ void Conductor::saveProfile(bool undo) { conductor_profiles[current_path_type].fromConductor(this); Diagram *dia = diagram(); if (undo && dia) { - ChangeConductorCommand *undo_object = new ChangeConductorCommand( + auto *undo_object = new ChangeConductorCommand( this, old_profile, conductor_profiles[current_path_type], diff --git a/sources/qetgraphicsitem/conductortextitem.cpp b/sources/qetgraphicsitem/conductortextitem.cpp index e2415bbe2..36ac1dbb6 100644 --- a/sources/qetgraphicsitem/conductortextitem.cpp +++ b/sources/qetgraphicsitem/conductortextitem.cpp @@ -205,7 +205,7 @@ void ConductorTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) { if (!applied_movement.isNull()) { //Create an undo object - MoveConductorsTextsCommand *undo_object = new MoveConductorsTextsCommand(diagram_ptr); + auto *undo_object = new MoveConductorsTextsCommand(diagram_ptr); undo_object -> addTextMovement(this, before_mov_pos_, pos(), moved_by_user_); moved_by_user_ = true; diff --git a/sources/qetgraphicsitem/customelement.cpp b/sources/qetgraphicsitem/customelement.cpp index 1c18cdfcb..b39046e2f 100644 --- a/sources/qetgraphicsitem/customelement.cpp +++ b/sources/qetgraphicsitem/customelement.cpp @@ -370,7 +370,7 @@ bool CustomElement::parseLine(QDomElement &e, QPainter &qp, bool addtolist) { if (addtolist){ //Add line to the list - QLineF *newLine = new QLineF(line); + auto *newLine = new QLineF(line); m_lines << newLine; } @@ -475,7 +475,7 @@ bool CustomElement::parseRect(QDomElement &e, QPainter &qp, bool addtolist) if (addtolist){ //Add rectangle to the list - QRectF *rect = new QRectF(rect_x, rect_y, rect_w, rect_h); + auto *rect = new QRectF(rect_x, rect_y, rect_w, rect_h); m_rectangles << rect; } @@ -516,7 +516,7 @@ bool CustomElement::parseCircle(QDomElement &e, QPainter &qp, bool addtolist) { if (addtolist){ // Add circle to list - QRectF *circle = new QRectF(circle_bounding_rect); + auto *circle = new QRectF(circle_bounding_rect); m_circles << circle; } @@ -549,7 +549,7 @@ bool CustomElement::parseEllipse(QDomElement &e, QPainter &qp, bool addtolist) { setPainterStyle(e, qp); if (addtolist){ - QVector *arc = new QVector; + auto *arc = new QVector; arc -> push_back(ellipse_x); arc -> push_back(ellipse_y); arc -> push_back(ellipse_l); @@ -592,7 +592,7 @@ bool CustomElement::parseArc(QDomElement &e, QPainter &qp, bool addtolist) { setPainterStyle(e, qp); if (addtolist){ - QVector *arc = new QVector; + auto *arc = new QVector; arc -> push_back(arc_x); arc -> push_back(arc_y); arc -> push_back(arc_l); @@ -647,7 +647,7 @@ bool CustomElement::parsePolygon(QDomElement &e, QPainter &qp, bool addtolist) { } if (addtolist){ // Add to list of polygons. - QVector *poly = new QVector(points); + auto *poly = new QVector(points); m_polygons << poly; } @@ -743,7 +743,7 @@ bool CustomElement::parseInput(QDomElement &dom_element) { ) return(false); else { - DynamicElementTextItem *deti = new DynamicElementTextItem(this); + auto *deti = new DynamicElementTextItem(this); deti->setText(dom_element.attribute("text", "_")); deti->setFontSize(dom_element.attribute("size", QString::number(9)).toInt()); deti->setRotation(dom_element.attribute("rotation", QString::number(0)).toDouble()); @@ -782,7 +782,7 @@ bool CustomElement::parseInput(QDomElement &dom_element) { */ DynamicElementTextItem *CustomElement::parseDynamicText(QDomElement &dom_element) { - DynamicElementTextItem *deti = new DynamicElementTextItem(this); + auto *deti = new DynamicElementTextItem(this); //Because the xml description of a .elmt file is the same as how a dynamic text field is save to xml in a .qet file //wa call fromXml, we just change the tagg name (.elmt = dynamic_text, .qet = dynamic_elmt_text) //and the uuid (because the uuid, is the uuid of the descritpion and not the uuid of instantiated dynamic text field) @@ -817,7 +817,7 @@ Terminal *CustomElement::parseTerminal(QDomElement &e) { else if (e.attribute("orientation") == "e") terminalo = Qet::East; else if (e.attribute("orientation") == "w") terminalo = Qet::West; else return(nullptr); - Terminal *new_terminal = new Terminal(terminalx, terminaly, terminalo, this); + auto *new_terminal = new Terminal(terminalx, terminaly, terminalo, this); m_terminals << new_terminal; //Sort from top to bottom and left to rigth diff --git a/sources/qetgraphicsitem/dynamicelementtextitem.cpp b/sources/qetgraphicsitem/dynamicelementtextitem.cpp index d42878e2d..d3ec0e47b 100644 --- a/sources/qetgraphicsitem/dynamicelementtextitem.cpp +++ b/sources/qetgraphicsitem/dynamicelementtextitem.cpp @@ -218,7 +218,7 @@ ElementTextItemGroup *DynamicElementTextItem::parentGroup() const { if(parentItem()) { - if(ElementTextItemGroup *grp = dynamic_cast(parentItem())) + if(auto *grp = dynamic_cast(parentItem())) return grp; } diff --git a/sources/qetgraphicsitem/element.cpp b/sources/qetgraphicsitem/element.cpp index 3a535a5da..55cae3605 100644 --- a/sources/qetgraphicsitem/element.cpp +++ b/sources/qetgraphicsitem/element.cpp @@ -78,7 +78,7 @@ Element::Element(QGraphicsItem *parent) : connect(this, &Element::rotationChanged, [this]() { for(QGraphicsItem *qgi : childItems()) { - if (Terminal *t = qgraphicsitem_cast(qgi)) + if (auto *t = qgraphicsitem_cast(qgi)) t->updateConductor(); } }); @@ -96,7 +96,7 @@ void Element::editProperty() { if (diagram() && !diagram()->isReadOnly()) { - ElementPropertiesWidget *epw = new ElementPropertiesWidget(this); + auto *epw = new ElementPropertiesWidget(this); PropertiesEditorDialog dialog(epw, QApplication::activeWindow()); connect(epw, &ElementPropertiesWidget::findEditClicked, &dialog, &QDialog::reject); //Must be windowModal, else when user do a drag and drop @@ -370,7 +370,7 @@ bool Element::fromXml(QDomElement &e, QHash &table_id_adr, bool QHash priv_id_adr; int terminals_non_trouvees = 0; foreach(QGraphicsItem *qgi, childItems()) { - if (Terminal *p = qgraphicsitem_cast(qgi)) { + if (auto *p = qgraphicsitem_cast(qgi)) { bool terminal_trouvee = false; foreach(QDomElement qde, liste_terminals) { if (p -> fromXml(qde)) { @@ -454,7 +454,7 @@ bool Element::fromXml(QDomElement &e, QHash &table_id_adr, bool //************************// for (const QDomElement& qde : QET::findInDomElement(e, "dynamic_texts", DynamicElementTextItem::xmlTaggName())) { - DynamicElementTextItem *deti = new DynamicElementTextItem(this); + auto *deti = new DynamicElementTextItem(this); addDynamicTextItem(deti); deti->fromXml(qde); } @@ -856,7 +856,7 @@ void Element::addDynamicTextItem(DynamicElementTextItem *deti) } else { - DynamicElementTextItem *text = new DynamicElementTextItem(this); + auto *text = new DynamicElementTextItem(this); m_dynamic_text_list.append(text); emit textAdded(text); } @@ -911,7 +911,7 @@ ElementTextItemGroup *Element::addTextGroup(const QString &name) { if(m_texts_group.isEmpty()) { - ElementTextItemGroup *group = new ElementTextItemGroup(name, this); + auto *group = new ElementTextItemGroup(name, this); m_texts_group << group; emit textsGroupAdded(group); return group; @@ -927,7 +927,7 @@ ElementTextItemGroup *Element::addTextGroup(const QString &name) } //Create the group - ElementTextItemGroup *group = new ElementTextItemGroup(rename, this); + auto *group = new ElementTextItemGroup(rename, this); m_texts_group << group; emit textsGroupAdded(group); return group; @@ -966,7 +966,7 @@ void Element::removeTextGroup(ElementTextItemGroup *group) { if(qgi->type() == DynamicElementTextItem::Type) { - DynamicElementTextItem *deti = static_cast(qgi); + auto *deti = static_cast(qgi); removeTextFromGroup(deti, group); } } diff --git a/sources/qetgraphicsitem/elementtextitemgroup.cpp b/sources/qetgraphicsitem/elementtextitemgroup.cpp index 86ca54f08..a49e34dd7 100644 --- a/sources/qetgraphicsitem/elementtextitemgroup.cpp +++ b/sources/qetgraphicsitem/elementtextitemgroup.cpp @@ -66,7 +66,7 @@ void ElementTextItemGroup::addToGroup(QGraphicsItem *item) QGraphicsItemGroup::addToGroup(item); updateAlignment(); - DynamicElementTextItem *deti = qgraphicsitem_cast(item); + auto *deti = qgraphicsitem_cast(item); connect(deti, &DynamicElementTextItem::fontSizeChanged, this, &ElementTextItemGroup::updateAlignment); connect(deti, &DynamicElementTextItem::textChanged, this, &ElementTextItemGroup::updateAlignment); connect(deti, &DynamicElementTextItem::textFromChanged, this, &ElementTextItemGroup::updateAlignment); @@ -96,7 +96,7 @@ void ElementTextItemGroup::removeFromGroup(QGraphicsItem *item) item->setFlag(QGraphicsItem::ItemIsSelectable, true); updateAlignment(); - if(DynamicElementTextItem *deti = qgraphicsitem_cast(item)) + if(auto *deti = qgraphicsitem_cast(item)) { disconnect(deti, &DynamicElementTextItem::fontSizeChanged, this, &ElementTextItemGroup::updateAlignment); disconnect(deti, &DynamicElementTextItem::textChanged, this, &ElementTextItemGroup::updateAlignment); @@ -780,7 +780,7 @@ void ElementTextItemGroup::autoPos() if(!diagram()) return; - MasterElement *master = static_cast(m_parent_element); + auto *master = static_cast(m_parent_element); XRefProperties xrp = diagram()->project()->defaultXRefProperties(master->kindInformations()["type"].toString()); if(xrp.snapTo() == XRefProperties::Bottom) { diff --git a/sources/qetgraphicsitem/qetshapeitem.cpp b/sources/qetgraphicsitem/qetshapeitem.cpp index 291dd6fc8..d586eb4a1 100644 --- a/sources/qetgraphicsitem/qetshapeitem.cpp +++ b/sources/qetgraphicsitem/qetshapeitem.cpp @@ -408,7 +408,7 @@ bool QetShapeItem::sceneEventFilter(QGraphicsItem *watched, QEvent *event) //Watched must be an handler if(watched->type() == QetGraphicsHandlerItem::Type) { - QetGraphicsHandlerItem *qghi = qgraphicsitem_cast(watched); + auto *qghi = qgraphicsitem_cast(watched); if(m_handler_vector.contains(qghi)) //Handler must be in m_vector_index, then we can start resize { diff --git a/sources/qetgraphicsitem/terminal.cpp b/sources/qetgraphicsitem/terminal.cpp index 01a563947..13ce47314 100644 --- a/sources/qetgraphicsitem/terminal.cpp +++ b/sources/qetgraphicsitem/terminal.cpp @@ -150,7 +150,7 @@ Terminal::~Terminal() { @return L'orientation actuelle de la Terminal. */ Qet::Orientation Terminal::orientation() const { - if (Element *elt = qgraphicsitem_cast(parentItem())) { + if (auto *elt = qgraphicsitem_cast(parentItem())) { // orientations actuelle et par defaut de l'element int ori_cur = elt -> orientation(); if (ori_cur == 0) return(ori_); @@ -431,7 +431,7 @@ Terminal* Terminal::alignedWithTerminal() const QList available_terminals; foreach (QGraphicsItem *qgi, qgi_list) { - if (Terminal *tt = qgraphicsitem_cast (qgi)) + if (auto *tt = qgraphicsitem_cast (qgi)) { //Call QET::lineContainsPoint to be sure the line intersect //the dock point and not an other part of terminal @@ -539,7 +539,7 @@ void Terminal::mouseMoveEvent(QGraphicsSceneMouseEvent *e) { // sinon on prend le deuxieme element de la liste et on verifie s'il s'agit d'une borne QGraphicsItem *qgi = qgis.at(1); // si le qgi est une borne... - Terminal *other_terminal = qgraphicsitem_cast(qgi); + auto *other_terminal = qgraphicsitem_cast(qgi); if (!other_terminal) return; previous_terminal_ = other_terminal; @@ -576,7 +576,7 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) if (!qgi) return; //Element must be a terminal - Terminal *other_terminal = qgraphicsitem_cast(qgi); + auto *other_terminal = qgraphicsitem_cast(qgi); if (!other_terminal) return; other_terminal -> hovered_color_ = neutralColor; @@ -586,7 +586,7 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) if (!canBeLinkedTo(other_terminal)) return; //Create conductor - Conductor *new_conductor = new Conductor(this, other_terminal); + auto *new_conductor = new Conductor(this, other_terminal); //Get all conductors at the same potential of new conductors QSet conductors_list = new_conductor->relatedPotentialConductors(); @@ -606,7 +606,7 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) } - QUndoCommand *undo = new QUndoCommand(); + auto *undo = new QUndoCommand(); QUndoCommand *aic = new AddItemCommand(new_conductor, diagram(), QPointF(), undo); undo->setText(aic->text()); diff --git a/sources/qetprintpreviewdialog.cpp b/sources/qetprintpreviewdialog.cpp index f684a1724..6ea93722c 100644 --- a/sources/qetprintpreviewdialog.cpp +++ b/sources/qetprintpreviewdialog.cpp @@ -392,7 +392,7 @@ void QETPrintPreviewDialog::setPrintOptionsVisible(bool display) { void QETPrintPreviewDialog::updateZoomList() { // recupere le zooom courant qreal current_zoom = preview_ -> zoomFactor(); - bool current_zoom_is_not_null = bool(int(current_zoom * 100.0)); + auto current_zoom_is_not_null = bool(int(current_zoom * 100.0)); // liste des zooms par defaut QList zooms_real; diff --git a/sources/qetproject.cpp b/sources/qetproject.cpp index 733a81ce7..dda5d6986 100644 --- a/sources/qetproject.cpp +++ b/sources/qetproject.cpp @@ -817,7 +817,7 @@ QDomDocument QETProject::toXml() { for(Diagram *diagram : diagrams_list) { // Write the diagram to XML only if it is not of type DiagramFolioList. - DiagramFolioList *ptr = dynamic_cast(diagram); + auto *ptr = dynamic_cast(diagram); if ( !ptr ) { qDebug() << qPrintable(QString("QETProject::toXml() : exporting diagram \"%1\"").arg(diagram -> title())) << "[" << diagram << "]"; @@ -1099,7 +1099,7 @@ Diagram *QETProject::addNewDiagram() { if (isReadOnly()) return(nullptr); // cree un nouveau schema - Diagram *diagram = new Diagram(this); + auto *diagram = new Diagram(this); // lui transmet les parametres par defaut diagram -> border_and_titleblock.importBorder(defaultBorderProperties()); @@ -1325,7 +1325,7 @@ void QETProject::readDiagramsXml(QDomDocument &xml_project) if (diagram_nodes.at(i).isElement()) { QDomElement diagram_xml_element = diagram_nodes.at(i).toElement(); - Diagram *diagram = new Diagram(this); + auto *diagram = new Diagram(this); bool diagram_loading = diagram -> initFromXml(diagram_xml_element); if (diagram_loading) { diff --git a/sources/qtextorientationspinboxwidget.cpp b/sources/qtextorientationspinboxwidget.cpp index 4a723635e..021b98008 100644 --- a/sources/qtextorientationspinboxwidget.cpp +++ b/sources/qtextorientationspinboxwidget.cpp @@ -117,7 +117,7 @@ void QTextOrientationSpinBoxWidget::build() { connect(spin_box_, SIGNAL(editingFinished()), this, SLOT(emitChangeSignals())); // dispose les widgets : le QTextOrientationWidget a gauche, le SpinBox a droite - QHBoxLayout *main_layout = new QHBoxLayout(); + auto *main_layout = new QHBoxLayout(); main_layout -> addWidget(orientation_widget_); main_layout -> addWidget(spin_box_); main_layout -> addStretch(); diff --git a/sources/recentfiles.cpp b/sources/recentfiles.cpp index 63374aff2..f8da40fff 100644 --- a/sources/recentfiles.cpp +++ b/sources/recentfiles.cpp @@ -175,7 +175,7 @@ void RecentFiles::buildMenu() { // remplit le menu foreach (QString filepath, list_) { // creee une nouvelle action pour le fichier - QAction *action = new QAction(filepath, this); + auto *action = new QAction(filepath, this); if (!files_icon_.isNull()) { action -> setIcon(files_icon_); } diff --git a/sources/richtext/richtexteditor.cpp b/sources/richtext/richtexteditor.cpp index 73672c475..fe4904214 100644 --- a/sources/richtext/richtexteditor.cpp +++ b/sources/richtext/richtexteditor.cpp @@ -417,7 +417,7 @@ static QAction *createCheckableAction(const QIcon &icon, const QString &text, QObject *receiver, const char *slot, QObject *parent = nullptr) { - QAction *result = new QAction(parent); + auto *result = new QAction(parent); result->setIcon(icon); result->setText(text); result->setCheckable(true); @@ -471,7 +471,7 @@ RichTextEditorToolBar::RichTextEditorToolBar(RichTextEditor *editor, // Left, center, right and justified alignment buttons - QActionGroup *alignment_group = new QActionGroup(this); + auto *alignment_group = new QActionGroup(this); connect(alignment_group, SIGNAL(triggered(QAction*)), SLOT(alignmentActionTriggered(QAction*))); @@ -767,12 +767,12 @@ RichTextEditorDialog::RichTextEditorDialog(QWidget *parent) : tool_bar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); QWidget *rich_edit = new QWidget; - QVBoxLayout *rich_edit_layout = new QVBoxLayout(rich_edit); + auto *rich_edit_layout = new QVBoxLayout(rich_edit); rich_edit_layout->addWidget(tool_bar); rich_edit_layout->addWidget(m_editor); QWidget *plain_edit = new QWidget; - QVBoxLayout *plain_edit_layout = new QVBoxLayout(plain_edit); + auto *plain_edit_layout = new QVBoxLayout(plain_edit); plain_edit_layout->addWidget(m_text_edit); m_tab_widget->setTabPosition(QTabWidget::South); @@ -789,7 +789,7 @@ RichTextEditorDialog::RichTextEditorDialog(QWidget *parent) : connect(buttonBox, SIGNAL(accepted()), this, SLOT(on_buttonBox_accepted())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); - QVBoxLayout *layout = new QVBoxLayout(this); + auto *layout = new QVBoxLayout(this); layout->addWidget(m_tab_widget); layout->addWidget(buttonBox); diff --git a/sources/titleblock/dimensionwidget.cpp b/sources/titleblock/dimensionwidget.cpp index 3cac85d9d..409870114 100644 --- a/sources/titleblock/dimensionwidget.cpp +++ b/sources/titleblock/dimensionwidget.cpp @@ -145,10 +145,10 @@ void TitleBlockDimensionWidget::initWidgets() { Initialize the layout of the dialog. */ void TitleBlockDimensionWidget::initLayouts() { - QHBoxLayout *hlayout0 = new QHBoxLayout(); + auto *hlayout0 = new QHBoxLayout(); hlayout0 -> addWidget(spinbox_label_); hlayout0 -> addWidget(spinbox_); - QVBoxLayout *vlayout0 = new QVBoxLayout(); + auto *vlayout0 = new QVBoxLayout(); vlayout0 -> addLayout(hlayout0); if (complete_) { vlayout0 -> addWidget(absolute_button_); diff --git a/sources/titleblock/qettemplateeditor.cpp b/sources/titleblock/qettemplateeditor.cpp index 2f75f7346..8cc756a8e 100644 --- a/sources/titleblock/qettemplateeditor.cpp +++ b/sources/titleblock/qettemplateeditor.cpp @@ -246,7 +246,7 @@ bool QETTitleBlockTemplateEditor::edit(QETProject *project, const QString &templ */ bool QETTitleBlockTemplateEditor::edit(const QString &file_path) { // get title block template object from the file, edit it - TitleBlockTemplate *tbt = new TitleBlockTemplate(); + auto *tbt = new TitleBlockTemplate(); bool loading = tbt -> loadFromXmlFile(file_path); if (!loading) { /// TODO the file opening failed, warn the user? @@ -301,7 +301,7 @@ void QETTitleBlockTemplateEditor::editLogos() { logo_manager_ -> layout() -> setContentsMargins(0, 0, 0, 0); QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Close); - QVBoxLayout *vlayout0 = new QVBoxLayout(); + auto *vlayout0 = new QVBoxLayout(); vlayout0 -> addWidget(logo_manager_); vlayout0 -> addWidget(buttons); @@ -320,7 +320,7 @@ void QETTitleBlockTemplateEditor::editLogos() { Launch a new title block template editor. */ void QETTitleBlockTemplateEditor::newTemplate() { - QETTitleBlockTemplateEditor *qet_template_editor = new QETTitleBlockTemplateEditor(); + auto *qet_template_editor = new QETTitleBlockTemplateEditor(); qet_template_editor -> edit(TitleBlockTemplateLocation()); qet_template_editor -> show(); } @@ -882,7 +882,7 @@ TitleBlockTemplateLocation QETTitleBlockTemplateEditor::getTitleBlockTemplateLoc } QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - QVBoxLayout *dialog_layout = new QVBoxLayout(); + auto *dialog_layout = new QVBoxLayout(); dialog_layout -> addWidget(widget); dialog_layout -> addWidget(buttons); @@ -932,7 +932,7 @@ void QETTitleBlockTemplateEditor::editTemplateInformation() { #endif dialog_author.setMinimumSize(400, 260); dialog_author.setWindowTitle(tr("Éditer les informations complémentaires", "window title")); - QVBoxLayout *dialog_layout = new QVBoxLayout(&dialog_author); + auto *dialog_layout = new QVBoxLayout(&dialog_author); // explanation label QLabel *information_label = new QLabel(tr("Vous pouvez utiliser ce champ libre pour mentionner les auteurs du cartouche, sa licence, ou tout autre renseignement que vous jugerez utile.")); @@ -941,7 +941,7 @@ void QETTitleBlockTemplateEditor::editTemplateInformation() { dialog_layout -> addWidget(information_label); // add a QTextEdit to the dialog - QTextEdit *text_field = new QTextEdit(); + auto *text_field = new QTextEdit(); text_field -> setAcceptRichText(false); text_field -> setPlainText(tb_template_ -> information()); text_field -> setReadOnly(read_only_); diff --git a/sources/titleblock/templatecellwidget.cpp b/sources/titleblock/templatecellwidget.cpp index dd01278c4..487de1625 100644 --- a/sources/titleblock/templatecellwidget.cpp +++ b/sources/titleblock/templatecellwidget.cpp @@ -96,11 +96,11 @@ void TitleBlockTemplateCellWidget::initWidgets() { font_adjust_input_ = new QCheckBox(tr("Ajuster la taille de police si besoin")); // layout - QHBoxLayout *label_edition = new QHBoxLayout(); + auto *label_edition = new QHBoxLayout(); label_edition -> addWidget(label_input_); label_edition -> addWidget(label_edit_); - QHBoxLayout *value_edition = new QHBoxLayout(); + auto *value_edition = new QHBoxLayout(); value_edition -> addWidget(value_input_); value_edition -> addWidget(value_edit_); @@ -375,7 +375,7 @@ bool TitleBlockTemplateCellWidget::isReadOnly() const { @param title Title of the dialog window */ void TitleBlockTemplateCellWidget::editTranslatableValue(NamesList &names, const QString &attribute, const QString &title) const { - NamesListWidget *names_widget = new NamesListWidget(); + auto *names_widget = new NamesListWidget(); names_widget -> setNames(names); QDialogButtonBox * buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); @@ -386,7 +386,7 @@ void TitleBlockTemplateCellWidget::editTranslatableValue(NamesList &names, const QLabel *def_var_label = new QLabel(defaultVariablesString()); def_var_label -> setTextFormat(Qt::RichText); - QVBoxLayout *editor_layout = new QVBoxLayout(); + auto *editor_layout = new QVBoxLayout(); editor_layout -> addWidget(information); editor_layout -> addWidget(names_widget); editor_layout -> addWidget(def_var_label); @@ -416,7 +416,7 @@ void TitleBlockTemplateCellWidget::emitModification(const QString &attribute, co // avoid creating a QUndoCommand object when no modification was actually done if (edited_cell_ -> attribute(attribute) == new_value) return; - ModifyTitleBlockCellCommand *command = new ModifyTitleBlockCellCommand(edited_cell_); + auto *command = new ModifyTitleBlockCellCommand(edited_cell_); command -> addModification(attribute, new_value); command -> setText( tr("Édition d'une cellule : %1", "label of and undo command when editing a cell") diff --git a/sources/titleblock/templatecommands.cpp b/sources/titleblock/templatecommands.cpp index e2fc55752..550063203 100644 --- a/sources/titleblock/templatecommands.cpp +++ b/sources/titleblock/templatecommands.cpp @@ -55,7 +55,7 @@ int ModifyTitleBlockCellCommand::id() const { @return true on success, false otherwise */ bool ModifyTitleBlockCellCommand::mergeWith(const QUndoCommand *command) { - const ModifyTitleBlockCellCommand *other = static_cast(command); + const auto *other = static_cast(command); if (other) { if (other -> modified_cell_ == modified_cell_) { if (other -> new_values_.keys() == new_values_.keys()) { @@ -226,7 +226,7 @@ ModifyTemplateGridCommand *ModifyTemplateGridCommand::addRow(TitleBlockTemplate if (!tbtemplate) return(nullptr); // create the command itself - ModifyTemplateGridCommand *add_row_command = new ModifyTemplateGridCommand(tbtemplate); + auto *add_row_command = new ModifyTemplateGridCommand(tbtemplate); add_row_command -> setInsertion(true); add_row_command -> setType(true); add_row_command -> setCells(tbtemplate -> createRow()); @@ -247,7 +247,7 @@ ModifyTemplateGridCommand *ModifyTemplateGridCommand::addColumn(TitleBlockTempla if (!tbtemplate) return(nullptr); // create the command itself - ModifyTemplateGridCommand *add_column_command = new ModifyTemplateGridCommand(tbtemplate); + auto *add_column_command = new ModifyTemplateGridCommand(tbtemplate); add_column_command -> setInsertion(true); add_column_command -> setType(false); add_column_command -> setCells(tbtemplate -> createColumn()); @@ -268,7 +268,7 @@ ModifyTemplateGridCommand *ModifyTemplateGridCommand::deleteRow(TitleBlockTempla if (!tbtemplate) return(nullptr); // create the command itself - ModifyTemplateGridCommand *del_row_command = new ModifyTemplateGridCommand(tbtemplate); + auto *del_row_command = new ModifyTemplateGridCommand(tbtemplate); del_row_command -> setInsertion(false); del_row_command -> setType(true); del_row_command -> setIndex(index); @@ -287,7 +287,7 @@ ModifyTemplateGridCommand *ModifyTemplateGridCommand::deleteColumn(TitleBlockTem if (!tbtemplate) return(nullptr); // create the command itself - ModifyTemplateGridCommand *del_column_command = new ModifyTemplateGridCommand(tbtemplate); + auto *del_column_command = new ModifyTemplateGridCommand(tbtemplate); del_column_command -> setInsertion(false); del_column_command -> setType(false); del_column_command -> setIndex(index); diff --git a/sources/titleblock/templatelogomanager.cpp b/sources/titleblock/templatelogomanager.cpp index af8c2c828..055550d3d 100644 --- a/sources/titleblock/templatelogomanager.cpp +++ b/sources/titleblock/templatelogomanager.cpp @@ -154,7 +154,7 @@ void TitleBlockTemplateLogoManager::fillView() { current_icon = QIcon(*svg_pixmap); } } - QListWidgetItem *qlwi = new QListWidgetItem(current_icon, logo_name); + auto *qlwi = new QListWidgetItem(current_icon, logo_name); qlwi -> setTextAlignment(Qt::AlignBottom | Qt::AlignHCenter); logos_view_ -> insertItem(0, qlwi); } @@ -192,18 +192,18 @@ QString TitleBlockTemplateLogoManager::confirmLogoName(const QString &initial_na rd_label = new QLabel(); rd_label -> setWordWrap(true); rd_input = new QLineEdit(); - QDialogButtonBox *rd_buttons = new QDialogButtonBox(); + auto *rd_buttons = new QDialogButtonBox(); QPushButton *replace_button = rd_buttons -> addButton(tr("Remplacer"), QDialogButtonBox::YesRole); QPushButton *rename_button = rd_buttons -> addButton(tr("Renommer"), QDialogButtonBox::NoRole); QPushButton *cancel_button = rd_buttons -> addButton(QDialogButtonBox::Cancel); - QVBoxLayout *rd_vlayout0 = new QVBoxLayout(); + auto *rd_vlayout0 = new QVBoxLayout(); rd_vlayout0 -> addWidget(rd_label); rd_vlayout0 -> addWidget(rd_input); rd_vlayout0 -> addWidget(rd_buttons); rename_dialog -> setLayout(rd_vlayout0); - QSignalMapper *signal_mapper = new QSignalMapper(rename_dialog); + auto *signal_mapper = new QSignalMapper(rename_dialog); signal_mapper -> setMapping(replace_button, QDialogButtonBox::YesRole); signal_mapper -> setMapping(rename_button, QDialogButtonBox::NoRole); signal_mapper -> setMapping(cancel_button, QDialogButtonBox::RejectRole); diff --git a/sources/titleblock/templatescollection.cpp b/sources/titleblock/templatescollection.cpp index 8be9872f3..5a0034444 100644 --- a/sources/titleblock/templatescollection.cpp +++ b/sources/titleblock/templatescollection.cpp @@ -199,7 +199,7 @@ TitleBlockTemplate *TitleBlockTemplatesProjectCollection::getTemplate(const QStr } // Ok, we have its XML description, we have to generate a TitleBlockTemplate object - TitleBlockTemplate *titleblock_template = new TitleBlockTemplate(this); + auto *titleblock_template = new TitleBlockTemplate(this); if (titleblock_template -> loadFromXmlElement(titleblock_templates_xml_[template_name])) { titleblock_templates_.insert(template_name, titleblock_template); return(titleblock_template); @@ -403,7 +403,7 @@ QStringList TitleBlockTemplatesFilesCollection::templates() { TitleBlockTemplate *TitleBlockTemplatesFilesCollection::getTemplate(const QString &template_name) { if (!templates().contains(template_name)) return(nullptr); - TitleBlockTemplate *tbtemplate = new TitleBlockTemplate(); + auto *tbtemplate = new TitleBlockTemplate(); QString tbt_file_path = path(template_name); bool loading = tbtemplate -> loadFromXmlFile(tbt_file_path); @@ -431,7 +431,7 @@ QDomElement TitleBlockTemplatesFilesCollection::getTemplateXmlDescription(const return(QDomElement()); } - QDomDocument *xml_document = new QDomDocument(); + auto *xml_document = new QDomDocument(); bool xml_parsing = xml_document -> setContent(&xml_file); if (!xml_parsing) { delete xml_document; diff --git a/sources/titleblock/templateview.cpp b/sources/titleblock/templateview.cpp index 2f38efa1d..680166673 100644 --- a/sources/titleblock/templateview.cpp +++ b/sources/titleblock/templateview.cpp @@ -140,7 +140,7 @@ QList TitleBlockTemplateView::cut() { QList copied_cells = copy(); if (!copied_cells.isEmpty()) { - CutTemplateCellsCommand *cut_command = new CutTemplateCellsCommand(tbtemplate_); + auto *cut_command = new CutTemplateCellsCommand(tbtemplate_); cut_command -> setCutCells(copied_cells); requestGridModification(cut_command); } @@ -247,7 +247,7 @@ void TitleBlockTemplateView::paste() { // change num_row and num_col attributes of pasted cells so they get positionned relatively to selected_cell normalizeCells(pasted_cells, erased_cell -> num_row, erased_cell -> num_col); - PasteTemplateCellsCommand *paste_command = new PasteTemplateCellsCommand(tbtemplate_); + auto *paste_command = new PasteTemplateCellsCommand(tbtemplate_); foreach (TitleBlockCell cell, pasted_cells) { TitleBlockCell *erased_cell = tbtemplate_ -> cell(cell.num_row, cell.num_col); if (!erased_cell) continue; @@ -334,7 +334,7 @@ void TitleBlockTemplateView::editColumn(HelperCell *cell) { dialog.setValue(dimension_before); int user_answer = dialog.exec(); if (!read_only_ && user_answer == QDialog::Accepted) { - ModifyTemplateDimension *command = new ModifyTemplateDimension(tbtemplate_); + auto *command = new ModifyTemplateDimension(tbtemplate_); command -> setType(false); command -> setIndex(index); command -> setDimensionBefore(dimension_before); @@ -360,7 +360,7 @@ void TitleBlockTemplateView::editRow(HelperCell *cell) { dialog.setValue(dimension_before); int user_answer = dialog.exec(); if (!read_only_ && user_answer == QDialog::Accepted) { - ModifyTemplateDimension *command = new ModifyTemplateDimension(tbtemplate_); + auto *command = new ModifyTemplateDimension(tbtemplate_); command -> setType(true); command -> setIndex(index); command -> setDimensionBefore(dimension_before); @@ -394,7 +394,7 @@ void TitleBlockTemplateView::mergeSelectedCells() { // retrieve the selected cells TitleBlockTemplateCellsSet selected_cells = selectedCellsSet(); - MergeCellsCommand *merge_command = new MergeCellsCommand(selected_cells, tbtemplate_); + auto *merge_command = new MergeCellsCommand(selected_cells, tbtemplate_); if (merge_command -> isValid()) requestGridModification(merge_command); } @@ -405,7 +405,7 @@ void TitleBlockTemplateView::splitSelectedCell() { // retrieve the selected cells TitleBlockTemplateCellsSet selected_cells = selectedCellsSet(); - SplitCellsCommand *split_command = new SplitCellsCommand(selected_cells, tbtemplate_); + auto *split_command = new SplitCellsCommand(selected_cells, tbtemplate_); if (split_command -> isValid()) requestGridModification(split_command); } @@ -578,7 +578,7 @@ void TitleBlockTemplateView::applyColumnsWidths(bool animate) { // no animation on first call tbgrid_ -> setColumnFixedWidth(COL_OFFSET + i, widths.at(i)); } else { - GridLayoutAnimation *animation = new GridLayoutAnimation(tbgrid_, form_); + auto *animation = new GridLayoutAnimation(tbgrid_, form_); animation -> setIndex(COL_OFFSET + i); animation -> setActsOnRows(false); animation -> setStartValue(QVariant(tbgrid_ -> columnMinimumWidth(COL_OFFSET + i))); @@ -643,7 +643,7 @@ void TitleBlockTemplateView::applyRowsHeights(bool animate) { // no animation on first call tbgrid_ -> setRowFixedHeight(ROW_OFFSET + i, heights.at(i)); } else { - GridLayoutAnimation *animation = new GridLayoutAnimation(tbgrid_, form_); + auto *animation = new GridLayoutAnimation(tbgrid_, form_); animation -> setIndex(ROW_OFFSET + i); animation -> setActsOnRows(true); animation -> setStartValue(QVariant(tbgrid_ -> rowMinimumHeight(ROW_OFFSET + i))); @@ -665,7 +665,7 @@ void TitleBlockTemplateView::updateRowsHelperCells() { int row_count = tbtemplate_ -> rowsCount(); QList heights = tbtemplate_ -> rowsHeights(); for (int i = 0 ; i < row_count ; ++ i) { - HelperCell *current_row_cell = static_cast(tbgrid_ -> itemAt(ROW_OFFSET + i, 0)); + auto *current_row_cell = static_cast(tbgrid_ -> itemAt(ROW_OFFSET + i, 0)); if (current_row_cell) { current_row_cell -> setType(QET::Absolute); // rows always have absolute heights current_row_cell -> setLabel(QString(tr("%1px", "format displayed in rows helper cells")).arg(heights.at(i))); @@ -680,7 +680,7 @@ void TitleBlockTemplateView::updateColumnsHelperCells() { int col_count = tbtemplate_ -> columnsCount(); for (int i = 0 ; i < col_count ; ++ i) { TitleBlockDimension current_col_dim = tbtemplate_ -> columnDimension(i); - HelperCell *current_col_cell = static_cast(tbgrid_ -> itemAt(1, COL_OFFSET + i)); + auto *current_col_cell = static_cast(tbgrid_ -> itemAt(1, COL_OFFSET + i)); if (current_col_cell) { current_col_cell -> setType(current_col_dim.type); current_col_cell -> setLabel(current_col_dim.toString()); @@ -714,7 +714,7 @@ void TitleBlockTemplateView::addCells() { // we add one cell per column to show their respective width for (int i = 0 ; i < col_count ; ++ i) { TitleBlockDimension current_col_dim = tbtemplate_ -> columnDimension(i); - HelperCell *current_col_cell = new HelperCell(); + auto *current_col_cell = new HelperCell(); current_col_cell -> setType(current_col_dim.type); current_col_cell -> setLabel(current_col_dim.toString()); current_col_cell -> setActions(columnsActions()); @@ -728,7 +728,7 @@ void TitleBlockTemplateView::addCells() { // we add one cell per row to show their respective height QList heights = tbtemplate_ -> rowsHeights(); for (int i = 0 ; i < row_count ; ++ i) { - HelperCell *current_row_cell = new HelperCell(); + auto *current_row_cell = new HelperCell(); current_row_cell -> setType(QET::Absolute); // rows always have absolute heights current_row_cell -> setLabel(QString(tr("%1px")).arg(heights.at(i))); current_row_cell -> orientation = Qt::Vertical; @@ -744,7 +744,7 @@ void TitleBlockTemplateView::addCells() { for (int j = 0 ; j < row_count ; ++ j) { TitleBlockCell *cell = tbtemplate_ -> cell(j, i); if (cell -> spanner_cell) continue; - TitleBlockTemplateVisualCell *cell_item = new TitleBlockTemplateVisualCell(); + auto *cell_item = new TitleBlockTemplateVisualCell(); cell_item -> setTemplateCell(tbtemplate_, cell); int row_span = 0, col_span = 0; @@ -768,7 +768,7 @@ void TitleBlockTemplateView::refresh() { for (int i = 0 ; i < col_count ; ++ i) { for (int j = 0 ; j < row_count ; ++ j) { if (QGraphicsLayoutItem *item = tbgrid_ -> itemAt(ROW_OFFSET + j, COL_OFFSET + i)) { - if (QGraphicsItem *qgi = dynamic_cast(item)) { + if (auto *qgi = dynamic_cast(item)) { qgi -> update(); } } @@ -800,7 +800,7 @@ void TitleBlockTemplateView::fillWithEmptyCells() { for (int i = 0 ; i < col_count ; ++ i) { for (int j = 0 ; j < row_count ; ++ j) { if (tbgrid_ -> itemAt(ROW_OFFSET + j, COL_OFFSET + i)) continue; - TitleBlockTemplateVisualCell *cell_item = new TitleBlockTemplateVisualCell(); + auto *cell_item = new TitleBlockTemplateVisualCell(); if (TitleBlockCell *target_cell = tbtemplate_ -> cell(j, i)) { qDebug() << Q_FUNC_INFO << "target_cell" << target_cell; cell_item -> setTemplateCell(tbtemplate_, target_cell); @@ -1057,7 +1057,7 @@ void TitleBlockTemplateView::removeItem(QGraphicsLayoutItem *item) { TitleBlockTemplateCellsSet TitleBlockTemplateView::makeCellsSetFromGraphicsItems(const QList &items) const { TitleBlockTemplateCellsSet set(this); foreach (QGraphicsItem *item, items) { - if (TitleBlockTemplateVisualCell *cell_view = dynamic_cast(item)) { + if (auto *cell_view = dynamic_cast(item)) { if (cell_view -> cell() && cell_view -> cell() -> num_row != -1) { set << cell_view; } diff --git a/sources/titleblocktemplate.cpp b/sources/titleblocktemplate.cpp index 32caf6091..29a023129 100644 --- a/sources/titleblocktemplate.cpp +++ b/sources/titleblocktemplate.cpp @@ -167,7 +167,7 @@ void TitleBlockTemplate::exportCellToXml(TitleBlockCell *cell, QDomElement &xml_ cells are duplicated too and associated with their parent template). */ TitleBlockTemplate *TitleBlockTemplate::clone() const { - TitleBlockTemplate *copy = new TitleBlockTemplate(); + auto *copy = new TitleBlockTemplate(); copy -> name_ = name_; copy -> information_ = information_; @@ -1030,7 +1030,7 @@ bool TitleBlockTemplate::addLogo(const QString &logo_name, QByteArray *logo_data // we can now create our image object from the byte array if (logo_type == "svg") { // SVG format is handled by the QSvgRenderer class - QSvgRenderer *svg = new QSvgRenderer(); + auto *svg = new QSvgRenderer(); if (!svg -> load(*logo_data)) { return(false); } diff --git a/sources/ui/conductorpropertiesdialog.cpp b/sources/ui/conductorpropertiesdialog.cpp index 2eb87d933..2ac449c5d 100644 --- a/sources/ui/conductorpropertiesdialog.cpp +++ b/sources/ui/conductorpropertiesdialog.cpp @@ -68,7 +68,7 @@ void ConductorPropertiesDialog::PropertiesDialog(Conductor *conductor, QWidget * old_value.setValue(conductor->properties()); new_value.setValue(cpd.properties()); - QPropertyUndoCommand *undo = new QPropertyUndoCommand(conductor, "properties", old_value, new_value); + auto *undo = new QPropertyUndoCommand(conductor, "properties", old_value, new_value); undo->setText(tr("Modifier les propriétés d'un conducteur", "undo caption")); if (!conductor->relatedPotentialConductors().isEmpty() && cpd.applyAll()) diff --git a/sources/ui/diagrampropertiesdialog.cpp b/sources/ui/diagrampropertiesdialog.cpp index 036361a26..60a886d10 100644 --- a/sources/ui/diagrampropertiesdialog.cpp +++ b/sources/ui/diagrampropertiesdialog.cpp @@ -48,7 +48,7 @@ DiagramPropertiesDialog::DiagramPropertiesDialog(Diagram *diagram, QWidget *pare setWindowTitle(tr("Propriétés du folio", "window title")); //Border widget - BorderPropertiesWidget *border_infos = new BorderPropertiesWidget(border, this); + auto *border_infos = new BorderPropertiesWidget(border, this); border_infos -> setReadOnly(diagram_is_read_only); //Title block widget @@ -78,7 +78,7 @@ DiagramPropertiesDialog::DiagramPropertiesDialog(Diagram *diagram, QWidget *pare connect(&boutons, SIGNAL(accepted()), this, SLOT(accept())); connect(&boutons, SIGNAL(rejected()), this, SLOT(reject())); - QGridLayout *glayout = new QGridLayout; + auto *glayout = new QGridLayout; glayout->addWidget(border_infos,0,0); glayout->addWidget(titleblock_infos, 1, 0); glayout->addWidget(m_cpw, 0, 1, 0, 1); diff --git a/sources/ui/diagrampropertieseditordockwidget.cpp b/sources/ui/diagrampropertieseditordockwidget.cpp index ddac9a65a..eef3b0d4a 100644 --- a/sources/ui/diagrampropertieseditordockwidget.cpp +++ b/sources/ui/diagrampropertieseditordockwidget.cpp @@ -127,7 +127,7 @@ void DiagramPropertiesEditorDockWidget::selectionChanged() } case DynamicElementTextItem::Type: { - DynamicElementTextItem *deti = static_cast(item); + auto *deti = static_cast(item); //For dynamic element text, we open the element editor to edit it //If we already edit an element, just update the editor with a new element @@ -144,7 +144,7 @@ void DiagramPropertiesEditorDockWidget::selectionChanged() } case QGraphicsItemGroup::Type: { - if(ElementTextItemGroup *group = dynamic_cast(item)) + if(auto *group = dynamic_cast(item)) { //For element text item group, we open the element editor to edit it //If we already edit an element, just update the editor with a new element diff --git a/sources/ui/diagramselection.cpp b/sources/ui/diagramselection.cpp index 4fead6d35..e7765bfbb 100644 --- a/sources/ui/diagramselection.cpp +++ b/sources/ui/diagramselection.cpp @@ -62,8 +62,8 @@ void diagramselection::load_TableDiagram() { // List Diagrams for(int i=0,j=0; i title(); if (diagram_title.isEmpty()) diagram_title = tr("Folio sans titre"); diff --git a/sources/ui/dynamicelementtextitemeditor.cpp b/sources/ui/dynamicelementtextitemeditor.cpp index c11f9aebf..4e0f5dae0 100644 --- a/sources/ui/dynamicelementtextitemeditor.cpp +++ b/sources/ui/dynamicelementtextitemeditor.cpp @@ -86,7 +86,7 @@ void DynamicElementTextItemEditor::apply() if (undo->childCount() == 1) { - QPropertyUndoCommand *quc = new QPropertyUndoCommand(static_cast(undo->child(0))); + auto *quc = new QPropertyUndoCommand(static_cast(undo->child(0))); if (quc->text().isEmpty()) quc->setText(undo->text()); undo_list << quc; @@ -105,7 +105,7 @@ void DynamicElementTextItemEditor::apply() if (undo->childCount() == 1) { - QPropertyUndoCommand *quc = new QPropertyUndoCommand(static_cast(undo->child(0))); + auto *quc = new QPropertyUndoCommand(static_cast(undo->child(0))); if (quc->text().isEmpty()) quc->setText(undo->text()); undo_list << quc; @@ -201,7 +201,7 @@ void DynamicElementTextItemEditor::on_m_add_text_clicked() if (!m_element) return; - DynamicElementTextItem *deti = new DynamicElementTextItem(m_element); + auto *deti = new DynamicElementTextItem(m_element); if (m_element->diagram()) { m_element->diagram()->undoStack().push(new AddElementTextCommand(m_element, deti)); diff --git a/sources/ui/dynamicelementtextmodel.cpp b/sources/ui/dynamicelementtextmodel.cpp index fb4a57167..efeb56c0b 100644 --- a/sources/ui/dynamicelementtextmodel.cpp +++ b/sources/ui/dynamicelementtextmodel.cpp @@ -138,7 +138,7 @@ QList DynamicElementTextModel::itemsForText(DynamicElementTextI if (deti->textFrom() == DynamicElementTextItem::UserText) title = tr("Texte utilisateur"); else if (deti->textFrom() == DynamicElementTextItem::ElementInfo) title = tr("Information de l'élément"); else title = tr("Texte composé"); - QStandardItem *srca = new QStandardItem(title); + auto *srca = new QStandardItem(title); srca->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable); srca->setData(textFrom, Qt::UserRole+1); @@ -192,7 +192,7 @@ QList DynamicElementTextModel::itemsForText(DynamicElementTextI QStandardItem *size = new QStandardItem(tr("Taille")); size->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - QStandardItem *siza = new QStandardItem(); + auto *siza = new QStandardItem(); siza->setData(deti->fontSize(), Qt::EditRole); siza->setData(DynamicElementTextModel::size, Qt::UserRole+1); siza->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable); @@ -205,7 +205,7 @@ QList DynamicElementTextModel::itemsForText(DynamicElementTextI QStandardItem *color = new QStandardItem(tr("Couleur")); color->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - QStandardItem *colora = new QStandardItem; + auto *colora = new QStandardItem; colora->setData(deti->color(), Qt::ForegroundRole); colora->setData(deti->color(), Qt::EditRole); colora->setData(DynamicElementTextModel::color, Qt::UserRole+1); @@ -219,7 +219,7 @@ QList DynamicElementTextModel::itemsForText(DynamicElementTextI QStandardItem *frame = new QStandardItem(tr("Cadre")); frame->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - QStandardItem *frame_a = new QStandardItem; + auto *frame_a = new QStandardItem; frame_a->setCheckable(true); frame_a->setCheckState(deti->frame()? Qt::Checked : Qt::Unchecked); frame_a->setData(DynamicElementTextModel::frame, Qt::UserRole+1); @@ -233,7 +233,7 @@ QList DynamicElementTextModel::itemsForText(DynamicElementTextI QStandardItem *width = new QStandardItem(tr("Largeur")); width->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - QStandardItem *width_a = new QStandardItem; + auto *width_a = new QStandardItem; width_a->setData(deti->textWidth(), Qt::EditRole); width_a->setData(DynamicElementTextModel::textWidth, Qt::UserRole+1); width_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable); @@ -248,7 +248,7 @@ QList DynamicElementTextModel::itemsForText(DynamicElementTextI QStandardItem *x_pos = new QStandardItem(tr("Position X")); x_pos->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - QStandardItem *x_pos_a = new QStandardItem; + auto *x_pos_a = new QStandardItem; x_pos_a->setData(deti->pos().x(), Qt::EditRole); x_pos_a->setData(DynamicElementTextModel::pos, Qt::UserRole+1); x_pos_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable); @@ -261,7 +261,7 @@ QList DynamicElementTextModel::itemsForText(DynamicElementTextI QStandardItem *y_pos = new QStandardItem(tr("Position Y")); y_pos->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - QStandardItem *y_pos_a = new QStandardItem; + auto *y_pos_a = new QStandardItem; y_pos_a->setData(deti->pos().y(), Qt::EditRole); y_pos_a->setData(DynamicElementTextModel::pos, Qt::UserRole+1); y_pos_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable); @@ -274,7 +274,7 @@ QList DynamicElementTextModel::itemsForText(DynamicElementTextI QStandardItem *rot = new QStandardItem(tr("Rotation")); rot->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - QStandardItem *rot_a = new QStandardItem; + auto *rot_a = new QStandardItem; rot_a->setData(deti->rotation(), Qt::EditRole); rot_a->setData(DynamicElementTextModel::rotation, Qt::UserRole+1); rot_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable); @@ -299,7 +299,7 @@ QList DynamicElementTextModel::itemsForText(DynamicElementTextI qsi_list.clear(); - QStandardItem *empty_qsi = new QStandardItem(0); + auto *empty_qsi = new QStandardItem(0); empty_qsi->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); qsi_list << qsi << empty_qsi; @@ -620,7 +620,7 @@ void DynamicElementTextModel::addGroup(ElementTextItemGroup *group) grp->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEditable); grp->setIcon(QET::Icons::textGroup); - QStandardItem *empty_qsi = new QStandardItem(0); + auto *empty_qsi = new QStandardItem(0); empty_qsi->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); QList qsi_list; @@ -640,7 +640,7 @@ void DynamicElementTextModel::addGroup(ElementTextItemGroup *group) case Qt::AlignVCenter: text = tr("Centre"); break; default: break;} - QStandardItem *alignment_a = new QStandardItem(text); + auto *alignment_a = new QStandardItem(text); alignment_a->setData(DynamicElementTextModel::grpAlignment, Qt::UserRole+1); alignment_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable); qsi_list.clear(); @@ -651,7 +651,7 @@ void DynamicElementTextModel::addGroup(ElementTextItemGroup *group) QStandardItem *x_pos = new QStandardItem(tr("Position X")); x_pos->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - QStandardItem *x_pos_a = new QStandardItem; + auto *x_pos_a = new QStandardItem; x_pos_a->setData(group->pos().x(), Qt::EditRole); x_pos_a->setData(DynamicElementTextModel::grpPos, Qt::UserRole+1); x_pos_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable); @@ -664,7 +664,7 @@ void DynamicElementTextModel::addGroup(ElementTextItemGroup *group) QStandardItem *y_pos = new QStandardItem(tr("Position Y")); y_pos->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - QStandardItem *y_pos_a = new QStandardItem; + auto *y_pos_a = new QStandardItem; y_pos_a->setData(group->pos().y(), Qt::EditRole); y_pos_a->setData(DynamicElementTextModel::grpPos, Qt::UserRole+1); y_pos_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable); @@ -677,7 +677,7 @@ void DynamicElementTextModel::addGroup(ElementTextItemGroup *group) QStandardItem *rot = new QStandardItem(tr("Rotation")); rot->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - QStandardItem *rot_a = new QStandardItem; + auto *rot_a = new QStandardItem; rot_a->setData(group->rotation(), Qt::EditRole); rot_a->setData(DynamicElementTextModel::grpRotation, Qt::UserRole+1); rot_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable); @@ -689,7 +689,7 @@ void DynamicElementTextModel::addGroup(ElementTextItemGroup *group) QStandardItem *v_adj = new QStandardItem(tr("Ajustement vertical")); v_adj->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); - QStandardItem *v_adj_a = new QStandardItem; + auto *v_adj_a = new QStandardItem; v_adj_a->setData(group->verticalAdjustment(), Qt::EditRole); v_adj_a->setData(DynamicElementTextModel::grpVAdjust, Qt::UserRole+1); v_adj_a->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable); @@ -701,7 +701,7 @@ void DynamicElementTextModel::addGroup(ElementTextItemGroup *group) QStandardItem *frame_ = new QStandardItem(tr("Cadre")); frame_->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); - QStandardItem *frame_a = new QStandardItem; + auto *frame_a = new QStandardItem; frame_a->setCheckable(true); frame_a->setCheckState(group->frame()? Qt::Checked : Qt::Unchecked); frame_a->setData(DynamicElementTextModel::grpFrame, Qt::UserRole+1); @@ -715,7 +715,7 @@ void DynamicElementTextModel::addGroup(ElementTextItemGroup *group) QStandardItem *hold_bottom = new QStandardItem(tr("Maintenir en bas de page")); hold_bottom->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); - QStandardItem *hold_bottom_a = new QStandardItem(); + auto *hold_bottom_a = new QStandardItem(); hold_bottom_a->setCheckable(true); hold_bottom_a->setCheckState(group->holdToBottomPage() ? Qt::Checked : Qt::Unchecked); hold_bottom_a->setData(DynamicElementTextModel::grpHoldBottom, Qt::UserRole+1); @@ -1046,7 +1046,7 @@ QMimeData *DynamicElementTextModel::mimeData(const QModelIndexList &indexes) con DynamicElementTextItem *deti = m_texts_list.key(item); if(deti) { - QMimeData *mime_data = new QMimeData(); + auto *mime_data = new QMimeData(); mime_data->setText(deti->uuid().toString()); mime_data->setData("application/x-qet-element-text-uuid", deti->uuid().toString().toLatin1()); return mime_data; @@ -1421,7 +1421,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti { case DynamicElementTextModel::textFrom: { - QComboBox *qcb = new QComboBox(parent); + auto *qcb = new QComboBox(parent); qcb->setObjectName("text_from"); qcb->addItem(tr("Texte utilisateur")); qcb->addItem(tr("Information de l'élément")); @@ -1430,7 +1430,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti } case DynamicElementTextModel::infoText: { - const DynamicElementTextModel *detm = static_cast(index.model()); + const auto *detm = static_cast(index.model()); QStandardItem *qsi = detm->itemFromIndex(index); if(!qsi) @@ -1447,7 +1447,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti info_map.insert(QETApp::elementTranslatedInfoKey(str), str); } - QComboBox *qcb = new QComboBox(parent); + auto *qcb = new QComboBox(parent); qcb->setObjectName("info_text"); for (const QString& key : info_map.keys()) { qcb->addItem(key, info_map.value(key)); @@ -1456,7 +1456,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti } case DynamicElementTextModel::compositeText: { - const DynamicElementTextModel *detm = static_cast(index.model()); + const auto *detm = static_cast(index.model()); QStandardItem *qsi = detm->itemFromIndex(index); if(!qsi) @@ -1466,13 +1466,13 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti if(!deti) break; - CompositeTextEditDialog *cted = new CompositeTextEditDialog(deti, parent); + auto *cted = new CompositeTextEditDialog(deti, parent); cted->setObjectName("composite_text"); return cted; } case DynamicElementTextModel::txtAlignment: { - const DynamicElementTextModel *detm = static_cast(index.model()); + const auto *detm = static_cast(index.model()); QStandardItem *qsi = detm->itemFromIndex(index); if(!qsi) @@ -1488,7 +1488,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti } case DynamicElementTextModel::size: { - QSpinBox *sb = new QSpinBox(parent); + auto *sb = new QSpinBox(parent); sb->setObjectName("font_size"); sb->setFrame(false); return sb; @@ -1501,7 +1501,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti } case DynamicElementTextModel::pos: { - QSpinBox *sb = new QSpinBox(parent); + auto *sb = new QSpinBox(parent); sb->setObjectName("pos_dialog"); sb->setRange(-1000,10000); sb->setFrame(false); @@ -1510,7 +1510,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti } case DynamicElementTextModel::rotation: { - QSpinBox *sb = new QSpinBox(parent); + auto *sb = new QSpinBox(parent); sb->setObjectName("rot_spinbox"); sb->setRange(0, 359); sb->setWrapping(true); @@ -1520,7 +1520,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti } case DynamicElementTextModel::textWidth: { - QSpinBox *sb = new QSpinBox(parent); + auto *sb = new QSpinBox(parent); sb->setObjectName("width_spinbox"); sb->setRange(-1, 500); sb->setFrame(false); @@ -1529,7 +1529,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti } case DynamicElementTextModel::grpAlignment: { - QComboBox *qcb = new QComboBox(parent); + auto *qcb = new QComboBox(parent); qcb->setFrame(false); qcb->setObjectName("group_alignment"); qcb->addItem(tr("Gauche")); @@ -1539,7 +1539,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti } case DynamicElementTextModel::grpPos: { - QSpinBox *sb = new QSpinBox(parent); + auto *sb = new QSpinBox(parent); sb->setObjectName("group_pos"); sb->setRange(-1000,10000); sb->setFrame(false); @@ -1548,7 +1548,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti } case DynamicElementTextModel::grpRotation: { - QSpinBox *sb = new QSpinBox(parent); + auto *sb = new QSpinBox(parent); sb->setObjectName("group_rotation"); sb->setRange(0, 359); sb->setWrapping(true); @@ -1558,7 +1558,7 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti } case DynamicElementTextModel::grpVAdjust: { - QSpinBox *sb = new QSpinBox(parent); + auto *sb = new QSpinBox(parent); sb->setObjectName("group_v_adjustment"); sb->setRange(-20, 20); sb->setFrame(false); @@ -1575,11 +1575,11 @@ void DynamicTextItemDelegate::setModelData(QWidget *editor, QAbstractItemModel * { if(editor->objectName() == "color_dialog") { - if (QStandardItemModel *qsim = dynamic_cast(model)) + if (auto *qsim = dynamic_cast(model)) { if(QStandardItem *qsi = qsim->itemFromIndex(index)) { - QColorDialog *cd = static_cast (editor); + auto *cd = static_cast (editor); qsi->setData(cd->selectedColor(), Qt::EditRole); qsi->setData(cd->selectedColor(), Qt::ForegroundRole); return; @@ -1589,11 +1589,11 @@ void DynamicTextItemDelegate::setModelData(QWidget *editor, QAbstractItemModel * } else if (editor->objectName() == "info_text") { - if (QStandardItemModel *qsim = dynamic_cast(model)) + if (auto *qsim = dynamic_cast(model)) { if(QStandardItem *qsi = qsim->itemFromIndex(index)) { - QComboBox *cb = static_cast(editor); + auto *cb = static_cast(editor); qsi->setData(cb->currentText(), Qt::DisplayRole); qsi->setData(cb->currentData(), Qt::UserRole+2); return; @@ -1603,17 +1603,17 @@ void DynamicTextItemDelegate::setModelData(QWidget *editor, QAbstractItemModel * } else if (editor->objectName() == "composite_text") { - if (QStandardItemModel *qsim = dynamic_cast(model)) + if (auto *qsim = dynamic_cast(model)) { if(QStandardItem *qsi = qsim->itemFromIndex(index)) { - CompositeTextEditDialog *cted = static_cast(editor); + auto *cted = static_cast(editor); QString edited_text = cted->plainText(); QString assigned_text; - const DynamicElementTextModel *detm = static_cast(index.model()); + const auto *detm = static_cast(index.model()); DynamicElementTextItem *deti = detm->textFromIndex(index); if(deti) { @@ -1631,11 +1631,11 @@ void DynamicTextItemDelegate::setModelData(QWidget *editor, QAbstractItemModel * } else if (editor->objectName() == "alignment_text") { - if(QStandardItemModel *qsim = dynamic_cast(model)) + if(auto *qsim = dynamic_cast(model)) { if(QStandardItem *qsi = qsim->itemFromIndex(index)) { - AlignmentTextDialog *atd = static_cast(editor); + auto *atd = static_cast(editor); Qt::Alignment align = atd->alignment(); qsi->setData(QVariant::fromValue(align), Qt::UserRole+2); return; @@ -1644,11 +1644,11 @@ void DynamicTextItemDelegate::setModelData(QWidget *editor, QAbstractItemModel * } else if (editor->objectName() == "group_alignment") { - if(QStandardItemModel *qsim = dynamic_cast(model)) + if(auto *qsim = dynamic_cast(model)) { if(QStandardItem *qsi = qsim->itemFromIndex(index)) { - QComboBox *cb = static_cast(editor); + auto *cb = static_cast(editor); qsi->setData(cb->currentText(), Qt::DisplayRole); } } @@ -1671,7 +1671,7 @@ bool DynamicTextItemDelegate::eventFilter(QObject *object, QEvent *event) { object->event(event); - QSpinBox *sb = static_cast(object); + auto *sb = static_cast(object); switch (event->type()) { case QEvent::KeyPress: emit commitData(sb); break; @@ -1691,7 +1691,7 @@ bool DynamicTextItemDelegate::eventFilter(QObject *object, QEvent *event) //Like the hack above, change the current index of the combobox, apply the change immediately, no need to lose focus or press enter. if((object->objectName() == "text_from" || object->objectName() == "info_text" || object->objectName() == "group_alignment") && event->type() == QEvent::FocusIn) { - QComboBox *qcb = static_cast(object); + auto *qcb = static_cast(object); connect(qcb, static_cast(&QComboBox::currentIndexChanged), [this,qcb](){emit commitData(qcb);}); } diff --git a/sources/ui/elementpropertieswidget.cpp b/sources/ui/elementpropertieswidget.cpp index a8fcd3c6e..fcb42f940 100644 --- a/sources/ui/elementpropertieswidget.cpp +++ b/sources/ui/elementpropertieswidget.cpp @@ -84,7 +84,7 @@ ElementPropertiesWidget::ElementPropertiesWidget(ElementTextItemGroup *group, QW { if(group->parentItem() && group->parentItem()->type() == Element::Type) { - Element *elmt = static_cast(group->parentItem()); + auto *elmt = static_cast(group->parentItem()); m_diagram = elmt->diagram(); buildGui(); setTextsGroup(group); @@ -133,7 +133,7 @@ void ElementPropertiesWidget::setDynamicText(DynamicElementTextItem *text) { if (QString(aepew->metaObject()->className()) == "DynamicElementTextItemEditor") { - DynamicElementTextItemEditor *detie = static_cast(aepew); + auto *detie = static_cast(aepew); m_tab->setCurrentWidget(detie); detie->setCurrentText(text); } @@ -156,7 +156,7 @@ void ElementPropertiesWidget::setTextsGroup(ElementTextItemGroup *group) { if (QString(aepew->metaObject()->className()) == "DynamicElementTextItemEditor") { - DynamicElementTextItemEditor *detie = static_cast(aepew); + auto *detie = static_cast(aepew); m_tab->setCurrentWidget(detie); detie->setCurrentGroup(group); } @@ -216,7 +216,7 @@ bool ElementPropertiesWidget::setLiveEdit(bool live_edit) */ void ElementPropertiesWidget::findInPanel() { - CustomElement *custom_element = qobject_cast(m_element); + auto *custom_element = qobject_cast(m_element); if (custom_element && m_diagram) { m_diagram->findElementRequired(custom_element->location()); @@ -230,7 +230,7 @@ void ElementPropertiesWidget::findInPanel() */ void ElementPropertiesWidget::editElement() { - CustomElement *custom_element = qobject_cast(m_element); + auto *custom_element = qobject_cast(m_element); if (custom_element && m_diagram) { m_diagram->findElementRequired(custom_element->location()); @@ -246,7 +246,7 @@ void ElementPropertiesWidget::editElement() void ElementPropertiesWidget::buildGui() { m_tab = new QTabWidget(this); - QVBoxLayout *main_layout = new QVBoxLayout(this); + auto *main_layout = new QVBoxLayout(this); main_layout -> addWidget(m_tab); setLayout(main_layout); } @@ -342,8 +342,8 @@ void ElementPropertiesWidget::addGeneralWidget() */ QWidget *ElementPropertiesWidget::generalWidget() { - CustomElement *custom_element = qobject_cast(m_element); - GhostElement *ghost_element = qobject_cast(m_element); + auto *custom_element = qobject_cast(m_element); + auto *ghost_element = qobject_cast(m_element); // type de l'element QString description_string; @@ -371,7 +371,7 @@ QWidget *ElementPropertiesWidget::generalWidget() // widget himself QWidget *general_widget = new QWidget (m_tab); - QVBoxLayout *vlayout_ = new QVBoxLayout (general_widget); + auto *vlayout_ = new QVBoxLayout (general_widget); general_widget -> setLayout(vlayout_); //widget for the text @@ -389,7 +389,7 @@ QWidget *ElementPropertiesWidget::generalWidget() connect(find_in_panel, SIGNAL(clicked()), this, SLOT(findInPanel())); QPushButton *edit_element = new QPushButton(QET::Icons::ElementEdit, tr("Éditer l'élément"), general_widget); connect(edit_element, SIGNAL(clicked()), this, SLOT(editElement())); - QHBoxLayout *hlayout_ = new QHBoxLayout; + auto *hlayout_ = new QHBoxLayout; hlayout_->addWidget(find_in_panel); hlayout_->addWidget(edit_element); vlayout_->addLayout(hlayout_); diff --git a/sources/ui/importelementdialog.cpp b/sources/ui/importelementdialog.cpp index 50241da31..7c87d687d 100644 --- a/sources/ui/importelementdialog.cpp +++ b/sources/ui/importelementdialog.cpp @@ -42,10 +42,10 @@ QET::Action ImportElementDialog::action() const void ImportElementDialog::setUpWidget() { - QButtonGroup *button_group = new QButtonGroup(this); + auto *button_group = new QButtonGroup(this); button_group->addButton(ui->m_use_actual_rd); button_group->addButton(ui->m_use_drop_rb); - QButtonGroup *button_group_drop = new QButtonGroup(this); + auto *button_group_drop = new QButtonGroup(this); button_group_drop->addButton(ui->m_erase_actual_rb); button_group_drop->addButton(ui->m_use_both_rb); diff --git a/sources/ui/linksingleelementwidget.cpp b/sources/ui/linksingleelementwidget.cpp index 2eb8651b0..3528f2e0e 100644 --- a/sources/ui/linksingleelementwidget.cpp +++ b/sources/ui/linksingleelementwidget.cpp @@ -157,7 +157,7 @@ void LinkSingleElementWidget::apply() */ QUndoCommand *LinkSingleElementWidget::associatedUndo() const { - LinkElementCommand *undo = new LinkElementCommand(m_element); + auto *undo = new LinkElementCommand(m_element); if (m_element_to_link || m_unlink) { @@ -257,7 +257,7 @@ void LinkSingleElementWidget::buildTree() qDebug() << "In method void LinkSingleElementWidget::updateUi(), provided element must be in a diagram"; } - QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_tree_widget, str_list); + auto *qtwi = new QTreeWidgetItem(ui->m_tree_widget, str_list); m_qtwi_elmt_hash.insert(qtwi, elmt); m_qtwi_strl_hash.insert(qtwi, search_list); } @@ -311,7 +311,7 @@ void LinkSingleElementWidget::buildTree() qDebug() << "In method void LinkSingleElementWidget::updateUi(), provided element must be in a diagram"; } - QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_tree_widget, str_list); + auto *qtwi = new QTreeWidgetItem(ui->m_tree_widget, str_list); m_qtwi_elmt_hash.insert(qtwi, elmt); m_qtwi_strl_hash.insert(qtwi, search_list); } @@ -381,7 +381,7 @@ void LinkSingleElementWidget::setUpCompleter() foreach(QStringList strl , m_qtwi_strl_hash.values()) search.append(strl); - QCompleter *c = new QCompleter(search, ui->m_search_field); + auto *c = new QCompleter(search, ui->m_search_field); c->setCaseSensitivity(Qt::CaseInsensitive); ui->m_search_field->setCompleter(c); } diff --git a/sources/ui/masterpropertieswidget.cpp b/sources/ui/masterpropertieswidget.cpp index 3746e8e70..9aea85f9d 100644 --- a/sources/ui/masterpropertieswidget.cpp +++ b/sources/ui/masterpropertieswidget.cpp @@ -196,7 +196,7 @@ QUndoCommand* MasterPropertiesWidget::associatedUndo() const return nullptr; } - LinkElementCommand *undo = new LinkElementCommand(m_element); + auto *undo = new LinkElementCommand(m_element); if (to_link.isEmpty()) undo->unlinkAll(); @@ -239,7 +239,7 @@ void MasterPropertiesWidget::updateUi() const QList free_list = elmt_prov.freeElement(Element::Slave); for(Element *elmt : free_list) { - QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_free_tree_widget); + auto *qtwi = new QTreeWidgetItem(ui->m_free_tree_widget); qtwi->setIcon(0, elmt->pixmap()); if(settings.value("genericpanel/folio", false).toBool()) @@ -267,7 +267,7 @@ void MasterPropertiesWidget::updateUi() const QList link_list = m_element->linkedElements(); for(Element *elmt : link_list) { - QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_link_tree_widget); + auto *qtwi = new QTreeWidgetItem(ui->m_link_tree_widget); qtwi->setIcon(0, elmt->pixmap()); if(settings.value("genericpanel/folio", false).toBool()) diff --git a/sources/ui/multipastedialog.cpp b/sources/ui/multipastedialog.cpp index 082a1f283..254ab6575 100644 --- a/sources/ui/multipastedialog.cpp +++ b/sources/ui/multipastedialog.cpp @@ -126,7 +126,7 @@ void MultiPasteDialog::on_m_button_box_accepted() { QPair pair = elmt->AlignedFreeTerminals().takeFirst(); - Conductor *conductor = new Conductor(pair.first, pair.second); + auto *conductor = new Conductor(pair.first, pair.second); m_diagram->undoStack().push(new AddItemCommand(conductor, m_diagram, QPointF())); //Autonum the new conductor, the undo command associated for this, have for parent undo_object diff --git a/sources/ui/potentialselectordialog.cpp b/sources/ui/potentialselectordialog.cpp index 91ec6024e..d65546108 100644 --- a/sources/ui/potentialselectordialog.cpp +++ b/sources/ui/potentialselectordialog.cpp @@ -240,8 +240,8 @@ void PotentialSelectorDialog::buildWidget() if(!cp2.m_tension_protocol.isEmpty()) text2.append(tr("\nTension/protocole : %1").arg(cp2.m_tension_protocol)); - QRadioButton *rb1 = new QRadioButton(text1, this); - QRadioButton *rb2 = new QRadioButton(text2, this); + auto *rb1 = new QRadioButton(text1, this); + auto *rb2 = new QRadioButton(text2, this); connect(rb1, &QRadioButton::toggled, [this](bool t) { diff --git a/sources/ui/projectpropertiesdialog.cpp b/sources/ui/projectpropertiesdialog.cpp index 3dc2d781b..f30118b55 100644 --- a/sources/ui/projectpropertiesdialog.cpp +++ b/sources/ui/projectpropertiesdialog.cpp @@ -28,8 +28,8 @@ * @param parent : parent widget of this dialog */ ProjectPropertiesDialog::ProjectPropertiesDialog(QETProject *project, QWidget *parent) { - NewDiagramPage *newDiagramPage = new NewDiagramPage(project,parent,this); - ProjectAutoNumConfigPage *projectAutoNumConfigPage = new ProjectAutoNumConfigPage (project); + auto *newDiagramPage = new NewDiagramPage(project,parent,this); + auto *projectAutoNumConfigPage = new ProjectAutoNumConfigPage (project); m_properties_dialog = new ConfigDialog (parent); m_properties_dialog -> setWindowTitle(QObject::tr("Propriétés du projet", "window title")); m_properties_dialog -> addPage(new ProjectMainConfigPage (project)); @@ -72,6 +72,6 @@ void ProjectPropertiesDialog::setCurrentPage(ProjectPropertiesDialog::Page p) { * Change the current displayed tab to folio tab. */ void ProjectPropertiesDialog::changeToFolio() { - ProjectAutoNumConfigPage *autoNumPage = static_cast (m_properties_dialog->pages.at(2)); + auto *autoNumPage = static_cast (m_properties_dialog->pages.at(2)); autoNumPage->changeToTab(3); } diff --git a/sources/undocommand/addelementtextcommand.cpp b/sources/undocommand/addelementtextcommand.cpp index f9661ceb2..02320d080 100644 --- a/sources/undocommand/addelementtextcommand.cpp +++ b/sources/undocommand/addelementtextcommand.cpp @@ -349,7 +349,7 @@ bool AlignmentTextsGroupCommand::mergeWith(const QUndoCommand *other) if (id() != other->id() || other->childCount()) return false; - AlignmentTextsGroupCommand const *undo = static_cast(other); + auto const *undo = static_cast(other); if (m_group != undo->m_group) return false; diff --git a/sources/undocommand/changeelementinformationcommand.cpp b/sources/undocommand/changeelementinformationcommand.cpp index 86b7b3aa1..2801f7df8 100644 --- a/sources/undocommand/changeelementinformationcommand.cpp +++ b/sources/undocommand/changeelementinformationcommand.cpp @@ -38,7 +38,7 @@ ChangeElementInformationCommand::ChangeElementInformationCommand(Element *elmt, bool ChangeElementInformationCommand::mergeWith(const QUndoCommand *other) { if (id() != other->id()) return false; - ChangeElementInformationCommand const *undo = static_cast(other); + auto const *undo = static_cast(other); if (m_element != undo->m_element) return false; m_new_info = undo->m_new_info; return true; diff --git a/sources/undocommand/linkelementcommand.cpp b/sources/undocommand/linkelementcommand.cpp index eed843f26..87bcf9d6c 100644 --- a/sources/undocommand/linkelementcommand.cpp +++ b/sources/undocommand/linkelementcommand.cpp @@ -45,7 +45,7 @@ LinkElementCommand::LinkElementCommand(Element *element_, QUndoCommand *parent): bool LinkElementCommand::mergeWith(const QUndoCommand *other) { if (id() != other->id() || other->childCount()) return false; - LinkElementCommand const *undo = static_cast (other); + auto const *undo = static_cast (other); if (m_element != undo->m_element) return false; m_linked_after = undo->m_linked_after; return true; diff --git a/sources/undocommand/rotateselectioncommand.cpp b/sources/undocommand/rotateselectioncommand.cpp index 46c8b7e7f..2511e4c01 100644 --- a/sources/undocommand/rotateselectioncommand.cpp +++ b/sources/undocommand/rotateselectioncommand.cpp @@ -61,7 +61,7 @@ m_diagram(diagram) break; case QGraphicsItemGroup::Type: { - if(ElementTextItemGroup *grp = dynamic_cast(item)) + if(auto *grp = dynamic_cast(item)) if(grp->parentElement() && !grp->parentElement()->isSelected()) m_undo << new QPropertyUndoCommand(grp, "rotation", QVariant(item->rotation()), QVariant(item->rotation()+angle), this); } diff --git a/sources/undocommand/rotatetextscommand.cpp b/sources/undocommand/rotatetextscommand.cpp index 9830e5854..3cadd653e 100644 --- a/sources/undocommand/rotatetextscommand.cpp +++ b/sources/undocommand/rotatetextscommand.cpp @@ -43,7 +43,7 @@ m_diagram(diagram) texts_list << dti; if(dti->type() == ConductorTextItem::Type) { - ConductorTextItem *cti = static_cast(dti); + auto *cti = static_cast(dti); m_cond_texts.insert(cti, cti->wasRotateByUser()); } } @@ -143,7 +143,7 @@ void RotateTextsCommand::setupAnimation(QObject *target, const QByteArray &prope if(m_anim_group == nullptr) m_anim_group = new QParallelAnimationGroup(); - QPropertyAnimation *animation = new QPropertyAnimation(target, propertyName); + auto *animation = new QPropertyAnimation(target, propertyName); animation->setDuration(300); animation->setStartValue(start); animation->setEndValue(end);