Apply clang-tidy's performance-unnecessary-value-param, performance-for-

range-copy


git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5448 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
scorpio810
2018-07-19 14:14:31 +00:00
parent 05fea9b94a
commit e4b1ba9797
97 changed files with 263 additions and 238 deletions

View File

@@ -76,7 +76,7 @@ ElementsLocation ECHSFileToFile::copy()
return copyDirectory(m_source, m_destination, rename); 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 source_dir(source.fileSystemPath());
QDir destination_dir(destination.fileSystemPath()); QDir destination_dir(destination.fileSystemPath());
@@ -130,7 +130,7 @@ ElementsLocation ECHSFileToFile::copyDirectory(ElementsLocation &source, Element
return ElementsLocation(); 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; QString new_elmt_name = rename.isEmpty() ? source.fileName() : rename;
bool rb = QFile::copy(source.fileSystemPath(), destination.fileSystemPath() + "/" + new_elmt_name); 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); 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()); QDir destination_dir(destination.fileSystemPath());
@@ -231,7 +231,7 @@ ElementsLocation ECHSXmlToFile::copyDirectory(ElementsLocation &source, Elements
return ElementsLocation(); 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(); if (!(destination.exist() && source.exist())) return ElementsLocation();

View File

@@ -48,8 +48,8 @@ class ECHSFileToFile : public ECHStrategy
ElementsLocation copy() override; ElementsLocation copy() override;
private: private:
ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, QString rename = QString()); ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString());
ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, QString rename = QString()); ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString());
}; };
/** /**
@@ -63,8 +63,8 @@ class ECHSXmlToFile : public ECHStrategy
ElementsLocation copy() override; ElementsLocation copy() override;
private: private:
ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, QString rename = QString()); ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString());
ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, QString rename = QString()); ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString());
}; };
/** /**

View File

@@ -71,7 +71,7 @@ ElementCollectionItem *ElementCollectionItem::lastItemForPath(const QString &pat
* @param name * @param name
* @return * @return
*/ */
ElementCollectionItem *ElementCollectionItem::childWithCollectionName(QString name) const ElementCollectionItem *ElementCollectionItem::childWithCollectionName(const QString& name) const
{ {
rowCount(); rowCount();
foreach (QStandardItem *qsi, directChilds()) { foreach (QStandardItem *qsi, directChilds()) {

View File

@@ -46,7 +46,7 @@ class ElementCollectionItem : public QStandardItem
virtual void clearData(); virtual void clearData();
ElementCollectionItem *lastItemForPath(const QString &path, QString &no_found_path); ElementCollectionItem *lastItemForPath(const QString &path, QString &no_found_path);
ElementCollectionItem *childWithCollectionName(QString name) const; ElementCollectionItem *childWithCollectionName(const QString& name) const;
QList<QStandardItem *> directChilds() const; QList<QStandardItem *> directChilds() const;
int rowForInsertItem(const QString &name); int rowForInsertItem(const QString &name);
ElementCollectionItem *itemAtPath(const QString &path); ElementCollectionItem *itemAtPath(const QString &path);

View File

@@ -286,7 +286,7 @@ void ElementsCollectionModel::addCustomCollection(bool set_data)
* If the location is already managed by this model, do nothing. * If the location is already managed by this model, do nothing.
* @param location * @param location
*/ */
void ElementsCollectionModel::addLocation(ElementsLocation location) void ElementsCollectionModel::addLocation(const ElementsLocation& location)
{ {
QModelIndex index = indexFromLocation(location); QModelIndex index = indexFromLocation(location);
if (index.isValid()) if (index.isValid())
@@ -504,7 +504,7 @@ QModelIndex ElementsCollectionModel::indexFromLocation(const ElementsLocation &l
* this method create and display the new element * this method create and display the new element
* @param path -The path of the new element in the embedded collection of a project * @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(); QObject *object = sender();
XmlElementCollection *collection = static_cast<XmlElementCollection *> (object); XmlElementCollection *collection = static_cast<XmlElementCollection *> (object);
@@ -537,7 +537,7 @@ void ElementsCollectionModel::elementIntegratedToCollection(QString path)
* This method must be called by a signal, to get a sender. * This method must be called by a signal, to get a sender.
* @param path * @param path
*/ */
void ElementsCollectionModel::itemRemovedFromCollection(QString path) void ElementsCollectionModel::itemRemovedFromCollection(const QString& path)
{ {
QObject *object = sender(); QObject *object = sender();
XmlElementCollection *collection = static_cast<XmlElementCollection *> (object); XmlElementCollection *collection = static_cast<XmlElementCollection *> (object);
@@ -565,7 +565,7 @@ void ElementsCollectionModel::itemRemovedFromCollection(QString path)
* Update the item at path * Update the item at path
* @param path * @param path
*/ */
void ElementsCollectionModel::updateItem(QString path) void ElementsCollectionModel::updateItem(const QString& path)
{ {
QObject *object = sender(); QObject *object = sender();
XmlElementCollection *collection = static_cast<XmlElementCollection *> (object); XmlElementCollection *collection = static_cast<XmlElementCollection *> (object);

View File

@@ -45,7 +45,7 @@ class ElementsCollectionModel : public QStandardItemModel
void addCommonCollection(bool set_data = true); void addCommonCollection(bool set_data = true);
void addCustomCollection(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 addProject(QETProject *project, bool set_data = true);
void removeProject(QETProject *project); void removeProject(QETProject *project);
@@ -64,9 +64,9 @@ class ElementsCollectionModel : public QStandardItemModel
void loadingProgressValue(int); void loadingProgressValue(int);
private: private:
void elementIntegratedToCollection (QString path); void elementIntegratedToCollection (const QString& path);
void itemRemovedFromCollection (QString path); void itemRemovedFromCollection (const QString& path);
void updateItem (QString path); void updateItem (const QString& path);
private: private:
QList <QETProject *> m_project_list; QList <QETProject *> m_project_list;

View File

@@ -566,7 +566,7 @@ void ElementsCollectionWidget::reload()
* Update or add the item represented by location to m_model * Update or add the item represented by location to m_model
* @param location * @param location
*/ */
void ElementsCollectionWidget::locationWasSaved(ElementsLocation location) void ElementsCollectionWidget::locationWasSaved(const ElementsLocation& location)
{ {
//Because this method update an item in the model, location must //Because this method update an item in the model, location must
//represente an existing element (in file system of project) //represente an existing element (in file system of project)

View File

@@ -81,7 +81,7 @@ class ElementsCollectionWidget : public QWidget
void reload(); void reload();
private: private:
void locationWasSaved(ElementsLocation location); void locationWasSaved(const ElementsLocation& location);
private: private:

View File

@@ -37,7 +37,7 @@ FileElementCollectionItem::FileElementCollectionItem()
* @param path * @param path
* @return true if path exist. * @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); QDir dir(path);
if (dir.exists()) { if (dir.exists()) {
@@ -278,7 +278,7 @@ void FileElementCollectionItem::setUpIcon()
* For create a new file collection see setRootPath. * For create a new file collection see setRootPath.
* @param path_name * @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; m_path = path_name;

View File

@@ -33,7 +33,7 @@ class FileElementCollectionItem : public ElementCollectionItem
enum { Type = UserType+2 }; enum { Type = UserType+2 };
int type() const override { return Type;} 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 fileSystemPath() const;
QString dirPath() const; QString dirPath() const;
@@ -54,7 +54,7 @@ class FileElementCollectionItem : public ElementCollectionItem
private: 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); void populate(bool set_data = true, bool hide_element = false);
private: private:

View File

@@ -16,12 +16,14 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>. along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "renamedialog.h" #include "renamedialog.h"
#include <utility>
#include "ui_renamedialog.h" #include "ui_renamedialog.h"
RenameDialog::RenameDialog(QString path, QWidget *parent) : RenameDialog::RenameDialog(QString path, QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::RenameDialog), ui(new Ui::RenameDialog),
m_path(path) m_path(std::move(path))
{ {
ui->setupUi(this); ui->setupUi(this);
m_name = m_path.split("/").last(); m_name = m_path.split("/").last();

View File

@@ -462,7 +462,7 @@ bool XmlElementCollection::addElementDefinition(const QString &dir_path, const Q
* @return True if element is removed and emit the signal elementRemoved. * @return True if element is removed and emit the signal elementRemoved.
* else false. * else false.
*/ */
bool XmlElementCollection::removeElement(QString path) bool XmlElementCollection::removeElement(const QString& path)
{ {
QDomElement elmt = element(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) * @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 * @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)) if (!(source.exist() && destination.isDirectory() && destination.isProject() && destination.projectCollection() == this))
return ElementsLocation(); return ElementsLocation();
@@ -520,7 +520,7 @@ bool XmlElementCollection::exist(const QString &path) const
* @param name_list : translation of the directorie name. * @param name_list : translation of the directorie name.
* @return true if creation success, if directorie already exist return true. * @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; 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), * @return true if successfuly removed and emit directoryRemoved(QString),
* else false. * else false.
*/ */
bool XmlElementCollection::removeDir(QString path) bool XmlElementCollection::removeDir(const QString& path)
{ {
QDomElement dir = directory(path); QDomElement dir = directory(path);
if (!dir.isNull()) { if (!dir.isNull()) {
@@ -670,7 +670,7 @@ void XmlElementCollection::cleanUnusedDirectory()
* @param deep_copy :if true copy all childs of source * @param deep_copy :if true copy all childs of source
* @return the ElementLocation that represent the copy, if copy failed return a null ElementLocation * @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; 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 * @param rename : rename the copy with @rename else use the name of source
* @return The ElementsLocation of the copy * @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; QString new_elmt_name = rename.isEmpty() ? source.fileName() : rename;

View File

@@ -50,11 +50,11 @@ class XmlElementCollection : public QObject
QDomElement directory(const QString &path) const; QDomElement directory(const QString &path) const;
QString addElement (ElementsLocation &location); QString addElement (ElementsLocation &location);
bool addElementDefinition (const QString &dir_path, const QString &elmt_name, const QDomElement &xml_definition); bool addElementDefinition (const QString &dir_path, const QString &elmt_name, const QDomElement &xml_definition);
bool removeElement(QString path); bool removeElement(const QString& path);
ElementsLocation copy (ElementsLocation &source, ElementsLocation &destination, QString rename = QString(), bool deep_copy = true); ElementsLocation copy (ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString(), bool deep_copy = true);
bool exist (const QString &path) const; bool exist (const QString &path) const;
bool createDir (QString path, QString name, const NamesList &name_list); bool createDir (const QString& path, const QString& name, const NamesList &name_list);
bool removeDir (QString path); bool removeDir (const QString& path);
QList <ElementsLocation> elementsLocation (QDomElement dom_element = QDomElement(), bool childs = true) const; QList <ElementsLocation> elementsLocation (QDomElement dom_element = QDomElement(), bool childs = true) const;
ElementsLocation domToLocation(QDomElement dom_element) const; ElementsLocation domToLocation(QDomElement dom_element) const;
@@ -63,8 +63,8 @@ class XmlElementCollection : public QObject
void cleanUnusedDirectory(); void cleanUnusedDirectory();
private: private:
ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, QString rename = QString(), bool deep_copy = true); ElementsLocation copyDirectory(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString(), bool deep_copy = true);
ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, QString rename = QString()); ElementsLocation copyElement(ElementsLocation &source, ElementsLocation &destination, const QString& rename = QString());
signals: signals:
/** /**

View File

@@ -259,7 +259,7 @@ void XmlProjectElementCollectionItem::populate(bool set_data, bool hide_element)
* @param project : the parent project of managed collection * @param project : the parent project of managed collection
* @param set_data : if true, call setUpData for every child of this item * @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_dom_element = element;
m_project = project; m_project = project;

View File

@@ -51,7 +51,7 @@ class XmlProjectElementCollectionItem : public ElementCollectionItem
private: private:
void populate(bool set_data = true, bool hide_element = false); 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: private:
QETProject *m_project = nullptr; QETProject *m_project = nullptr;

View File

@@ -18,6 +18,7 @@
#include "qetgraphicshandleritem.h" #include "qetgraphicshandleritem.h"
#include <QPainter> #include <QPainter>
#include <QDebug> #include <QDebug>
#include <utility>
/** /**
* @brief QetGraphicsHandlerItem::QetGraphicsHandlerItem * @brief QetGraphicsHandlerItem::QetGraphicsHandlerItem
@@ -46,7 +47,7 @@ QRectF QetGraphicsHandlerItem::boundingRect() const {
*/ */
void QetGraphicsHandlerItem::setColor(QColor color) void QetGraphicsHandlerItem::setColor(QColor color)
{ {
m_color = color; m_color = std::move(color);
update(); update();
} }

View File

@@ -24,6 +24,7 @@
#include <QVariant> #include <QVariant>
#include <QStringList> #include <QStringList>
#include <utility>
namespace autonum namespace autonum
{ {
@@ -88,7 +89,7 @@ namespace autonum
* @param tag_name : the tag name used for the QDomElement. * @param tag_name : the tag name used for the QDomElement.
* @return A QDomElement, if this sequential have no value, the returned QDomELement is empty * @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); QDomElement element = document.createElement(tag_name);
@@ -161,7 +162,7 @@ namespace autonum
*/ */
QString AssignVariables::formulaToLabel(QString formula, sequentialNumbers &seqStruct, Diagram *diagram, const Element *elmt) 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; seqStruct = av.m_seq_struct;
return av.m_assigned_label; return av.m_assigned_label;
} }
@@ -193,7 +194,7 @@ namespace autonum
return str; 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_diagram(diagram),
m_arg_formula(formula), m_arg_formula(formula),
m_assigned_label(formula), m_assigned_label(formula),
@@ -293,7 +294,7 @@ namespace autonum
* @param context : numerotation context to retrieve value * @param context : numerotation context to retrieve value
* @param type : type of sequential (unit, unitfolio, ten, tenfolio, hundred, hundredfolio) * @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++) for (int i = 0; i < context.size(); i++)
{ {
@@ -317,7 +318,7 @@ namespace autonum
* @param hash : hash to have values inserted * @param hash : hash to have values inserted
* @param autoNumName : name to use as key of hash * @param autoNumName : name to use as key of hash
*/ */
void setFolioSequentialToHash(QStringList &list, QHash<QString, QStringList> &hash, QString autoNumName) void setFolioSequentialToHash(QStringList &list, QHash<QString, QStringList> &hash, const QString& autoNumName)
{ {
if (hash.isEmpty() || !hash.contains(autoNumName)) if (hash.isEmpty() || !hash.contains(autoNumName))
{ {
@@ -354,7 +355,7 @@ namespace autonum
* to keep up to date the current sequential of folio. * to keep up to date the current sequential of folio.
* @param hashKey : the hash key used to store the sequential for folio type. * @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()) if (!context.isEmpty())
{ {

View File

@@ -42,7 +42,7 @@ namespace autonum
bool operator== (const sequentialNumbers &other) const; bool operator== (const sequentialNumbers &other) const;
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 fromXml(const QDomElement &element);
void clear(); void clear();
@@ -66,7 +66,7 @@ namespace autonum
static QString replaceVariable (const QString &formula, const DiagramContext &dc); static QString replaceVariable (const QString &formula, const DiagramContext &dc);
private: 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 assignTitleBlockVar();
void assignProjectVar(); void assignProjectVar();
void assignSequence(); void assignSequence();
@@ -78,9 +78,9 @@ namespace autonum
const Element *m_element = nullptr; const Element *m_element = nullptr;
}; };
void setSequentialToList(QStringList &list, NumerotationContext &nc, QString type); void setSequentialToList(QStringList &list, NumerotationContext &nc, const QString& type);
void setFolioSequentialToHash(QStringList &list, QHash<QString, QStringList> &hash, QString autoNumName); void setFolioSequentialToHash(QStringList &list, QHash<QString, QStringList> &hash, const QString& autoNumName);
void setSequential(QString label, autonum::sequentialNumbers &seqStruct, NumerotationContext &context, Diagram *diagram, QString hashKey); void setSequential(const QString& label, autonum::sequentialNumbers &seqStruct, NumerotationContext &context, Diagram *diagram, const QString& hashKey);
QString numerotationContextToFormula(const NumerotationContext &nc); QString numerotationContextToFormula(const NumerotationContext &nc);
QString elementPrefixForLocation(const ElementsLocation &location); QString elementPrefixForLocation(const ElementsLocation &location);
} }

View File

@@ -16,6 +16,8 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>. along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "numerotationcontext.h" #include "numerotationcontext.h"
#include <utility>
#include "qet.h" #include "qet.h"
/** /**
@@ -130,7 +132,7 @@ bool NumerotationContext::keyIsNumber(const QString &type) const {
* @brief NumerotationContext::toXml * @brief NumerotationContext::toXml
* Save the numerotation context in a QDomElement under the element name @str * 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); QDomElement num_auto = d.createElement(str);
for (int i=0; i<content_.size(); ++i) { for (int i=0; i<content_.size(); ++i) {
QStringList strl = itemAt(i); QStringList strl = itemAt(i);
@@ -166,7 +168,7 @@ void NumerotationContext::fromXml(QDomElement &e) {
void NumerotationContext::replaceValue(int index, QString content) { void NumerotationContext::replaceValue(int index, QString content) {
QString sep = "|"; QString sep = "|";
QString type = content_[index].split("|").at(0); QString type = content_[index].split("|").at(0);
QString value = content; const QString& value = std::move(content);
QString increase = content_[index].split("|").at(2); QString increase = content_[index].split("|").at(2);
QString initvalue = content_[index].split("|").at(3); QString initvalue = content_[index].split("|").at(3);
content_[index].replace(content_[index], type + "|" + value + "|" + increase + "|" + initvalue); content_[index].replace(content_[index], type + "|" + value + "|" + increase + "|" + initvalue);

View File

@@ -43,7 +43,7 @@ class NumerotationContext
QString validRegExpNumber() const; QString validRegExpNumber() const;
bool keyIsAcceptable (const QString &) const; bool keyIsAcceptable (const QString &) const;
bool keyIsNumber(const QString &) const; bool keyIsNumber(const QString &) const;
QDomElement toXml(QDomDocument &, QString); QDomElement toXml(QDomDocument &, const QString&);
void fromXml(QDomElement &); void fromXml(QDomElement &);
void replaceValue(int, QString); void replaceValue(int, QString);

View File

@@ -20,6 +20,7 @@
#include <QMessageBox> #include <QMessageBox>
#include <QPushButton> #include <QPushButton>
#include <QtWidgets> #include <QtWidgets>
#include <utility>
/** /**
* Constructor * Constructor
@@ -45,7 +46,7 @@ FormulaAutonumberingW::~FormulaAutonumberingW()
* @brief FormulaAutonumberingW::setContext * @brief FormulaAutonumberingW::setContext
* @param formula to be inserted into context * @param formula to be inserted into context
*/ */
void FormulaAutonumberingW::setContext(QString formula) { void FormulaAutonumberingW::setContext(const QString& formula) {
ui->m_formula_le->insert(formula); ui->m_formula_le->insert(formula);
} }
@@ -70,5 +71,5 @@ QString FormulaAutonumberingW::formula() {
* Update Apply Button * Update Apply Button
*/ */
void FormulaAutonumberingW::on_m_formula_le_textChanged(QString text) { void FormulaAutonumberingW::on_m_formula_le_textChanged(QString text) {
emit (textChanged(text)); emit (textChanged(std::move(text)));
} }

View File

@@ -41,7 +41,7 @@ class FormulaAutonumberingW : public QWidget
explicit FormulaAutonumberingW(QWidget *parent = nullptr); explicit FormulaAutonumberingW(QWidget *parent = nullptr);
~FormulaAutonumberingW() override; ~FormulaAutonumberingW() override;
QString formula(); QString formula();
void setContext(QString); void setContext(const QString&);
void clearContext(); void clearContext();
Ui::FormulaAutonumberingW *ui; Ui::FormulaAutonumberingW *ui;

View File

@@ -16,6 +16,7 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>. along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <QPainter> #include <QPainter>
#include <utility>
#include "titleblocktemplate.h" #include "titleblocktemplate.h"
#include "titleblocktemplaterenderer.h" #include "titleblocktemplaterenderer.h"
#include "bordertitleblock.h" #include "bordertitleblock.h"
@@ -408,7 +409,7 @@ void BorderTitleBlock::displayBorder(bool db) {
* Set Page (Folio) Auto Num * Set Page (Folio) Auto Num
*/ */
void BorderTitleBlock::slot_setAutoPageNum(QString pageAutoNum) { 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 total nombre total de schemas dans le projet
@param project_properties Project-wide properties, to be merged with diagram-wide ones. @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; if (index < 1 || total < 1 || index > total) return;
// memorise les informations // memorise les informations

View File

@@ -153,7 +153,7 @@ class BorderTitleBlock : public QObject
btb_folio_ = folio; btb_folio_ = folio;
emit (titleBlockFolioChanged(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 /// @param author the new value of the "File" field
void setMachine(const QString &machine) { btb_machine_ = machine; } void setMachine(const QString &machine) { btb_machine_ = machine; }
void setLocMach(const QString &locmach) { btb_locmach_ = locmach; } void setLocMach(const QString &locmach) { btb_locmach_ = locmach; }

View File

@@ -56,7 +56,7 @@ void ConductorAutoNumerotation::numerate() {
* @brief ConductorAutoNumerotation::applyText * @brief ConductorAutoNumerotation::applyText
* apply the text @t to @conductor_ and all conductors at the same potential * 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; if (!m_conductor) return;

View File

@@ -32,7 +32,7 @@ class ConductorAutoNumerotation
//methods //methods
void numerate (); void numerate ();
void applyText (QString); void applyText (const QString&);
private: private:
//methods //methods

View File

@@ -17,6 +17,7 @@
*/ */
#include "conductorproperties.h" #include "conductorproperties.h"
#include <QPainter> #include <QPainter>
#include <utility>
/** /**
Constructeur par defaut Constructeur par defaut
@@ -426,7 +427,7 @@ void ConductorProperties::setText(QString text) {
*/ */
void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> list) void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> list)
{ {
const QList<ConductorProperties> clist = list; const QList<ConductorProperties> clist = std::move(list);
if (clist.isEmpty()) if (clist.isEmpty())
return; return;

View File

@@ -30,6 +30,7 @@
#include <QFontDialog> #include <QFontDialog>
#include <QFont> #include <QFont>
#include <QSizePolicy> #include <QSizePolicy>
#include <utility>
/** /**
* @brief NewDiagramPage::NewDiagramPage * @brief NewDiagramPage::NewDiagramPage
@@ -203,7 +204,7 @@ void NewDiagramPage::changeToAutoFolioTab(){
* Set temporary TBP to use in auto folio num * Set temporary TBP to use in auto folio num
*/ */
void NewDiagramPage::setFolioAutonum(QString autoNum){ void NewDiagramPage::setFolioAutonum(QString autoNum){
TitleBlockProperties tbptemp = ipw->propertiesAutoNum(autoNum); TitleBlockProperties tbptemp = ipw->propertiesAutoNum(std::move(autoNum));
ipw->setProperties(tbptemp); ipw->setProperties(tbptemp);
applyConf(); applyConf();
} }

View File

@@ -39,7 +39,7 @@ Createdxf::~Createdxf()
} }
/* Header section of every DXF file.*/ /* 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. // Creation of an output stream object in text mode.
@@ -229,7 +229,7 @@ void Createdxf::dxfBegin (QString fileName)
} }
/* End Section of every DXF File*/ /* 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. // Creation of an output stream object in text mode.
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
@@ -253,7 +253,7 @@ void Createdxf::dxfEnd (QString fileName)
/* draw circle in dxf format*/ /* 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()) { if (!fileName.isEmpty()) {
QFile file(fileName); QFile file(fileName);
@@ -668,7 +668,7 @@ void Createdxf::drawRectangle(const QString &filepath, const QRectF &rect, const
} }
/* draw arc in dx format */ /* 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()) { if (!fileName.isEmpty()) {
QFile file(fileName); 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 */ /* 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()) { if (!fileName.isEmpty()) {
QFile file(fileName); 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 */ /* draw aligned text in DXF Format */
// leftAlign flag added. If the alignment requested is 'fit to width' and the text length is very small, // 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. // 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) bool leftAlign, float scale)
{ {
Q_UNUSED(scale); Q_UNUSED(scale);

View File

@@ -28,11 +28,11 @@ class Createdxf
public: public:
Createdxf(); Createdxf();
~Createdxf(); ~Createdxf();
static void dxfBegin (QString); static void dxfBegin (const QString&);
static void dxfEnd(QString); static void dxfEnd(const QString&);
// you can add more functions to create more drawings. // you can add more functions to create more drawings.
static void drawCircle(QString,double,double,double,int); static void drawCircle(const QString&,double,double,double,int);
static void drawArc(QString,double x,double y,double rad,double startAngle,double endAngle,int color); 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 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); 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 &filapath,double,double,double,double, const int &clorcode);
static void drawLine(const QString &filepath, const QLineF &line,const int &colorcode); static void drawLine(const QString &filepath, const QLineF &line,const int &colorcode);
static void drawText(QString,QString,double,double,double,double,int); static void drawText(const QString&,const 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 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); static int getcolorCode (const long red, const long green, const long blue);

View File

@@ -1,4 +1,4 @@
/* /*
Copyright 2006-2017 The QElectroTech Team Copyright 2006-2017 The QElectroTech Team
This file is part of QElectroTech. This file is part of QElectroTech.
@@ -729,7 +729,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
+ * @param hash to retrieve content with content + * @param hash to retrieve content with content
+ * @param sequential type + * @param sequential type
+ */ + */
void Diagram::folioSequentialsToXml(QHash<QString, QStringList> *hash, QDomElement *domElement, QString seq_type, QString type, QDomDocument *doc) { void Diagram::folioSequentialsToXml(QHash<QString, QStringList> *hash, QDomElement *domElement, const QString& seq_type, const QString& type, QDomDocument *doc) {
QHash<QString, QStringList>::iterator i; QHash<QString, QStringList>::iterator i;
for (i = hash->begin(); i != hash->end(); i++) { for (i = hash->begin(); i != hash->end(); i++) {
QDomElement folioseq = doc->createElement(type); 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 @return true si l'import a reussi, false sinon
*/ */
bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_informations, DiagramContent *content_ptr) { 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 // The first element must be a diagram
if (root.tagName() != "diagram") return(false); if (root.tagName() != "diagram") return(false);
@@ -1019,7 +1019,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
* @param seq type * @param seq type
* @param type of sequential * @param type of sequential
*/ */
void Diagram::folioSequentialsFromXml(const QDomElement &root, QHash<QString, QStringList>* hash, QString folioSeq, QString seq, QString type, QString autonumFolioSeqType) { void Diagram::folioSequentialsFromXml(const QDomElement &root, QHash<QString, QStringList>* hash, const QString& folioSeq, const QString& seq, const QString& type, const QString& autonumFolioSeqType) {
foreach (QDomElement folioSeqAutoNum, QET::findInDomElement(root, autonumFolioSeqType, folioSeq)) { foreach (QDomElement folioSeqAutoNum, QET::findInDomElement(root, autonumFolioSeqType, folioSeq)) {
for(QDomElement folioseq = folioSeqAutoNum.firstChildElement(type); !folioseq.isNull(); folioseq = folioseq.nextSiblingElement(type)) { for(QDomElement folioseq = folioSeqAutoNum.firstChildElement(type); !folioseq.isNull(); folioseq = folioseq.nextSiblingElement(type)) {
QString title = folioseq.attribute("title"); QString title = folioseq.attribute("title");
@@ -1236,7 +1236,7 @@ void Diagram::updateLabels()
* @param type to be treated * @param type to be treated
* @param Numerotation Context to be manipulated * @param Numerotation Context to be manipulated
*/ */
void Diagram::insertFolioSeqHash(QHash<QString, QStringList> *hash, QString title, QString type, NumerotationContext *nc) { void Diagram::insertFolioSeqHash(QHash<QString, QStringList> *hash, const QString& title, const QString& type, NumerotationContext *nc) {
QStringList max; QStringList max;
for (int i = 0; i < nc->size(); i++) { for (int i = 0; i < nc->size(); i++) {
if (nc->itemAt(i).at(0) == type) { if (nc->itemAt(i).at(0) == type) {
@@ -1257,7 +1257,7 @@ void Diagram::insertFolioSeqHash(QHash<QString, QStringList> *hash, QString titl
* @param type to be treated * @param type to be treated
* @param Numerotation Context to be manipulated * @param Numerotation Context to be manipulated
*/ */
void Diagram::loadFolioSeqHash(QHash<QString, QStringList> *hash, QString title, QString type, NumerotationContext *nc) { void Diagram::loadFolioSeqHash(QHash<QString, QStringList> *hash, const QString& title, const QString& type, NumerotationContext *nc) {
int j = 0; int j = 0;
for (int i = 0; i < nc->size(); i++) { for (int i = 0; i < nc->size(); i++) {
if (nc->itemAt(i).at(0) == type) { if (nc->itemAt(i).at(0) == type) {

View File

@@ -153,8 +153,8 @@ class Diagram : public QGraphicsScene
bool initFromXml(QDomElement &, QPointF = QPointF(), bool = true, DiagramContent * = nullptr); bool initFromXml(QDomElement &, QPointF = QPointF(), bool = true, DiagramContent * = nullptr);
bool fromXml(QDomDocument &, QPointF = QPointF(), bool = true, DiagramContent * = nullptr); bool fromXml(QDomDocument &, QPointF = QPointF(), bool = true, DiagramContent * = nullptr);
bool fromXml(QDomElement &, QPointF = QPointF(), bool = true, DiagramContent * = nullptr); bool fromXml(QDomElement &, QPointF = QPointF(), bool = true, DiagramContent * = nullptr);
void folioSequentialsToXml(QHash<QString, QStringList>*, QDomElement *, QString, QString, QDomDocument *); void folioSequentialsToXml(QHash<QString, QStringList>*, QDomElement *, const QString&, const QString&, QDomDocument *);
void folioSequentialsFromXml(const QDomElement&, QHash<QString, QStringList>*, QString, QString, QString, QString); void folioSequentialsFromXml(const QDomElement&, QHash<QString, QStringList>*, const QString&, const QString&, const QString&, const QString&);
void refreshContents(); void refreshContents();
@@ -210,8 +210,8 @@ class Diagram : public QGraphicsScene
bool freezeNewConductors(); bool freezeNewConductors();
//methods related to insertion and loading of folio sequential //methods related to insertion and loading of folio sequential
void insertFolioSeqHash (QHash<QString, QStringList> *hash, QString title, QString seq, NumerotationContext *nc); void insertFolioSeqHash (QHash<QString, QStringList> *hash, const QString& title, const QString& seq, NumerotationContext *nc);
void loadFolioSeqHash (QHash<QString, QStringList> *hash, QString title, QString seq, NumerotationContext *nc); void loadFolioSeqHash (QHash<QString, QStringList> *hash, const QString& title, const QString& seq, NumerotationContext *nc);
void changeZValue(QET::DepthOption option); void changeZValue(QET::DepthOption option);
public slots: public slots:

View File

@@ -283,7 +283,7 @@ void MoveElementsCommand::move(const QPointF &actual_movement)
* @param start value at start * @param start value at start
* @param end value at end * @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. //create animation group if not yet.
if (m_anim_group == nullptr) m_anim_group = new QParallelAnimationGroup(); if (m_anim_group == nullptr) m_anim_group = new QParallelAnimationGroup();
QPropertyAnimation *animation = new QPropertyAnimation(target, propertyName); QPropertyAnimation *animation = new QPropertyAnimation(target, propertyName);

View File

@@ -138,7 +138,7 @@ class MoveElementsCommand : public QUndoCommand {
virtual void move(const QPointF &); virtual void move(const QPointF &);
private: 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 // attributes
private: private:

View File

@@ -119,8 +119,8 @@ void DiagramFolioList::drawBackground(QPainter *p, const QRectF &r)
* @param qp Qpainter to use * @param qp Qpainter to use
* @param row_rect rectangle where we must draw the new row * @param row_rect rectangle where we must draw the new row
*/ */
void DiagramFolioList::fillRow(QPainter *qp, const QRectF &row_rect, QString author, QString title, void DiagramFolioList::fillRow(QPainter *qp, const QRectF &row_rect, const QString& author, const QString& title,
QString folio, QString machine, QString loc, QString indexrev, QString date) const QString& folio, const QString& machine, const QString& loc, const QString& indexrev, const QString& date)
{ {
qreal x = row_rect.topLeft().x(); qreal x = row_rect.topLeft().x();
qreal y = row_rect.topLeft().y(); qreal y = row_rect.topLeft().y();

View File

@@ -37,7 +37,7 @@ class DiagramFolioList : public Diagram
void drawBackground(QPainter *, const QRectF &) override; void drawBackground(QPainter *, const QRectF &) override;
private: 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 buildGrid(QPainter *, const QRectF &, int, int, qreal[]);
void fillHeader(QPainter *, const QRectF &); void fillHeader(QPainter *, const QRectF &);

View File

@@ -352,7 +352,7 @@ void DiagramPrintDialog::browseFilePrintTypeDialog() {
ou non ou non
@param options Options de rendu @param options Options de rendu
*/ */
void DiagramPrintDialog::print(const QList<Diagram *> &diagrams, bool fit_page, const ExportProperties options) { void DiagramPrintDialog::print(const QList<Diagram *> &diagrams, bool fit_page, const ExportProperties& options) {
//qDebug() << "Demande d'impression de " << diagrams.count() << "schemas."; //qDebug() << "Demande d'impression de " << diagrams.count() << "schemas.";
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
#ifdef Q_OS_WIN #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 @param save true pour memoriser les parametres du schema et appliquer ceux
definis dans options, false pour restaurer les parametres 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; static ExportProperties state_exportProperties;
if (save) { if (save) {

View File

@@ -56,13 +56,13 @@ class DiagramPrintDialog : public QWidget
private: private:
void buildPrintTypeDialog(); void buildPrintTypeDialog();
void buildDialog(); void buildDialog();
void saveReloadDiagramParameters(Diagram *, const ExportProperties, bool); void saveReloadDiagramParameters(Diagram *, const ExportProperties&, bool);
void savePageSetupForCurrentPrinter(); void savePageSetupForCurrentPrinter();
void loadPageSetupForCurrentPrinter(); void loadPageSetupForCurrentPrinter();
QString settingsSectionName(const QPrinter *); QString settingsSectionName(const QPrinter *);
private slots: private slots:
void print(const QList<Diagram *> &, bool, const ExportProperties); void print(const QList<Diagram *> &, bool, const ExportProperties&);
void printDiagram(Diagram *, bool, const ExportProperties &, QPainter *, QPrinter * = nullptr); void printDiagram(Diagram *, bool, const ExportProperties &, QPainter *, QPrinter * = nullptr);
void updatePrintTypeDialog(); void updatePrintTypeDialog();
void acceptPrintTypeDialog(); void acceptPrintTypeDialog();

View File

@@ -83,7 +83,7 @@ void ElementEditionCommand::setElementView(ElementView *view) {
*/ */
DeletePartsCommand::DeletePartsCommand( DeletePartsCommand::DeletePartsCommand(
ElementScene *scene, ElementScene *scene,
const QList<QGraphicsItem *> parts, const QList<QGraphicsItem *>& parts,
QUndoCommand *parent QUndoCommand *parent
) : ) :
ElementEditionCommand(QObject::tr("suppression", "undo caption"), scene, nullptr, 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( CutPartsCommand::CutPartsCommand(
ElementScene *scene, ElementScene *scene,
const QList<QGraphicsItem *> parts, const QList<QGraphicsItem *>& parts,
QUndoCommand *parent QUndoCommand *parent
) : ) :
DeletePartsCommand(scene, parts, parent) DeletePartsCommand(scene, parts, parent)
@@ -224,7 +224,7 @@ CutPartsCommand::~CutPartsCommand() {
MovePartsCommand::MovePartsCommand( MovePartsCommand::MovePartsCommand(
const QPointF &m, const QPointF &m,
ElementScene *scene, ElementScene *scene,
const QList<QGraphicsItem *> parts, const QList<QGraphicsItem *>& parts,
QUndoCommand *parent QUndoCommand *parent
) : ) :
ElementEditionCommand(QObject::tr("déplacement", "undo caption"), scene, nullptr, 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 context: new info about type.
* @param parent: parent undo * @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) ElementEditionCommand(scene, nullptr, parent)
{ {
m_type << scene->m_elmt_type << type; m_type << scene->m_elmt_type << type;

View File

@@ -60,7 +60,7 @@ class ElementEditionCommand : public QUndoCommand
class DeletePartsCommand : public ElementEditionCommand { class DeletePartsCommand : public ElementEditionCommand {
// constructors, destructor // constructors, destructor
public: public:
DeletePartsCommand(ElementScene *, const QList<QGraphicsItem *>, QUndoCommand * = nullptr); DeletePartsCommand(ElementScene *, const QList<QGraphicsItem *>&, QUndoCommand * = nullptr);
~DeletePartsCommand() override; ~DeletePartsCommand() override;
private: private:
DeletePartsCommand(const DeletePartsCommand &); DeletePartsCommand(const DeletePartsCommand &);
@@ -113,7 +113,7 @@ class PastePartsCommand : public ElementEditionCommand {
class CutPartsCommand : public DeletePartsCommand { class CutPartsCommand : public DeletePartsCommand {
// constructors, destructor // constructors, destructor
public: public:
CutPartsCommand(ElementScene *, const QList<QGraphicsItem *>, QUndoCommand * = nullptr); CutPartsCommand(ElementScene *, const QList<QGraphicsItem *>&, QUndoCommand * = nullptr);
~CutPartsCommand() override; ~CutPartsCommand() override;
private: private:
CutPartsCommand(const CutPartsCommand &); CutPartsCommand(const CutPartsCommand &);
@@ -125,7 +125,7 @@ class CutPartsCommand : public DeletePartsCommand {
class MovePartsCommand : public ElementEditionCommand { class MovePartsCommand : public ElementEditionCommand {
// constructors, destructor // constructors, destructor
public: public:
MovePartsCommand(const QPointF &, ElementScene *, const QList<QGraphicsItem *>, QUndoCommand * = nullptr); MovePartsCommand(const QPointF &, ElementScene *, const QList<QGraphicsItem *>&, QUndoCommand * = nullptr);
~MovePartsCommand() override; ~MovePartsCommand() override;
private: private:
MovePartsCommand(const MovePartsCommand &); MovePartsCommand(const MovePartsCommand &);
@@ -290,7 +290,7 @@ class ScalePartsCommand : public ElementEditionCommand {
class ChangePropertiesCommand : public ElementEditionCommand { class ChangePropertiesCommand : public ElementEditionCommand {
public: 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; ~ChangePropertiesCommand () override;
void undo() override; void undo() override;

View File

@@ -580,7 +580,7 @@ QETElementEditor* ElementScene::editor() const {
return m_element_editor; return m_element_editor;
} }
void ElementScene::setElementInfo(DiagramContext dc) void ElementScene::setElementInfo(const DiagramContext& dc)
{ {
if(m_elmt_information != dc) if(m_elmt_information != dc)
{ {

View File

@@ -120,7 +120,7 @@ class ElementScene : public QGraphicsScene
void cut(); void cut();
void copy(); void copy();
QETElementEditor* editor() const; QETElementEditor* editor() const;
void setElementInfo(DiagramContext dc); void setElementInfo(const DiagramContext& dc);
protected: protected:
void mouseMoveEvent (QGraphicsSceneMouseEvent *) override; void mouseMoveEvent (QGraphicsSceneMouseEvent *) override;

View File

@@ -333,7 +333,7 @@ QString PartDynamicTextField::compositeText() const{
* @brief PartDynamicTextField::setColor * @brief PartDynamicTextField::setColor
* @param color set text color to color * @param color set text color to color
*/ */
void PartDynamicTextField::setColor(QColor color) void PartDynamicTextField::setColor(const QColor& color)
{ {
setDefaultTextColor(color); setDefaultTextColor(color);
emit colorChanged(color); emit colorChanged(color);

View File

@@ -86,7 +86,7 @@ class PartDynamicTextField : public QGraphicsTextItem, public CustomElementPart
QString infoName() const; QString infoName() const;
void setCompositeText(const QString &text); void setCompositeText(const QString &text);
QString compositeText() const; QString compositeText() const;
void setColor(QColor color); void setColor(const QColor& color);
QColor color() const; QColor color() const;
void setFontSize(int s); void setFontSize(int s);
int fontSize()const; int fontSize()const;

View File

@@ -55,6 +55,7 @@
#include <QFileDialog> #include <QFileDialog>
#include <QFile> #include <QFile>
#include <QModelIndex> #include <QModelIndex>
#include <utility>
/* /*
Nombre maximum de primitives affichees par la "liste des parties" Nombre maximum de primitives affichees par la "liste des parties"
@@ -408,7 +409,7 @@ void QETElementEditor::setupMenus() {
void QETElementEditor::contextMenu(QPoint p, QList<QAction *> actions) void QETElementEditor::contextMenu(QPoint p, QList<QAction *> actions)
{ {
QMenu menu(this); QMenu menu(this);
menu.addActions(actions); menu.addActions(std::move(actions));
menu.addSeparator(); menu.addSeparator();
menu.addAction(undo); menu.addAction(undo);
menu.addAction(redo); menu.addAction(redo);

View File

@@ -45,7 +45,7 @@ DynamicTextFieldEditor::~DynamicTextFieldEditor()
{ {
delete ui; delete ui;
if(!m_connection_list.isEmpty()) if(!m_connection_list.isEmpty())
for(QMetaObject::Connection con : m_connection_list) for(const QMetaObject::Connection& con : m_connection_list)
disconnect(con); disconnect(con);
} }
@@ -59,7 +59,7 @@ bool DynamicTextFieldEditor::setPart(CustomElementPart *part)
{ {
//Remove previous connection //Remove previous connection
if(!m_connection_list.isEmpty()) if(!m_connection_list.isEmpty())
for(QMetaObject::Connection con : m_connection_list) for(const QMetaObject::Connection& con : m_connection_list)
disconnect(con); disconnect(con);
QGraphicsItem *qgi = part->toItem(); QGraphicsItem *qgi = part->toItem();
@@ -129,7 +129,7 @@ void DynamicTextFieldEditor::updateForm()
} }
} }
void DynamicTextFieldEditor::setColorPushButton(QColor color) void DynamicTextFieldEditor::setColorPushButton(const QColor& color)
{ {
QPalette palette; QPalette palette;
palette.setColor(QPalette::Button, color); 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, //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 //the value of the combo box are always alphabetically sorted
QMap <QString, QString> info_map; QMap <QString, QString> info_map;
for(QString str : strl) for(const QString& str : strl)
info_map.insert(QETApp::elementTranslatedInfoKey(str), str); 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)); ui->m_elmt_info_cb->addItem(key, info_map.value(key));
} }

View File

@@ -42,7 +42,7 @@ class DynamicTextFieldEditor : public ElementItemEditor
void updateForm() override; void updateForm() override;
private: private:
void setColorPushButton(QColor color); void setColorPushButton(const QColor& color);
void fillInfoComboBox(); void fillInfoComboBox();
private slots: private slots:

View File

@@ -154,7 +154,7 @@ void ElementPropertiesEditorWidget::populateTree()
{ {
QStringList keys{"label", "comment", "description", "designation", "manufacturer", "manufacturer-reference", "provider", "machine-manufacturer-reference"}; 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); QTreeWidgetItem *qtwi = new QTreeWidgetItem(ui->m_tree);
qtwi->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable); qtwi->setFlags(Qt::ItemIsEnabled | Qt::ItemIsEditable);

View File

@@ -174,7 +174,7 @@ QTreeWidgetItem *ElementsPanel::updateTemplateItem(QTreeWidgetItem *tb_template_
/** /**
@return true if \a item matches the filter, false otherwise @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); if (!item) return(false);
// no filter => we consider the item matches // no filter => we consider the item matches

View File

@@ -68,7 +68,7 @@ class ElementsPanel : public GenericPanel {
protected: protected:
void startDrag(Qt::DropActions) override; void startDrag(Qt::DropActions) override;
void startTitleBlockTemplateDrag(const TitleBlockTemplateLocation &); void startTitleBlockTemplateDrag(const TitleBlockTemplateLocation &);
bool matchesFilter(const QTreeWidgetItem *, QString) const; bool matchesFilter(const QTreeWidgetItem *, const QString&) const;
protected slots: protected slots:
void panelContentChange(); void panelContentChange();

View File

@@ -162,7 +162,7 @@ ImportElementTextPattern::ImportElementTextPattern(Element *elmt):
* @param ok * @param ok
* @return * @return
*/ */
QString ImportElementTextPattern::getName(QStringList list, bool &ok) const QString ImportElementTextPattern::getName(const QStringList& list, bool &ok) const
{ {
return QInputDialog::getItem(parentWidget(), return QInputDialog::getItem(parentWidget(),
QObject::tr("Séléctionner une configuration de textes"), 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. //In each group of the xml description, replace the original uuids, by the news created upper.
QList <QDomElement> groups = QET::findInDomElement(root, "texts_groups", "texts_group"); QList <QDomElement> 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")) 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"))); undo_stack.beginMacro(QObject::tr("Importer la configuration de texte : %1").arg(name.remove(".xml")));
//Add the texts to element //Add the texts to element
for(QDomElement text : texts) for(const QDomElement& text : texts)
{ {
DynamicElementTextItem *deti = new DynamicElementTextItem(m_element); DynamicElementTextItem *deti = new DynamicElementTextItem(m_element);
undo_stack.push(new AddElementTextCommand(m_element, deti)); undo_stack.push(new AddElementTextCommand(m_element, deti));
deti->fromXml(text); deti->fromXml(text);
} }
//Add the groups to element //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.push(new AddTextsGroupCommand(m_element, xml_group));
undo_stack.endMacro(); undo_stack.endMacro();

View File

@@ -45,7 +45,7 @@ class ImportElementTextPattern
ImportElementTextPattern(Element *elmt); ImportElementTextPattern(Element *elmt);
private: private:
QString getName(QStringList list, bool &ok) const; QString getName(const QStringList& list, bool &ok) const;
QWidget *parentWidget() const; QWidget *parentWidget() const;
void apply(QString name) const; void apply(QString name) const;

View File

@@ -19,6 +19,7 @@
#include <QSvgGenerator> #include <QSvgGenerator>
#include <cmath> #include <cmath>
#include <QtXml> #include <QtXml>
#include <utility>
#include "qeticons.h" #include "qeticons.h"
#include "qetmessagebox.h" #include "qetmessagebox.h"
#include "exportpropertieswidget.h" #include "exportpropertieswidget.h"
@@ -649,7 +650,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
saveReloadDiagramParameters(diagram, false); 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) QString folio, QString date)
{ {
qreal x = row_rect.bottomLeft().x(); 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; qreal height = row_rect.height() * Createdxf::yScale *0.7;
y += height*0.2; 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.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); 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 + 0.02*DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale, 0, true);
x += DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale; 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 + 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 + 3.02*DiagramFolioList::colWidths[2]*row_rect.width()*Createdxf::xScale, 0);
x += DiagramFolioList::colWidths[2]*row_rect.width()*Createdxf::xScale; 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 + 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); x + 5.02*DiagramFolioList::colWidths[3]*row_rect.width()*Createdxf::xScale, 0);
} }

View File

@@ -90,7 +90,7 @@ class ExportDialog : public QDialog {
void saveReloadDiagramParameters(Diagram *, bool = true); void saveReloadDiagramParameters(Diagram *, bool = true);
void generateSvg(Diagram *, int, int, bool, QIODevice &); void generateSvg(Diagram *, int, int, bool, QIODevice &);
void generateDxf(Diagram *, int, int, bool, QString &); 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); QImage generateImage(Diagram *, int, int, bool);
void exportDiagram(ExportDiagramLine *); void exportDiagram(ExportDiagramLine *);
qreal diagramRatio(Diagram *); qreal diagramRatio(Diagram *);

View File

@@ -344,7 +344,7 @@ void ProjectAutoNumConfigPage::buildConnections()
* Display the current selected context for conductor * Display the current selected context for conductor
* @param str, key of context stored in project * @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()); if (str == tr("Nom de la nouvelle numérotation")) m_saw_conductor -> setContext(NumerotationContext());
else m_saw_conductor ->setContext(m_project->conductorAutoNum(str)); 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 * Display the current selected context for folio
* @param str, key of context stored in project * @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()); if (str == tr("Nom de la nouvelle numérotation")) m_saw_folio -> setContext(NumerotationContext());
else m_saw_folio ->setContext(m_project->folioAutoNum(str)); 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 * Display the current selected context for element
* @param str, key of context stored in project * @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")) if (str == tr("Nom de la nouvelle numérotation"))
{ {

View File

@@ -136,13 +136,13 @@ class ProjectAutoNumConfigPage : public ProjectConfigPage {
private: private:
void buildConnections(); void buildConnections();
private slots: private slots:
void updateContextConductor(QString);//conductor void updateContextConductor(const QString&);//conductor
void saveContextConductor(); void saveContextConductor();
void removeContextConductor(); void removeContextConductor();
void updateContextFolio(QString);//folio void updateContextFolio(const QString&);//folio
void saveContextFolio(); void saveContextFolio();
void removeContextFolio(); void removeContextFolio();
void updateContextElement(QString);//element void updateContextElement(const QString&);//element
void saveContextElement(); void saveContextElement();
void removeContextElement(); void removeContextElement();

View File

@@ -195,7 +195,7 @@ bool QET::orthogonalProjection(const QPointF &point, const QLineF &line, QPointF
@param entier Pointeur facultatif vers un entier @param entier Pointeur facultatif vers un entier
@return true si l'attribut est bien un entier, false sinon @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 // verifie la presence de l'attribut
if (!e.hasAttribute(nom_attribut)) return(false); if (!e.hasAttribute(nom_attribut)) return(false);
// verifie la validite de l'attribut // 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 @param reel Pointeur facultatif vers un double
@return true si l'attribut est bien un reel, false sinon @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 // verifie la presence de l'attribut
if (!e.hasAttribute(nom_attribut)) return(false); if (!e.hasAttribute(nom_attribut)) return(false);
// verifie la validite de l'attribut // verifie la validite de l'attribut

View File

@@ -158,8 +158,8 @@ namespace QET {
bool lineContainsPoint(const QLineF &, const QPointF &); bool lineContainsPoint(const QLineF &, const QPointF &);
bool orthogonalProjection(const QPointF &, const QLineF &, QPointF * = nullptr); bool orthogonalProjection(const QPointF &, const QLineF &, QPointF * = nullptr);
bool attributeIsAnInteger(const QDomElement &, QString , int * = nullptr); bool attributeIsAnInteger(const QDomElement &, const QString& , int * = nullptr);
bool attributeIsAReal(const QDomElement &, QString , qreal * = nullptr); bool attributeIsAReal(const QDomElement &, const QString& , qreal * = nullptr);
QString ElementsAndConductorsSentence(int, int, int = 0, int = 0, int = 0, int = 0); QString ElementsAndConductorsSentence(int, int, int = 0, int = 0, int = 0, int = 0);
QList<QDomElement> findInDomElement(const QDomElement &, const QString &); QList<QDomElement> findInDomElement(const QDomElement &, const QString &);
QList<QDomElement> findInDomElement(const QDomElement &, const QString &, const QString &); QList<QDomElement> findInDomElement(const QDomElement &, const QString &, const QString &);

View File

@@ -149,7 +149,7 @@ QETApp::~QETApp()
{ {
QStringList extension_filter("*.qet"); QStringList extension_filter("*.qet");
QStringList list = dir.entryList(extension_filter); QStringList list = dir.entryList(extension_filter);
for(QString str : list) for(const QString& str : list)
dir.remove(str); dir.remove(str);
} }
} }
@@ -1660,13 +1660,13 @@ void QETApp::checkBackupFiles()
else else
text.append(tr("<b>Les fichiers de restauration suivant on été trouvé,<br>" text.append(tr("<b>Les fichiers de restauration suivant on été trouvé,<br>"
"Voulez-vous les ouvrir ?</b><br>")); "Voulez-vous les ouvrir ?</b><br>"));
for(QString name : list) for(const QString& name : list)
text.append("<br>" + name); text.append("<br>" + name);
if (QET::QetMessageBox::question(nullptr, tr("Fichier de restauration"), text, QMessageBox::Ok|QMessageBox::Cancel) == QMessageBox::Ok) if (QET::QetMessageBox::question(nullptr, tr("Fichier de restauration"), text, QMessageBox::Ok|QMessageBox::Cancel) == QMessageBox::Ok)
{ {
QStringList files_list; QStringList files_list;
for(QString str : list) for(const QString& str : list)
files_list << dir.path() + "/" + str; files_list << dir.path() + "/" + str;
QList<QETDiagramEditor *> diagrams_editors = diagramEditors(); QList<QETDiagramEditor *> diagrams_editors = diagramEditors();
@@ -1691,7 +1691,7 @@ void QETApp::checkBackupFiles()
de_open -> setVisible(true); de_open -> setVisible(true);
} }
for(QString file : files_list) { for(const QString& file : files_list) {
de_open -> openAndAddProject(file); de_open -> openAndAddProject(file);
} }
} }

View File

@@ -41,7 +41,7 @@ class ConductorXmlRetroCompatibility
{ {
friend class Conductor; 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; int i = 0;
while (!dom_element.attribute(seq + QString::number(i+1)).isEmpty()) while (!dom_element.attribute(seq + QString::number(i+1)).isEmpty())
@@ -939,7 +939,7 @@ QList<QPointF> Conductor::segmentsToPoints() const {
Regenere les segments de ce conducteur a partir de la liste de points passee en parametre 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 @param points_list Liste de points a utiliser pour generer les segments
*/ */
void Conductor::pointsToSegments(QList<QPointF> points_list) { void Conductor::pointsToSegments(const QList<QPointF>& points_list) {
// supprime les segments actuels // supprime les segments actuels
deleteSegments(); deleteSegments();
@@ -1667,7 +1667,7 @@ void Conductor::editProperty() {
ConductorPropertiesDialog::PropertiesDialog(this, diagramEditor()); ConductorPropertiesDialog::PropertiesDialog(this, diagramEditor());
} }
void Conductor::setSequenceNum(autonum::sequentialNumbers sn) void Conductor::setSequenceNum(const autonum::sequentialNumbers& sn)
{ {
m_autoNum_seq = sn; m_autoNum_seq = sn;
refreshText(); refreshText();

View File

@@ -121,7 +121,7 @@ class Conductor : public QGraphicsObject
autonum::sequentialNumbers sequenceNum () const {return m_autoNum_seq;} autonum::sequentialNumbers sequenceNum () const {return m_autoNum_seq;}
autonum::sequentialNumbers& rSequenceNum() {return m_autoNum_seq;} autonum::sequentialNumbers& rSequenceNum() {return m_autoNum_seq;}
void setSequenceNum(autonum::sequentialNumbers sn); void setSequenceNum(const autonum::sequentialNumbers& sn);
private: private:
void setUpConnectionForFormula(QString old_formula, QString new_formula); void setUpConnectionForFormula(QString old_formula, QString new_formula);
@@ -194,7 +194,7 @@ class Conductor : public QGraphicsObject
QList<QPointF> segmentsToPoints() const; QList<QPointF> segmentsToPoints() const;
QList<ConductorBend> bends() const; QList<ConductorBend> bends() const;
QList<QPointF> junctions() const; QList<QPointF> junctions() const;
void pointsToSegments(QList<QPointF>); void pointsToSegments(const QList<QPointF>&);
Qt::Corner currentPathType() const; Qt::Corner currentPathType() const;
void deleteSegments(); void deleteSegments();
static int getCoeff(const qreal &, const qreal &); static int getCoeff(const qreal &, const qreal &);

View File

@@ -96,7 +96,7 @@ void CrossRefItem::init()
*/ */
void CrossRefItem::setUpConnection() void CrossRefItem::setUpConnection()
{ {
for(QMetaObject::Connection c : m_update_connection) for(const QMetaObject::Connection& c : m_update_connection)
disconnect(c); disconnect(c);
m_update_connection.clear(); m_update_connection.clear();
@@ -369,7 +369,7 @@ void CrossRefItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
void CrossRefItem::linkedChanged() void CrossRefItem::linkedChanged()
{ {
for(QMetaObject::Connection c : m_slave_connection) for(const QMetaObject::Connection& c : m_slave_connection)
disconnect(c); disconnect(c);
m_slave_connection.clear(); m_slave_connection.clear();
@@ -781,7 +781,7 @@ void CrossRefItem::fillCrossRef(QPainter &painter)
* @param painter painter to use for draw the text * @param painter painter to use for draw the text
* @param type type of Info do be draw e.g. comment, location. * @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); 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); bool must_show = m_element -> elementInformations().keyMustShow(type);

View File

@@ -91,7 +91,7 @@ class CrossRefItem : public QGraphicsObject
void drawAsContacts (QPainter &painter); void drawAsContacts (QPainter &painter);
QRectF drawContact (QPainter &painter, int flags, Element *elmt); QRectF drawContact (QPainter &painter, int flags, Element *elmt);
void fillCrossRef (QPainter &painter); void fillCrossRef (QPainter &painter);
void AddExtraInfo (QPainter &painter, QString); void AddExtraInfo (QPainter &painter, const QString&);
QList<Element *> NOElements() const; QList<Element *> NOElements() const;
QList<Element *> NCElements() const; QList<Element *> NCElements() const;

View File

@@ -163,7 +163,7 @@ int DiagramTextItem::fontSize() const
return font().pointSize(); return font().pointSize();
} }
void DiagramTextItem::setColor(QColor color) void DiagramTextItem::setColor(const QColor& color)
{ {
setDefaultTextColor(color); setDefaultTextColor(color);
emit colorChanged(color); emit colorChanged(color);

View File

@@ -68,7 +68,7 @@ class DiagramTextItem : public QGraphicsTextItem
void setFontSize(int s); void setFontSize(int s);
int fontSize()const; int fontSize()const;
void setColor(QColor color); void setColor(const QColor& color);
QColor color() const; QColor color() const;
void setNoEditable(bool e = true) {m_no_editable = e;} void setNoEditable(bool e = true) {m_no_editable = e;}

View File

@@ -969,7 +969,7 @@ void DynamicElementTextItem::setupFormulaConnection()
void DynamicElementTextItem::clearFormulaConnection() void DynamicElementTextItem::clearFormulaConnection()
{ {
for (QMetaObject::Connection con : m_formula_connection) for (const QMetaObject::Connection& con : m_formula_connection)
disconnect(con); disconnect(con);
m_formula_connection.clear(); m_formula_connection.clear();
} }

View File

@@ -20,6 +20,7 @@
#include "conductor.h" #include "conductor.h"
#include "diagramcommands.h" #include "diagramcommands.h"
#include <QtDebug> #include <QtDebug>
#include <utility>
#include "elementprovider.h" #include "elementprovider.h"
#include "diagramposition.h" #include "diagramposition.h"
#include "terminal.h" #include "terminal.h"
@@ -35,7 +36,7 @@ class ElementXmlRetroCompatibility
{ {
friend class Element; 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; int i = 0;
while (!dom_element.attribute(seq + QString::number(i+1)).isEmpty()) while (!dom_element.attribute(seq + QString::number(i+1)).isEmpty())
@@ -451,7 +452,7 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
//************************// //************************//
//***Dynamic texts item***// //***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); DynamicElementTextItem *deti = new DynamicElementTextItem(this);
addDynamicTextItem(deti); addDynamicTextItem(deti);
@@ -471,7 +472,7 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
for (DynamicElementTextItem *deti : conv_deti_list) 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. //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 //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 * set Element Prefix
*/ */
void Element::setPrefix(QString prefix) { void Element::setPrefix(QString prefix) {
m_prefix = prefix; m_prefix = std::move(prefix);
} }
/** /**

View File

@@ -28,6 +28,7 @@
#include <QPainter> #include <QPainter>
#include <QGraphicsSceneMouseEvent> #include <QGraphicsSceneMouseEvent>
#include <utility>
bool sorting(QGraphicsItem *qgia, QGraphicsItem *qgib) bool sorting(QGraphicsItem *qgia, QGraphicsItem *qgib)
{ {
@@ -253,7 +254,7 @@ void ElementTextItemGroup::setVerticalAdjustment(int v)
*/ */
void ElementTextItemGroup::setName(QString name) void ElementTextItemGroup::setName(QString name)
{ {
m_name = name; m_name = std::move(name);
emit nameChanged(m_name); emit nameChanged(m_name);
} }
@@ -412,7 +413,7 @@ void ElementTextItemGroup::fromXml(QDomElement &dom_element)
if(parentElement()) if(parentElement())
{ {
m_block_alignment_update = true; 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; DynamicElementTextItem *deti = nullptr;
QUuid uuid(text.attribute("uuid")); QUuid uuid(text.attribute("uuid"));

View File

@@ -880,7 +880,7 @@ bool QetShapeItem::fromXml(const QDomElement &e)
} }
} }
else { 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()); m_polygon << QPointF(de.attribute("x", nullptr).toDouble(), de.attribute("y", nullptr).toDouble());
} }
} }

View File

@@ -23,7 +23,7 @@
#include "conductor.h" #include "conductor.h"
#include "dynamicelementtextitem.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) CustomElement(location, qgi, state)
{ {
link_type == "next_report"? m_link_type=NextReport : m_link_type=PreviousReport; link_type == "next_report"? m_link_type=NextReport : m_link_type=PreviousReport;

View File

@@ -30,7 +30,7 @@ class ReportElement : public CustomElement
Q_OBJECT Q_OBJECT
public : 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; ~ReportElement() override;
void linkToElement(Element *) override; void linkToElement(Element *) override;
void unlinkAllElements() override; void unlinkAllElements() override;

View File

@@ -16,6 +16,8 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>. along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "terminal.h" #include "terminal.h"
#include <utility>
#include "diagram.h" #include "diagram.h"
#include "qetgraphicsitem/element.h" #include "qetgraphicsitem/element.h"
#include "qetgraphicsitem/conductor.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); default : dock_elmt_ += QPointF(0, -Terminal::terminalSize);
} }
// Number of terminal // Number of terminal
number_terminal_ = number; number_terminal_ = std::move(number);
// Name of terminal // Name of terminal
name_terminal_ = name; name_terminal_ = std::move(name);
name_terminal_hidden = hiddenName; name_terminal_hidden = hiddenName;
// par defaut : pas de conducteur // par defaut : pas de conducteur
@@ -127,7 +129,7 @@ Terminal::Terminal(QPointF pf, Qet::Orientation o, QString num, QString name, bo
parent_element_ (e), parent_element_ (e),
hovered_color_ (Terminal::neutralColor) 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 * @param number
*/ */
void Terminal::setNumber(QString 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 * @param name
*/ */
void Terminal::setName(QString name, bool hiddenName) { void Terminal::setName(QString name, bool hiddenName) {
name_terminal_ = name; name_terminal_ = std::move(name);
name_terminal_hidden = hiddenName; name_terminal_hidden = hiddenName;
} }

View File

@@ -34,6 +34,7 @@
#include <QTimer> #include <QTimer>
#include <QStandardPaths> #include <QStandardPaths>
#include <utility>
static int BACKUP_INTERVAL = 300000; //interval in ms of backup static int BACKUP_INTERVAL = 300000; //interval in ms of backup
@@ -445,7 +446,7 @@ void QETProject::setDefaultReportProperties(const QString &properties)
emit reportPropertiesChanged(old, 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); m_default_xref_properties.insert(type, properties);
emit XRefPropertiesChanged(); emit XRefPropertiesChanged();
} }
@@ -477,7 +478,7 @@ QHash <QString, NumerotationContext> QETProject::elementAutoNum() const {
* @param element autonum title * @param element autonum title
* @return Formula of element autonum stored in element autonum * @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)) { if (m_element_autonum.contains(key)) {
return autonum::numerotationContextToFormula(m_element_autonum[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 * @param autoNum : set the current element autonum to @autonum
*/ */
void QETProject::setCurrrentElementAutonum(QString 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 * @param conductor autonum title
* @return Formula of element autonum stored in conductor autonum * @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)) if (m_conductor_autonum.contains(key))
return autonum::numerotationContextToFormula(m_conductor_autonum.value(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 * @param autoNum set the current conductor autonum to @autonum
*/ */
void QETProject::setCurrentConductorAutoNum(QString autoNum) { void QETProject::setCurrentConductorAutoNum(QString autoNum) {
m_current_conductor_autonum = autoNum; m_current_conductor_autonum = std::move(autoNum);
} }
/** /**
@@ -554,7 +555,7 @@ QHash <QString, NumerotationContext> QETProject::folioAutoNum() const {
* @param key * @param key
* @param context * @param context
*/ */
void QETProject::addConductorAutoNum(QString key, NumerotationContext context) { void QETProject::addConductorAutoNum(const QString& key, const NumerotationContext& context) {
m_conductor_autonum.insert(key, context); m_conductor_autonum.insert(key, context);
} }
@@ -565,7 +566,7 @@ void QETProject::addConductorAutoNum(QString key, NumerotationContext context) {
* @param key * @param key
* @param context * @param context
*/ */
void QETProject::addElementAutoNum(QString key, NumerotationContext context) void QETProject::addElementAutoNum(const QString& key, const NumerotationContext& context)
{ {
m_element_autonum.insert(key, context); m_element_autonum.insert(key, context);
emit elementAutoNumAdded(key); emit elementAutoNumAdded(key);
@@ -578,7 +579,7 @@ void QETProject::addElementAutoNum(QString key, NumerotationContext context)
* @param key * @param key
* @param context * @param context
*/ */
void QETProject::addFolioAutoNum(QString key, NumerotationContext context) { void QETProject::addFolioAutoNum(const QString& key, const NumerotationContext& context) {
m_folio_autonum.insert(key, 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 * Remove Conductor Numerotation Context stored with key
* @param key * @param key
*/ */
void QETProject::removeConductorAutoNum(QString key) { void QETProject::removeConductorAutoNum(const QString& key) {
m_conductor_autonum.remove(key); m_conductor_autonum.remove(key);
} }
@@ -596,7 +597,7 @@ void QETProject::removeConductorAutoNum(QString key) {
* Remove Element Numerotation Context stored with key * Remove Element Numerotation Context stored with key
* @param key * @param key
*/ */
void QETProject::removeElementAutoNum(QString key) void QETProject::removeElementAutoNum(const QString& key)
{ {
m_element_autonum.remove(key); m_element_autonum.remove(key);
emit elementAutoNumRemoved(key); emit elementAutoNumRemoved(key);
@@ -607,7 +608,7 @@ void QETProject::removeElementAutoNum(QString key)
* Remove Folio Numerotation Context stored with key * Remove Folio Numerotation Context stored with key
* @param key * @param key
*/ */
void QETProject::removeFolioAutoNum(QString key) { void QETProject::removeFolioAutoNum(const QString& key) {
m_folio_autonum.remove(key); m_folio_autonum.remove(key);
} }
@@ -760,7 +761,7 @@ void QETProject::autoFolioNumberingNewFolios(){
* @param autonum used, index from selected tabs "from" and "to" * @param autonum used, index from selected tabs "from" and "to"
* rename folios with selected autonum * 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(); int total_folio = m_diagrams_list.count();
DiagramContext project_wide_properties = project_properties_; DiagramContext project_wide_properties = project_properties_;
for (int i=from; i<=to; i++) { for (int i=from; i<=to; i++) {

View File

@@ -103,27 +103,27 @@ class QETProject : public QObject
XRefProperties defaultXRefProperties (const QString &type) const {return m_default_xref_properties[type];} XRefProperties defaultXRefProperties (const QString &type) const {return m_default_xref_properties[type];}
QHash <QString, XRefProperties> defaultXRefProperties() const {return m_default_xref_properties;} QHash <QString, XRefProperties> 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 <QString, XRefProperties> hash); void setDefaultXRefProperties(QHash <QString, XRefProperties> hash);
QHash <QString, NumerotationContext> conductorAutoNum() const; QHash <QString, NumerotationContext> conductorAutoNum() const;
QHash <QString, NumerotationContext> elementAutoNum() const; QHash <QString, NumerotationContext> elementAutoNum() const;
QHash <QString, NumerotationContext> folioAutoNum() const; QHash <QString, NumerotationContext> folioAutoNum() const;
void addConductorAutoNum (QString key, NumerotationContext context); void addConductorAutoNum (const QString& key, const NumerotationContext& context);
void addElementAutoNum (QString key, NumerotationContext context); void addElementAutoNum (const QString& key, const NumerotationContext& context);
void addFolioAutoNum (QString key, NumerotationContext context); void addFolioAutoNum (const QString& key, const NumerotationContext& context);
void removeConductorAutoNum (QString key); void removeConductorAutoNum (const QString& key);
void removeElementAutoNum (QString key); void removeElementAutoNum (const QString& key);
void removeFolioAutoNum (QString key); void removeFolioAutoNum (const QString& key);
NumerotationContext conductorAutoNum(const QString &key) const; NumerotationContext conductorAutoNum(const QString &key) const;
NumerotationContext folioAutoNum(const QString &key) const; NumerotationContext folioAutoNum(const QString &key) const;
NumerotationContext elementAutoNum(const QString &key); NumerotationContext elementAutoNum(const QString &key);
QString conductorAutoNumFormula(const QString key) const; //returns Formula QString conductorAutoNumFormula(const QString& key) const; //returns Formula
QString conductorCurrentAutoNum() const; QString conductorCurrentAutoNum() const;
void setCurrentConductorAutoNum(QString autoNum); void setCurrentConductorAutoNum(QString autoNum);
QString elementAutoNumFormula(const QString key) const; QString elementAutoNumFormula(const QString& key) const;
QString elementAutoNumCurrentFormula() const; QString elementAutoNumCurrentFormula() const;
QString elementCurrentAutoNum() const; QString elementCurrentAutoNum() const;
void setCurrrentElementAutonum(QString autoNum); void setCurrrentElementAutonum(QString autoNum);
@@ -146,7 +146,7 @@ class QETProject : public QObject
void setAutoConductor (bool ac); void setAutoConductor (bool ac);
void setAutoElement (bool ae); void setAutoElement (bool ae);
void autoFolioNumberingNewFolios (); void autoFolioNumberingNewFolios ();
void autoFolioNumberingSelectedFolios(int, int, QString); void autoFolioNumberingSelectedFolios(int, int, const QString&);
QDomDocument toXml(); QDomDocument toXml();
bool close(); bool close();

View File

@@ -26,7 +26,7 @@ const int QETSingleApplication::timeout_ = 10000;
@param argv Tableau des arguments passes au programme par le systeme @param argv Tableau des arguments passes au programme par le systeme
@param unique_key Cle unique @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), QApplication(argc, argv),
unique_key_(unique_key) unique_key_(unique_key)
{ {

View File

@@ -28,7 +28,7 @@ class QETSingleApplication : public QApplication {
Q_OBJECT Q_OBJECT
// constructors, destructor // constructors, destructor
public: public:
QETSingleApplication(int &, char **, const QString); QETSingleApplication(int &, char **, const QString&);
~QETSingleApplication() override; ~QETSingleApplication() override;
private: private:

View File

@@ -27,7 +27,7 @@
* @param pen : the pen to store * @param pen : the pen to store
* @return : A QDomElement with the attribute stored. The tagName of QDomeElement is "pen". * @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"); QDomElement element = parent_document.createElement("pen");
@@ -88,7 +88,7 @@ QPen QETXML::penFromXml(const QDomElement &element)
* @param brush : the brush to store * @param brush : the brush to store
* @return A QDomElement with the attribute stored. The tagName of QDomeElement is "brush". * @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"); 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. * @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. * 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(); 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 * @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 * 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)) 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 * @param value
* @return * @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); QDomElement element = document.createElement(tag_name);
QDomText text = document.createTextNode(value); QDomText text = document.createTextNode(value);

View File

@@ -30,18 +30,18 @@ class QFile;
*/ */
namespace QETXML namespace QETXML
{ {
QDomElement penToXml(QDomDocument &parent_document, QPen pen); QDomElement penToXml(QDomDocument &parent_document, const QPen& pen);
QPen penFromXml (const QDomElement &element); 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); QBrush brushFromXml (const QDomElement &element);
QDomElement fileSystemDirToXmlCollectionDir (QDomDocument &document, const QDir &dir, QString rename = QString()); QDomElement fileSystemDirToXmlCollectionDir (QDomDocument &document, const QDir &dir, const QString& rename = QString());
QDomElement fileSystemElementToXmlCollectionElement (QDomDocument &document, QFile &file, 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); 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 #endif // QETXML_H

View File

@@ -615,7 +615,7 @@ void QETTitleBlockTemplateEditor::writeSettings()
Update various things when user changes the selected cells. Update various things when user changes the selected cells.
@param selected_cells List of selected cells. @param selected_cells List of selected cells.
*/ */
void QETTitleBlockTemplateEditor::selectedCellsChanged(QList<TitleBlockCell *> selected_cells) { void QETTitleBlockTemplateEditor::selectedCellsChanged(const QList<TitleBlockCell *>& selected_cells) {
if (selected_cells.count() == 1) { if (selected_cells.count() == 1) {
template_cell_editor_widget_ -> edit(selected_cells.at(0)); template_cell_editor_widget_ -> edit(selected_cells.at(0));
template_cell_editor_widget_ -> setVisible(true); template_cell_editor_widget_ -> setVisible(true);

View File

@@ -104,7 +104,7 @@ class QETTitleBlockTemplateEditor : public QETMainWindow {
public slots: public slots:
void readSettings(); void readSettings();
void writeSettings(); void writeSettings();
void selectedCellsChanged(QList<TitleBlockCell *>); void selectedCellsChanged(const QList<TitleBlockCell *>&);
void duplicateCurrentLocation(); void duplicateCurrentLocation();
bool edit(const TitleBlockTemplateLocation &); bool edit(const TitleBlockTemplateLocation &);
bool edit(QETProject *, const QString &); bool edit(QETProject *, const QString &);

View File

@@ -1,4 +1,6 @@
#include "compositetexteditdialog.h" #include "compositetexteditdialog.h"
#include <utility>
#include "ui_compositetexteditdialog.h" #include "ui_compositetexteditdialog.h"
#include "dynamicelementtextitem.h" #include "dynamicelementtextitem.h"
#include "element.h" #include "element.h"
@@ -24,7 +26,7 @@ CompositeTextEditDialog::CompositeTextEditDialog(QString text, QWidget *parent)
ui(new Ui::CompositeTextEditDialog) ui(new Ui::CompositeTextEditDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
m_default_text = text; m_default_text = std::move(text);
ui->m_plain_text_edit->setPlainText(m_default_text); ui->m_plain_text_edit->setPlainText(m_default_text);
#if QT_VERSION >= 0x050300 #if QT_VERSION >= 0x050300
ui->m_plain_text_edit->setPlaceholderText(tr("Entrée votre texte composé ici, en vous aidant des variables disponible")); 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, //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 //the value of the combo box are always alphabetically sorted
QMap <QString, QString> info_map; QMap <QString, QString> info_map;
for(QString str : qstrl) { for(const QString& str : qstrl) {
info_map.insert(QETApp::elementTranslatedInfoKey(str), QETApp::elementInfoToVar(str)); 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)); ui->m_info_cb->addItem(key, info_map.value(key));
} }
} }

View File

@@ -1226,7 +1226,7 @@ void DynamicElementTextModel::setConnection(DynamicElementTextItem *deti, bool s
if(!m_hash_text_connect.keys().contains(deti)) if(!m_hash_text_connect.keys().contains(deti))
return; return;
for (QMetaObject::Connection con : m_hash_text_connect.value(deti)) for (const QMetaObject::Connection& con : m_hash_text_connect.value(deti))
disconnect(con); disconnect(con);
m_hash_text_connect.remove(deti); 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)) if(!m_hash_group_connect.keys().contains(group))
return; return;
for (QMetaObject::Connection con : m_hash_group_connect.value(group)) for (const QMetaObject::Connection& con : m_hash_group_connect.value(group))
disconnect(con); disconnect(con);
m_hash_group_connect.remove(group); 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, //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 //the value of the combo box are always alphabetically sorted
QMap <QString, QString> info_map; QMap <QString, QString> info_map;
for(QString str : availableInfo(deti)) { for(const QString& str : availableInfo(deti)) {
info_map.insert(QETApp::elementTranslatedInfoKey(str), str); info_map.insert(QETApp::elementTranslatedInfoKey(str), str);
} }
QComboBox *qcb = new QComboBox(parent); QComboBox *qcb = new QComboBox(parent);
qcb->setObjectName("info_text"); qcb->setObjectName("info_text");
for (QString key : info_map.keys()) { for (const QString& key : info_map.keys()) {
qcb->addItem(key, info_map.value(key)); qcb->addItem(key, info_map.value(key));
} }
return qcb; return qcb;
@@ -1733,7 +1733,7 @@ QStringList DynamicTextItemDelegate::availableInfo(DynamicElementTextItem *deti)
info_list.removeAll("formula"); //No need to have formula info_list.removeAll("formula"); //No need to have formula
DiagramContext dc = elmt->elementInformations(); DiagramContext dc = elmt->elementInformations();
for(QString info : info_list) for(const QString& info : info_list)
{ {
if(dc.contains(info)) if(dc.contains(info))
qstrl << info; qstrl << info;

View File

@@ -16,6 +16,8 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>. along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "elementinfopartwidget.h" #include "elementinfopartwidget.h"
#include <utility>
#include "ui_elementinfopartwidget.h" #include "ui_elementinfopartwidget.h"
@@ -26,10 +28,10 @@
* @param translated_key the string key translated * @param translated_key the string key translated
* @param parent parent widget * @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), QWidget(parent),
ui(new Ui::ElementInfoPartWidget), ui(new Ui::ElementInfoPartWidget),
key_(key) key_(std::move(key))
{ {
ui->setupUi(this); ui->setupUi(this);
ui->label_->setText(translated_key); ui->label_->setText(translated_key);

View File

@@ -30,7 +30,7 @@ class ElementInfoPartWidget : public QWidget
//METHODS //METHODS
public: public:
explicit ElementInfoPartWidget(QString key, QString translated_key, QWidget *parent = nullptr); explicit ElementInfoPartWidget(QString key, const QString& translated_key, QWidget *parent = nullptr);
~ElementInfoPartWidget() override; ~ElementInfoPartWidget() override;
QString key () const {return key_;} QString key () const {return key_;}

View File

@@ -32,17 +32,17 @@ FormulaAssistantDialog::~FormulaAssistantDialog()
delete ui; delete ui;
} }
void FormulaAssistantDialog::setForbiddenVariables(QStringList list) void FormulaAssistantDialog::setForbiddenVariables(const QStringList& list)
{ {
m_rx.setPattern(list.join("|")); m_rx.setPattern(list.join("|"));
} }
void FormulaAssistantDialog::setText(QString text) void FormulaAssistantDialog::setText(const QString& text)
{ {
ui->m_label->setText(text); ui->m_label->setText(text);
} }
void FormulaAssistantDialog::setFormula(QString text) void FormulaAssistantDialog::setFormula(const QString& text)
{ {
ui->m_line_edit->setText(text); ui->m_line_edit->setText(text);
} }

View File

@@ -33,9 +33,9 @@ class FormulaAssistantDialog : public QDialog
FormulaAssistantDialog(QWidget *parent = nullptr); FormulaAssistantDialog(QWidget *parent = nullptr);
~FormulaAssistantDialog() override; ~FormulaAssistantDialog() override;
void setForbiddenVariables(QStringList list); void setForbiddenVariables(const QStringList& list);
void setText(QString text); void setText(const QString& text);
void setFormula(QString text); void setFormula(const QString& text);
QString formula() const; QString formula() const;
private slots: private slots:

View File

@@ -18,7 +18,7 @@
#include "reportpropertiewidget.h" #include "reportpropertiewidget.h"
#include "ui_reportpropertiewidget.h" #include "ui_reportpropertiewidget.h"
ReportPropertieWidget::ReportPropertieWidget(QString value, QWidget *parent) : ReportPropertieWidget::ReportPropertieWidget(const QString& value, QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::ReportPropertieWidget) ui(new Ui::ReportPropertieWidget)
{ {
@@ -35,7 +35,7 @@ void ReportPropertieWidget::toSettings(QSettings &settings, const QString &prefi
settings.setValue(prefix + "label", ui->line_edit->text()); settings.setValue(prefix + "label", ui->line_edit->text());
} }
void ReportPropertieWidget::setReportProperties(QString label) { void ReportPropertieWidget::setReportProperties(const QString& label) {
ui->line_edit->setText(label); ui->line_edit->setText(label);
} }

View File

@@ -31,10 +31,10 @@ class ReportPropertieWidget : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit ReportPropertieWidget(QString value, QWidget *parent = nullptr); explicit ReportPropertieWidget(const QString& value, QWidget *parent = nullptr);
~ReportPropertieWidget() override; ~ReportPropertieWidget() override;
void toSettings (QSettings &settings, const QString &prefix); void toSettings (QSettings &settings, const QString &prefix);
void setReportProperties (QString label); void setReportProperties (const QString& label);
QString ReportProperties () const; QString ReportProperties () const;
private: private:

View File

@@ -22,6 +22,7 @@
#include "titleblocktemplate.h" #include "titleblocktemplate.h"
#include "qetapp.h" #include "qetapp.h"
#include <QMenu> #include <QMenu>
#include <utility>
/** /**
* @brief TitleBlockPropertiesWidget::TitleBlockPropertiesWidget * @brief TitleBlockPropertiesWidget::TitleBlockPropertiesWidget
@@ -221,7 +222,7 @@ TitleBlockProperties TitleBlockPropertiesWidget::propertiesAutoNum(QString autoN
prop.context = m_dcw -> context(); prop.context = m_dcw -> context();
prop.auto_page_num = autoNum; prop.auto_page_num = std::move(autoNum);
return prop; return prop;
} }

View File

@@ -16,6 +16,8 @@
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>. along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "xrefpropertieswidget.h" #include "xrefpropertieswidget.h"
#include <utility>
#include "ui_xrefpropertieswidget.h" #include "ui_xrefpropertieswidget.h"
#include "qdebug.h" #include "qdebug.h"
@@ -28,7 +30,7 @@
XRefPropertiesWidget::XRefPropertiesWidget(QHash <QString, XRefProperties> properties, QWidget *parent) : XRefPropertiesWidget::XRefPropertiesWidget(QHash <QString, XRefProperties> properties, QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::XRefPropertiesWidget), ui(new Ui::XRefPropertiesWidget),
m_properties(properties) m_properties(std::move(properties))
{ {
ui->setupUi(this); ui->setupUi(this);
buildUi(); buildUi();

View File

@@ -21,6 +21,7 @@
#include "elementtextitemgroup.h" #include "elementtextitemgroup.h"
#include <QGraphicsScene> #include <QGraphicsScene>
#include <utility>
/************************ /************************
@@ -70,7 +71,7 @@ void AddElementTextCommand::redo()
AddTextsGroupCommand::AddTextsGroupCommand(Element *element, QString groupe_name, QUndoCommand *parent) : AddTextsGroupCommand::AddTextsGroupCommand(Element *element, QString groupe_name, QUndoCommand *parent) :
QUndoCommand(parent), QUndoCommand(parent),
m_element(element), m_element(element),
m_name(groupe_name) m_name(std::move(groupe_name))
{ {
setText(QObject::tr("Ajouter un groupe de textes d'élément")); 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 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 * @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), QUndoCommand(parent),
m_element(element), m_element(element),
m_dom_element(dom_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<DynamicElementTextItem *> texts_list, QUndoCommand *parent) : AddTextsGroupCommand::AddTextsGroupCommand(Element *element, QString groupe_name, QList<DynamicElementTextItem *> texts_list, QUndoCommand *parent) :
QUndoCommand(parent), QUndoCommand(parent),
m_element(element), m_element(element),
m_name(groupe_name) m_name(std::move(groupe_name))
{ {
for(DynamicElementTextItem *deti : texts_list) for(DynamicElementTextItem *deti : texts_list)
{ {
@@ -188,7 +189,7 @@ void RemoveTextsGroupCommand::undo()
{ {
m_element.data()->addTextGroup(m_group.data()); m_element.data()->addTextGroup(m_group.data());
for(QPointer<DynamicElementTextItem> p : m_text_list) for(const QPointer<DynamicElementTextItem>& p : m_text_list)
if(p) if(p)
m_element.data()->addTextToGroup(p.data(), m_group.data()); m_element.data()->addTextToGroup(p.data(), m_group.data());
} }
@@ -198,7 +199,7 @@ void RemoveTextsGroupCommand::redo()
{ {
if(m_element && m_group) if(m_element && m_group)
{ {
for(QPointer<DynamicElementTextItem> p : m_text_list) for(const QPointer<DynamicElementTextItem>& p : m_text_list)
if(p) if(p)
m_element.data()->removeTextFromGroup(p.data(), m_group.data()); m_element.data()->removeTextFromGroup(p.data(), m_group.data());

View File

@@ -52,7 +52,7 @@ class AddTextsGroupCommand : public QUndoCommand
{ {
public: public:
AddTextsGroupCommand(Element *element, QString groupe_name, QUndoCommand *parent = nullptr); 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<DynamicElementTextItem *> texts_list, QUndoCommand *parent = nullptr); AddTextsGroupCommand(Element *element, QString groupe_name, QList<DynamicElementTextItem *> texts_list, QUndoCommand *parent = nullptr);
~AddTextsGroupCommand() override; ~AddTextsGroupCommand() override;

View File

@@ -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. * This method do several check to know if element can be linked or not.
* @param element_list * @param element_list
*/ */
void LinkElementCommand::setLink(QList<Element *> element_list) void LinkElementCommand::setLink(const QList<Element *>& element_list)
{ {
m_linked_after.clear(); m_linked_after.clear();
setUpNewLink(element_list, true); setUpNewLink(element_list, true);

View File

@@ -38,7 +38,7 @@ class LinkElementCommand : public QUndoCommand
static bool isLinkable (Element *element_a, Element *element_b, bool already_linked = false); static bool isLinkable (Element *element_a, Element *element_b, bool already_linked = false);
void setLink (QList<Element *> element_list); void setLink (const QList<Element *>& element_list);
void setLink (Element *element_); void setLink (Element *element_);
void unlink (QList<Element *> element_list); void unlink (QList<Element *> element_list);
void unlinkAll (); void unlinkAll ();

View File

@@ -87,7 +87,7 @@ void RotateSelectionCommand::undo()
m_diagram->showMe(); m_diagram->showMe();
QUndoCommand::undo(); QUndoCommand::undo();
for(QPointer<ConductorTextItem> cti : m_cond_text) for(const QPointer<ConductorTextItem>& cti : m_cond_text)
{ {
cti->forceRotateByUser(m_rotate_by_user.value(cti.data())); cti->forceRotateByUser(m_rotate_by_user.value(cti.data()));
if(!cti->wasRotateByUser()) if(!cti->wasRotateByUser())
@@ -103,7 +103,7 @@ void RotateSelectionCommand::redo()
m_diagram->showMe(); m_diagram->showMe();
QUndoCommand::redo(); QUndoCommand::redo();
for(QPointer<ConductorTextItem> cti : m_cond_text) for(const QPointer<ConductorTextItem>& cti : m_cond_text)
{ {
m_rotate_by_user.insert(cti, cti->wasRotateByUser()); m_rotate_by_user.insert(cti, cti->wasRotateByUser());
cti->forceRotateByUser(true); cti->forceRotateByUser(true);

View File

@@ -138,7 +138,7 @@ void RotateTextsCommand::openDialog()
#endif #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) if(m_anim_group == nullptr)
m_anim_group = new QParallelAnimationGroup(); m_anim_group = new QParallelAnimationGroup();

View File

@@ -40,7 +40,7 @@ class RotateTextsCommand : public QUndoCommand
private: private:
void openDialog(); 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: private:
QPointer<Diagram> m_diagram; QPointer<Diagram> m_diagram;