Use QString's multi-arg overload to save memory allocations. [-Wclazy-qstring-arg] Thanks Clazy!

This commit is contained in:
Mateusz Skowroński
2019-01-30 19:43:13 +01:00
committed by wmayer
parent 216106e407
commit 317bcd59c9
36 changed files with 177 additions and 192 deletions

View File

@@ -256,7 +256,7 @@ void SelectionView::select(QListWidgetItem* item)
//Gui::Selection().clearSelection();
Gui::Command::runCommand(Gui::Command::Gui,"Gui.Selection.clearSelection()");
//Gui::Selection().addSelection(elements[0].toLatin1(),elements[1].toLatin1(),0);
QString cmd = QString::fromLatin1("Gui.Selection.addSelection(App.getDocument(\"%1\").getObject(\"%2\"))").arg(elements[0]).arg(elements[1]);
QString cmd = QString::fromLatin1("Gui.Selection.addSelection(App.getDocument(\"%1\").getObject(\"%2\"))").arg(elements[0], elements[1]);
Gui::Command::runCommand(Gui::Command::Gui,cmd.toLatin1());
}
@@ -270,7 +270,7 @@ void SelectionView::deselect(void)
return;
//Gui::Selection().rmvSelection(elements[0].toLatin1(),elements[1].toLatin1(),0);
QString cmd = QString::fromLatin1("Gui.Selection.removeSelection(App.getDocument(\"%1\").getObject(\"%2\"))").arg(elements[0]).arg(elements[1]);
QString cmd = QString::fromLatin1("Gui.Selection.removeSelection(App.getDocument(\"%1\").getObject(\"%2\"))").arg(elements[0], elements[1]);
Gui::Command::runCommand(Gui::Command::Gui,cmd.toLatin1());
}
@@ -294,7 +294,7 @@ void SelectionView::touch(void)
QStringList elements = item->data(Qt::UserRole).toStringList();
if (elements.size() < 2)
return;
QString cmd = QString::fromLatin1("App.getDocument(\"%1\").getObject(\"%2\").touch()").arg(elements[0]).arg(elements[1]);
QString cmd = QString::fromLatin1("App.getDocument(\"%1\").getObject(\"%2\").touch()").arg(elements[0], elements[1]);
Gui::Command::runCommand(Gui::Command::Doc,cmd.toLatin1());
}
@@ -308,7 +308,7 @@ void SelectionView::toPython(void)
return;
try {
QString cmd = QString::fromLatin1("obj = App.getDocument(\"%1\").getObject(\"%2\")").arg(elements[0]).arg(elements[1]);
QString cmd = QString::fromLatin1("obj = App.getDocument(\"%1\").getObject(\"%2\")").arg(elements[0], elements[1]);
Gui::Command::runCommand(Gui::Command::Gui,cmd.toLatin1());
if (elements.length() > 2) {
App::Document* doc = App::GetApplication().getDocument(elements[0].toLatin1());
@@ -316,17 +316,12 @@ void SelectionView::toPython(void)
QString property = getProperty(obj);
cmd = QString::fromLatin1("shp = App.getDocument(\"%1\").getObject(\"%2\").%3")
.arg(elements[0])
.arg(elements[1])
.arg(property);
.arg(elements[0], elements[1], property);
Gui::Command::runCommand(Gui::Command::Gui,cmd.toLatin1());
if (supportPart(obj, elements[2])) {
cmd = QString::fromLatin1("elt = App.getDocument(\"%1\").getObject(\"%2\").%3.%4")
.arg(elements[0])
.arg(elements[1])
.arg(property)
.arg(elements[2]);
.arg(elements[0], elements[1], property, elements[2]);
Gui::Command::runCommand(Gui::Command::Gui,cmd.toLatin1());
}
}
@@ -351,11 +346,7 @@ void SelectionView::showPart(void)
try {
Gui::Command::addModule(Gui::Command::Gui, module.toLatin1());
QString cmd = QString::fromLatin1("%1.show(App.getDocument(\"%2\").getObject(\"%3\").%4.%5)")
.arg(module)
.arg(elements[0])
.arg(elements[1])
.arg(property)
.arg(elements[2]);
.arg(module, elements[0], elements[1], property, elements[2]);
Gui::Command::runCommand(Gui::Command::Gui,cmd.toLatin1());
}
catch (const Base::Exception& e) {