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

@@ -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();