diff --git a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp index 1c7fbc97e1..df194bb171 100644 --- a/src/Mod/Sketcher/App/SketchObjectPyImp.cpp +++ b/src/Mod/Sketcher/App/SketchObjectPyImp.cpp @@ -1708,7 +1708,7 @@ void SketchObjectPy::setMissingPointOnPointConstraints(Py::List arg) return (checkitem(t,i,0)?Sketcher::PointPos::none:(checkitem(t,i,1)?Sketcher::PointPos::start:(checkitem(t,i,2)?Sketcher::PointPos::end:Sketcher::PointPos::mid))); }; - for (auto ti : arg) { + for (const auto& ti : arg) { Py::Tuple t(ti); ConstraintIds c; c.First = (long)Py::Long(t.getItem(0)); @@ -1749,7 +1749,7 @@ void SketchObjectPy::setMissingVerticalHorizontalConstraints(Py::List arg) return (checkitem(t,i,0)?Sketcher::PointPos::none:(checkitem(t,i,1)?Sketcher::PointPos::start:(checkitem(t,i,2)?Sketcher::PointPos::end:Sketcher::PointPos::mid))); }; - for (auto ti : arg) { + for (const auto& ti : arg) { Py::Tuple t(ti); ConstraintIds c; c.First = (long)Py::Long(t.getItem(0)); @@ -1789,7 +1789,7 @@ void SketchObjectPy::setMissingLineEqualityConstraints(Py::List arg) return (checkitem(t,i,0)?Sketcher::PointPos::none:(checkitem(t,i,1)?Sketcher::PointPos::start:(checkitem(t,i,2)?Sketcher::PointPos::end:Sketcher::PointPos::mid))); }; - for (auto ti : arg) { + for (const auto& ti : arg) { Py::Tuple t(ti); ConstraintIds c; c.First = (long)Py::Long(t.getItem(0)); @@ -1829,7 +1829,7 @@ void SketchObjectPy::setMissingRadiusConstraints(Py::List arg) return (checkitem(t,i,0)?Sketcher::PointPos::none:(checkitem(t,i,1)?Sketcher::PointPos::start:(checkitem(t,i,2)?Sketcher::PointPos::end:Sketcher::PointPos::mid))); }; - for (auto ti : arg) { + for (const auto& ti : arg) { Py::Tuple t(ti); ConstraintIds c; c.First = (long)Py::Long(t.getItem(0)); diff --git a/src/Mod/Sketcher/App/planegcs/GCS.cpp b/src/Mod/Sketcher/App/planegcs/GCS.cpp index 3b6bf45ec7..b09f2b988f 100644 --- a/src/Mod/Sketcher/App/planegcs/GCS.cpp +++ b/src/Mod/Sketcher/App/planegcs/GCS.cpp @@ -357,7 +357,7 @@ void SolverReportingManager::LogGroupOfConstraints(const std::string & str, std: tempstream << str << ":" << '\n'; - for(auto group : constraintgroups) { + for(const auto& group : constraintgroups) { tempstream << "["; for(auto c :group) diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index 5a00829c75..316d7558f6 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -4415,7 +4415,6 @@ void CmdSketcherConstrainTangent::applyConstraint(std::vector &selSeq { SketcherGui::ViewProviderSketch* sketchgui = static_cast(getActiveGuiDocument()->getInEdit()); Sketcher::SketchObject* Obj = sketchgui->getSketchObject(); - QString strError; int GeoId1 = GeoEnum::GeoUndef, GeoId2 = GeoEnum::GeoUndef, GeoId3 = GeoEnum::GeoUndef; Sketcher::PointPos PosId1 = Sketcher::PointPos::none, PosId2 = Sketcher::PointPos::none, PosId3 = Sketcher::PointPos::none; @@ -6403,7 +6402,6 @@ void CmdSketcherConstrainEqual::applyConstraint(std::vector &selSeq, { SketcherGui::ViewProviderSketch* sketchgui = static_cast(getActiveGuiDocument()->getInEdit()); Sketcher::SketchObject* Obj = sketchgui->getSketchObject(); - QString strError; int GeoId1 = GeoEnum::GeoUndef, GeoId2 = GeoEnum::GeoUndef; @@ -6651,7 +6649,6 @@ void CmdSketcherConstrainSymmetric::applyConstraint(std::vector &selS { SketcherGui::ViewProviderSketch* sketchgui = static_cast(getActiveGuiDocument()->getInEdit()); Sketcher::SketchObject* Obj = sketchgui->getSketchObject(); - QString strError; int GeoId1 = GeoEnum::GeoUndef, GeoId2 = GeoEnum::GeoUndef, GeoId3 = GeoEnum::GeoUndef; Sketcher::PointPos PosId1 = Sketcher::PointPos::none, PosId2 = Sketcher::PointPos::none, PosId3 = Sketcher::PointPos::none; diff --git a/src/Mod/Sketcher/Gui/EditDatumDialog.cpp b/src/Mod/Sketcher/Gui/EditDatumDialog.cpp index 68b7b6c532..e46539589d 100644 --- a/src/Mod/Sketcher/Gui/EditDatumDialog.cpp +++ b/src/Mod/Sketcher/Gui/EditDatumDialog.cpp @@ -244,7 +244,7 @@ void EditDatumDialog::drivingToggled(bool state) void EditDatumDialog::datumChanged() { - if (ui_ins_datum->labelEdit->text() != ui_ins_datum->labelEdit->getHistory()[0]) { + if (ui_ins_datum->labelEdit->text() != qAsConst(ui_ins_datum->labelEdit)->getHistory()[0]) { ui_ins_datum->cbDriving->setChecked(false); } } diff --git a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp index bc3b40b4a5..067e9dd4dc 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherConstraints.cpp @@ -148,7 +148,7 @@ public: case Sketcher::Weight: case Sketcher::Diameter: case Sketcher::Angle: - name = QString::fromLatin1("%1 (%2)").arg(name).arg(constraint->getPresentationValue().getUserString()); + name = QString::fromLatin1("%1 (%2)").arg(name, constraint->getPresentationValue().getUserString()); break; case Sketcher::SnellsLaw: { double v = constraint->getPresentationValue().getValue(); @@ -537,7 +537,7 @@ void ConstraintView::updateDrivingStatus() ConstraintItem *it = dynamic_cast(item); if (it) { - onUpdateDrivingStatus(item, !it->isDriving()); + Q_EMIT onUpdateDrivingStatus(item, !it->isDriving()); } } @@ -547,7 +547,7 @@ void ConstraintView::updateActiveStatus() ConstraintItem *it = dynamic_cast(item); if (it) { - onUpdateActiveStatus(item, !it->isActive()); + Q_EMIT onUpdateActiveStatus(item, !it->isActive()); } } @@ -563,7 +563,7 @@ void ConstraintView::hideConstraints() void ConstraintView::modifyCurrentItem() { - /*emit*/itemActivated(currentItem()); + Q_EMIT itemActivated(currentItem()); } void ConstraintView::renameCurrentItem() @@ -708,7 +708,7 @@ TaskSketcherConstraints::TaskSketcherConstraints(ViewProviderSketch *sketchView) ); QObject::connect( - ui->visibilityButton->actions()[0], SIGNAL(changed()), + qAsConst(ui->visibilityButton)->actions()[0], SIGNAL(changed()), this , SLOT (on_visibilityButton_trackingaction_changed()) ); @@ -1079,8 +1079,8 @@ void TaskSketcherConstraints::on_visualisationTrackingFilter_stateChanged(int st { QSignalBlocker block(this); - if(ui->visibilityButton->actions()[0]->isChecked() != (state == Qt::Checked)) - ui->visibilityButton->actions()[0]->setChecked(state); + if (qAsConst(ui->visibilityButton)->actions()[0]->isChecked() != (state == Qt::Checked)) + qAsConst(ui->visibilityButton)->actions()[0]->setChecked(state); } if(state == Qt::Checked) @@ -1093,7 +1093,7 @@ void TaskSketcherConstraints::on_visibilityButton_trackingaction_changed() ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher"); bool visibilityTracksFilter = hGrp->GetBool("VisualisationTrackingFilter",false); - bool bstate = ui->visibilityButton->actions()[0]->isChecked(); + bool bstate = qAsConst(ui->visibilityButton)->actions()[0]->isChecked(); if(visibilityTracksFilter != bstate) { hGrp->SetBool("VisualisationTrackingFilter", bstate); diff --git a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp index 01420ff0e9..0b579c06e9 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherElements.cpp @@ -240,7 +240,7 @@ void ElementView::keyPressEvent(QKeyEvent * event) { case Qt::Key_Z: // signal - onFilterShortcutPressed(); + Q_EMIT onFilterShortcutPressed(); break; default: QListWidget::keyPressEvent( event ); @@ -276,7 +276,7 @@ TaskSketcherElements::TaskSketcherElements(ViewProviderSketch *sketchView) QString zKey = QString::fromLatin1("Z"); ui->Explanation->setText(tr("

"%1": multiple selection

" "

"%2": switch to next valid type

") - .arg(cmdKey).arg(zKey)); + .arg(cmdKey, zKey)); ui->listWidgetElements->setSelectionMode(QAbstractItemView::ExtendedSelection); ui->listWidgetElements->setEditTriggers(QListWidget::NoEditTriggers); ui->listWidgetElements->setMouseTracking(true); @@ -1128,7 +1128,7 @@ TaskSketcherElements::MultIcon::MultIcon(const char* name) { int hue, sat, val, alp; Normal = Gui::BitmapFactory().iconFromTheme(name); - QImage imgConstr(Normal.pixmap(Normal.availableSizes()[0]).toImage()); + QImage imgConstr(Normal.pixmap(qAsConst(Normal).availableSizes()[0]).toImage()); QImage imgExt(imgConstr); for(int ix=0 ; ixrenderingOrder && event->type() == QEvent::ChildRemoved) { - emitRenderOrderChanged(); + Q_EMIT emitRenderOrderChanged(); } return false; } diff --git a/src/Mod/Sketcher/Gui/ViewProviderPython.cpp b/src/Mod/Sketcher/Gui/ViewProviderPython.cpp index 3870d332b6..3724731172 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderPython.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderPython.cpp @@ -56,7 +56,7 @@ void ViewProviderCustom::onChanged(const App::Property* prop) } } } - PartGui::ViewProviderPart::onChanged(prop); + ViewProviderSketch::onChanged(prop); } void ViewProviderCustom::updateData(const App::Property* prop) diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 8b2124ea6b..748002b3b7 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -3022,7 +3022,7 @@ void ViewProviderSketch::unsetEdit(int ModNum) "ActiveSketch.ViewObject.TempoVis = None\n" "del(tv)\n" "del(ActiveSketch)\n" - ).arg(QString::fromLatin1(getDocument()->getDocument()->getName())).arg( + ).arg(QString::fromLatin1(getDocument()->getDocument()->getName()), QString::fromLatin1(getSketchObject()->getNameInDocument())); QByteArray cmdstr_bytearray = cmdstr.toLatin1(); Gui::Command::runCommand(Gui::Command::Gui, cmdstr_bytearray); @@ -3046,7 +3046,7 @@ void ViewProviderSketch::setEditViewer(Gui::View3DInventorViewer* viewer, int Mo " ActiveSketch.ViewObject.TempoVis.saveCamera()\n" " if ActiveSketch.ViewObject.ForceOrtho:\n" " ActiveSketch.ViewObject.Document.ActiveView.setCameraType('Orthographic')\n" - ).arg(QString::fromLatin1(getDocument()->getDocument()->getName())).arg( + ).arg(QString::fromLatin1(getDocument()->getDocument()->getName()), QString::fromLatin1(getSketchObject()->getNameInDocument())); QByteArray cmdstr_bytearray = cmdstr.toLatin1(); Gui::Command::runCommand(Gui::Command::Gui, cmdstr_bytearray);