diff --git a/sources/ElementsCollection/elementcollectionhandler.cpp b/sources/ElementsCollection/elementcollectionhandler.cpp index 894d385ab..3aca3f869 100644 --- a/sources/ElementsCollection/elementcollectionhandler.cpp +++ b/sources/ElementsCollection/elementcollectionhandler.cpp @@ -76,7 +76,7 @@ ElementsLocation ECHSFileToFile::copy() return copyDirectory(m_source, m_destination, rename); } -ElementsLocation ECHSFileToFile::copyDirectory(ElementsLocation &source, ElementsLocation &destination, QString rename) +ElementsLocation ECHSFileToFile::copyDirectory(ElementsLocation &source, ElementsLocation &destination, const QString& rename) { QDir source_dir(source.fileSystemPath()); QDir destination_dir(destination.fileSystemPath()); @@ -130,7 +130,7 @@ ElementsLocation ECHSFileToFile::copyDirectory(ElementsLocation &source, Element return ElementsLocation(); } -ElementsLocation ECHSFileToFile::copyElement(ElementsLocation &source, ElementsLocation &destination, QString rename) +ElementsLocation ECHSFileToFile::copyElement(ElementsLocation &source, ElementsLocation &destination, const QString& rename) { QString new_elmt_name = rename.isEmpty() ? source.fileName() : rename; bool rb = QFile::copy(source.fileSystemPath(), destination.fileSystemPath() + "/" + new_elmt_name); @@ -184,7 +184,7 @@ ElementsLocation ECHSXmlToFile::copy() return copyDirectory(m_source, m_destination, rename); } -ElementsLocation ECHSXmlToFile::copyDirectory(ElementsLocation &source, ElementsLocation &destination, QString rename) +ElementsLocation ECHSXmlToFile::copyDirectory(ElementsLocation &source, ElementsLocation &destination, const QString& rename) { QDir destination_dir(destination.fileSystemPath()); @@ -231,7 +231,7 @@ ElementsLocation ECHSXmlToFile::copyDirectory(ElementsLocation &source, Elements return ElementsLocation(); } -ElementsLocation ECHSXmlToFile::copyElement(ElementsLocation &source, ElementsLocation &destination, QString rename) +ElementsLocation ECHSXmlToFile::copyElement(ElementsLocation &source, ElementsLocation &destination, const QString& rename) { if (!(destination.exist() && source.exist())) return ElementsLocation(); diff --git a/sources/ElementsCollection/elementcollectionhandler.h b/sources/ElementsCollection/elementcollectionhandler.h index 34f5de0dd..51f993f53 100644 --- a/sources/ElementsCollection/elementcollectionhandler.h +++ b/sources/ElementsCollection/elementcollectionhandler.h @@ -48,8 +48,8 @@ class ECHSFileToFile : public ECHStrategy ElementsLocation copy() override; private: - ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, QString rename = QString()); - ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, QString rename = QString()); + ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString()); + ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString()); }; /** @@ -63,8 +63,8 @@ class ECHSXmlToFile : public ECHStrategy ElementsLocation copy() override; private: - ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, QString rename = QString()); - ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, QString rename = QString()); + ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString()); + ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString()); }; /** diff --git a/sources/ElementsCollection/elementcollectionitem.cpp b/sources/ElementsCollection/elementcollectionitem.cpp index 7c336b12c..4aa708e60 100644 --- a/sources/ElementsCollection/elementcollectionitem.cpp +++ b/sources/ElementsCollection/elementcollectionitem.cpp @@ -71,7 +71,7 @@ ElementCollectionItem *ElementCollectionItem::lastItemForPath(const QString &pat * @param name * @return */ -ElementCollectionItem *ElementCollectionItem::childWithCollectionName(QString name) const +ElementCollectionItem *ElementCollectionItem::childWithCollectionName(const QString& name) const { rowCount(); foreach (QStandardItem *qsi, directChilds()) { diff --git a/sources/ElementsCollection/elementcollectionitem.h b/sources/ElementsCollection/elementcollectionitem.h index 13253ce29..c9b3522e1 100644 --- a/sources/ElementsCollection/elementcollectionitem.h +++ b/sources/ElementsCollection/elementcollectionitem.h @@ -46,7 +46,7 @@ class ElementCollectionItem : public QStandardItem virtual void clearData(); ElementCollectionItem *lastItemForPath(const QString &path, QString &no_found_path); - ElementCollectionItem *childWithCollectionName(QString name) const; + ElementCollectionItem *childWithCollectionName(const QString& name) const; QList directChilds() const; int rowForInsertItem(const QString &name); ElementCollectionItem *itemAtPath(const QString &path); diff --git a/sources/ElementsCollection/elementscollectionmodel.cpp b/sources/ElementsCollection/elementscollectionmodel.cpp index d8e1b14db..11426db7b 100644 --- a/sources/ElementsCollection/elementscollectionmodel.cpp +++ b/sources/ElementsCollection/elementscollectionmodel.cpp @@ -286,7 +286,7 @@ void ElementsCollectionModel::addCustomCollection(bool set_data) * If the location is already managed by this model, do nothing. * @param location */ -void ElementsCollectionModel::addLocation(ElementsLocation location) +void ElementsCollectionModel::addLocation(const ElementsLocation& location) { QModelIndex index = indexFromLocation(location); if (index.isValid()) @@ -504,7 +504,7 @@ QModelIndex ElementsCollectionModel::indexFromLocation(const ElementsLocation &l * this method create and display the new element * @param path -The path of the new element in the embedded collection of a project */ -void ElementsCollectionModel::elementIntegratedToCollection(QString path) +void ElementsCollectionModel::elementIntegratedToCollection(const QString& path) { QObject *object = sender(); XmlElementCollection *collection = static_cast (object); @@ -537,7 +537,7 @@ void ElementsCollectionModel::elementIntegratedToCollection(QString path) * This method must be called by a signal, to get a sender. * @param path */ -void ElementsCollectionModel::itemRemovedFromCollection(QString path) +void ElementsCollectionModel::itemRemovedFromCollection(const QString& path) { QObject *object = sender(); XmlElementCollection *collection = static_cast (object); @@ -565,7 +565,7 @@ void ElementsCollectionModel::itemRemovedFromCollection(QString path) * Update the item at path * @param path */ -void ElementsCollectionModel::updateItem(QString path) +void ElementsCollectionModel::updateItem(const QString& path) { QObject *object = sender(); XmlElementCollection *collection = static_cast (object); diff --git a/sources/ElementsCollection/elementscollectionmodel.h b/sources/ElementsCollection/elementscollectionmodel.h index 1e18f7a0e..ee036dd53 100644 --- a/sources/ElementsCollection/elementscollectionmodel.h +++ b/sources/ElementsCollection/elementscollectionmodel.h @@ -45,7 +45,7 @@ class ElementsCollectionModel : public QStandardItemModel void addCommonCollection(bool set_data = true); void addCustomCollection(bool set_data = true); - void addLocation(ElementsLocation location); + void addLocation(const ElementsLocation& location); void addProject(QETProject *project, bool set_data = true); void removeProject(QETProject *project); @@ -64,9 +64,9 @@ class ElementsCollectionModel : public QStandardItemModel void loadingProgressValue(int); private: - void elementIntegratedToCollection (QString path); - void itemRemovedFromCollection (QString path); - void updateItem (QString path); + void elementIntegratedToCollection (const QString& path); + void itemRemovedFromCollection (const QString& path); + void updateItem (const QString& path); private: QList m_project_list; diff --git a/sources/ElementsCollection/elementscollectionwidget.cpp b/sources/ElementsCollection/elementscollectionwidget.cpp index 7089986ce..9ff46af7a 100644 --- a/sources/ElementsCollection/elementscollectionwidget.cpp +++ b/sources/ElementsCollection/elementscollectionwidget.cpp @@ -566,7 +566,7 @@ void ElementsCollectionWidget::reload() * Update or add the item represented by location to m_model * @param location */ -void ElementsCollectionWidget::locationWasSaved(ElementsLocation location) +void ElementsCollectionWidget::locationWasSaved(const ElementsLocation& location) { //Because this method update an item in the model, location must //represente an existing element (in file system of project) diff --git a/sources/ElementsCollection/elementscollectionwidget.h b/sources/ElementsCollection/elementscollectionwidget.h index 75a90796f..9722a01ac 100644 --- a/sources/ElementsCollection/elementscollectionwidget.h +++ b/sources/ElementsCollection/elementscollectionwidget.h @@ -81,7 +81,7 @@ class ElementsCollectionWidget : public QWidget void reload(); private: - void locationWasSaved(ElementsLocation location); + void locationWasSaved(const ElementsLocation& location); private: diff --git a/sources/ElementsCollection/fileelementcollectionitem.cpp b/sources/ElementsCollection/fileelementcollectionitem.cpp index 4af9d4b45..3115517f8 100644 --- a/sources/ElementsCollection/fileelementcollectionitem.cpp +++ b/sources/ElementsCollection/fileelementcollectionitem.cpp @@ -37,7 +37,7 @@ FileElementCollectionItem::FileElementCollectionItem() * @param path * @return true if path exist. */ -bool FileElementCollectionItem::setRootPath(QString path, bool set_data, bool hide_element) +bool FileElementCollectionItem::setRootPath(const QString& path, bool set_data, bool hide_element) { QDir dir(path); if (dir.exists()) { @@ -278,7 +278,7 @@ void FileElementCollectionItem::setUpIcon() * For create a new file collection see setRootPath. * @param path_name */ -void FileElementCollectionItem::setPathName(QString path_name, bool set_data, bool hide_element) +void FileElementCollectionItem::setPathName(const QString& path_name, bool set_data, bool hide_element) { m_path = path_name; diff --git a/sources/ElementsCollection/fileelementcollectionitem.h b/sources/ElementsCollection/fileelementcollectionitem.h index 985f422a4..4facdb643 100644 --- a/sources/ElementsCollection/fileelementcollectionitem.h +++ b/sources/ElementsCollection/fileelementcollectionitem.h @@ -33,7 +33,7 @@ class FileElementCollectionItem : public ElementCollectionItem enum { Type = UserType+2 }; int type() const override { return Type;} - bool setRootPath(QString path, bool set_data = true, bool hide_element = false); + bool setRootPath(const QString& path, bool set_data = true, bool hide_element = false); QString fileSystemPath() const; QString dirPath() const; @@ -54,7 +54,7 @@ class FileElementCollectionItem : public ElementCollectionItem private: - void setPathName(QString path_name, bool set_data = true, bool hide_element = false); + void setPathName(const QString& path_name, bool set_data = true, bool hide_element = false); void populate(bool set_data = true, bool hide_element = false); private: diff --git a/sources/ElementsCollection/ui/renamedialog.cpp b/sources/ElementsCollection/ui/renamedialog.cpp index 67e7628d5..fb2fe2a9f 100644 --- a/sources/ElementsCollection/ui/renamedialog.cpp +++ b/sources/ElementsCollection/ui/renamedialog.cpp @@ -16,12 +16,14 @@ along with QElectroTech. If not, see . */ #include "renamedialog.h" + +#include #include "ui_renamedialog.h" RenameDialog::RenameDialog(QString path, QWidget *parent) : QDialog(parent), ui(new Ui::RenameDialog), - m_path(path) + m_path(std::move(path)) { ui->setupUi(this); m_name = m_path.split("/").last(); diff --git a/sources/ElementsCollection/xmlelementcollection.cpp b/sources/ElementsCollection/xmlelementcollection.cpp index 3cdfe4552..9cd2ff1cd 100644 --- a/sources/ElementsCollection/xmlelementcollection.cpp +++ b/sources/ElementsCollection/xmlelementcollection.cpp @@ -462,7 +462,7 @@ bool XmlElementCollection::addElementDefinition(const QString &dir_path, const Q * @return True if element is removed and emit the signal elementRemoved. * else false. */ -bool XmlElementCollection::removeElement(QString path) +bool XmlElementCollection::removeElement(const QString& path) { QDomElement elmt = element(path); @@ -486,7 +486,7 @@ bool XmlElementCollection::removeElement(QString path) * @param deep_copy : if true copy all childs of source (only if source is directory) * @return the ElementLocation that represent the copy, if copy failed return a null ElementLocation */ -ElementsLocation XmlElementCollection::copy(ElementsLocation &source, ElementsLocation &destination, QString rename, bool deep_copy) +ElementsLocation XmlElementCollection::copy(ElementsLocation &source, ElementsLocation &destination, const QString& rename, bool deep_copy) { if (!(source.exist() && destination.isDirectory() && destination.isProject() && destination.projectCollection() == this)) return ElementsLocation(); @@ -520,7 +520,7 @@ bool XmlElementCollection::exist(const QString &path) const * @param name_list : translation of the directorie name. * @return true if creation success, if directorie already exist return true. */ -bool XmlElementCollection::createDir(QString path, QString name, const NamesList &name_list) +bool XmlElementCollection::createDir(const QString& path, const QString& name, const NamesList &name_list) { QString new_dir_path = path + "/" + name; @@ -552,7 +552,7 @@ bool XmlElementCollection::createDir(QString path, QString name, const NamesList * @return true if successfuly removed and emit directoryRemoved(QString), * else false. */ -bool XmlElementCollection::removeDir(QString path) +bool XmlElementCollection::removeDir(const QString& path) { QDomElement dir = directory(path); if (!dir.isNull()) { @@ -670,7 +670,7 @@ void XmlElementCollection::cleanUnusedDirectory() * @param deep_copy :if true copy all childs of source * @return the ElementLocation that represent the copy, if copy failed return a null ElementLocation */ -ElementsLocation XmlElementCollection::copyDirectory(ElementsLocation &source, ElementsLocation &destination, QString rename, bool deep_copy) +ElementsLocation XmlElementCollection::copyDirectory(ElementsLocation &source, ElementsLocation &destination, const QString& rename, bool deep_copy) { QString new_dir_name = rename.isEmpty() ? source.fileName() : rename; @@ -757,7 +757,7 @@ ElementsLocation XmlElementCollection::copyDirectory(ElementsLocation &source, E * @param rename : rename the copy with @rename else use the name of source * @return The ElementsLocation of the copy */ -ElementsLocation XmlElementCollection::copyElement(ElementsLocation &source, ElementsLocation &destination, QString rename) +ElementsLocation XmlElementCollection::copyElement(ElementsLocation &source, ElementsLocation &destination, const QString& rename) { QString new_elmt_name = rename.isEmpty() ? source.fileName() : rename; diff --git a/sources/ElementsCollection/xmlelementcollection.h b/sources/ElementsCollection/xmlelementcollection.h index d238b6bbe..ab5b246ee 100644 --- a/sources/ElementsCollection/xmlelementcollection.h +++ b/sources/ElementsCollection/xmlelementcollection.h @@ -50,11 +50,11 @@ class XmlElementCollection : public QObject QDomElement directory(const QString &path) const; QString addElement (ElementsLocation &location); bool addElementDefinition (const QString &dir_path, const QString &elmt_name, const QDomElement &xml_definition); - bool removeElement(QString path); - ElementsLocation copy (ElementsLocation &source, ElementsLocation &destination, QString rename = QString(), bool deep_copy = true); + bool removeElement(const QString& path); + ElementsLocation copy (ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString(), bool deep_copy = true); bool exist (const QString &path) const; - bool createDir (QString path, QString name, const NamesList &name_list); - bool removeDir (QString path); + bool createDir (const QString& path, const QString& name, const NamesList &name_list); + bool removeDir (const QString& path); QList elementsLocation (QDomElement dom_element = QDomElement(), bool childs = true) const; ElementsLocation domToLocation(QDomElement dom_element) const; @@ -63,8 +63,8 @@ class XmlElementCollection : public QObject void cleanUnusedDirectory(); private: - ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, QString rename = QString(), bool deep_copy = true); - ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, QString rename = QString()); + ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString(), bool deep_copy = true); + ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString()); signals: /** diff --git a/sources/ElementsCollection/xmlprojectelementcollectionitem.cpp b/sources/ElementsCollection/xmlprojectelementcollectionitem.cpp index 942c09ce1..9a51e0536 100644 --- a/sources/ElementsCollection/xmlprojectelementcollectionitem.cpp +++ b/sources/ElementsCollection/xmlprojectelementcollectionitem.cpp @@ -259,7 +259,7 @@ void XmlProjectElementCollectionItem::populate(bool set_data, bool hide_element) * @param project : the parent project of managed collection * @param set_data : if true, call setUpData for every child of this item */ -void XmlProjectElementCollectionItem::setXmlElement(QDomElement element, QETProject *project, bool set_data, bool hide_element) +void XmlProjectElementCollectionItem::setXmlElement(const QDomElement& element, QETProject *project, bool set_data, bool hide_element) { m_dom_element = element; m_project = project; diff --git a/sources/ElementsCollection/xmlprojectelementcollectionitem.h b/sources/ElementsCollection/xmlprojectelementcollectionitem.h index 59ca18f86..46364c904 100644 --- a/sources/ElementsCollection/xmlprojectelementcollectionitem.h +++ b/sources/ElementsCollection/xmlprojectelementcollectionitem.h @@ -51,7 +51,7 @@ class XmlProjectElementCollectionItem : public ElementCollectionItem private: void populate(bool set_data = true, bool hide_element = false); - void setXmlElement(QDomElement element, QETProject *project, bool set_data = true, bool hide_element = false); + void setXmlElement(const QDomElement& element, QETProject *project, bool set_data = true, bool hide_element = false); private: QETProject *m_project = nullptr; diff --git a/sources/QetGraphicsItemModeler/qetgraphicshandleritem.cpp b/sources/QetGraphicsItemModeler/qetgraphicshandleritem.cpp index 0ee80a50d..1e1a046d1 100644 --- a/sources/QetGraphicsItemModeler/qetgraphicshandleritem.cpp +++ b/sources/QetGraphicsItemModeler/qetgraphicshandleritem.cpp @@ -18,6 +18,7 @@ #include "qetgraphicshandleritem.h" #include #include +#include /** * @brief QetGraphicsHandlerItem::QetGraphicsHandlerItem @@ -46,7 +47,7 @@ QRectF QetGraphicsHandlerItem::boundingRect() const { */ void QetGraphicsHandlerItem::setColor(QColor color) { - m_color = color; + m_color = std::move(color); update(); } diff --git a/sources/autoNum/assignvariables.cpp b/sources/autoNum/assignvariables.cpp index c25d817ea..481a5cb6a 100644 --- a/sources/autoNum/assignvariables.cpp +++ b/sources/autoNum/assignvariables.cpp @@ -24,6 +24,7 @@ #include #include +#include namespace autonum { @@ -88,7 +89,7 @@ namespace autonum * @param tag_name : the tag name used for the QDomElement. * @return A QDomElement, if this sequential have no value, the returned QDomELement is empty */ - QDomElement sequentialNumbers::toXml(QDomDocument &document, QString tag_name) const + QDomElement sequentialNumbers::toXml(QDomDocument &document, const QString& tag_name) const { QDomElement element = document.createElement(tag_name); @@ -161,7 +162,7 @@ namespace autonum */ QString AssignVariables::formulaToLabel(QString formula, sequentialNumbers &seqStruct, Diagram *diagram, const Element *elmt) { - AssignVariables av(formula, seqStruct, diagram, elmt); + AssignVariables av(std::move(formula), seqStruct, diagram, elmt); seqStruct = av.m_seq_struct; return av.m_assigned_label; } @@ -193,7 +194,7 @@ namespace autonum return str; } - AssignVariables::AssignVariables(QString formula, sequentialNumbers seqStruct , Diagram *diagram, const Element *elmt): + AssignVariables::AssignVariables(const QString& formula, const sequentialNumbers& seqStruct , Diagram *diagram, const Element *elmt): m_diagram(diagram), m_arg_formula(formula), m_assigned_label(formula), @@ -293,7 +294,7 @@ namespace autonum * @param context : numerotation context to retrieve value * @param type : type of sequential (unit, unitfolio, ten, tenfolio, hundred, hundredfolio) */ - void setSequentialToList(QStringList &list, NumerotationContext &context, QString type) + void setSequentialToList(QStringList &list, NumerotationContext &context, const QString& type) { for (int i = 0; i < context.size(); i++) { @@ -317,7 +318,7 @@ namespace autonum * @param hash : hash to have values inserted * @param autoNumName : name to use as key of hash */ - void setFolioSequentialToHash(QStringList &list, QHash &hash, QString autoNumName) + void setFolioSequentialToHash(QStringList &list, QHash &hash, const QString& autoNumName) { if (hash.isEmpty() || !hash.contains(autoNumName)) { @@ -354,7 +355,7 @@ namespace autonum * to keep up to date the current sequential of folio. * @param hashKey : the hash key used to store the sequential for folio type. */ - void setSequential(QString label, sequentialNumbers &seqStruct, NumerotationContext &context, Diagram *diagram, QString hashKey) + void setSequential(const QString& label, sequentialNumbers &seqStruct, NumerotationContext &context, Diagram *diagram, const QString& hashKey) { if (!context.isEmpty()) { diff --git a/sources/autoNum/assignvariables.h b/sources/autoNum/assignvariables.h index bec69e40d..5f69a136a 100644 --- a/sources/autoNum/assignvariables.h +++ b/sources/autoNum/assignvariables.h @@ -42,7 +42,7 @@ namespace autonum bool operator== (const sequentialNumbers &other) const; bool operator!= (const sequentialNumbers &other) const; - QDomElement toXml(QDomDocument &document, QString tag_name = QString("sequentialNumbers")) const; + QDomElement toXml(QDomDocument &document, const QString& tag_name = QString("sequentialNumbers")) const; void fromXml(const QDomElement &element); void clear(); @@ -66,7 +66,7 @@ namespace autonum static QString replaceVariable (const QString &formula, const DiagramContext &dc); private: - AssignVariables(QString formula, sequentialNumbers seqStruct , Diagram *diagram, const Element *elmt = nullptr); + AssignVariables(const QString& formula, const sequentialNumbers& seqStruct , Diagram *diagram, const Element *elmt = nullptr); void assignTitleBlockVar(); void assignProjectVar(); void assignSequence(); @@ -78,9 +78,9 @@ namespace autonum const Element *m_element = nullptr; }; - void setSequentialToList(QStringList &list, NumerotationContext &nc, QString type); - void setFolioSequentialToHash(QStringList &list, QHash &hash, QString autoNumName); - void setSequential(QString label, autonum::sequentialNumbers &seqStruct, NumerotationContext &context, Diagram *diagram, QString hashKey); + void setSequentialToList(QStringList &list, NumerotationContext &nc, const QString& type); + void setFolioSequentialToHash(QStringList &list, QHash &hash, const QString& autoNumName); + void setSequential(const QString& label, autonum::sequentialNumbers &seqStruct, NumerotationContext &context, Diagram *diagram, const QString& hashKey); QString numerotationContextToFormula(const NumerotationContext &nc); QString elementPrefixForLocation(const ElementsLocation &location); } diff --git a/sources/autoNum/numerotationcontext.cpp b/sources/autoNum/numerotationcontext.cpp index 7a89f7390..92ebc2133 100644 --- a/sources/autoNum/numerotationcontext.cpp +++ b/sources/autoNum/numerotationcontext.cpp @@ -16,6 +16,8 @@ along with QElectroTech. If not, see . */ #include "numerotationcontext.h" + +#include #include "qet.h" /** @@ -130,7 +132,7 @@ bool NumerotationContext::keyIsNumber(const QString &type) const { * @brief NumerotationContext::toXml * Save the numerotation context in a QDomElement under the element name @str */ -QDomElement NumerotationContext::toXml(QDomDocument &d, QString str) { +QDomElement NumerotationContext::toXml(QDomDocument &d, const QString& str) { QDomElement num_auto = d.createElement(str); for (int i=0; i #include #include +#include /** * Constructor @@ -45,7 +46,7 @@ FormulaAutonumberingW::~FormulaAutonumberingW() * @brief FormulaAutonumberingW::setContext * @param formula to be inserted into context */ -void FormulaAutonumberingW::setContext(QString formula) { +void FormulaAutonumberingW::setContext(const QString& formula) { ui->m_formula_le->insert(formula); } @@ -70,5 +71,5 @@ QString FormulaAutonumberingW::formula() { * Update Apply Button */ void FormulaAutonumberingW::on_m_formula_le_textChanged(QString text) { - emit (textChanged(text)); + emit (textChanged(std::move(text))); } diff --git a/sources/autoNum/ui/formulaautonumberingw.h b/sources/autoNum/ui/formulaautonumberingw.h index 47a95e6f6..6daf61710 100644 --- a/sources/autoNum/ui/formulaautonumberingw.h +++ b/sources/autoNum/ui/formulaautonumberingw.h @@ -41,7 +41,7 @@ class FormulaAutonumberingW : public QWidget explicit FormulaAutonumberingW(QWidget *parent = nullptr); ~FormulaAutonumberingW() override; QString formula(); - void setContext(QString); + void setContext(const QString&); void clearContext(); Ui::FormulaAutonumberingW *ui; diff --git a/sources/bordertitleblock.cpp b/sources/bordertitleblock.cpp index e63a26631..9b1545aae 100644 --- a/sources/bordertitleblock.cpp +++ b/sources/bordertitleblock.cpp @@ -16,6 +16,7 @@ along with QElectroTech. If not, see . */ #include +#include #include "titleblocktemplate.h" #include "titleblocktemplaterenderer.h" #include "bordertitleblock.h" @@ -408,7 +409,7 @@ void BorderTitleBlock::displayBorder(bool db) { * Set Page (Folio) Auto Num */ void BorderTitleBlock::slot_setAutoPageNum(QString pageAutoNum) { - btb_auto_page_num_=pageAutoNum; + btb_auto_page_num_=std::move(pageAutoNum); } /** @@ -735,7 +736,7 @@ QString BorderTitleBlock::incrementLetters(const QString &string) { @param total nombre total de schemas dans le projet @param project_properties Project-wide properties, to be merged with diagram-wide ones. */ -void BorderTitleBlock::setFolioData(int index, int total, QString autonum, const DiagramContext &project_properties) { +void BorderTitleBlock::setFolioData(int index, int total, const QString& autonum, const DiagramContext &project_properties) { if (index < 1 || total < 1 || index > total) return; // memorise les informations diff --git a/sources/bordertitleblock.h b/sources/bordertitleblock.h index 1b14f45f5..c0cadaad5 100644 --- a/sources/bordertitleblock.h +++ b/sources/bordertitleblock.h @@ -153,7 +153,7 @@ class BorderTitleBlock : public QObject btb_folio_ = folio; emit (titleBlockFolioChanged(folio)); } - void setFolioData(int, int, QString = nullptr, const DiagramContext & = DiagramContext()); + void setFolioData(int, int, const QString& = nullptr, const DiagramContext & = DiagramContext()); /// @param author the new value of the "File" field void setMachine(const QString &machine) { btb_machine_ = machine; } void setLocMach(const QString &locmach) { btb_locmach_ = locmach; } diff --git a/sources/conductorautonumerotation.cpp b/sources/conductorautonumerotation.cpp index 065036f31..cc3fc995e 100644 --- a/sources/conductorautonumerotation.cpp +++ b/sources/conductorautonumerotation.cpp @@ -56,7 +56,7 @@ void ConductorAutoNumerotation::numerate() { * @brief ConductorAutoNumerotation::applyText * apply the text @t to @conductor_ and all conductors at the same potential */ -void ConductorAutoNumerotation::applyText(QString t) +void ConductorAutoNumerotation::applyText(const QString& t) { if (!m_conductor) return; diff --git a/sources/conductorautonumerotation.h b/sources/conductorautonumerotation.h index 4200e7c5c..081a5d575 100644 --- a/sources/conductorautonumerotation.h +++ b/sources/conductorautonumerotation.h @@ -32,7 +32,7 @@ class ConductorAutoNumerotation //methods void numerate (); - void applyText (QString); + void applyText (const QString&); private: //methods diff --git a/sources/conductorproperties.cpp b/sources/conductorproperties.cpp index 62a737fc8..4082ca9b8 100644 --- a/sources/conductorproperties.cpp +++ b/sources/conductorproperties.cpp @@ -17,6 +17,7 @@ */ #include "conductorproperties.h" #include +#include /** Constructeur par defaut @@ -426,7 +427,7 @@ void ConductorProperties::setText(QString text) { */ void ConductorProperties::applyForEqualAttributes(QList list) { - const QList clist = list; + const QList clist = std::move(list); if (clist.isEmpty()) return; diff --git a/sources/configpages.cpp b/sources/configpages.cpp index 2ec82e361..278640625 100644 --- a/sources/configpages.cpp +++ b/sources/configpages.cpp @@ -30,6 +30,7 @@ #include #include #include +#include /** * @brief NewDiagramPage::NewDiagramPage @@ -203,7 +204,7 @@ void NewDiagramPage::changeToAutoFolioTab(){ * Set temporary TBP to use in auto folio num */ void NewDiagramPage::setFolioAutonum(QString autoNum){ - TitleBlockProperties tbptemp = ipw->propertiesAutoNum(autoNum); + TitleBlockProperties tbptemp = ipw->propertiesAutoNum(std::move(autoNum)); ipw->setProperties(tbptemp); applyConf(); } diff --git a/sources/createdxf.cpp b/sources/createdxf.cpp index 65bf05e07..2c18f6e3d 100644 --- a/sources/createdxf.cpp +++ b/sources/createdxf.cpp @@ -39,7 +39,7 @@ Createdxf::~Createdxf() } /* Header section of every DXF file.*/ -void Createdxf::dxfBegin (QString fileName) +void Createdxf::dxfBegin (const QString& fileName) { // Creation of an output stream object in text mode. @@ -229,7 +229,7 @@ void Createdxf::dxfBegin (QString fileName) } /* End Section of every DXF File*/ -void Createdxf::dxfEnd (QString fileName) +void Createdxf::dxfEnd (const QString& fileName) { // Creation of an output stream object in text mode. if (!fileName.isEmpty()) { @@ -253,7 +253,7 @@ void Createdxf::dxfEnd (QString fileName) /* draw circle in dxf format*/ -void Createdxf::drawCircle (QString fileName, double radius, double x, double y, int colour) +void Createdxf::drawCircle (const QString& fileName, double radius, double x, double y, int colour) { if (!fileName.isEmpty()) { QFile file(fileName); @@ -668,7 +668,7 @@ void Createdxf::drawRectangle(const QString &filepath, const QRectF &rect, const } /* draw arc in dx format */ -void Createdxf::drawArc(QString fileName,double x,double y,double rad,double startAngle,double endAngle,int color) +void Createdxf::drawArc(const QString& fileName,double x,double y,double rad,double startAngle,double endAngle,int color) { if (!fileName.isEmpty()) { QFile file(fileName); @@ -705,7 +705,7 @@ void Createdxf::drawArc(QString fileName,double x,double y,double rad,double sta } /* draw simple text in dxf format without any alignment specified */ -void Createdxf::drawText(QString fileName, QString text,double x, double y, double height, double rotation, int colour) +void Createdxf::drawText(const QString& fileName, const QString& text,double x, double y, double height, double rotation, int colour) { if (!fileName.isEmpty()) { QFile file(fileName); @@ -744,7 +744,7 @@ void Createdxf::drawText(QString fileName, QString text,double x, double y, doub /* draw aligned text in DXF Format */ // leftAlign flag added. If the alignment requested is 'fit to width' and the text length is very small, // then the text is either centered or left-aligned, depnding on the value of leftAlign. -void Createdxf::drawTextAligned(QString fileName, QString text,double x, double y, double height, double rotation, double oblique,int hAlign, int vAlign, double xAlign,int colour, +void Createdxf::drawTextAligned(const QString& fileName, const QString& text,double x, double y, double height, double rotation, double oblique,int hAlign, int vAlign, double xAlign,int colour, bool leftAlign, float scale) { Q_UNUSED(scale); diff --git a/sources/createdxf.h b/sources/createdxf.h index 54a3c2cad..cffa6e820 100644 --- a/sources/createdxf.h +++ b/sources/createdxf.h @@ -28,11 +28,11 @@ class Createdxf public: Createdxf(); ~Createdxf(); - static void dxfBegin (QString); - static void dxfEnd(QString); + static void dxfBegin (const QString&); + static void dxfEnd(const QString&); // you can add more functions to create more drawings. - static void drawCircle(QString,double,double,double,int); - static void drawArc(QString,double x,double y,double rad,double startAngle,double endAngle,int color); + static void drawCircle(const QString&,double,double,double,int); + static void drawArc(const QString&,double x,double y,double rad,double startAngle,double endAngle,int color); static void drawDonut(QString,double,double,double,int); static void drawArcEllipse (const QString &file_path, qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal spanAngle, qreal hotspot_x, qreal hotspot_y, qreal rotation_angle, const int &colorcode); @@ -45,8 +45,8 @@ class Createdxf static void drawLine(const QString &filapath,double,double,double,double, const int &clorcode); static void drawLine(const QString &filepath, const QLineF &line,const int &colorcode); - static void drawText(QString,QString,double,double,double,double,int); - static void drawTextAligned(QString fileName, QString text,double x, double y, double height, double rotation, double oblique,int hAlign, int vAlign, double xAlign, int colour, bool leftAlign = false, float scale = 0); + static void drawText(const QString&,const QString&,double,double,double,double,int); + static void drawTextAligned(const QString& fileName, const QString& text,double x, double y, double height, double rotation, double oblique,int hAlign, int vAlign, double xAlign, int colour, bool leftAlign = false, float scale = 0); static int getcolorCode (const long red, const long green, const long blue); diff --git a/sources/diagram.cpp b/sources/diagram.cpp index 25e8091bf..c6c887412 100644 --- a/sources/diagram.cpp +++ b/sources/diagram.cpp @@ -1,4 +1,4 @@ -/* +/* Copyright 2006-2017 The QElectroTech Team This file is part of QElectroTech. @@ -729,7 +729,7 @@ QDomDocument Diagram::toXml(bool whole_content) { + * @param hash to retrieve content with content + * @param sequential type + */ -void Diagram::folioSequentialsToXml(QHash *hash, QDomElement *domElement, QString seq_type, QString type, QDomDocument *doc) { +void Diagram::folioSequentialsToXml(QHash *hash, QDomElement *domElement, const QString& seq_type, const QString& type, QDomDocument *doc) { QHash::iterator i; for (i = hash->begin(); i != hash->end(); i++) { QDomElement folioseq = doc->createElement(type); @@ -795,7 +795,7 @@ bool Diagram::initFromXml(QDomElement &document, QPointF position, bool consider @return true si l'import a reussi, false sinon */ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_informations, DiagramContent *content_ptr) { - QDomElement root = document; + const QDomElement& root = document; // The first element must be a diagram if (root.tagName() != "diagram") return(false); @@ -1019,7 +1019,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf * @param seq type * @param type of sequential */ -void Diagram::folioSequentialsFromXml(const QDomElement &root, QHash* hash, QString folioSeq, QString seq, QString type, QString autonumFolioSeqType) { +void Diagram::folioSequentialsFromXml(const QDomElement &root, QHash* hash, const QString& folioSeq, const QString& seq, const QString& type, const QString& autonumFolioSeqType) { foreach (QDomElement folioSeqAutoNum, QET::findInDomElement(root, autonumFolioSeqType, folioSeq)) { for(QDomElement folioseq = folioSeqAutoNum.firstChildElement(type); !folioseq.isNull(); folioseq = folioseq.nextSiblingElement(type)) { QString title = folioseq.attribute("title"); @@ -1236,7 +1236,7 @@ void Diagram::updateLabels() * @param type to be treated * @param Numerotation Context to be manipulated */ -void Diagram::insertFolioSeqHash(QHash *hash, QString title, QString type, NumerotationContext *nc) { +void Diagram::insertFolioSeqHash(QHash *hash, const QString& title, const QString& type, NumerotationContext *nc) { QStringList max; for (int i = 0; i < nc->size(); i++) { if (nc->itemAt(i).at(0) == type) { @@ -1257,7 +1257,7 @@ void Diagram::insertFolioSeqHash(QHash *hash, QString titl * @param type to be treated * @param Numerotation Context to be manipulated */ -void Diagram::loadFolioSeqHash(QHash *hash, QString title, QString type, NumerotationContext *nc) { +void Diagram::loadFolioSeqHash(QHash *hash, const QString& title, const QString& type, NumerotationContext *nc) { int j = 0; for (int i = 0; i < nc->size(); i++) { if (nc->itemAt(i).at(0) == type) { diff --git a/sources/diagram.h b/sources/diagram.h index 5ffc4ed63..7991cc377 100644 --- a/sources/diagram.h +++ b/sources/diagram.h @@ -153,8 +153,8 @@ class Diagram : public QGraphicsScene bool initFromXml(QDomElement &, QPointF = QPointF(), bool = true, DiagramContent * = nullptr); bool fromXml(QDomDocument &, QPointF = QPointF(), bool = true, DiagramContent * = nullptr); bool fromXml(QDomElement &, QPointF = QPointF(), bool = true, DiagramContent * = nullptr); - void folioSequentialsToXml(QHash*, QDomElement *, QString, QString, QDomDocument *); - void folioSequentialsFromXml(const QDomElement&, QHash*, QString, QString, QString, QString); + void folioSequentialsToXml(QHash*, QDomElement *, const QString&, const QString&, QDomDocument *); + void folioSequentialsFromXml(const QDomElement&, QHash*, const QString&, const QString&, const QString&, const QString&); void refreshContents(); @@ -210,8 +210,8 @@ class Diagram : public QGraphicsScene bool freezeNewConductors(); //methods related to insertion and loading of folio sequential - void insertFolioSeqHash (QHash *hash, QString title, QString seq, NumerotationContext *nc); - void loadFolioSeqHash (QHash *hash, QString title, QString seq, NumerotationContext *nc); + void insertFolioSeqHash (QHash *hash, const QString& title, const QString& seq, NumerotationContext *nc); + void loadFolioSeqHash (QHash *hash, const QString& title, const QString& seq, NumerotationContext *nc); void changeZValue(QET::DepthOption option); public slots: diff --git a/sources/diagramcommands.cpp b/sources/diagramcommands.cpp index f83c7a62c..26cbfbdfd 100644 --- a/sources/diagramcommands.cpp +++ b/sources/diagramcommands.cpp @@ -283,7 +283,7 @@ void MoveElementsCommand::move(const QPointF &actual_movement) * @param start value at start * @param end value at end */ -void MoveElementsCommand::setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant start, const QVariant end) { +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); diff --git a/sources/diagramcommands.h b/sources/diagramcommands.h index d68cbc818..f1646ff1e 100644 --- a/sources/diagramcommands.h +++ b/sources/diagramcommands.h @@ -138,7 +138,7 @@ class MoveElementsCommand : public QUndoCommand { virtual void move(const QPointF &); private: - void setupAnimation (QObject * target, const QByteArray &propertyName, const QVariant start, const QVariant end); + void setupAnimation (QObject * target, const QByteArray &propertyName, const QVariant& start, const QVariant& end); // attributes private: diff --git a/sources/diagramfoliolist.cpp b/sources/diagramfoliolist.cpp index 89e30c330..7759d43d3 100644 --- a/sources/diagramfoliolist.cpp +++ b/sources/diagramfoliolist.cpp @@ -119,8 +119,8 @@ void DiagramFolioList::drawBackground(QPainter *p, const QRectF &r) * @param qp Qpainter to use * @param row_rect rectangle where we must draw the new row */ -void DiagramFolioList::fillRow(QPainter *qp, const QRectF &row_rect, QString author, QString title, - QString folio, QString machine, QString loc, QString indexrev, QString date) +void DiagramFolioList::fillRow(QPainter *qp, const QRectF &row_rect, const QString& author, const QString& title, + const QString& folio, const QString& machine, const QString& loc, const QString& indexrev, const QString& date) { qreal x = row_rect.topLeft().x(); qreal y = row_rect.topLeft().y(); diff --git a/sources/diagramfoliolist.h b/sources/diagramfoliolist.h index c2173f7fd..55d0324da 100644 --- a/sources/diagramfoliolist.h +++ b/sources/diagramfoliolist.h @@ -37,7 +37,7 @@ class DiagramFolioList : public Diagram void drawBackground(QPainter *, const QRectF &) override; private: - void fillRow(QPainter *, const QRectF &, QString, QString, QString, QString, QString, QString, QString); + void fillRow(QPainter *, const QRectF &, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&); void buildGrid(QPainter *, const QRectF &, int, int, qreal[]); void fillHeader(QPainter *, const QRectF &); diff --git a/sources/diagramprintdialog.cpp b/sources/diagramprintdialog.cpp index e41d96d69..a4e2241a0 100644 --- a/sources/diagramprintdialog.cpp +++ b/sources/diagramprintdialog.cpp @@ -352,7 +352,7 @@ void DiagramPrintDialog::browseFilePrintTypeDialog() { ou non @param options Options de rendu */ -void DiagramPrintDialog::print(const QList &diagrams, bool fit_page, const ExportProperties options) { +void DiagramPrintDialog::print(const QList &diagrams, bool fit_page, const ExportProperties& options) { //qDebug() << "Demande d'impression de " << diagrams.count() << "schemas."; #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) #ifdef Q_OS_WIN @@ -516,7 +516,7 @@ void DiagramPrintDialog::printDiagram(Diagram *diagram, bool fit_page, const Exp @param save true pour memoriser les parametres du schema et appliquer ceux definis dans options, false pour restaurer les parametres */ -void DiagramPrintDialog::saveReloadDiagramParameters(Diagram *diagram, const ExportProperties options, bool save) { +void DiagramPrintDialog::saveReloadDiagramParameters(Diagram *diagram, const ExportProperties& options, bool save) { static ExportProperties state_exportProperties; if (save) { diff --git a/sources/diagramprintdialog.h b/sources/diagramprintdialog.h index 3072588ec..26ca1d9c3 100644 --- a/sources/diagramprintdialog.h +++ b/sources/diagramprintdialog.h @@ -56,13 +56,13 @@ class DiagramPrintDialog : public QWidget private: void buildPrintTypeDialog(); void buildDialog(); - void saveReloadDiagramParameters(Diagram *, const ExportProperties, bool); + void saveReloadDiagramParameters(Diagram *, const ExportProperties&, bool); void savePageSetupForCurrentPrinter(); void loadPageSetupForCurrentPrinter(); QString settingsSectionName(const QPrinter *); private slots: - void print(const QList &, bool, const ExportProperties); + void print(const QList &, bool, const ExportProperties&); void printDiagram(Diagram *, bool, const ExportProperties &, QPainter *, QPrinter * = nullptr); void updatePrintTypeDialog(); void acceptPrintTypeDialog(); diff --git a/sources/editor/editorcommands.cpp b/sources/editor/editorcommands.cpp index 0476975c8..2b9f56dba 100644 --- a/sources/editor/editorcommands.cpp +++ b/sources/editor/editorcommands.cpp @@ -83,7 +83,7 @@ void ElementEditionCommand::setElementView(ElementView *view) { */ DeletePartsCommand::DeletePartsCommand( ElementScene *scene, - const QList parts, + const QList& parts, QUndoCommand *parent ) : ElementEditionCommand(QObject::tr("suppression", "undo caption"), scene, nullptr, parent), @@ -201,7 +201,7 @@ void PastePartsCommand::setOffset(int old_offset_pc, const QPointF &old_start_tl */ CutPartsCommand::CutPartsCommand( ElementScene *scene, - const QList parts, + const QList& parts, QUndoCommand *parent ) : DeletePartsCommand(scene, parts, parent) @@ -224,7 +224,7 @@ CutPartsCommand::~CutPartsCommand() { MovePartsCommand::MovePartsCommand( const QPointF &m, ElementScene *scene, - const QList parts, + const QList& parts, QUndoCommand *parent ) : ElementEditionCommand(QObject::tr("déplacement", "undo caption"), scene, nullptr, parent), @@ -593,7 +593,7 @@ void ScalePartsCommand::adjustText() { * @param context: new info about type. * @param parent: parent undo */ -ChangePropertiesCommand::ChangePropertiesCommand(ElementScene *scene, QString type, DiagramContext info, DiagramContext elmt_info, QUndoCommand *parent) : +ChangePropertiesCommand::ChangePropertiesCommand(ElementScene *scene, const QString& type, const DiagramContext& info, const DiagramContext& elmt_info, QUndoCommand *parent) : ElementEditionCommand(scene, nullptr, parent) { m_type << scene->m_elmt_type << type; diff --git a/sources/editor/editorcommands.h b/sources/editor/editorcommands.h index 43b06437d..461d3ea97 100644 --- a/sources/editor/editorcommands.h +++ b/sources/editor/editorcommands.h @@ -60,7 +60,7 @@ class ElementEditionCommand : public QUndoCommand class DeletePartsCommand : public ElementEditionCommand { // constructors, destructor public: - DeletePartsCommand(ElementScene *, const QList, QUndoCommand * = nullptr); + DeletePartsCommand(ElementScene *, const QList&, QUndoCommand * = nullptr); ~DeletePartsCommand() override; private: DeletePartsCommand(const DeletePartsCommand &); @@ -113,7 +113,7 @@ class PastePartsCommand : public ElementEditionCommand { class CutPartsCommand : public DeletePartsCommand { // constructors, destructor public: - CutPartsCommand(ElementScene *, const QList, QUndoCommand * = nullptr); + CutPartsCommand(ElementScene *, const QList&, QUndoCommand * = nullptr); ~CutPartsCommand() override; private: CutPartsCommand(const CutPartsCommand &); @@ -125,7 +125,7 @@ class CutPartsCommand : public DeletePartsCommand { class MovePartsCommand : public ElementEditionCommand { // constructors, destructor public: - MovePartsCommand(const QPointF &, ElementScene *, const QList, QUndoCommand * = nullptr); + MovePartsCommand(const QPointF &, ElementScene *, const QList&, QUndoCommand * = nullptr); ~MovePartsCommand() override; private: MovePartsCommand(const MovePartsCommand &); @@ -290,7 +290,7 @@ class ScalePartsCommand : public ElementEditionCommand { class ChangePropertiesCommand : public ElementEditionCommand { public: - ChangePropertiesCommand (ElementScene *scene, QString type, DiagramContext info, DiagramContext elmt_info, QUndoCommand *parent=nullptr); + ChangePropertiesCommand (ElementScene *scene, const QString& type, const DiagramContext& info, const DiagramContext& elmt_info, QUndoCommand *parent=nullptr); ~ChangePropertiesCommand () override; void undo() override; diff --git a/sources/editor/elementscene.cpp b/sources/editor/elementscene.cpp index 70a10cb33..dc03397e7 100644 --- a/sources/editor/elementscene.cpp +++ b/sources/editor/elementscene.cpp @@ -580,7 +580,7 @@ QETElementEditor* ElementScene::editor() const { return m_element_editor; } -void ElementScene::setElementInfo(DiagramContext dc) +void ElementScene::setElementInfo(const DiagramContext& dc) { if(m_elmt_information != dc) { diff --git a/sources/editor/elementscene.h b/sources/editor/elementscene.h index 9910f783b..b49cb5bd7 100644 --- a/sources/editor/elementscene.h +++ b/sources/editor/elementscene.h @@ -120,7 +120,7 @@ class ElementScene : public QGraphicsScene void cut(); void copy(); QETElementEditor* editor() const; - void setElementInfo(DiagramContext dc); + void setElementInfo(const DiagramContext& dc); protected: void mouseMoveEvent (QGraphicsSceneMouseEvent *) override; diff --git a/sources/editor/graphicspart/partdynamictextfield.cpp b/sources/editor/graphicspart/partdynamictextfield.cpp index 7956c1d68..bdcfe866f 100644 --- a/sources/editor/graphicspart/partdynamictextfield.cpp +++ b/sources/editor/graphicspart/partdynamictextfield.cpp @@ -333,7 +333,7 @@ QString PartDynamicTextField::compositeText() const{ * @brief PartDynamicTextField::setColor * @param color set text color to color */ -void PartDynamicTextField::setColor(QColor color) +void PartDynamicTextField::setColor(const QColor& color) { setDefaultTextColor(color); emit colorChanged(color); diff --git a/sources/editor/graphicspart/partdynamictextfield.h b/sources/editor/graphicspart/partdynamictextfield.h index ec2f073cf..f5aac2682 100644 --- a/sources/editor/graphicspart/partdynamictextfield.h +++ b/sources/editor/graphicspart/partdynamictextfield.h @@ -86,7 +86,7 @@ class PartDynamicTextField : public QGraphicsTextItem, public CustomElementPart QString infoName() const; void setCompositeText(const QString &text); QString compositeText() const; - void setColor(QColor color); + void setColor(const QColor& color); QColor color() const; void setFontSize(int s); int fontSize()const; diff --git a/sources/editor/qetelementeditor.cpp b/sources/editor/qetelementeditor.cpp index f2a1abae5..e1c35fbc2 100644 --- a/sources/editor/qetelementeditor.cpp +++ b/sources/editor/qetelementeditor.cpp @@ -55,6 +55,7 @@ #include #include #include +#include /* Nombre maximum de primitives affichees par la "liste des parties" @@ -408,7 +409,7 @@ void QETElementEditor::setupMenus() { void QETElementEditor::contextMenu(QPoint p, QList actions) { QMenu menu(this); - menu.addActions(actions); + menu.addActions(std::move(actions)); menu.addSeparator(); menu.addAction(undo); menu.addAction(redo); diff --git a/sources/editor/ui/dynamictextfieldeditor.cpp b/sources/editor/ui/dynamictextfieldeditor.cpp index 76d3d1e30..1c9e3e34e 100644 --- a/sources/editor/ui/dynamictextfieldeditor.cpp +++ b/sources/editor/ui/dynamictextfieldeditor.cpp @@ -45,7 +45,7 @@ DynamicTextFieldEditor::~DynamicTextFieldEditor() { delete ui; if(!m_connection_list.isEmpty()) - for(QMetaObject::Connection con : m_connection_list) + for(const QMetaObject::Connection& con : m_connection_list) disconnect(con); } @@ -59,7 +59,7 @@ bool DynamicTextFieldEditor::setPart(CustomElementPart *part) { //Remove previous connection if(!m_connection_list.isEmpty()) - for(QMetaObject::Connection con : m_connection_list) + for(const QMetaObject::Connection& con : m_connection_list) disconnect(con); QGraphicsItem *qgi = part->toItem(); @@ -129,7 +129,7 @@ void DynamicTextFieldEditor::updateForm() } } -void DynamicTextFieldEditor::setColorPushButton(QColor color) +void DynamicTextFieldEditor::setColorPushButton(const QColor& color) { QPalette palette; palette.setColor(QPalette::Button, color); @@ -155,10 +155,10 @@ void DynamicTextFieldEditor::fillInfoComboBox() //We use a QMap because the keys of the map are sorted, then no matter the curent local, //the value of the combo box are always alphabetically sorted QMap info_map; - for(QString str : strl) + for(const QString& str : strl) info_map.insert(QETApp::elementTranslatedInfoKey(str), str); - for (QString key : info_map.keys()) + for (const QString& key : info_map.keys()) ui->m_elmt_info_cb->addItem(key, info_map.value(key)); } diff --git a/sources/editor/ui/dynamictextfieldeditor.h b/sources/editor/ui/dynamictextfieldeditor.h index ce5315860..446dd78b1 100644 --- a/sources/editor/ui/dynamictextfieldeditor.h +++ b/sources/editor/ui/dynamictextfieldeditor.h @@ -42,7 +42,7 @@ class DynamicTextFieldEditor : public ElementItemEditor void updateForm() override; private: - void setColorPushButton(QColor color); + void setColorPushButton(const QColor& color); void fillInfoComboBox(); private slots: diff --git a/sources/editor/ui/elementpropertieseditorwidget.cpp b/sources/editor/ui/elementpropertieseditorwidget.cpp index 157343b50..3d82306b6 100644 --- a/sources/editor/ui/elementpropertieseditorwidget.cpp +++ b/sources/editor/ui/elementpropertieseditorwidget.cpp @@ -154,7 +154,7 @@ void ElementPropertiesEditorWidget::populateTree() { QStringList keys{"label", "comment", "description", "designation", "manufacturer", "manufacturer-reference", "provider", "machine-manufacturer-reference"}; - for(QString key : keys) + for(const QString& key : keys) { QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_tree); qtwi->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable); diff --git a/sources/elementspanel.cpp b/sources/elementspanel.cpp index c62d8188e..b578dbae7 100644 --- a/sources/elementspanel.cpp +++ b/sources/elementspanel.cpp @@ -174,7 +174,7 @@ QTreeWidgetItem *ElementsPanel::updateTemplateItem(QTreeWidgetItem *tb_template_ /** @return true if \a item matches the filter, false otherwise */ -bool ElementsPanel::matchesFilter(const QTreeWidgetItem *item, QString filter) const { +bool ElementsPanel::matchesFilter(const QTreeWidgetItem *item, const QString& filter) const { if (!item) return(false); // no filter => we consider the item matches diff --git a/sources/elementspanel.h b/sources/elementspanel.h index 76bdca5e1..11002c1ee 100644 --- a/sources/elementspanel.h +++ b/sources/elementspanel.h @@ -68,7 +68,7 @@ class ElementsPanel : public GenericPanel { protected: void startDrag(Qt::DropActions) override; void startTitleBlockTemplateDrag(const TitleBlockTemplateLocation &); - bool matchesFilter(const QTreeWidgetItem *, QString) const; + bool matchesFilter(const QTreeWidgetItem *, const QString&) const; protected slots: void panelContentChange(); diff --git a/sources/elementtextpattern.cpp b/sources/elementtextpattern.cpp index 084d06e82..e4b3a6ef0 100644 --- a/sources/elementtextpattern.cpp +++ b/sources/elementtextpattern.cpp @@ -162,7 +162,7 @@ ImportElementTextPattern::ImportElementTextPattern(Element *elmt): * @param ok * @return */ -QString ImportElementTextPattern::getName(QStringList list, bool &ok) const +QString ImportElementTextPattern::getName(const QStringList& list, bool &ok) const { return QInputDialog::getItem(parentWidget(), QObject::tr("Séléctionner une configuration de textes"), @@ -221,7 +221,7 @@ void ImportElementTextPattern::apply(QString name) const //In each group of the xml description, replace the original uuids, by the news created upper. QList groups = QET::findInDomElement(root, "texts_groups", "texts_group"); - for(QDomElement group : groups) + for(const QDomElement& group : groups) { for(QDomElement text : QET::findInDomElement(group, "texts", "text")) { @@ -236,14 +236,14 @@ void ImportElementTextPattern::apply(QString name) const undo_stack.beginMacro(QObject::tr("Importer la configuration de texte : %1").arg(name.remove(".xml"))); //Add the texts to element - for(QDomElement text : texts) + for(const QDomElement& text : texts) { DynamicElementTextItem *deti = new DynamicElementTextItem(m_element); undo_stack.push(new AddElementTextCommand(m_element, deti)); deti->fromXml(text); } //Add the groups to element - for(QDomElement xml_group : groups) + for(const QDomElement& xml_group : groups) undo_stack.push(new AddTextsGroupCommand(m_element, xml_group)); undo_stack.endMacro(); diff --git a/sources/elementtextpattern.h b/sources/elementtextpattern.h index 17079aa10..fb780412b 100644 --- a/sources/elementtextpattern.h +++ b/sources/elementtextpattern.h @@ -45,7 +45,7 @@ class ImportElementTextPattern ImportElementTextPattern(Element *elmt); private: - QString getName(QStringList list, bool &ok) const; + QString getName(const QStringList& list, bool &ok) const; QWidget *parentWidget() const; void apply(QString name) const; diff --git a/sources/exportdialog.cpp b/sources/exportdialog.cpp index 1f2a4f25d..27530f924 100644 --- a/sources/exportdialog.cpp +++ b/sources/exportdialog.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include "qeticons.h" #include "qetmessagebox.h" #include "exportpropertieswidget.h" @@ -649,7 +650,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee saveReloadDiagramParameters(diagram, false); } -void ExportDialog::fillRow(QString file_path, const QRectF &row_rect, QString author, QString title, +void ExportDialog::fillRow(const QString& file_path, const QRectF &row_rect, QString author, const QString& title, QString folio, QString date) { qreal x = row_rect.bottomLeft().x(); @@ -660,7 +661,7 @@ void ExportDialog::fillRow(QString file_path, const QRectF &row_rect, QString au qreal height = row_rect.height() * Createdxf::yScale *0.7; y += height*0.2; - Createdxf::drawTextAligned(file_path, folio, + Createdxf::drawTextAligned(file_path, std::move(folio), x + 0.02*DiagramFolioList::colWidths[0]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0, x + 0.95*DiagramFolioList::colWidths[0]*row_rect.width()*Createdxf::xScale, 0); @@ -676,12 +677,12 @@ void ExportDialog::fillRow(QString file_path, const QRectF &row_rect, QString au x + 0.02*DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale, 0, true); x += DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale; - Createdxf::drawTextAligned(file_path, author, + Createdxf::drawTextAligned(file_path, std::move(author), x + 0.02*DiagramFolioList::colWidths[2]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0, x + 3.02*DiagramFolioList::colWidths[2]*row_rect.width()*Createdxf::xScale, 0); x += DiagramFolioList::colWidths[2]*row_rect.width()*Createdxf::xScale; - Createdxf::drawTextAligned(file_path, date, + Createdxf::drawTextAligned(file_path, std::move(date), x + 0.02*DiagramFolioList::colWidths[3]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0, x + 5.02*DiagramFolioList::colWidths[3]*row_rect.width()*Createdxf::xScale, 0); } diff --git a/sources/exportdialog.h b/sources/exportdialog.h index 78350024b..dc49bdea0 100644 --- a/sources/exportdialog.h +++ b/sources/exportdialog.h @@ -90,7 +90,7 @@ class ExportDialog : public QDialog { void saveReloadDiagramParameters(Diagram *, bool = true); void generateSvg(Diagram *, int, int, bool, QIODevice &); void generateDxf(Diagram *, int, int, bool, QString &); - void fillRow(QString, const QRectF &, QString, QString, QString, QString); + void fillRow(const QString&, const QRectF &, QString, const QString&, QString, QString); QImage generateImage(Diagram *, int, int, bool); void exportDiagram(ExportDiagramLine *); qreal diagramRatio(Diagram *); diff --git a/sources/projectconfigpages.cpp b/sources/projectconfigpages.cpp index 74bbb96bf..121ffa48a 100644 --- a/sources/projectconfigpages.cpp +++ b/sources/projectconfigpages.cpp @@ -344,7 +344,7 @@ void ProjectAutoNumConfigPage::buildConnections() * Display the current selected context for conductor * @param str, key of context stored in project */ -void ProjectAutoNumConfigPage::updateContextConductor(QString str) { +void ProjectAutoNumConfigPage::updateContextConductor(const QString& str) { if (str == tr("Nom de la nouvelle numérotation")) m_saw_conductor -> setContext(NumerotationContext()); else m_saw_conductor ->setContext(m_project->conductorAutoNum(str)); } @@ -354,7 +354,7 @@ void ProjectAutoNumConfigPage::updateContextConductor(QString str) { * Display the current selected context for folio * @param str, key of context stored in project */ -void ProjectAutoNumConfigPage::updateContextFolio(QString str) { +void ProjectAutoNumConfigPage::updateContextFolio(const QString& str) { if (str == tr("Nom de la nouvelle numérotation")) m_saw_folio -> setContext(NumerotationContext()); else m_saw_folio ->setContext(m_project->folioAutoNum(str)); } @@ -364,7 +364,7 @@ void ProjectAutoNumConfigPage::updateContextFolio(QString str) { * Display the current selected context for element * @param str, key of context stored in project */ -void ProjectAutoNumConfigPage::updateContextElement(QString str) +void ProjectAutoNumConfigPage::updateContextElement(const QString& str) { if (str == tr("Nom de la nouvelle numérotation")) { diff --git a/sources/projectconfigpages.h b/sources/projectconfigpages.h index 4fee3a729..1894c805b 100644 --- a/sources/projectconfigpages.h +++ b/sources/projectconfigpages.h @@ -136,13 +136,13 @@ class ProjectAutoNumConfigPage : public ProjectConfigPage { private: void buildConnections(); private slots: - void updateContextConductor(QString);//conductor + void updateContextConductor(const QString&);//conductor void saveContextConductor(); void removeContextConductor(); - void updateContextFolio(QString);//folio + void updateContextFolio(const QString&);//folio void saveContextFolio(); void removeContextFolio(); - void updateContextElement(QString);//element + void updateContextElement(const QString&);//element void saveContextElement(); void removeContextElement(); diff --git a/sources/qet.cpp b/sources/qet.cpp index bad248eb6..7733b1825 100644 --- a/sources/qet.cpp +++ b/sources/qet.cpp @@ -195,7 +195,7 @@ bool QET::orthogonalProjection(const QPointF &point, const QLineF &line, QPointF @param entier Pointeur facultatif vers un entier @return true si l'attribut est bien un entier, false sinon */ -bool QET::attributeIsAnInteger(const QDomElement &e, QString nom_attribut, int *entier) { +bool QET::attributeIsAnInteger(const QDomElement &e, const QString& nom_attribut, int *entier) { // verifie la presence de l'attribut if (!e.hasAttribute(nom_attribut)) return(false); // verifie la validite de l'attribut @@ -214,7 +214,7 @@ bool QET::attributeIsAnInteger(const QDomElement &e, QString nom_attribut, int * @param reel Pointeur facultatif vers un double @return true si l'attribut est bien un reel, false sinon */ -bool QET::attributeIsAReal(const QDomElement &e, QString nom_attribut, qreal *reel) { +bool QET::attributeIsAReal(const QDomElement &e, const QString& nom_attribut, qreal *reel) { // verifie la presence de l'attribut if (!e.hasAttribute(nom_attribut)) return(false); // verifie la validite de l'attribut diff --git a/sources/qet.h b/sources/qet.h index b5dcb16f4..f6040c559 100644 --- a/sources/qet.h +++ b/sources/qet.h @@ -158,8 +158,8 @@ namespace QET { bool lineContainsPoint(const QLineF &, const QPointF &); bool orthogonalProjection(const QPointF &, const QLineF &, QPointF * = nullptr); - bool attributeIsAnInteger(const QDomElement &, QString , int * = nullptr); - bool attributeIsAReal(const QDomElement &, QString , qreal * = nullptr); + bool attributeIsAnInteger(const QDomElement &, const QString& , int * = nullptr); + bool attributeIsAReal(const QDomElement &, const QString& , qreal * = nullptr); QString ElementsAndConductorsSentence(int, int, int = 0, int = 0, int = 0, int = 0); QList findInDomElement(const QDomElement &, const QString &); QList findInDomElement(const QDomElement &, const QString &, const QString &); diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp index 2d68fde7e..38b6e888a 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -149,7 +149,7 @@ QETApp::~QETApp() { QStringList extension_filter("*.qet"); QStringList list = dir.entryList(extension_filter); - for(QString str : list) + for(const QString& str : list) dir.remove(str); } } @@ -1660,13 +1660,13 @@ void QETApp::checkBackupFiles() else text.append(tr("Les fichiers de restauration suivant on été trouvé,
" "Voulez-vous les ouvrir ?

")); - for(QString name : list) + for(const QString& name : list) text.append("
" + name); if (QET::QetMessageBox::question(nullptr, tr("Fichier de restauration"), text, QMessageBox::Ok|QMessageBox::Cancel) == QMessageBox::Ok) { QStringList files_list; - for(QString str : list) + for(const QString& str : list) files_list << dir.path() + "/" + str; QList diagrams_editors = diagramEditors(); @@ -1691,7 +1691,7 @@ void QETApp::checkBackupFiles() de_open -> setVisible(true); } - for(QString file : files_list) { + for(const QString& file : files_list) { de_open -> openAndAddProject(file); } } diff --git a/sources/qetgraphicsitem/conductor.cpp b/sources/qetgraphicsitem/conductor.cpp index 8b2061c6c..b723f9755 100644 --- a/sources/qetgraphicsitem/conductor.cpp +++ b/sources/qetgraphicsitem/conductor.cpp @@ -41,7 +41,7 @@ class ConductorXmlRetroCompatibility { friend class Conductor; - static void loadSequential(const QDomElement &dom_element, QString seq, QStringList* list) + static void loadSequential(const QDomElement &dom_element, const QString& seq, QStringList* list) { int i = 0; while (!dom_element.attribute(seq + QString::number(i+1)).isEmpty()) @@ -939,7 +939,7 @@ QList Conductor::segmentsToPoints() const { Regenere les segments de ce conducteur a partir de la liste de points passee en parametre @param points_list Liste de points a utiliser pour generer les segments */ -void Conductor::pointsToSegments(QList points_list) { +void Conductor::pointsToSegments(const QList& points_list) { // supprime les segments actuels deleteSegments(); @@ -1667,7 +1667,7 @@ void Conductor::editProperty() { ConductorPropertiesDialog::PropertiesDialog(this, diagramEditor()); } -void Conductor::setSequenceNum(autonum::sequentialNumbers sn) +void Conductor::setSequenceNum(const autonum::sequentialNumbers& sn) { m_autoNum_seq = sn; refreshText(); diff --git a/sources/qetgraphicsitem/conductor.h b/sources/qetgraphicsitem/conductor.h index b1fe3f0ae..c66121a89 100644 --- a/sources/qetgraphicsitem/conductor.h +++ b/sources/qetgraphicsitem/conductor.h @@ -121,7 +121,7 @@ class Conductor : public QGraphicsObject autonum::sequentialNumbers sequenceNum () const {return m_autoNum_seq;} autonum::sequentialNumbers& rSequenceNum() {return m_autoNum_seq;} - void setSequenceNum(autonum::sequentialNumbers sn); + void setSequenceNum(const autonum::sequentialNumbers& sn); private: void setUpConnectionForFormula(QString old_formula, QString new_formula); @@ -194,7 +194,7 @@ class Conductor : public QGraphicsObject QList segmentsToPoints() const; QList bends() const; QList junctions() const; - void pointsToSegments(QList); + void pointsToSegments(const QList&); Qt::Corner currentPathType() const; void deleteSegments(); static int getCoeff(const qreal &, const qreal &); diff --git a/sources/qetgraphicsitem/crossrefitem.cpp b/sources/qetgraphicsitem/crossrefitem.cpp index c272a8db0..ed3ea48ab 100644 --- a/sources/qetgraphicsitem/crossrefitem.cpp +++ b/sources/qetgraphicsitem/crossrefitem.cpp @@ -96,7 +96,7 @@ void CrossRefItem::init() */ void CrossRefItem::setUpConnection() { - for(QMetaObject::Connection c : m_update_connection) + for(const QMetaObject::Connection& c : m_update_connection) disconnect(c); m_update_connection.clear(); @@ -369,7 +369,7 @@ void CrossRefItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) void CrossRefItem::linkedChanged() { - for(QMetaObject::Connection c : m_slave_connection) + for(const QMetaObject::Connection& c : m_slave_connection) disconnect(c); m_slave_connection.clear(); @@ -781,7 +781,7 @@ void CrossRefItem::fillCrossRef(QPainter &painter) * @param painter painter to use for draw the text * @param type type of Info do be draw e.g. comment, location. */ -void CrossRefItem::AddExtraInfo(QPainter &painter, QString type) +void CrossRefItem::AddExtraInfo(QPainter &painter, const QString& type) { QString text = autonum::AssignVariables::formulaToLabel(m_element -> elementInformations()[type].toString(), m_element->rSequenceStruct(), m_element->diagram(), m_element); bool must_show = m_element -> elementInformations().keyMustShow(type); diff --git a/sources/qetgraphicsitem/crossrefitem.h b/sources/qetgraphicsitem/crossrefitem.h index 6f35a0eb0..d8942b726 100644 --- a/sources/qetgraphicsitem/crossrefitem.h +++ b/sources/qetgraphicsitem/crossrefitem.h @@ -91,7 +91,7 @@ class CrossRefItem : public QGraphicsObject void drawAsContacts (QPainter &painter); QRectF drawContact (QPainter &painter, int flags, Element *elmt); void fillCrossRef (QPainter &painter); - void AddExtraInfo (QPainter &painter, QString); + void AddExtraInfo (QPainter &painter, const QString&); QList NOElements() const; QList NCElements() const; diff --git a/sources/qetgraphicsitem/diagramtextitem.cpp b/sources/qetgraphicsitem/diagramtextitem.cpp index 2deb0888c..3eb583aa5 100644 --- a/sources/qetgraphicsitem/diagramtextitem.cpp +++ b/sources/qetgraphicsitem/diagramtextitem.cpp @@ -163,7 +163,7 @@ int DiagramTextItem::fontSize() const return font().pointSize(); } -void DiagramTextItem::setColor(QColor color) +void DiagramTextItem::setColor(const QColor& color) { setDefaultTextColor(color); emit colorChanged(color); diff --git a/sources/qetgraphicsitem/diagramtextitem.h b/sources/qetgraphicsitem/diagramtextitem.h index e405095e1..b43d0d81f 100644 --- a/sources/qetgraphicsitem/diagramtextitem.h +++ b/sources/qetgraphicsitem/diagramtextitem.h @@ -68,7 +68,7 @@ class DiagramTextItem : public QGraphicsTextItem void setFontSize(int s); int fontSize()const; - void setColor(QColor color); + void setColor(const QColor& color); QColor color() const; void setNoEditable(bool e = true) {m_no_editable = e;} diff --git a/sources/qetgraphicsitem/dynamicelementtextitem.cpp b/sources/qetgraphicsitem/dynamicelementtextitem.cpp index 68268a1e5..d42878e2d 100644 --- a/sources/qetgraphicsitem/dynamicelementtextitem.cpp +++ b/sources/qetgraphicsitem/dynamicelementtextitem.cpp @@ -969,7 +969,7 @@ void DynamicElementTextItem::setupFormulaConnection() void DynamicElementTextItem::clearFormulaConnection() { - for (QMetaObject::Connection con : m_formula_connection) + for (const QMetaObject::Connection& con : m_formula_connection) disconnect(con); m_formula_connection.clear(); } diff --git a/sources/qetgraphicsitem/element.cpp b/sources/qetgraphicsitem/element.cpp index 789696f31..3a535a5da 100644 --- a/sources/qetgraphicsitem/element.cpp +++ b/sources/qetgraphicsitem/element.cpp @@ -20,6 +20,7 @@ #include "conductor.h" #include "diagramcommands.h" #include +#include #include "elementprovider.h" #include "diagramposition.h" #include "terminal.h" @@ -35,7 +36,7 @@ class ElementXmlRetroCompatibility { friend class Element; - static void loadSequential(const QDomElement &dom_element, QString seq, QStringList* list) + static void loadSequential(const QDomElement &dom_element, const QString& seq, QStringList* list) { int i = 0; while (!dom_element.attribute(seq + QString::number(i+1)).isEmpty()) @@ -451,7 +452,7 @@ bool Element::fromXml(QDomElement &e, QHash &table_id_adr, bool //************************// //***Dynamic texts item***// //************************// - for (QDomElement qde : QET::findInDomElement(e, "dynamic_texts", DynamicElementTextItem::xmlTaggName())) + for (const QDomElement& qde : QET::findInDomElement(e, "dynamic_texts", DynamicElementTextItem::xmlTaggName())) { DynamicElementTextItem *deti = new DynamicElementTextItem(this); addDynamicTextItem(deti); @@ -471,7 +472,7 @@ bool Element::fromXml(QDomElement &e, QHash &table_id_adr, bool for (DynamicElementTextItem *deti : conv_deti_list) { - for(QDomElement dom_input : dom_inputs) + for(const QDomElement& dom_input : dom_inputs) { //we use the same method used in ElementTextItem::fromXml to compar and know if the input dom element is for one of the text stored. //The comparaison is made from the text position : if the position of the text is the same as the position stored in 'input' dom element @@ -1235,7 +1236,7 @@ QString Element::getPrefix() const{ * set Element Prefix */ void Element::setPrefix(QString prefix) { - m_prefix = prefix; + m_prefix = std::move(prefix); } /** diff --git a/sources/qetgraphicsitem/elementtextitemgroup.cpp b/sources/qetgraphicsitem/elementtextitemgroup.cpp index 0a07cc700..86ca54f08 100644 --- a/sources/qetgraphicsitem/elementtextitemgroup.cpp +++ b/sources/qetgraphicsitem/elementtextitemgroup.cpp @@ -28,6 +28,7 @@ #include #include +#include bool sorting(QGraphicsItem *qgia, QGraphicsItem *qgib) { @@ -253,7 +254,7 @@ void ElementTextItemGroup::setVerticalAdjustment(int v) */ void ElementTextItemGroup::setName(QString name) { - m_name = name; + m_name = std::move(name); emit nameChanged(m_name); } @@ -412,7 +413,7 @@ void ElementTextItemGroup::fromXml(QDomElement &dom_element) if(parentElement()) { m_block_alignment_update = true; - for(QDomElement text : QET::findInDomElement(dom_element, "texts", "text")) + for(const QDomElement& text : QET::findInDomElement(dom_element, "texts", "text")) { DynamicElementTextItem *deti = nullptr; QUuid uuid(text.attribute("uuid")); diff --git a/sources/qetgraphicsitem/qetshapeitem.cpp b/sources/qetgraphicsitem/qetshapeitem.cpp index 959e3ff19..291dd6fc8 100644 --- a/sources/qetgraphicsitem/qetshapeitem.cpp +++ b/sources/qetgraphicsitem/qetshapeitem.cpp @@ -880,7 +880,7 @@ bool QetShapeItem::fromXml(const QDomElement &e) } } else { - for(QDomElement de : QET::findInDomElement(e, "points", "point")) { + for(const QDomElement& de : QET::findInDomElement(e, "points", "point")) { m_polygon << QPointF(de.attribute("x", nullptr).toDouble(), de.attribute("y", nullptr).toDouble()); } } diff --git a/sources/qetgraphicsitem/reportelement.cpp b/sources/qetgraphicsitem/reportelement.cpp index f51e69e9e..f12e2987c 100644 --- a/sources/qetgraphicsitem/reportelement.cpp +++ b/sources/qetgraphicsitem/reportelement.cpp @@ -23,7 +23,7 @@ #include "conductor.h" #include "dynamicelementtextitem.h" -ReportElement::ReportElement(const ElementsLocation &location, QString link_type,QGraphicsItem *qgi, int *state) : +ReportElement::ReportElement(const ElementsLocation &location, const QString& link_type,QGraphicsItem *qgi, int *state) : CustomElement(location, qgi, state) { link_type == "next_report"? m_link_type=NextReport : m_link_type=PreviousReport; diff --git a/sources/qetgraphicsitem/reportelement.h b/sources/qetgraphicsitem/reportelement.h index d7aafdbdc..eaefa7d58 100644 --- a/sources/qetgraphicsitem/reportelement.h +++ b/sources/qetgraphicsitem/reportelement.h @@ -30,7 +30,7 @@ class ReportElement : public CustomElement Q_OBJECT public : - explicit ReportElement(const ElementsLocation &,QString link_type, QGraphicsItem * = nullptr, int * = nullptr); + explicit ReportElement(const ElementsLocation &,const QString& link_type, QGraphicsItem * = nullptr, int * = nullptr); ~ReportElement() override; void linkToElement(Element *) override; void unlinkAllElements() override; diff --git a/sources/qetgraphicsitem/terminal.cpp b/sources/qetgraphicsitem/terminal.cpp index 4e8a31c92..01a563947 100644 --- a/sources/qetgraphicsitem/terminal.cpp +++ b/sources/qetgraphicsitem/terminal.cpp @@ -16,6 +16,8 @@ along with QElectroTech. If not, see . */ #include "terminal.h" + +#include #include "diagram.h" #include "qetgraphicsitem/element.h" #include "qetgraphicsitem/conductor.h" @@ -55,9 +57,9 @@ void Terminal::init(QPointF pf, Qet::Orientation o, QString number, QString name default : dock_elmt_ += QPointF(0, -Terminal::terminalSize); } // Number of terminal - number_terminal_ = number; + number_terminal_ = std::move(number); // Name of terminal - name_terminal_ = name; + name_terminal_ = std::move(name); name_terminal_hidden = hiddenName; // par defaut : pas de conducteur @@ -127,7 +129,7 @@ Terminal::Terminal(QPointF pf, Qet::Orientation o, QString num, QString name, bo parent_element_ (e), hovered_color_ (Terminal::neutralColor) { - init(pf, o, num, name, hiddenName); + init(pf, o, std::move(num), std::move(name), hiddenName); } /** @@ -168,7 +170,7 @@ Qet::Orientation Terminal::orientation() const { * @param number */ void Terminal::setNumber(QString number) { - number_terminal_ = number; + number_terminal_ = std::move(number); } /** @@ -176,7 +178,7 @@ void Terminal::setNumber(QString number) { * @param name */ void Terminal::setName(QString name, bool hiddenName) { - name_terminal_ = name; + name_terminal_ = std::move(name); name_terminal_hidden = hiddenName; } diff --git a/sources/qetproject.cpp b/sources/qetproject.cpp index aa451a515..733a81ce7 100644 --- a/sources/qetproject.cpp +++ b/sources/qetproject.cpp @@ -34,6 +34,7 @@ #include #include +#include static int BACKUP_INTERVAL = 300000; //interval in ms of backup @@ -445,7 +446,7 @@ void QETProject::setDefaultReportProperties(const QString &properties) emit reportPropertiesChanged(old, properties); } -void QETProject::setDefaultXRefProperties(const QString type, const XRefProperties &properties) { +void QETProject::setDefaultXRefProperties(const QString& type, const XRefProperties &properties) { m_default_xref_properties.insert(type, properties); emit XRefPropertiesChanged(); } @@ -477,7 +478,7 @@ QHash QETProject::elementAutoNum() const { * @param element autonum title * @return Formula of element autonum stored in element autonum */ -QString QETProject::elementAutoNumFormula (QString key) const +QString QETProject::elementAutoNumFormula (const QString& key) const { if (m_element_autonum.contains(key)) { return autonum::numerotationContextToFormula(m_element_autonum[key]); @@ -507,7 +508,7 @@ QString QETProject::elementCurrentAutoNum () const { * @param autoNum : set the current element autonum to @autonum */ void QETProject::setCurrrentElementAutonum(QString autoNum) { - m_current_element_autonum = autoNum; + m_current_element_autonum = std::move(autoNum); } /** @@ -515,7 +516,7 @@ void QETProject::setCurrrentElementAutonum(QString autoNum) { * @param conductor autonum title * @return Formula of element autonum stored in conductor autonum */ -QString QETProject::conductorAutoNumFormula (QString key) const +QString QETProject::conductorAutoNumFormula (const QString& key) const { if (m_conductor_autonum.contains(key)) return autonum::numerotationContextToFormula(m_conductor_autonum.value(key)); @@ -536,7 +537,7 @@ QString QETProject::conductorCurrentAutoNum () const { * @param autoNum set the current conductor autonum to @autonum */ void QETProject::setCurrentConductorAutoNum(QString autoNum) { - m_current_conductor_autonum = autoNum; + m_current_conductor_autonum = std::move(autoNum); } /** @@ -554,7 +555,7 @@ QHash QETProject::folioAutoNum() const { * @param key * @param context */ -void QETProject::addConductorAutoNum(QString key, NumerotationContext context) { +void QETProject::addConductorAutoNum(const QString& key, const NumerotationContext& context) { m_conductor_autonum.insert(key, context); } @@ -565,7 +566,7 @@ void QETProject::addConductorAutoNum(QString key, NumerotationContext context) { * @param key * @param context */ -void QETProject::addElementAutoNum(QString key, NumerotationContext context) +void QETProject::addElementAutoNum(const QString& key, const NumerotationContext& context) { m_element_autonum.insert(key, context); emit elementAutoNumAdded(key); @@ -578,7 +579,7 @@ void QETProject::addElementAutoNum(QString key, NumerotationContext context) * @param key * @param context */ -void QETProject::addFolioAutoNum(QString key, NumerotationContext context) { +void QETProject::addFolioAutoNum(const QString& key, const NumerotationContext& context) { m_folio_autonum.insert(key, context); } @@ -587,7 +588,7 @@ void QETProject::addFolioAutoNum(QString key, NumerotationContext context) { * Remove Conductor Numerotation Context stored with key * @param key */ -void QETProject::removeConductorAutoNum(QString key) { +void QETProject::removeConductorAutoNum(const QString& key) { m_conductor_autonum.remove(key); } @@ -596,7 +597,7 @@ void QETProject::removeConductorAutoNum(QString key) { * Remove Element Numerotation Context stored with key * @param key */ -void QETProject::removeElementAutoNum(QString key) +void QETProject::removeElementAutoNum(const QString& key) { m_element_autonum.remove(key); emit elementAutoNumRemoved(key); @@ -607,7 +608,7 @@ void QETProject::removeElementAutoNum(QString key) * Remove Folio Numerotation Context stored with key * @param key */ -void QETProject::removeFolioAutoNum(QString key) { +void QETProject::removeFolioAutoNum(const QString& key) { m_folio_autonum.remove(key); } @@ -760,7 +761,7 @@ void QETProject::autoFolioNumberingNewFolios(){ * @param autonum used, index from selected tabs "from" and "to" * rename folios with selected autonum */ -void QETProject::autoFolioNumberingSelectedFolios(int from, int to, QString autonum){ +void QETProject::autoFolioNumberingSelectedFolios(int from, int to, const QString& autonum){ int total_folio = m_diagrams_list.count(); DiagramContext project_wide_properties = project_properties_; for (int i=from; i<=to; i++) { diff --git a/sources/qetproject.h b/sources/qetproject.h index 59f5713ed..696f143ec 100644 --- a/sources/qetproject.h +++ b/sources/qetproject.h @@ -103,27 +103,27 @@ class QETProject : public QObject XRefProperties defaultXRefProperties (const QString &type) const {return m_default_xref_properties[type];} QHash defaultXRefProperties() const {return m_default_xref_properties;} - void setDefaultXRefProperties(const QString type, const XRefProperties &properties); + void setDefaultXRefProperties(const QString& type, const XRefProperties &properties); void setDefaultXRefProperties(QHash hash); QHash conductorAutoNum() const; QHash elementAutoNum() const; QHash folioAutoNum() const; - void addConductorAutoNum (QString key, NumerotationContext context); - void addElementAutoNum (QString key, NumerotationContext context); - void addFolioAutoNum (QString key, NumerotationContext context); - void removeConductorAutoNum (QString key); - void removeElementAutoNum (QString key); - void removeFolioAutoNum (QString key); + void addConductorAutoNum (const QString& key, const NumerotationContext& context); + void addElementAutoNum (const QString& key, const NumerotationContext& context); + void addFolioAutoNum (const QString& key, const NumerotationContext& context); + void removeConductorAutoNum (const QString& key); + void removeElementAutoNum (const QString& key); + void removeFolioAutoNum (const QString& key); NumerotationContext conductorAutoNum(const QString &key) const; NumerotationContext folioAutoNum(const QString &key) const; NumerotationContext elementAutoNum(const QString &key); - QString conductorAutoNumFormula(const QString key) const; //returns Formula + QString conductorAutoNumFormula(const QString& key) const; //returns Formula QString conductorCurrentAutoNum() const; void setCurrentConductorAutoNum(QString autoNum); - QString elementAutoNumFormula(const QString key) const; + QString elementAutoNumFormula(const QString& key) const; QString elementAutoNumCurrentFormula() const; QString elementCurrentAutoNum() const; void setCurrrentElementAutonum(QString autoNum); @@ -146,7 +146,7 @@ class QETProject : public QObject void setAutoConductor (bool ac); void setAutoElement (bool ae); void autoFolioNumberingNewFolios (); - void autoFolioNumberingSelectedFolios(int, int, QString); + void autoFolioNumberingSelectedFolios(int, int, const QString&); QDomDocument toXml(); bool close(); diff --git a/sources/qetsingleapplication.cpp b/sources/qetsingleapplication.cpp index aae0a1417..20cf8d1eb 100644 --- a/sources/qetsingleapplication.cpp +++ b/sources/qetsingleapplication.cpp @@ -26,7 +26,7 @@ const int QETSingleApplication::timeout_ = 10000; @param argv Tableau des arguments passes au programme par le systeme @param unique_key Cle unique */ -QETSingleApplication::QETSingleApplication(int &argc, char **argv, const QString unique_key) : +QETSingleApplication::QETSingleApplication(int &argc, char **argv, const QString& unique_key) : QApplication(argc, argv), unique_key_(unique_key) { diff --git a/sources/qetsingleapplication.h b/sources/qetsingleapplication.h index 4ea7ba0f8..d156a5a34 100644 --- a/sources/qetsingleapplication.h +++ b/sources/qetsingleapplication.h @@ -28,7 +28,7 @@ class QETSingleApplication : public QApplication { Q_OBJECT // constructors, destructor public: - QETSingleApplication(int &, char **, const QString); + QETSingleApplication(int &, char **, const QString&); ~QETSingleApplication() override; private: diff --git a/sources/qetxml.cpp b/sources/qetxml.cpp index 288535ac0..5b726c867 100644 --- a/sources/qetxml.cpp +++ b/sources/qetxml.cpp @@ -27,7 +27,7 @@ * @param pen : the pen to store * @return : A QDomElement with the attribute stored. The tagName of QDomeElement is "pen". */ -QDomElement QETXML::penToXml(QDomDocument &parent_document,QPen pen) +QDomElement QETXML::penToXml(QDomDocument &parent_document,const QPen& pen) { QDomElement element = parent_document.createElement("pen"); @@ -88,7 +88,7 @@ QPen QETXML::penFromXml(const QDomElement &element) * @param brush : the brush to store * @return A QDomElement with the attribute stored. The tagName of QDomeElement is "brush". */ -QDomElement QETXML::brushToXml(QDomDocument &parent_document, QBrush brush) +QDomElement QETXML::brushToXml(QDomDocument &parent_document, const QBrush& brush) { QDomElement element = parent_document.createElement("brush"); @@ -162,7 +162,7 @@ QBrush QETXML::brushFromXml(const QDomElement &element) * @return A file system directory converted to a QDomElement directory ready to be inserted into a XmlElementCollection. * If the QDomElement can't be created, return a null QDomElement. */ -QDomElement QETXML::fileSystemDirToXmlCollectionDir(QDomDocument &document, const QDir &dir, QString rename) +QDomElement QETXML::fileSystemDirToXmlCollectionDir(QDomDocument &document, const QDir &dir, const QString& rename) { if (!dir.exists()) return QDomElement(); @@ -200,7 +200,7 @@ QDomElement QETXML::fileSystemDirToXmlCollectionDir(QDomDocument &document, cons * @return A file system element converted to a QDomElement ready to be inserted into a XmlElementCollection * If the QDomElement can't be created, return a null QDomElement */ -QDomElement QETXML::fileSystemElementToXmlCollectionElement(QDomDocument &document, QFile &file, QString rename) +QDomElement QETXML::fileSystemElementToXmlCollectionElement(QDomDocument &document, QFile &file, const QString& rename) { if (file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text)) { @@ -266,7 +266,7 @@ bool QETXML::writeXmlFile(const QDomDocument &xml_document, const QString &file_ * @param value * @return */ -QDomElement QETXML::textToDomElement(QDomDocument &document, QString tag_name, QString value) +QDomElement QETXML::textToDomElement(QDomDocument &document, const QString& tag_name, const QString& value) { QDomElement element = document.createElement(tag_name); QDomText text = document.createTextNode(value); diff --git a/sources/qetxml.h b/sources/qetxml.h index aeecddc6e..e2e50e240 100644 --- a/sources/qetxml.h +++ b/sources/qetxml.h @@ -30,18 +30,18 @@ class QFile; */ namespace QETXML { - QDomElement penToXml(QDomDocument &parent_document, QPen pen); + QDomElement penToXml(QDomDocument &parent_document, const QPen& pen); QPen penFromXml (const QDomElement &element); - QDomElement brushToXml (QDomDocument &parent_document, QBrush brush); + QDomElement brushToXml (QDomDocument &parent_document, const QBrush& brush); QBrush brushFromXml (const QDomElement &element); - QDomElement fileSystemDirToXmlCollectionDir (QDomDocument &document, const QDir &dir, QString rename = QString()); - QDomElement fileSystemElementToXmlCollectionElement (QDomDocument &document, QFile &file, QString rename = QString()); + QDomElement fileSystemDirToXmlCollectionDir (QDomDocument &document, const QDir &dir, const QString& rename = QString()); + QDomElement fileSystemElementToXmlCollectionElement (QDomDocument &document, QFile &file, const QString& rename = QString()); bool writeXmlFile(const QDomDocument &xml_document, const QString &file_path, QString *error_message = nullptr); - QDomElement textToDomElement (QDomDocument &document, QString tag_name, QString value); + QDomElement textToDomElement (QDomDocument &document, const QString& tag_name, const QString& value); } #endif // QETXML_H diff --git a/sources/titleblock/qettemplateeditor.cpp b/sources/titleblock/qettemplateeditor.cpp index 15df34e96..2f75f7346 100644 --- a/sources/titleblock/qettemplateeditor.cpp +++ b/sources/titleblock/qettemplateeditor.cpp @@ -615,7 +615,7 @@ void QETTitleBlockTemplateEditor::writeSettings() Update various things when user changes the selected cells. @param selected_cells List of selected cells. */ -void QETTitleBlockTemplateEditor::selectedCellsChanged(QList selected_cells) { +void QETTitleBlockTemplateEditor::selectedCellsChanged(const QList& selected_cells) { if (selected_cells.count() == 1) { template_cell_editor_widget_ -> edit(selected_cells.at(0)); template_cell_editor_widget_ -> setVisible(true); diff --git a/sources/titleblock/qettemplateeditor.h b/sources/titleblock/qettemplateeditor.h index b8f1ae3e3..2e657fb18 100644 --- a/sources/titleblock/qettemplateeditor.h +++ b/sources/titleblock/qettemplateeditor.h @@ -104,7 +104,7 @@ class QETTitleBlockTemplateEditor : public QETMainWindow { public slots: void readSettings(); void writeSettings(); - void selectedCellsChanged(QList); + void selectedCellsChanged(const QList&); void duplicateCurrentLocation(); bool edit(const TitleBlockTemplateLocation &); bool edit(QETProject *, const QString &); diff --git a/sources/ui/compositetexteditdialog.cpp b/sources/ui/compositetexteditdialog.cpp index 4c68f2ca7..5f822f488 100644 --- a/sources/ui/compositetexteditdialog.cpp +++ b/sources/ui/compositetexteditdialog.cpp @@ -1,4 +1,6 @@ #include "compositetexteditdialog.h" + +#include #include "ui_compositetexteditdialog.h" #include "dynamicelementtextitem.h" #include "element.h" @@ -24,7 +26,7 @@ CompositeTextEditDialog::CompositeTextEditDialog(QString text, QWidget *parent) ui(new Ui::CompositeTextEditDialog) { ui->setupUi(this); - m_default_text = text; + m_default_text = std::move(text); ui->m_plain_text_edit->setPlainText(m_default_text); #if QT_VERSION >= 0x050300 ui->m_plain_text_edit->setPlaceholderText(tr("Entrée votre texte composé ici, en vous aidant des variables disponible")); @@ -65,10 +67,10 @@ void CompositeTextEditDialog::setUpComboBox() //We use a QMap because the keys of the map are sorted, then no matter the curent local, //the value of the combo box are always alphabetically sorted QMap info_map; - for(QString str : qstrl) { + for(const QString& str : qstrl) { info_map.insert(QETApp::elementTranslatedInfoKey(str), QETApp::elementInfoToVar(str)); } - for(QString key : info_map.keys()) { + for(const QString& key : info_map.keys()) { ui->m_info_cb->addItem(key, info_map.value(key)); } } diff --git a/sources/ui/dynamicelementtextmodel.cpp b/sources/ui/dynamicelementtextmodel.cpp index 279b23a44..fb4a57167 100644 --- a/sources/ui/dynamicelementtextmodel.cpp +++ b/sources/ui/dynamicelementtextmodel.cpp @@ -1226,7 +1226,7 @@ void DynamicElementTextModel::setConnection(DynamicElementTextItem *deti, bool s if(!m_hash_text_connect.keys().contains(deti)) return; - for (QMetaObject::Connection con : m_hash_text_connect.value(deti)) + for (const QMetaObject::Connection& con : m_hash_text_connect.value(deti)) disconnect(con); m_hash_text_connect.remove(deti); @@ -1264,7 +1264,7 @@ void DynamicElementTextModel::setConnection(ElementTextItemGroup *group, bool se if(!m_hash_group_connect.keys().contains(group)) return; - for (QMetaObject::Connection con : m_hash_group_connect.value(group)) + for (const QMetaObject::Connection& con : m_hash_group_connect.value(group)) disconnect(con); m_hash_group_connect.remove(group); @@ -1443,13 +1443,13 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti //We use a QMap because the keys of the map are sorted, then no matter the curent local, //the value of the combo box are always alphabetically sorted QMap info_map; - for(QString str : availableInfo(deti)) { + for(const QString& str : availableInfo(deti)) { info_map.insert(QETApp::elementTranslatedInfoKey(str), str); } QComboBox *qcb = new QComboBox(parent); qcb->setObjectName("info_text"); - for (QString key : info_map.keys()) { + for (const QString& key : info_map.keys()) { qcb->addItem(key, info_map.value(key)); } return qcb; @@ -1733,7 +1733,7 @@ QStringList DynamicTextItemDelegate::availableInfo(DynamicElementTextItem *deti) info_list.removeAll("formula"); //No need to have formula DiagramContext dc = elmt->elementInformations(); - for(QString info : info_list) + for(const QString& info : info_list) { if(dc.contains(info)) qstrl << info; diff --git a/sources/ui/elementinfopartwidget.cpp b/sources/ui/elementinfopartwidget.cpp index 9a8b312a9..149595886 100644 --- a/sources/ui/elementinfopartwidget.cpp +++ b/sources/ui/elementinfopartwidget.cpp @@ -16,6 +16,8 @@ along with QElectroTech. If not, see . */ #include "elementinfopartwidget.h" + +#include #include "ui_elementinfopartwidget.h" @@ -26,10 +28,10 @@ * @param translated_key the string key translated * @param parent parent widget */ -ElementInfoPartWidget::ElementInfoPartWidget(QString key, QString translated_key, QWidget *parent): +ElementInfoPartWidget::ElementInfoPartWidget(QString key, const QString& translated_key, QWidget *parent): QWidget(parent), ui(new Ui::ElementInfoPartWidget), - key_(key) + key_(std::move(key)) { ui->setupUi(this); ui->label_->setText(translated_key); diff --git a/sources/ui/elementinfopartwidget.h b/sources/ui/elementinfopartwidget.h index 1cbc575e7..8e607d3b7 100644 --- a/sources/ui/elementinfopartwidget.h +++ b/sources/ui/elementinfopartwidget.h @@ -30,7 +30,7 @@ class ElementInfoPartWidget : public QWidget //METHODS public: - explicit ElementInfoPartWidget(QString key, QString translated_key, QWidget *parent = nullptr); + explicit ElementInfoPartWidget(QString key, const QString& translated_key, QWidget *parent = nullptr); ~ElementInfoPartWidget() override; QString key () const {return key_;} diff --git a/sources/ui/formulaassistantdialog.cpp b/sources/ui/formulaassistantdialog.cpp index ab7489314..23a171337 100644 --- a/sources/ui/formulaassistantdialog.cpp +++ b/sources/ui/formulaassistantdialog.cpp @@ -32,17 +32,17 @@ FormulaAssistantDialog::~FormulaAssistantDialog() delete ui; } -void FormulaAssistantDialog::setForbiddenVariables(QStringList list) +void FormulaAssistantDialog::setForbiddenVariables(const QStringList& list) { m_rx.setPattern(list.join("|")); } -void FormulaAssistantDialog::setText(QString text) +void FormulaAssistantDialog::setText(const QString& text) { ui->m_label->setText(text); } -void FormulaAssistantDialog::setFormula(QString text) +void FormulaAssistantDialog::setFormula(const QString& text) { ui->m_line_edit->setText(text); } diff --git a/sources/ui/formulaassistantdialog.h b/sources/ui/formulaassistantdialog.h index a4d9b7bf9..be5f5a05a 100644 --- a/sources/ui/formulaassistantdialog.h +++ b/sources/ui/formulaassistantdialog.h @@ -33,9 +33,9 @@ class FormulaAssistantDialog : public QDialog FormulaAssistantDialog(QWidget *parent = nullptr); ~FormulaAssistantDialog() override; - void setForbiddenVariables(QStringList list); - void setText(QString text); - void setFormula(QString text); + void setForbiddenVariables(const QStringList& list); + void setText(const QString& text); + void setFormula(const QString& text); QString formula() const; private slots: diff --git a/sources/ui/reportpropertiewidget.cpp b/sources/ui/reportpropertiewidget.cpp index 1f288969f..ab77486f1 100644 --- a/sources/ui/reportpropertiewidget.cpp +++ b/sources/ui/reportpropertiewidget.cpp @@ -18,7 +18,7 @@ #include "reportpropertiewidget.h" #include "ui_reportpropertiewidget.h" -ReportPropertieWidget::ReportPropertieWidget(QString value, QWidget *parent) : +ReportPropertieWidget::ReportPropertieWidget(const QString& value, QWidget *parent) : QWidget(parent), ui(new Ui::ReportPropertieWidget) { @@ -35,7 +35,7 @@ void ReportPropertieWidget::toSettings(QSettings &settings, const QString &prefi settings.setValue(prefix + "label", ui->line_edit->text()); } -void ReportPropertieWidget::setReportProperties(QString label) { +void ReportPropertieWidget::setReportProperties(const QString& label) { ui->line_edit->setText(label); } diff --git a/sources/ui/reportpropertiewidget.h b/sources/ui/reportpropertiewidget.h index 3e923e649..056315b00 100644 --- a/sources/ui/reportpropertiewidget.h +++ b/sources/ui/reportpropertiewidget.h @@ -31,10 +31,10 @@ class ReportPropertieWidget : public QWidget Q_OBJECT public: - explicit ReportPropertieWidget(QString value, QWidget *parent = nullptr); + explicit ReportPropertieWidget(const QString& value, QWidget *parent = nullptr); ~ReportPropertieWidget() override; void toSettings (QSettings &settings, const QString &prefix); - void setReportProperties (QString label); + void setReportProperties (const QString& label); QString ReportProperties () const; private: diff --git a/sources/ui/titleblockpropertieswidget.cpp b/sources/ui/titleblockpropertieswidget.cpp index 26d8a8741..47c4ac706 100644 --- a/sources/ui/titleblockpropertieswidget.cpp +++ b/sources/ui/titleblockpropertieswidget.cpp @@ -22,6 +22,7 @@ #include "titleblocktemplate.h" #include "qetapp.h" #include +#include /** * @brief TitleBlockPropertiesWidget::TitleBlockPropertiesWidget @@ -221,7 +222,7 @@ TitleBlockProperties TitleBlockPropertiesWidget::propertiesAutoNum(QString autoN prop.context = m_dcw -> context(); - prop.auto_page_num = autoNum; + prop.auto_page_num = std::move(autoNum); return prop; } diff --git a/sources/ui/xrefpropertieswidget.cpp b/sources/ui/xrefpropertieswidget.cpp index a824c4117..c514a17c9 100644 --- a/sources/ui/xrefpropertieswidget.cpp +++ b/sources/ui/xrefpropertieswidget.cpp @@ -16,6 +16,8 @@ along with QElectroTech. If not, see . */ #include "xrefpropertieswidget.h" + +#include #include "ui_xrefpropertieswidget.h" #include "qdebug.h" @@ -28,7 +30,7 @@ XRefPropertiesWidget::XRefPropertiesWidget(QHash properties, QWidget *parent) : QWidget(parent), ui(new Ui::XRefPropertiesWidget), - m_properties(properties) + m_properties(std::move(properties)) { ui->setupUi(this); buildUi(); diff --git a/sources/undocommand/addelementtextcommand.cpp b/sources/undocommand/addelementtextcommand.cpp index d97ecbd79..f9661ceb2 100644 --- a/sources/undocommand/addelementtextcommand.cpp +++ b/sources/undocommand/addelementtextcommand.cpp @@ -21,6 +21,7 @@ #include "elementtextitemgroup.h" #include +#include /************************ @@ -70,7 +71,7 @@ void AddElementTextCommand::redo() AddTextsGroupCommand::AddTextsGroupCommand(Element *element, QString groupe_name, QUndoCommand *parent) : QUndoCommand(parent), m_element(element), - m_name(groupe_name) + m_name(std::move(groupe_name)) { setText(QObject::tr("Ajouter un groupe de textes d'élément")); } @@ -81,7 +82,7 @@ AddTextsGroupCommand::AddTextsGroupCommand(Element *element, QString groupe_name * @param dom_element : the first time the group is created, we call the function fromXml of the group, and give @dom_element has argument. * @param parent : parent undo */ -AddTextsGroupCommand::AddTextsGroupCommand(Element *element, QDomElement dom_element, QUndoCommand *parent) : +AddTextsGroupCommand::AddTextsGroupCommand(Element *element, const QDomElement& dom_element, QUndoCommand *parent) : QUndoCommand(parent), m_element(element), m_dom_element(dom_element) @@ -98,7 +99,7 @@ AddTextsGroupCommand::AddTextsGroupCommand(Element *element, QDomElement dom_ele AddTextsGroupCommand::AddTextsGroupCommand(Element *element, QString groupe_name, QList texts_list, QUndoCommand *parent) : QUndoCommand(parent), m_element(element), - m_name(groupe_name) + m_name(std::move(groupe_name)) { for(DynamicElementTextItem *deti : texts_list) { @@ -188,7 +189,7 @@ void RemoveTextsGroupCommand::undo() { m_element.data()->addTextGroup(m_group.data()); - for(QPointer p : m_text_list) + for(const QPointer& p : m_text_list) if(p) m_element.data()->addTextToGroup(p.data(), m_group.data()); } @@ -198,7 +199,7 @@ void RemoveTextsGroupCommand::redo() { if(m_element && m_group) { - for(QPointer p : m_text_list) + for(const QPointer& p : m_text_list) if(p) m_element.data()->removeTextFromGroup(p.data(), m_group.data()); diff --git a/sources/undocommand/addelementtextcommand.h b/sources/undocommand/addelementtextcommand.h index 852215507..d1f0a8816 100644 --- a/sources/undocommand/addelementtextcommand.h +++ b/sources/undocommand/addelementtextcommand.h @@ -52,7 +52,7 @@ class AddTextsGroupCommand : public QUndoCommand { public: AddTextsGroupCommand(Element *element, QString groupe_name, QUndoCommand *parent = nullptr); - AddTextsGroupCommand(Element *element, QDomElement dom_element, QUndoCommand *parent = nullptr); + AddTextsGroupCommand(Element *element, const QDomElement& dom_element, QUndoCommand *parent = nullptr); AddTextsGroupCommand(Element *element, QString groupe_name, QList texts_list, QUndoCommand *parent = nullptr); ~AddTextsGroupCommand() override; diff --git a/sources/undocommand/linkelementcommand.cpp b/sources/undocommand/linkelementcommand.cpp index 8b711d0bb..eed843f26 100644 --- a/sources/undocommand/linkelementcommand.cpp +++ b/sources/undocommand/linkelementcommand.cpp @@ -129,7 +129,7 @@ bool LinkElementCommand::isLinkable(Element *element_a, Element *element_b, bool * This method do several check to know if element can be linked or not. * @param element_list */ -void LinkElementCommand::setLink(QList element_list) +void LinkElementCommand::setLink(const QList& element_list) { m_linked_after.clear(); setUpNewLink(element_list, true); diff --git a/sources/undocommand/linkelementcommand.h b/sources/undocommand/linkelementcommand.h index 0c5f8d0fb..0257ca97b 100644 --- a/sources/undocommand/linkelementcommand.h +++ b/sources/undocommand/linkelementcommand.h @@ -38,7 +38,7 @@ class LinkElementCommand : public QUndoCommand static bool isLinkable (Element *element_a, Element *element_b, bool already_linked = false); - void setLink (QList element_list); + void setLink (const QList& element_list); void setLink (Element *element_); void unlink (QList element_list); void unlinkAll (); diff --git a/sources/undocommand/rotateselectioncommand.cpp b/sources/undocommand/rotateselectioncommand.cpp index eb7d77c6e..46c8b7e7f 100644 --- a/sources/undocommand/rotateselectioncommand.cpp +++ b/sources/undocommand/rotateselectioncommand.cpp @@ -87,7 +87,7 @@ void RotateSelectionCommand::undo() m_diagram->showMe(); QUndoCommand::undo(); - for(QPointer cti : m_cond_text) + for(const QPointer& cti : m_cond_text) { cti->forceRotateByUser(m_rotate_by_user.value(cti.data())); if(!cti->wasRotateByUser()) @@ -103,7 +103,7 @@ void RotateSelectionCommand::redo() m_diagram->showMe(); QUndoCommand::redo(); - for(QPointer cti : m_cond_text) + for(const QPointer& cti : m_cond_text) { m_rotate_by_user.insert(cti, cti->wasRotateByUser()); cti->forceRotateByUser(true); diff --git a/sources/undocommand/rotatetextscommand.cpp b/sources/undocommand/rotatetextscommand.cpp index 0b7774ad1..9830e5854 100644 --- a/sources/undocommand/rotatetextscommand.cpp +++ b/sources/undocommand/rotatetextscommand.cpp @@ -138,7 +138,7 @@ void RotateTextsCommand::openDialog() #endif } -void RotateTextsCommand::setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant start, const QVariant end) +void RotateTextsCommand::setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant& start, const QVariant& end) { if(m_anim_group == nullptr) m_anim_group = new QParallelAnimationGroup(); diff --git a/sources/undocommand/rotatetextscommand.h b/sources/undocommand/rotatetextscommand.h index 31a4a6690..f0f3231fa 100644 --- a/sources/undocommand/rotatetextscommand.h +++ b/sources/undocommand/rotatetextscommand.h @@ -40,7 +40,7 @@ class RotateTextsCommand : public QUndoCommand private: void openDialog(); - void setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant start, const QVariant end); + void setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant& start, const QVariant& end); private: QPointer m_diagram;