Fix several clazy issue:
* Use multi-arg instead [-Wclazy-qstring-arg] * Use an empty QLatin1String instead of an empty QStringLiteral [-Wclazy-empty-qstringliteral] * getter Gui::ProgressBar::canAbort possibly mismarked as a slot [-Wclazy-const-signal-or-slot] * Missing emit keyword on signal call [-Wclazy-incorrect-emit]
This commit is contained in:
@@ -914,7 +914,7 @@ void RecentMacrosAction::setFiles(const QStringList& files)
|
||||
if (check) {
|
||||
recentFiles[index]->setShortcut(QKeySequence());
|
||||
auto msg = QStringLiteral("Recent macros : keyboard shortcut %1 disabled because conflicting with %2")
|
||||
.arg(accel_tmp).arg(QLatin1String(check->getName()));
|
||||
.arg(accel_tmp, QLatin1String(check->getName()));
|
||||
Base::Console().Warning("%s\n", qPrintable(msg));
|
||||
}
|
||||
else {
|
||||
@@ -922,7 +922,7 @@ void RecentMacrosAction::setFiles(const QStringList& files)
|
||||
recentFiles[index]->setShortcut(accel);
|
||||
}
|
||||
}
|
||||
recentFiles[index]->setStatusTip(tr("Run macro %1 (Shift+click to edit) keyboard shortcut: %2").arg(files[index]).arg(accel));
|
||||
recentFiles[index]->setStatusTip(tr("Run macro %1 (Shift+click to edit) keyboard shortcut: %2").arg(files[index], accel));
|
||||
recentFiles[index]->setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ void DlgPreferencePackManagementImp::deleteUserPack(const std::string& name)
|
||||
if (result == QMessageBox::Yes) {
|
||||
Application::Instance->prefPackManager()->deleteUserPack(name);
|
||||
showEvent(nullptr);
|
||||
packVisibilityChanged();
|
||||
Q_EMIT packVisibilityChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,14 +190,14 @@ void DlgPreferencePackManagementImp::hideBuiltInPack(const std::string& prefPack
|
||||
{
|
||||
Application::Instance->prefPackManager()->toggleVisibility("##BUILT_IN##", prefPackName);
|
||||
showEvent(nullptr);
|
||||
packVisibilityChanged();
|
||||
Q_EMIT packVisibilityChanged();
|
||||
}
|
||||
|
||||
void DlgPreferencePackManagementImp::hideInstalledPack(const std::string& addonName, const std::string& prefPackName)
|
||||
{
|
||||
Application::Instance->prefPackManager()->toggleVisibility(addonName, prefPackName);
|
||||
showEvent(nullptr);
|
||||
packVisibilityChanged();
|
||||
Q_EMIT packVisibilityChanged();
|
||||
}
|
||||
|
||||
void DlgPreferencePackManagementImp::showAddonManager()
|
||||
|
||||
@@ -1206,7 +1206,7 @@ bool Document::saveAs(void)
|
||||
QString exe = qApp->applicationName();
|
||||
QString fn = FileDialog::getSaveFileName(getMainWindow(), QObject::tr("Save %1 Document").arg(exe),
|
||||
QString::fromUtf8(getDocument()->FileName.getValue()),
|
||||
QString::fromLatin1("%1 %2 (*.FCStd)").arg(exe).arg(QObject::tr("Document")));
|
||||
QString::fromLatin1("%1 %2 (*.FCStd)").arg(exe, QObject::tr("Document")));
|
||||
|
||||
if (!fn.isEmpty()) {
|
||||
QFileInfo fi;
|
||||
@@ -2324,20 +2324,18 @@ bool Document::checkTransactionID(bool undo, int iSteps) {
|
||||
}
|
||||
str << " " << doc->getName() << "\n";
|
||||
}
|
||||
int ret = QMessageBox::warning(getMainWindow(),
|
||||
undo?QObject::tr("Undo"):QObject::tr("Redo"),
|
||||
QString::fromLatin1("%1,\n%2%3")
|
||||
.arg(QObject::tr(
|
||||
"There are grouped transactions in the following documents with "
|
||||
"other preceding transactions"))
|
||||
.arg(QString::fromUtf8(str.str().c_str()))
|
||||
.arg(QObject::tr("Choose 'Yes' to roll back all preceding transactions.\n"
|
||||
"Choose 'No' to roll back in the active document only.\n"
|
||||
"Choose 'Abort' to abort")),
|
||||
int ret = QMessageBox::warning(getMainWindow(), undo ? QObject::tr("Undo") : QObject::tr("Redo"),
|
||||
QString::fromLatin1("%1,\n%2%3").arg(
|
||||
QObject::tr("There are grouped transactions in the following documents with "
|
||||
"other preceding transactions"),
|
||||
QString::fromStdString(str.str()),
|
||||
QObject::tr("Choose 'Yes' to roll back all preceding transactions.\n"
|
||||
"Choose 'No' to roll back in the active document only.\n"
|
||||
"Choose 'Abort' to abort")),
|
||||
QMessageBox::Yes|QMessageBox::No|QMessageBox::Abort, QMessageBox::Yes);
|
||||
if(ret == QMessageBox::Abort)
|
||||
if (ret == QMessageBox::Abort)
|
||||
return false;
|
||||
if(ret == QMessageBox::No)
|
||||
if (ret == QMessageBox::No)
|
||||
return true;
|
||||
}
|
||||
for(auto &v : dmap) {
|
||||
|
||||
@@ -168,6 +168,7 @@ public Q_SLOTS:
|
||||
*/
|
||||
void setMinimumDuration (int ms);
|
||||
|
||||
public:
|
||||
bool canAbort() const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -601,7 +601,7 @@ void QuantitySpinBox::updateFromCache(bool notify, bool updateUnit /* = true */)
|
||||
d->pendingEmit = false;
|
||||
Q_EMIT valueChanged(res);
|
||||
Q_EMIT valueChanged(res.getValue());
|
||||
textChanged(text);
|
||||
Q_EMIT textChanged(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,8 @@ void SelectionView::onSelectionChanged(const SelectionChanges &Reason)
|
||||
str << Reason.pDocName;
|
||||
str << "#";
|
||||
// remove all items
|
||||
for(auto item : selectionView->findItems(selObject,Qt::MatchStartsWith))
|
||||
const auto items = selectionView->findItems(selObject,Qt::MatchStartsWith);
|
||||
for(auto item : items)
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
@@ -381,15 +382,15 @@ void SelectionView::toggleSelect(QListWidgetItem* item)
|
||||
if(Gui::Selection().isSelected(docname,objname,subname))
|
||||
cmd = QString::fromLatin1("Gui.Selection.removeSelection("
|
||||
"App.getDocument('%1').getObject('%2'),'%3')")
|
||||
.arg(QString::fromLatin1(docname))
|
||||
.arg(QString::fromLatin1(objname))
|
||||
.arg(QString::fromLatin1(subname));
|
||||
.arg(QString::fromLatin1(docname),
|
||||
QString::fromLatin1(objname),
|
||||
QString::fromLatin1(subname));
|
||||
else
|
||||
cmd = QString::fromLatin1("Gui.Selection.addSelection("
|
||||
"App.getDocument('%1').getObject('%2'),'%3',%4,%5,%6)")
|
||||
.arg(QString::fromLatin1(docname))
|
||||
.arg(QString::fromLatin1(objname))
|
||||
.arg(QString::fromLatin1(subname))
|
||||
.arg(QString::fromLatin1(docname),
|
||||
QString::fromLatin1(objname),
|
||||
QString::fromLatin1(subname))
|
||||
.arg(x).arg(y).arg(z);
|
||||
try {
|
||||
Gui::Command::runCommand(Gui::Command::Gui,cmd.toLatin1());
|
||||
@@ -419,9 +420,9 @@ void SelectionView::preselect(QListWidgetItem* item)
|
||||
}
|
||||
QString cmd = QString::fromLatin1("Gui.Selection.setPreselection("
|
||||
"App.getDocument('%1').getObject('%2'),'%3',tp=2)")
|
||||
.arg(QString::fromLatin1(docname))
|
||||
.arg(QString::fromLatin1(objname))
|
||||
.arg(QString::fromLatin1(subname));
|
||||
.arg(QString::fromLatin1(docname),
|
||||
QString::fromLatin1(objname),
|
||||
QString::fromLatin1(subname));
|
||||
try {
|
||||
Gui::Command::runCommand(Gui::Command::Gui,cmd.toLatin1());
|
||||
}catch(Base::Exception &e) {
|
||||
|
||||
@@ -686,9 +686,9 @@ void AboutDialog::on_copyButton_clicked()
|
||||
QString minor = QString::fromLatin1(config["BuildVersionMinor"].c_str());
|
||||
QString build = QString::fromLatin1(config["BuildRevision"].c_str());
|
||||
|
||||
QString deskEnv = QProcessEnvironment::systemEnvironment().value(QStringLiteral("XDG_CURRENT_DESKTOP"),QStringLiteral(""));
|
||||
QString deskSess = QProcessEnvironment::systemEnvironment().value(QStringLiteral("DESKTOP_SESSION"),QStringLiteral(""));
|
||||
QString deskInfo = QStringLiteral("");
|
||||
QString deskEnv = QProcessEnvironment::systemEnvironment().value(QStringLiteral("XDG_CURRENT_DESKTOP"), QString());
|
||||
QString deskSess = QProcessEnvironment::systemEnvironment().value(QStringLiteral("DESKTOP_SESSION"), QString());
|
||||
QString deskInfo;
|
||||
|
||||
if ( !(deskEnv.isEmpty() && deskSess.isEmpty()) ) {
|
||||
if ( deskEnv.isEmpty() || deskSess.isEmpty() )
|
||||
|
||||
@@ -76,7 +76,7 @@ bool VectorTableModel::setData(const QModelIndex &index, const QVariant &value,
|
||||
if (role == Qt::EditRole && r < vectors.size()) {
|
||||
if (value.canConvert<Base::Vector3d>()) {
|
||||
vectors[r] = value.value<Base::Vector3d>();
|
||||
dataChanged(index, index.sibling(index.row(), 2));
|
||||
Q_EMIT dataChanged(index, index.sibling(index.row(), 2));
|
||||
return true;
|
||||
}
|
||||
else if (c < 3) {
|
||||
@@ -87,7 +87,7 @@ bool VectorTableModel::setData(const QModelIndex &index, const QVariant &value,
|
||||
vectors[r].y = d;
|
||||
else if (c == 2)
|
||||
vectors[r].z = d;
|
||||
dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ void PropertyItem::reset()
|
||||
void PropertyItem::onChange()
|
||||
{
|
||||
if(hasExpression()) {
|
||||
for(auto child : childItems) {
|
||||
for(auto child : qAsConst(childItems)) {
|
||||
if(child && child->hasExpression())
|
||||
child->setExpression(std::shared_ptr<App::Expression>());
|
||||
}
|
||||
@@ -1356,7 +1356,7 @@ public:
|
||||
}
|
||||
|
||||
bool apply(const std::string &propName) {
|
||||
if (!ExpressionBinding::apply(propName)) {
|
||||
if (!ExpressionBinding::apply(propName)) { // clazy:exclude=skipped-base-method
|
||||
QVariant data = property("coords");
|
||||
if (data.canConvert<Base::Vector3d>()) {
|
||||
const Base::Vector3d& value = data.value<Base::Vector3d>();
|
||||
@@ -1554,7 +1554,7 @@ void PropertyEditorWidget::setValue(const QVariant& val)
|
||||
{
|
||||
variant = val;
|
||||
showValue(variant);
|
||||
valueChanged(variant);
|
||||
Q_EMIT valueChanged(variant);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
@@ -1724,9 +1724,9 @@ void PropertyVectorDistanceItem::setValue(const QVariant& variant)
|
||||
|
||||
Base::QuantityFormat format(Base::QuantityFormat::Fixed, decimals());
|
||||
QString data = QString::fromLatin1("(%1, %2, %3)")
|
||||
.arg(Base::UnitsApi::toNumber(x, format))
|
||||
.arg(Base::UnitsApi::toNumber(y, format))
|
||||
.arg(Base::UnitsApi::toNumber(z, format));
|
||||
.arg(Base::UnitsApi::toNumber(x, format),
|
||||
Base::UnitsApi::toNumber(y, format),
|
||||
Base::UnitsApi::toNumber(z, format));
|
||||
setPropertyValue(data);
|
||||
}
|
||||
|
||||
@@ -2412,10 +2412,10 @@ void PropertyRotationItem::setValue(const QVariant& value)
|
||||
h.getValue(axis, angle);
|
||||
Base::QuantityFormat format(Base::QuantityFormat::Fixed, decimals());
|
||||
QString data = QString::fromLatin1("App.Rotation(App.Vector(%1,%2,%3),%4)")
|
||||
.arg(Base::UnitsApi::toNumber(axis.x, format))
|
||||
.arg(Base::UnitsApi::toNumber(axis.y, format))
|
||||
.arg(Base::UnitsApi::toNumber(axis.z, format))
|
||||
.arg(Base::UnitsApi::toNumber(angle, format));
|
||||
.arg(Base::UnitsApi::toNumber(axis.x, format),
|
||||
Base::UnitsApi::toNumber(axis.y, format),
|
||||
Base::UnitsApi::toNumber(axis.z, format),
|
||||
Base::UnitsApi::toNumber(angle, format));
|
||||
setPropertyValue(data);
|
||||
}
|
||||
|
||||
@@ -2724,13 +2724,13 @@ void PropertyPlacementItem::setValue(const QVariant& value)
|
||||
QString data = QString::fromLatin1("App.Placement("
|
||||
"App.Vector(%1,%2,%3),"
|
||||
"App.Rotation(App.Vector(%4,%5,%6),%7))")
|
||||
.arg(Base::UnitsApi::toNumber(pos.x, format))
|
||||
.arg(Base::UnitsApi::toNumber(pos.y, format))
|
||||
.arg(Base::UnitsApi::toNumber(pos.z, format))
|
||||
.arg(Base::UnitsApi::toNumber(axis.x, format))
|
||||
.arg(Base::UnitsApi::toNumber(axis.y, format))
|
||||
.arg(Base::UnitsApi::toNumber(axis.z, format))
|
||||
.arg(Base::UnitsApi::toNumber(angle, format));
|
||||
.arg(Base::UnitsApi::toNumber(pos.x, format),
|
||||
Base::UnitsApi::toNumber(pos.y, format),
|
||||
Base::UnitsApi::toNumber(pos.z, format),
|
||||
Base::UnitsApi::toNumber(axis.x, format),
|
||||
Base::UnitsApi::toNumber(axis.y, format),
|
||||
Base::UnitsApi::toNumber(axis.z, format),
|
||||
Base::UnitsApi::toNumber(angle, format));
|
||||
setPropertyValue(data);
|
||||
}
|
||||
|
||||
@@ -2971,7 +2971,7 @@ QWidget* PropertyEnumItem::createEditor(QWidget* parent, const QObject* receiver
|
||||
});
|
||||
QObject::connect(menu, &QMenu::triggered, this, [=](QAction *action) {
|
||||
button->setText(action->data().toString());
|
||||
button->picked();
|
||||
Q_EMIT button->picked();
|
||||
});
|
||||
QObject::connect(button, SIGNAL(picked()), receiver, method);
|
||||
return button;
|
||||
|
||||
Reference in New Issue
Block a user