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

View File

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

View File

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

View File

@@ -46,7 +46,7 @@ class ElementCollectionItem : public QStandardItem
virtual void clearData();
ElementCollectionItem *lastItemForPath(const QString &path, QString &no_found_path);
ElementCollectionItem *childWithCollectionName(QString name) const;
ElementCollectionItem *childWithCollectionName(const QString& name) const;
QList<QStandardItem *> directChilds() const;
int rowForInsertItem(const QString &name);
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.
* @param location
*/
void ElementsCollectionModel::addLocation(ElementsLocation location)
void ElementsCollectionModel::addLocation(const ElementsLocation& location)
{
QModelIndex index = indexFromLocation(location);
if (index.isValid())
@@ -504,7 +504,7 @@ QModelIndex ElementsCollectionModel::indexFromLocation(const ElementsLocation &l
* this method create and display the new element
* @param path -The path of the new element in the embedded collection of a project
*/
void ElementsCollectionModel::elementIntegratedToCollection(QString path)
void ElementsCollectionModel::elementIntegratedToCollection(const QString& path)
{
QObject *object = sender();
XmlElementCollection *collection = static_cast<XmlElementCollection *> (object);
@@ -537,7 +537,7 @@ void ElementsCollectionModel::elementIntegratedToCollection(QString path)
* This method must be called by a signal, to get a sender.
* @param path
*/
void ElementsCollectionModel::itemRemovedFromCollection(QString path)
void ElementsCollectionModel::itemRemovedFromCollection(const QString& path)
{
QObject *object = sender();
XmlElementCollection *collection = static_cast<XmlElementCollection *> (object);
@@ -565,7 +565,7 @@ void ElementsCollectionModel::itemRemovedFromCollection(QString path)
* Update the item at path
* @param path
*/
void ElementsCollectionModel::updateItem(QString path)
void ElementsCollectionModel::updateItem(const QString& path)
{
QObject *object = sender();
XmlElementCollection *collection = static_cast<XmlElementCollection *> (object);

View File

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

View File

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

View File

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

View File

@@ -37,7 +37,7 @@ FileElementCollectionItem::FileElementCollectionItem()
* @param path
* @return true if path exist.
*/
bool FileElementCollectionItem::setRootPath(QString path, bool set_data, bool hide_element)
bool FileElementCollectionItem::setRootPath(const QString& path, bool set_data, bool hide_element)
{
QDir dir(path);
if (dir.exists()) {
@@ -278,7 +278,7 @@ void FileElementCollectionItem::setUpIcon()
* For create a new file collection see setRootPath.
* @param path_name
*/
void FileElementCollectionItem::setPathName(QString path_name, bool set_data, bool hide_element)
void FileElementCollectionItem::setPathName(const QString& path_name, bool set_data, bool hide_element)
{
m_path = path_name;

View File

@@ -33,7 +33,7 @@ class FileElementCollectionItem : public ElementCollectionItem
enum { Type = UserType+2 };
int type() const override { return Type;}
bool setRootPath(QString path, bool set_data = true, bool hide_element = false);
bool setRootPath(const QString& path, bool set_data = true, bool hide_element = false);
QString fileSystemPath() const;
QString dirPath() const;
@@ -54,7 +54,7 @@ class FileElementCollectionItem : public ElementCollectionItem
private:
void setPathName(QString path_name, bool set_data = true, bool hide_element = false);
void setPathName(const QString& path_name, bool set_data = true, bool hide_element = false);
void populate(bool set_data = true, bool hide_element = false);
private:

View File

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

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

View File

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

View File

@@ -259,7 +259,7 @@ void XmlProjectElementCollectionItem::populate(bool set_data, bool hide_element)
* @param project : the parent project of managed collection
* @param set_data : if true, call setUpData for every child of this item
*/
void XmlProjectElementCollectionItem::setXmlElement(QDomElement element, QETProject *project, bool set_data, bool hide_element)
void XmlProjectElementCollectionItem::setXmlElement(const QDomElement& element, QETProject *project, bool set_data, bool hide_element)
{
m_dom_element = element;
m_project = project;

View File

@@ -51,7 +51,7 @@ class XmlProjectElementCollectionItem : public ElementCollectionItem
private:
void populate(bool set_data = true, bool hide_element = false);
void setXmlElement(QDomElement element, QETProject *project, bool set_data = true, bool hide_element = false);
void setXmlElement(const QDomElement& element, QETProject *project, bool set_data = true, bool hide_element = false);
private:
QETProject *m_project = nullptr;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -56,7 +56,7 @@ void ConductorAutoNumerotation::numerate() {
* @brief ConductorAutoNumerotation::applyText
* apply the text @t to @conductor_ and all conductors at the same potential
*/
void ConductorAutoNumerotation::applyText(QString t)
void ConductorAutoNumerotation::applyText(const QString& t)
{
if (!m_conductor) return;

View File

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

View File

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

View File

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

View File

@@ -39,7 +39,7 @@ Createdxf::~Createdxf()
}
/* Header section of every DXF file.*/
void Createdxf::dxfBegin (QString fileName)
void Createdxf::dxfBegin (const QString& fileName)
{
// Creation of an output stream object in text mode.
@@ -229,7 +229,7 @@ void Createdxf::dxfBegin (QString fileName)
}
/* End Section of every DXF File*/
void Createdxf::dxfEnd (QString fileName)
void Createdxf::dxfEnd (const QString& fileName)
{
// Creation of an output stream object in text mode.
if (!fileName.isEmpty()) {
@@ -253,7 +253,7 @@ void Createdxf::dxfEnd (QString fileName)
/* draw circle in dxf format*/
void Createdxf::drawCircle (QString fileName, double radius, double x, double y, int colour)
void Createdxf::drawCircle (const QString& fileName, double radius, double x, double y, int colour)
{
if (!fileName.isEmpty()) {
QFile file(fileName);
@@ -668,7 +668,7 @@ void Createdxf::drawRectangle(const QString &filepath, const QRectF &rect, const
}
/* draw arc in dx format */
void Createdxf::drawArc(QString fileName,double x,double y,double rad,double startAngle,double endAngle,int color)
void Createdxf::drawArc(const QString& fileName,double x,double y,double rad,double startAngle,double endAngle,int color)
{
if (!fileName.isEmpty()) {
QFile file(fileName);
@@ -705,7 +705,7 @@ void Createdxf::drawArc(QString fileName,double x,double y,double rad,double sta
}
/* draw simple text in dxf format without any alignment specified */
void Createdxf::drawText(QString fileName, QString text,double x, double y, double height, double rotation, int colour)
void Createdxf::drawText(const QString& fileName, const QString& text,double x, double y, double height, double rotation, int colour)
{
if (!fileName.isEmpty()) {
QFile file(fileName);
@@ -744,7 +744,7 @@ void Createdxf::drawText(QString fileName, QString text,double x, double y, doub
/* draw aligned text in DXF Format */
// leftAlign flag added. If the alignment requested is 'fit to width' and the text length is very small,
// then the text is either centered or left-aligned, depnding on the value of leftAlign.
void Createdxf::drawTextAligned(QString fileName, QString text,double x, double y, double height, double rotation, double oblique,int hAlign, int vAlign, double xAlign,int colour,
void Createdxf::drawTextAligned(const QString& fileName, const QString& text,double x, double y, double height, double rotation, double oblique,int hAlign, int vAlign, double xAlign,int colour,
bool leftAlign, float scale)
{
Q_UNUSED(scale);

View File

@@ -28,11 +28,11 @@ class Createdxf
public:
Createdxf();
~Createdxf();
static void dxfBegin (QString);
static void dxfEnd(QString);
static void dxfBegin (const QString&);
static void dxfEnd(const QString&);
// you can add more functions to create more drawings.
static void drawCircle(QString,double,double,double,int);
static void drawArc(QString,double x,double y,double rad,double startAngle,double endAngle,int color);
static void drawCircle(const QString&,double,double,double,int);
static void drawArc(const QString&,double x,double y,double rad,double startAngle,double endAngle,int color);
static void drawDonut(QString,double,double,double,int);
static void drawArcEllipse (const QString &file_path, qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal spanAngle, qreal hotspot_x, qreal hotspot_y, qreal rotation_angle, const int &colorcode);
@@ -45,8 +45,8 @@ class Createdxf
static void drawLine(const QString &filapath,double,double,double,double, const int &clorcode);
static void drawLine(const QString &filepath, const QLineF &line,const int &colorcode);
static void drawText(QString,QString,double,double,double,double,int);
static void drawTextAligned(QString fileName, QString text,double x, double y, double height, double rotation, double oblique,int hAlign, int vAlign, double xAlign, int colour, bool leftAlign = false, float scale = 0);
static void drawText(const QString&,const QString&,double,double,double,double,int);
static void drawTextAligned(const QString& fileName, const QString& text,double x, double y, double height, double rotation, double oblique,int hAlign, int vAlign, double xAlign, int colour, bool leftAlign = false, float scale = 0);
static int getcolorCode (const long red, const long green, const long blue);

View File

@@ -1,4 +1,4 @@
/*
/*
Copyright 2006-2017 The QElectroTech Team
This file is part of QElectroTech.
@@ -729,7 +729,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
+ * @param hash to retrieve content with content
+ * @param sequential type
+ */
void Diagram::folioSequentialsToXml(QHash<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;
for (i = hash->begin(); i != hash->end(); i++) {
QDomElement folioseq = doc->createElement(type);
@@ -795,7 +795,7 @@ bool Diagram::initFromXml(QDomElement &document, QPointF position, bool consider
@return true si l'import a reussi, false sinon
*/
bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_informations, DiagramContent *content_ptr) {
QDomElement root = document;
const QDomElement& root = document;
// The first element must be a diagram
if (root.tagName() != "diagram") return(false);
@@ -1019,7 +1019,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf
* @param seq type
* @param type of sequential
*/
void Diagram::folioSequentialsFromXml(const QDomElement &root, QHash<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)) {
for(QDomElement folioseq = folioSeqAutoNum.firstChildElement(type); !folioseq.isNull(); folioseq = folioseq.nextSiblingElement(type)) {
QString title = folioseq.attribute("title");
@@ -1236,7 +1236,7 @@ void Diagram::updateLabels()
* @param type to be treated
* @param Numerotation Context to be manipulated
*/
void Diagram::insertFolioSeqHash(QHash<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;
for (int i = 0; i < nc->size(); i++) {
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 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;
for (int i = 0; i < nc->size(); i++) {
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 fromXml(QDomDocument &, 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 folioSequentialsFromXml(const QDomElement&, QHash<QString, QStringList>*, QString, QString, QString, QString);
void folioSequentialsToXml(QHash<QString, QStringList>*, QDomElement *, const QString&, const QString&, QDomDocument *);
void folioSequentialsFromXml(const QDomElement&, QHash<QString, QStringList>*, const QString&, const QString&, const QString&, const QString&);
void refreshContents();
@@ -210,8 +210,8 @@ class Diagram : public QGraphicsScene
bool freezeNewConductors();
//methods related to insertion and loading of folio sequential
void insertFolioSeqHash (QHash<QString, QStringList> *hash, QString title, QString seq, NumerotationContext *nc);
void loadFolioSeqHash (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, const QString& title, const QString& seq, NumerotationContext *nc);
void changeZValue(QET::DepthOption option);
public slots:

View File

@@ -283,7 +283,7 @@ void MoveElementsCommand::move(const QPointF &actual_movement)
* @param start value at start
* @param end value at end
*/
void MoveElementsCommand::setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant start, const QVariant end) {
void MoveElementsCommand::setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant& start, const QVariant& end) {
//create animation group if not yet.
if (m_anim_group == nullptr) m_anim_group = new QParallelAnimationGroup();
QPropertyAnimation *animation = new QPropertyAnimation(target, propertyName);

View File

@@ -138,7 +138,7 @@ class MoveElementsCommand : public QUndoCommand {
virtual void move(const QPointF &);
private:
void setupAnimation (QObject * target, const QByteArray &propertyName, const QVariant start, const QVariant end);
void setupAnimation (QObject * target, const QByteArray &propertyName, const QVariant& start, const QVariant& end);
// attributes
private:

View File

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

View File

@@ -37,7 +37,7 @@ class DiagramFolioList : public Diagram
void drawBackground(QPainter *, const QRectF &) override;
private:
void fillRow(QPainter *, const QRectF &, QString, QString, QString, QString, QString, QString, QString);
void fillRow(QPainter *, const QRectF &, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&, const QString&);
void buildGrid(QPainter *, const QRectF &, int, int, qreal[]);
void fillHeader(QPainter *, const QRectF &);

View File

@@ -352,7 +352,7 @@ void DiagramPrintDialog::browseFilePrintTypeDialog() {
ou non
@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.";
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
#ifdef Q_OS_WIN
@@ -516,7 +516,7 @@ void DiagramPrintDialog::printDiagram(Diagram *diagram, bool fit_page, const Exp
@param save true pour memoriser les parametres du schema et appliquer ceux
definis dans options, false pour restaurer les parametres
*/
void DiagramPrintDialog::saveReloadDiagramParameters(Diagram *diagram, const ExportProperties options, bool save) {
void DiagramPrintDialog::saveReloadDiagramParameters(Diagram *diagram, const ExportProperties& options, bool save) {
static ExportProperties state_exportProperties;
if (save) {

View File

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

View File

@@ -83,7 +83,7 @@ void ElementEditionCommand::setElementView(ElementView *view) {
*/
DeletePartsCommand::DeletePartsCommand(
ElementScene *scene,
const QList<QGraphicsItem *> parts,
const QList<QGraphicsItem *>& parts,
QUndoCommand *parent
) :
ElementEditionCommand(QObject::tr("suppression", "undo caption"), scene, nullptr, parent),
@@ -201,7 +201,7 @@ void PastePartsCommand::setOffset(int old_offset_pc, const QPointF &old_start_tl
*/
CutPartsCommand::CutPartsCommand(
ElementScene *scene,
const QList<QGraphicsItem *> parts,
const QList<QGraphicsItem *>& parts,
QUndoCommand *parent
) :
DeletePartsCommand(scene, parts, parent)
@@ -224,7 +224,7 @@ CutPartsCommand::~CutPartsCommand() {
MovePartsCommand::MovePartsCommand(
const QPointF &m,
ElementScene *scene,
const QList<QGraphicsItem *> parts,
const QList<QGraphicsItem *>& parts,
QUndoCommand *parent
) :
ElementEditionCommand(QObject::tr("déplacement", "undo caption"), scene, nullptr, parent),
@@ -593,7 +593,7 @@ void ScalePartsCommand::adjustText() {
* @param context: new info about type.
* @param parent: parent undo
*/
ChangePropertiesCommand::ChangePropertiesCommand(ElementScene *scene, QString type, DiagramContext info, DiagramContext elmt_info, QUndoCommand *parent) :
ChangePropertiesCommand::ChangePropertiesCommand(ElementScene *scene, const QString& type, const DiagramContext& info, const DiagramContext& elmt_info, QUndoCommand *parent) :
ElementEditionCommand(scene, nullptr, parent)
{
m_type << scene->m_elmt_type << type;

View File

@@ -60,7 +60,7 @@ class ElementEditionCommand : public QUndoCommand
class DeletePartsCommand : public ElementEditionCommand {
// constructors, destructor
public:
DeletePartsCommand(ElementScene *, const QList<QGraphicsItem *>, QUndoCommand * = nullptr);
DeletePartsCommand(ElementScene *, const QList<QGraphicsItem *>&, QUndoCommand * = nullptr);
~DeletePartsCommand() override;
private:
DeletePartsCommand(const DeletePartsCommand &);
@@ -113,7 +113,7 @@ class PastePartsCommand : public ElementEditionCommand {
class CutPartsCommand : public DeletePartsCommand {
// constructors, destructor
public:
CutPartsCommand(ElementScene *, const QList<QGraphicsItem *>, QUndoCommand * = nullptr);
CutPartsCommand(ElementScene *, const QList<QGraphicsItem *>&, QUndoCommand * = nullptr);
~CutPartsCommand() override;
private:
CutPartsCommand(const CutPartsCommand &);
@@ -125,7 +125,7 @@ class CutPartsCommand : public DeletePartsCommand {
class MovePartsCommand : public ElementEditionCommand {
// constructors, destructor
public:
MovePartsCommand(const QPointF &, ElementScene *, const QList<QGraphicsItem *>, QUndoCommand * = nullptr);
MovePartsCommand(const QPointF &, ElementScene *, const QList<QGraphicsItem *>&, QUndoCommand * = nullptr);
~MovePartsCommand() override;
private:
MovePartsCommand(const MovePartsCommand &);
@@ -290,7 +290,7 @@ class ScalePartsCommand : public ElementEditionCommand {
class ChangePropertiesCommand : public ElementEditionCommand {
public:
ChangePropertiesCommand (ElementScene *scene, QString type, DiagramContext info, DiagramContext elmt_info, QUndoCommand *parent=nullptr);
ChangePropertiesCommand (ElementScene *scene, const QString& type, const DiagramContext& info, const DiagramContext& elmt_info, QUndoCommand *parent=nullptr);
~ChangePropertiesCommand () override;
void undo() override;

View File

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

View File

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

View File

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

View File

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

View File

@@ -55,6 +55,7 @@
#include <QFileDialog>
#include <QFile>
#include <QModelIndex>
#include <utility>
/*
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)
{
QMenu menu(this);
menu.addActions(actions);
menu.addActions(std::move(actions));
menu.addSeparator();
menu.addAction(undo);
menu.addAction(redo);

View File

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

View File

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

View File

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

View File

@@ -174,7 +174,7 @@ QTreeWidgetItem *ElementsPanel::updateTemplateItem(QTreeWidgetItem *tb_template_
/**
@return true if \a item matches the filter, false otherwise
*/
bool ElementsPanel::matchesFilter(const QTreeWidgetItem *item, QString filter) const {
bool ElementsPanel::matchesFilter(const QTreeWidgetItem *item, const QString& filter) const {
if (!item) return(false);
// no filter => we consider the item matches

View File

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

View File

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

View File

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

View File

@@ -19,6 +19,7 @@
#include <QSvgGenerator>
#include <cmath>
#include <QtXml>
#include <utility>
#include "qeticons.h"
#include "qetmessagebox.h"
#include "exportpropertieswidget.h"
@@ -649,7 +650,7 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
saveReloadDiagramParameters(diagram, false);
}
void ExportDialog::fillRow(QString file_path, const QRectF &row_rect, QString author, QString title,
void ExportDialog::fillRow(const QString& file_path, const QRectF &row_rect, QString author, const QString& title,
QString folio, QString date)
{
qreal x = row_rect.bottomLeft().x();
@@ -660,7 +661,7 @@ void ExportDialog::fillRow(QString file_path, const QRectF &row_rect, QString au
qreal height = row_rect.height() * Createdxf::yScale *0.7;
y += height*0.2;
Createdxf::drawTextAligned(file_path, folio,
Createdxf::drawTextAligned(file_path, std::move(folio),
x + 0.02*DiagramFolioList::colWidths[0]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0,
x + 0.95*DiagramFolioList::colWidths[0]*row_rect.width()*Createdxf::xScale, 0);
@@ -676,12 +677,12 @@ void ExportDialog::fillRow(QString file_path, const QRectF &row_rect, QString au
x + 0.02*DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale, 0, true);
x += DiagramFolioList::colWidths[1]*row_rect.width()*Createdxf::xScale;
Createdxf::drawTextAligned(file_path, author,
Createdxf::drawTextAligned(file_path, std::move(author),
x + 0.02*DiagramFolioList::colWidths[2]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0,
x + 3.02*DiagramFolioList::colWidths[2]*row_rect.width()*Createdxf::xScale, 0);
x += DiagramFolioList::colWidths[2]*row_rect.width()*Createdxf::xScale;
Createdxf::drawTextAligned(file_path, date,
Createdxf::drawTextAligned(file_path, std::move(date),
x + 0.02*DiagramFolioList::colWidths[3]*row_rect.width()*Createdxf::xScale, y, height, 0, 0, 5, 0,
x + 5.02*DiagramFolioList::colWidths[3]*row_rect.width()*Createdxf::xScale, 0);
}

View File

@@ -90,7 +90,7 @@ class ExportDialog : public QDialog {
void saveReloadDiagramParameters(Diagram *, bool = true);
void generateSvg(Diagram *, int, int, bool, QIODevice &);
void generateDxf(Diagram *, int, int, bool, QString &);
void fillRow(QString, const QRectF &, QString, QString, QString, QString);
void fillRow(const QString&, const QRectF &, QString, const QString&, QString, QString);
QImage generateImage(Diagram *, int, int, bool);
void exportDiagram(ExportDiagramLine *);
qreal diagramRatio(Diagram *);

View File

@@ -344,7 +344,7 @@ void ProjectAutoNumConfigPage::buildConnections()
* Display the current selected context for conductor
* @param str, key of context stored in project
*/
void ProjectAutoNumConfigPage::updateContextConductor(QString str) {
void ProjectAutoNumConfigPage::updateContextConductor(const QString& str) {
if (str == tr("Nom de la nouvelle numérotation")) m_saw_conductor -> setContext(NumerotationContext());
else m_saw_conductor ->setContext(m_project->conductorAutoNum(str));
}
@@ -354,7 +354,7 @@ void ProjectAutoNumConfigPage::updateContextConductor(QString str) {
* Display the current selected context for folio
* @param str, key of context stored in project
*/
void ProjectAutoNumConfigPage::updateContextFolio(QString str) {
void ProjectAutoNumConfigPage::updateContextFolio(const QString& str) {
if (str == tr("Nom de la nouvelle numérotation")) m_saw_folio -> setContext(NumerotationContext());
else m_saw_folio ->setContext(m_project->folioAutoNum(str));
}
@@ -364,7 +364,7 @@ void ProjectAutoNumConfigPage::updateContextFolio(QString str) {
* Display the current selected context for element
* @param str, key of context stored in project
*/
void ProjectAutoNumConfigPage::updateContextElement(QString str)
void ProjectAutoNumConfigPage::updateContextElement(const QString& str)
{
if (str == tr("Nom de la nouvelle numérotation"))
{

View File

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

View File

@@ -195,7 +195,7 @@ bool QET::orthogonalProjection(const QPointF &point, const QLineF &line, QPointF
@param entier Pointeur facultatif vers un entier
@return true si l'attribut est bien un entier, false sinon
*/
bool QET::attributeIsAnInteger(const QDomElement &e, QString nom_attribut, int *entier) {
bool QET::attributeIsAnInteger(const QDomElement &e, const QString& nom_attribut, int *entier) {
// verifie la presence de l'attribut
if (!e.hasAttribute(nom_attribut)) return(false);
// verifie la validite de l'attribut
@@ -214,7 +214,7 @@ bool QET::attributeIsAnInteger(const QDomElement &e, QString nom_attribut, int *
@param reel Pointeur facultatif vers un double
@return true si l'attribut est bien un reel, false sinon
*/
bool QET::attributeIsAReal(const QDomElement &e, QString nom_attribut, qreal *reel) {
bool QET::attributeIsAReal(const QDomElement &e, const QString& nom_attribut, qreal *reel) {
// verifie la presence de l'attribut
if (!e.hasAttribute(nom_attribut)) return(false);
// verifie la validite de l'attribut

View File

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

View File

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

View File

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

View File

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

View File

@@ -96,7 +96,7 @@ void CrossRefItem::init()
*/
void CrossRefItem::setUpConnection()
{
for(QMetaObject::Connection c : m_update_connection)
for(const QMetaObject::Connection& c : m_update_connection)
disconnect(c);
m_update_connection.clear();
@@ -369,7 +369,7 @@ void CrossRefItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
void CrossRefItem::linkedChanged()
{
for(QMetaObject::Connection c : m_slave_connection)
for(const QMetaObject::Connection& c : m_slave_connection)
disconnect(c);
m_slave_connection.clear();
@@ -781,7 +781,7 @@ void CrossRefItem::fillCrossRef(QPainter &painter)
* @param painter painter to use for draw the text
* @param type type of Info do be draw e.g. comment, location.
*/
void CrossRefItem::AddExtraInfo(QPainter &painter, QString type)
void CrossRefItem::AddExtraInfo(QPainter &painter, const QString& type)
{
QString text = autonum::AssignVariables::formulaToLabel(m_element -> elementInformations()[type].toString(), m_element->rSequenceStruct(), m_element->diagram(), m_element);
bool must_show = m_element -> elementInformations().keyMustShow(type);

View File

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

View File

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

View File

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

View File

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

View File

@@ -20,6 +20,7 @@
#include "conductor.h"
#include "diagramcommands.h"
#include <QtDebug>
#include <utility>
#include "elementprovider.h"
#include "diagramposition.h"
#include "terminal.h"
@@ -35,7 +36,7 @@ class ElementXmlRetroCompatibility
{
friend class Element;
static void loadSequential(const QDomElement &dom_element, QString seq, QStringList* list)
static void loadSequential(const QDomElement &dom_element, const QString& seq, QStringList* list)
{
int i = 0;
while (!dom_element.attribute(seq + QString::number(i+1)).isEmpty())
@@ -451,7 +452,7 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
//************************//
//***Dynamic texts item***//
//************************//
for (QDomElement qde : QET::findInDomElement(e, "dynamic_texts", DynamicElementTextItem::xmlTaggName()))
for (const QDomElement& qde : QET::findInDomElement(e, "dynamic_texts", DynamicElementTextItem::xmlTaggName()))
{
DynamicElementTextItem *deti = new DynamicElementTextItem(this);
addDynamicTextItem(deti);
@@ -471,7 +472,7 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
for (DynamicElementTextItem *deti : conv_deti_list)
{
for(QDomElement dom_input : dom_inputs)
for(const QDomElement& dom_input : dom_inputs)
{
//we use the same method used in ElementTextItem::fromXml to compar and know if the input dom element is for one of the text stored.
//The comparaison is made from the text position : if the position of the text is the same as the position stored in 'input' dom element
@@ -1235,7 +1236,7 @@ QString Element::getPrefix() const{
* set Element Prefix
*/
void Element::setPrefix(QString prefix) {
m_prefix = prefix;
m_prefix = std::move(prefix);
}
/**

View File

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

View File

@@ -880,7 +880,7 @@ bool QetShapeItem::fromXml(const QDomElement &e)
}
}
else {
for(QDomElement de : QET::findInDomElement(e, "points", "point")) {
for(const QDomElement& de : QET::findInDomElement(e, "points", "point")) {
m_polygon << QPointF(de.attribute("x", nullptr).toDouble(), de.attribute("y", nullptr).toDouble());
}
}

View File

@@ -23,7 +23,7 @@
#include "conductor.h"
#include "dynamicelementtextitem.h"
ReportElement::ReportElement(const ElementsLocation &location, QString link_type,QGraphicsItem *qgi, int *state) :
ReportElement::ReportElement(const ElementsLocation &location, const QString& link_type,QGraphicsItem *qgi, int *state) :
CustomElement(location, qgi, state)
{
link_type == "next_report"? m_link_type=NextReport : m_link_type=PreviousReport;

View File

@@ -30,7 +30,7 @@ class ReportElement : public CustomElement
Q_OBJECT
public :
explicit ReportElement(const ElementsLocation &,QString link_type, QGraphicsItem * = nullptr, int * = nullptr);
explicit ReportElement(const ElementsLocation &,const QString& link_type, QGraphicsItem * = nullptr, int * = nullptr);
~ReportElement() override;
void linkToElement(Element *) override;
void unlinkAllElements() override;

View File

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

View File

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

View File

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

View File

@@ -26,7 +26,7 @@ const int QETSingleApplication::timeout_ = 10000;
@param argv Tableau des arguments passes au programme par le systeme
@param unique_key Cle unique
*/
QETSingleApplication::QETSingleApplication(int &argc, char **argv, const QString unique_key) :
QETSingleApplication::QETSingleApplication(int &argc, char **argv, const QString& unique_key) :
QApplication(argc, argv),
unique_key_(unique_key)
{

View File

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

View File

@@ -27,7 +27,7 @@
* @param pen : the pen to store
* @return : A QDomElement with the attribute stored. The tagName of QDomeElement is "pen".
*/
QDomElement QETXML::penToXml(QDomDocument &parent_document,QPen pen)
QDomElement QETXML::penToXml(QDomDocument &parent_document,const QPen& pen)
{
QDomElement element = parent_document.createElement("pen");
@@ -88,7 +88,7 @@ QPen QETXML::penFromXml(const QDomElement &element)
* @param brush : the brush to store
* @return A QDomElement with the attribute stored. The tagName of QDomeElement is "brush".
*/
QDomElement QETXML::brushToXml(QDomDocument &parent_document, QBrush brush)
QDomElement QETXML::brushToXml(QDomDocument &parent_document, const QBrush& brush)
{
QDomElement element = parent_document.createElement("brush");
@@ -162,7 +162,7 @@ QBrush QETXML::brushFromXml(const QDomElement &element)
* @return A file system directory converted to a QDomElement directory ready to be inserted into a XmlElementCollection.
* If the QDomElement can't be created, return a null QDomElement.
*/
QDomElement QETXML::fileSystemDirToXmlCollectionDir(QDomDocument &document, const QDir &dir, QString rename)
QDomElement QETXML::fileSystemDirToXmlCollectionDir(QDomDocument &document, const QDir &dir, const QString& rename)
{
if (!dir.exists()) return QDomElement();
@@ -200,7 +200,7 @@ QDomElement QETXML::fileSystemDirToXmlCollectionDir(QDomDocument &document, cons
* @return A file system element converted to a QDomElement ready to be inserted into a XmlElementCollection
* If the QDomElement can't be created, return a null QDomElement
*/
QDomElement QETXML::fileSystemElementToXmlCollectionElement(QDomDocument &document, QFile &file, QString rename)
QDomElement QETXML::fileSystemElementToXmlCollectionElement(QDomDocument &document, QFile &file, const QString& rename)
{
if (file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text))
{
@@ -266,7 +266,7 @@ bool QETXML::writeXmlFile(const QDomDocument &xml_document, const QString &file_
* @param value
* @return
*/
QDomElement QETXML::textToDomElement(QDomDocument &document, QString tag_name, QString value)
QDomElement QETXML::textToDomElement(QDomDocument &document, const QString& tag_name, const QString& value)
{
QDomElement element = document.createElement(tag_name);
QDomText text = document.createTextNode(value);

View File

@@ -30,18 +30,18 @@ class QFile;
*/
namespace QETXML
{
QDomElement penToXml(QDomDocument &parent_document, QPen pen);
QDomElement penToXml(QDomDocument &parent_document, const QPen& pen);
QPen penFromXml (const QDomElement &element);
QDomElement brushToXml (QDomDocument &parent_document, QBrush brush);
QDomElement brushToXml (QDomDocument &parent_document, const QBrush& brush);
QBrush brushFromXml (const QDomElement &element);
QDomElement fileSystemDirToXmlCollectionDir (QDomDocument &document, const QDir &dir, QString rename = QString());
QDomElement fileSystemElementToXmlCollectionElement (QDomDocument &document, QFile &file, QString rename = QString());
QDomElement fileSystemDirToXmlCollectionDir (QDomDocument &document, const QDir &dir, const QString& rename = QString());
QDomElement fileSystemElementToXmlCollectionElement (QDomDocument &document, QFile &file, const QString& rename = QString());
bool writeXmlFile(const QDomDocument &xml_document, const QString &file_path, QString *error_message = nullptr);
QDomElement textToDomElement (QDomDocument &document, QString tag_name, QString value);
QDomElement textToDomElement (QDomDocument &document, const QString& tag_name, const QString& value);
}
#endif // QETXML_H

View File

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

View File

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

View File

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

View File

@@ -1226,7 +1226,7 @@ void DynamicElementTextModel::setConnection(DynamicElementTextItem *deti, bool s
if(!m_hash_text_connect.keys().contains(deti))
return;
for (QMetaObject::Connection con : m_hash_text_connect.value(deti))
for (const QMetaObject::Connection& con : m_hash_text_connect.value(deti))
disconnect(con);
m_hash_text_connect.remove(deti);
@@ -1264,7 +1264,7 @@ void DynamicElementTextModel::setConnection(ElementTextItemGroup *group, bool se
if(!m_hash_group_connect.keys().contains(group))
return;
for (QMetaObject::Connection con : m_hash_group_connect.value(group))
for (const QMetaObject::Connection& con : m_hash_group_connect.value(group))
disconnect(con);
m_hash_group_connect.remove(group);
@@ -1443,13 +1443,13 @@ QWidget *DynamicTextItemDelegate::createEditor(QWidget *parent, const QStyleOpti
//We use a QMap because the keys of the map are sorted, then no matter the curent local,
//the value of the combo box are always alphabetically sorted
QMap <QString, QString> info_map;
for(QString str : availableInfo(deti)) {
for(const QString& str : availableInfo(deti)) {
info_map.insert(QETApp::elementTranslatedInfoKey(str), str);
}
QComboBox *qcb = new QComboBox(parent);
qcb->setObjectName("info_text");
for (QString key : info_map.keys()) {
for (const QString& key : info_map.keys()) {
qcb->addItem(key, info_map.value(key));
}
return qcb;
@@ -1733,7 +1733,7 @@ QStringList DynamicTextItemDelegate::availableInfo(DynamicElementTextItem *deti)
info_list.removeAll("formula"); //No need to have formula
DiagramContext dc = elmt->elementInformations();
for(QString info : info_list)
for(const QString& info : info_list)
{
if(dc.contains(info))
qstrl << info;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -21,6 +21,7 @@
#include "elementtextitemgroup.h"
#include <QGraphicsScene>
#include <utility>
/************************
@@ -70,7 +71,7 @@ void AddElementTextCommand::redo()
AddTextsGroupCommand::AddTextsGroupCommand(Element *element, QString groupe_name, QUndoCommand *parent) :
QUndoCommand(parent),
m_element(element),
m_name(groupe_name)
m_name(std::move(groupe_name))
{
setText(QObject::tr("Ajouter un groupe de textes d'élément"));
}
@@ -81,7 +82,7 @@ AddTextsGroupCommand::AddTextsGroupCommand(Element *element, QString groupe_name
* @param dom_element : the first time the group is created, we call the function fromXml of the group, and give @dom_element has argument.
* @param parent : parent undo
*/
AddTextsGroupCommand::AddTextsGroupCommand(Element *element, QDomElement dom_element, QUndoCommand *parent) :
AddTextsGroupCommand::AddTextsGroupCommand(Element *element, const QDomElement& dom_element, QUndoCommand *parent) :
QUndoCommand(parent),
m_element(element),
m_dom_element(dom_element)
@@ -98,7 +99,7 @@ AddTextsGroupCommand::AddTextsGroupCommand(Element *element, QDomElement dom_ele
AddTextsGroupCommand::AddTextsGroupCommand(Element *element, QString groupe_name, QList<DynamicElementTextItem *> texts_list, QUndoCommand *parent) :
QUndoCommand(parent),
m_element(element),
m_name(groupe_name)
m_name(std::move(groupe_name))
{
for(DynamicElementTextItem *deti : texts_list)
{
@@ -188,7 +189,7 @@ void RemoveTextsGroupCommand::undo()
{
m_element.data()->addTextGroup(m_group.data());
for(QPointer<DynamicElementTextItem> p : m_text_list)
for(const QPointer<DynamicElementTextItem>& p : m_text_list)
if(p)
m_element.data()->addTextToGroup(p.data(), m_group.data());
}
@@ -198,7 +199,7 @@ void RemoveTextsGroupCommand::redo()
{
if(m_element && m_group)
{
for(QPointer<DynamicElementTextItem> p : m_text_list)
for(const QPointer<DynamicElementTextItem>& p : m_text_list)
if(p)
m_element.data()->removeTextFromGroup(p.data(), m_group.data());

View File

@@ -52,7 +52,7 @@ class AddTextsGroupCommand : public QUndoCommand
{
public:
AddTextsGroupCommand(Element *element, QString groupe_name, QUndoCommand *parent = nullptr);
AddTextsGroupCommand(Element *element, QDomElement dom_element, QUndoCommand *parent = nullptr);
AddTextsGroupCommand(Element *element, const QDomElement& dom_element, QUndoCommand *parent = nullptr);
AddTextsGroupCommand(Element *element, QString groupe_name, QList<DynamicElementTextItem *> texts_list, QUndoCommand *parent = nullptr);
~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.
* @param element_list
*/
void LinkElementCommand::setLink(QList<Element *> element_list)
void LinkElementCommand::setLink(const QList<Element *>& element_list)
{
m_linked_after.clear();
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);
void setLink (QList<Element *> element_list);
void setLink (const QList<Element *>& element_list);
void setLink (Element *element_);
void unlink (QList<Element *> element_list);
void unlinkAll ();

View File

@@ -87,7 +87,7 @@ void RotateSelectionCommand::undo()
m_diagram->showMe();
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()));
if(!cti->wasRotateByUser())
@@ -103,7 +103,7 @@ void RotateSelectionCommand::redo()
m_diagram->showMe();
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());
cti->forceRotateByUser(true);

View File

@@ -138,7 +138,7 @@ void RotateTextsCommand::openDialog()
#endif
}
void RotateTextsCommand::setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant start, const QVariant end)
void RotateTextsCommand::setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant& start, const QVariant& end)
{
if(m_anim_group == nullptr)
m_anim_group = new QParallelAnimationGroup();

View File

@@ -40,7 +40,7 @@ class RotateTextsCommand : public QUndoCommand
private:
void openDialog();
void setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant start, const QVariant end);
void setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant& start, const QVariant& end);
private:
QPointer<Diagram> m_diagram;