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

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