diff --git a/src/Mod/PartDesign/Gui/DlgActiveBody.cpp b/src/Mod/PartDesign/Gui/DlgActiveBody.cpp index 07bcd2ad02..a57833c9f6 100644 --- a/src/Mod/PartDesign/Gui/DlgActiveBody.cpp +++ b/src/Mod/PartDesign/Gui/DlgActiveBody.cpp @@ -48,8 +48,8 @@ DlgActiveBody::DlgActiveBody(QWidget *parent, App::Document*& doc, const QString { ui->setupUi(this); - connect(ui->bodySelect, SIGNAL(itemDoubleClicked(QListWidgetItem *)), - this, SLOT(accept())); + connect(ui->bodySelect, &QListWidget::itemDoubleClicked, + this, &DlgActiveBody::accept); if (!infoText.isEmpty()) { ui->label->setText(infoText + QString::fromUtf8("\n\n") + tr("Please select")); diff --git a/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp b/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp index 3d2dbc050c..ad52302eb6 100644 --- a/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp @@ -60,12 +60,12 @@ TaskBooleanParameters::TaskBooleanParameters(ViewProviderBoolean *BooleanView,QW ui->setupUi(proxy); QMetaObject::connectSlotsByName(this); - connect(ui->buttonBodyAdd, SIGNAL(toggled(bool)), - this, SLOT(onButtonBodyAdd(bool))); - connect(ui->buttonBodyRemove, SIGNAL(toggled(bool)), - this, SLOT(onButtonBodyRemove(bool))); - connect(ui->comboType, SIGNAL(currentIndexChanged(int)), - this, SLOT(onTypeChanged(int))); + connect(ui->buttonBodyAdd, &QToolButton::toggled, + this, &TaskBooleanParameters::onButtonBodyAdd); + connect(ui->buttonBodyRemove, &QToolButton::toggled, + this, &TaskBooleanParameters::onButtonBodyRemove); + connect(ui->comboType, qOverload(&QComboBox::currentIndexChanged), + this, &TaskBooleanParameters::onTypeChanged); this->groupLayout()->addWidget(proxy); @@ -85,7 +85,7 @@ TaskBooleanParameters::TaskBooleanParameters(ViewProviderBoolean *BooleanView,QW action->setShortcutVisibleInContextMenu(true); #endif ui->listWidgetBodies->addAction(action); - connect(action, SIGNAL(triggered()), this, SLOT(onBodyDeleted())); + connect(action, &QAction::triggered, this, &TaskBooleanParameters::onBodyDeleted); ui->listWidgetBodies->setContextMenuPolicy(Qt::ActionsContextMenu); int index = pcBoolean->Type.getValue(); diff --git a/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp b/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp index ad09973d74..a1255ab0c0 100644 --- a/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskChamferParameters.cpp @@ -75,36 +75,36 @@ TaskChamferParameters::TaskChamferParameters(ViewProviderDressUp *DressUpView, Q QMetaObject::connectSlotsByName(this); - connect(ui->chamferType, SIGNAL(currentIndexChanged(int)), - this, SLOT(onTypeChanged(int))); - connect(ui->chamferSize, SIGNAL(valueChanged(double)), - this, SLOT(onSizeChanged(double))); - connect(ui->chamferSize2, SIGNAL(valueChanged(double)), - this, SLOT(onSize2Changed(double))); - connect(ui->chamferAngle, SIGNAL(valueChanged(double)), - this, SLOT(onAngleChanged(double))); - connect(ui->flipDirection, SIGNAL(toggled(bool)), - this, SLOT(onFlipDirection(bool))); - connect(ui->buttonRefAdd, SIGNAL(toggled(bool)), - this, SLOT(onButtonRefAdd(bool))); - connect(ui->buttonRefRemove, SIGNAL(toggled(bool)), - this, SLOT(onButtonRefRemove(bool))); - connect(ui->checkBoxUseAllEdges, SIGNAL(toggled(bool)), - this, SLOT(onCheckBoxUseAllEdgesToggled(bool))); + connect(ui->chamferType, qOverload(&QComboBox::currentIndexChanged), + this, &TaskChamferParameters::onTypeChanged); + connect(ui->chamferSize, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskChamferParameters::onSizeChanged); + connect(ui->chamferSize2, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskChamferParameters::onSize2Changed); + connect(ui->chamferAngle, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskChamferParameters::onAngleChanged); + connect(ui->flipDirection, &QCheckBox::toggled, + this, &TaskChamferParameters::onFlipDirection); + connect(ui->buttonRefAdd, &QToolButton::toggled, + this, &TaskChamferParameters::onButtonRefAdd); + connect(ui->buttonRefRemove, &QToolButton::toggled, + this, &TaskChamferParameters::onButtonRefRemove); + connect(ui->checkBoxUseAllEdges, &QCheckBox::toggled, + this, &TaskChamferParameters::onCheckBoxUseAllEdgesToggled); // Create context menu createDeleteAction(ui->listWidgetReferences, ui->buttonRefRemove); - connect(deleteAction, SIGNAL(triggered()), this, SLOT(onRefDeleted())); + connect(deleteAction, &QAction::triggered, this, &TaskChamferParameters::onRefDeleted); createAddAllEdgesAction(ui->listWidgetReferences); connect(addAllEdgesAction, &QAction::triggered, this, &TaskChamferParameters::onAddAllEdges); - connect(ui->listWidgetReferences, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), - this, SLOT(setSelection(QListWidgetItem*))); - connect(ui->listWidgetReferences, SIGNAL(itemClicked(QListWidgetItem*)), - this, SLOT(setSelection(QListWidgetItem*))); - connect(ui->listWidgetReferences, SIGNAL(itemDoubleClicked(QListWidgetItem*)), - this, SLOT(doubleClicked(QListWidgetItem*))); + connect(ui->listWidgetReferences, &QListWidget::currentItemChanged, + this, &TaskChamferParameters::setSelection); + connect(ui->listWidgetReferences, &QListWidget::itemClicked, + this, &TaskChamferParameters::setSelection); + connect(ui->listWidgetReferences, &QListWidget::itemDoubleClicked, + this, &TaskChamferParameters::doubleClicked); // the dialog can be called on a broken chamfer, then hide the chamfer hideOnError(); diff --git a/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp b/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp index 354685355a..aebcaabe45 100644 --- a/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskDraftParameters.cpp @@ -81,29 +81,29 @@ TaskDraftParameters::TaskDraftParameters(ViewProviderDressUp *DressUpView, QWidg QMetaObject::connectSlotsByName(this); - connect(ui->draftAngle, SIGNAL(valueChanged(double)), - this, SLOT(onAngleChanged(double))); - connect(ui->checkReverse, SIGNAL(toggled(bool)), - this, SLOT(onReversedChanged(bool))); - connect(ui->buttonRefAdd, SIGNAL(toggled(bool)), - this, SLOT(onButtonRefAdd(bool))); - connect(ui->buttonRefRemove, SIGNAL(toggled(bool)), - this, SLOT(onButtonRefRemove(bool))); - connect(ui->buttonPlane, SIGNAL(toggled(bool)), - this, SLOT(onButtonPlane(bool))); - connect(ui->buttonLine, SIGNAL(toggled(bool)), - this, SLOT(onButtonLine(bool))); + connect(ui->draftAngle, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskDraftParameters::onAngleChanged); + connect(ui->checkReverse, &QCheckBox::toggled, + this, &TaskDraftParameters::onReversedChanged); + connect(ui->buttonRefAdd, &QToolButton::toggled, + this, &TaskDraftParameters::onButtonRefAdd); + connect(ui->buttonRefRemove, &QToolButton::toggled, + this, &TaskDraftParameters::onButtonRefRemove); + connect(ui->buttonPlane, &QToolButton::toggled, + this, &TaskDraftParameters::onButtonPlane); + connect(ui->buttonLine, &QToolButton::toggled, + this, &TaskDraftParameters::onButtonLine); // Create context menu createDeleteAction(ui->listWidgetReferences, ui->buttonRefRemove); - connect(deleteAction, SIGNAL(triggered()), this, SLOT(onRefDeleted())); + connect(deleteAction, &QAction::triggered, this, &TaskDraftParameters::onRefDeleted); - connect(ui->listWidgetReferences, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), - this, SLOT(setSelection(QListWidgetItem*))); - connect(ui->listWidgetReferences, SIGNAL(itemClicked(QListWidgetItem*)), - this, SLOT(setSelection(QListWidgetItem*))); - connect(ui->listWidgetReferences, SIGNAL(itemDoubleClicked(QListWidgetItem*)), - this, SLOT(doubleClicked(QListWidgetItem*))); + connect(ui->listWidgetReferences, &QListWidget::currentItemChanged, + this, &TaskDraftParameters::setSelection); + connect(ui->listWidgetReferences, &QListWidget::itemClicked, + this, &TaskDraftParameters::setSelection); + connect(ui->listWidgetReferences, &QListWidget::itemDoubleClicked, + this, &TaskDraftParameters::doubleClicked); App::DocumentObject* ref = pcDraft->NeutralPlane.getValue(); strings = pcDraft->NeutralPlane.getSubValues(); diff --git a/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp b/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp index bb30b2973c..3dfaf11457 100644 --- a/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp +++ b/src/Mod/PartDesign/Gui/TaskFeaturePick.cpp @@ -85,14 +85,14 @@ TaskFeaturePick::TaskFeaturePick(std::vector& objects, proxy = new QWidget(this); ui->setupUi(proxy); - connect(ui->checkUsed, SIGNAL(toggled(bool)), this, SLOT(onUpdate(bool))); - connect(ui->checkOtherBody, SIGNAL(toggled(bool)), this, SLOT(onUpdate(bool))); - connect(ui->checkOtherPart, SIGNAL(toggled(bool)), this, SLOT(onUpdate(bool))); - connect(ui->radioIndependent, SIGNAL(toggled(bool)), this, SLOT(onUpdate(bool))); - connect(ui->radioDependent, SIGNAL(toggled(bool)), this, SLOT(onUpdate(bool))); - connect(ui->radioXRef, SIGNAL(toggled(bool)), this, SLOT(onUpdate(bool))); - connect(ui->listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(onItemSelectionChanged())); - connect(ui->listWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(onDoubleClick(QListWidgetItem *))); + connect(ui->checkUsed, &QCheckBox::toggled, this, &TaskFeaturePick::onUpdate); + connect(ui->checkOtherBody, &QCheckBox::toggled, this, &TaskFeaturePick::onUpdate); + connect(ui->checkOtherPart, &QCheckBox::toggled, this, &TaskFeaturePick::onUpdate); + connect(ui->radioIndependent, &QRadioButton::toggled, this, &TaskFeaturePick::onUpdate); + connect(ui->radioDependent, &QRadioButton::toggled, this, &TaskFeaturePick::onUpdate); + connect(ui->radioXRef, &QRadioButton::toggled, this, &TaskFeaturePick::onUpdate); + connect(ui->listWidget, &QListWidget::itemSelectionChanged, this, &TaskFeaturePick::onItemSelectionChanged); + connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &TaskFeaturePick::onDoubleClick); if (!singleFeatureSelect) { diff --git a/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp b/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp index 4f1c7076f4..3f9959d474 100644 --- a/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskFilletParameters.cpp @@ -77,28 +77,28 @@ TaskFilletParameters::TaskFilletParameters(ViewProviderDressUp *DressUpView, QWi QMetaObject::connectSlotsByName(this); - connect(ui->filletRadius, SIGNAL(valueChanged(double)), - this, SLOT(onLengthChanged(double))); - connect(ui->buttonRefAdd, SIGNAL(toggled(bool)), - this, SLOT(onButtonRefAdd(bool))); - connect(ui->buttonRefRemove, SIGNAL(toggled(bool)), - this, SLOT(onButtonRefRemove(bool))); - connect(ui->checkBoxUseAllEdges, SIGNAL(toggled(bool)), - this, SLOT(onCheckBoxUseAllEdgesToggled(bool))); + connect(ui->filletRadius, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskFilletParameters::onLengthChanged); + connect(ui->buttonRefAdd, &QToolButton::toggled, + this, &TaskFilletParameters::onButtonRefAdd); + connect(ui->buttonRefRemove, &QToolButton::toggled, + this, &TaskFilletParameters::onButtonRefRemove); + connect(ui->checkBoxUseAllEdges, &QToolButton::toggled, + this, &TaskFilletParameters::onCheckBoxUseAllEdgesToggled); // Create context menu createDeleteAction(ui->listWidgetReferences, ui->buttonRefRemove); - connect(deleteAction, SIGNAL(triggered()), this, SLOT(onRefDeleted())); + connect(deleteAction, &QAction::triggered, this, &TaskFilletParameters::onRefDeleted); createAddAllEdgesAction(ui->listWidgetReferences); connect(addAllEdgesAction, &QAction::triggered, this, &TaskFilletParameters::onAddAllEdges); - connect(ui->listWidgetReferences, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), - this, SLOT(setSelection(QListWidgetItem*))); - connect(ui->listWidgetReferences, SIGNAL(itemClicked(QListWidgetItem*)), - this, SLOT(setSelection(QListWidgetItem*))); - connect(ui->listWidgetReferences, SIGNAL(itemDoubleClicked(QListWidgetItem*)), - this, SLOT(doubleClicked(QListWidgetItem*))); + connect(ui->listWidgetReferences, &QListWidget::currentItemChanged, + this, &TaskFilletParameters::setSelection); + connect(ui->listWidgetReferences, &QListWidget::itemClicked, + this, &TaskFilletParameters::setSelection); + connect(ui->listWidgetReferences, &QListWidget::itemDoubleClicked, + this, &TaskFilletParameters::doubleClicked); // the dialog can be called on a broken fillet, then hide the fillet hideOnError(); diff --git a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp index 5b93e9eab4..ab2e3c2bf6 100644 --- a/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskHoleParameters.cpp @@ -182,34 +182,61 @@ TaskHoleParameters::TaskHoleParameters(ViewProviderHole* HoleView, QWidget* pare ui->ThreadDepth->setEnabled(ui->Threaded->isChecked() && ui->ModelThread->isChecked() && std::string(pcHole->ThreadDepthType.getValueAsString()) == "Dimension"); - connect(ui->Threaded, SIGNAL(clicked(bool)), this, SLOT(threadedChanged())); - connect(ui->ThreadType, SIGNAL(currentIndexChanged(int)), this, SLOT(threadTypeChanged(int))); - connect(ui->ThreadSize, SIGNAL(currentIndexChanged(int)), this, SLOT(threadSizeChanged(int))); - connect(ui->ThreadClass, SIGNAL(currentIndexChanged(int)), this, SLOT(threadClassChanged(int))); - connect(ui->ThreadFit, SIGNAL(currentIndexChanged(int)), this, SLOT(threadFitChanged(int))); - connect(ui->Diameter, SIGNAL(valueChanged(double)), this, SLOT(threadDiameterChanged(double))); - connect(ui->directionRightHand, SIGNAL(clicked(bool)), this, SLOT(threadDirectionChanged())); - connect(ui->directionLeftHand, SIGNAL(clicked(bool)), this, SLOT(threadDirectionChanged())); - connect(ui->HoleCutType, SIGNAL(currentIndexChanged(int)), this, SLOT(holeCutTypeChanged(int))); - connect(ui->HoleCutCustomValues, SIGNAL(clicked(bool)), this, SLOT(holeCutCustomValuesChanged())); - connect(ui->HoleCutDiameter, SIGNAL(valueChanged(double)), this, SLOT(holeCutDiameterChanged(double))); - connect(ui->HoleCutDepth, SIGNAL(valueChanged(double)), this, SLOT(holeCutDepthChanged(double))); - connect(ui->HoleCutCountersinkAngle, SIGNAL(valueChanged(double)), this, SLOT(holeCutCountersinkAngleChanged(double))); - connect(ui->DepthType, SIGNAL(currentIndexChanged(int)), this, SLOT(depthChanged(int))); - connect(ui->Depth, SIGNAL(valueChanged(double)), this, SLOT(depthValueChanged(double))); - connect(ui->drillPointFlat, SIGNAL(clicked(bool)), this, SLOT(drillPointChanged())); - connect(ui->drillPointAngled, SIGNAL(clicked(bool)), this, SLOT(drillPointChanged())); - connect(ui->DrillPointAngle, SIGNAL(valueChanged(double)), this, SLOT(drillPointAngledValueChanged(double))); - connect(ui->DrillForDepth, SIGNAL(clicked(bool)), this, SLOT(drillForDepthChanged())); - connect(ui->Tapered, SIGNAL(clicked(bool)), this, SLOT(taperedChanged())); - connect(ui->Reversed, SIGNAL(clicked(bool)), this, SLOT(reversedChanged())); - connect(ui->TaperedAngle, SIGNAL(valueChanged(double)), this, SLOT(taperedAngleChanged(double))); - connect(ui->ModelThread, SIGNAL(clicked(bool)), this, SLOT(modelThreadChanged())); - connect(ui->UpdateView, SIGNAL(toggled(bool)), this, SLOT(updateViewChanged(bool))); - connect(ui->UseCustomThreadClearance, SIGNAL(toggled(bool)), this, SLOT(useCustomThreadClearanceChanged())); - connect(ui->CustomThreadClearance, SIGNAL(valueChanged(double)), this, SLOT(customThreadClearanceChanged(double))); - connect(ui->ThreadDepthType, SIGNAL(currentIndexChanged(int)), this, SLOT(threadDepthTypeChanged(int))); - connect(ui->ThreadDepth, SIGNAL(valueChanged(double)), this, SLOT(threadDepthChanged(double))); + connect(ui->Threaded, &QCheckBox::clicked, this, &TaskHoleParameters::threadedChanged); + connect(ui->ThreadType, qOverload(&QComboBox::currentIndexChanged), + this, &TaskHoleParameters::threadTypeChanged); + connect(ui->ThreadSize, qOverload(&QComboBox::currentIndexChanged), + this, &TaskHoleParameters::threadSizeChanged); + connect(ui->ThreadClass, qOverload(&QComboBox::currentIndexChanged), + this, &TaskHoleParameters::threadClassChanged); + connect(ui->ThreadFit, qOverload(&QComboBox::currentIndexChanged), + this, &TaskHoleParameters::threadFitChanged); + connect(ui->Diameter, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskHoleParameters::threadDiameterChanged); + connect(ui->directionRightHand, &QRadioButton::clicked, + this, &TaskHoleParameters::threadDirectionChanged); + connect(ui->directionLeftHand, &QRadioButton::clicked, + this, &TaskHoleParameters::threadDirectionChanged); + connect(ui->HoleCutType, qOverload(&QComboBox::currentIndexChanged), + this, &TaskHoleParameters::holeCutTypeChanged); + connect(ui->HoleCutCustomValues, &QCheckBox::clicked, + this, &TaskHoleParameters::holeCutCustomValuesChanged); + connect(ui->HoleCutDiameter, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskHoleParameters::holeCutDiameterChanged); + connect(ui->HoleCutDepth, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskHoleParameters::holeCutDepthChanged); + connect(ui->HoleCutCountersinkAngle, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskHoleParameters::holeCutCountersinkAngleChanged); + connect(ui->DepthType, qOverload(&QComboBox::currentIndexChanged), + this, &TaskHoleParameters::depthChanged); + connect(ui->Depth, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskHoleParameters::depthValueChanged); + connect(ui->drillPointFlat, &QRadioButton::clicked, + this, &TaskHoleParameters::drillPointChanged); + connect(ui->drillPointAngled, &QRadioButton::clicked, + this, &TaskHoleParameters::drillPointChanged); + connect(ui->DrillPointAngle, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskHoleParameters::drillPointAngledValueChanged); + connect(ui->DrillForDepth, &QCheckBox::clicked, + this, &TaskHoleParameters::drillForDepthChanged); + connect(ui->Tapered, &QCheckBox::clicked, + this, &TaskHoleParameters::taperedChanged); + connect(ui->Reversed, &QCheckBox::clicked, + this, &TaskHoleParameters::reversedChanged); + connect(ui->TaperedAngle, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskHoleParameters::taperedAngleChanged); + connect(ui->ModelThread, &QCheckBox::clicked, + this, &TaskHoleParameters::modelThreadChanged); + connect(ui->UpdateView, &QCheckBox::toggled, + this, &TaskHoleParameters::updateViewChanged); + connect(ui->UseCustomThreadClearance, &QCheckBox::toggled, + this, &TaskHoleParameters::useCustomThreadClearanceChanged); + connect(ui->CustomThreadClearance, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskHoleParameters::customThreadClearanceChanged); + connect(ui->ThreadDepthType, qOverload(&QComboBox::currentIndexChanged), + this, &TaskHoleParameters::threadDepthTypeChanged); + connect(ui->ThreadDepth, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskHoleParameters::threadDepthChanged); vp->show(); diff --git a/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.cpp b/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.cpp index a2cec26079..27b87903c2 100644 --- a/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.cpp @@ -78,8 +78,8 @@ TaskLinearPatternParameters::TaskLinearPatternParameters(TaskMultiTransformParam { proxy = new QWidget(parentTask); ui->setupUi(proxy); - connect(ui->buttonOK, SIGNAL(pressed()), - parentTask, SLOT(onSubTaskButtonOK())); + connect(ui->buttonOK, &QToolButton::pressed, + parentTask, &TaskLinearPatternParameters::onSubTaskButtonOK); QMetaObject::connectSlotsByName(this); layout->addWidget(proxy); @@ -92,14 +92,17 @@ TaskLinearPatternParameters::TaskLinearPatternParameters(TaskMultiTransformParam selectionMode = none; - blockUpdate = false; // Hack, sometimes it is NOT false although set to false in Transformed::Transformed()!! + // Hack, sometimes it is NOT false although set to false in Transformed::Transformed()!! + blockUpdate = false; setupUI(); } void TaskLinearPatternParameters::connectSignals() { - connect(ui->buttonAddFeature, SIGNAL(toggled(bool)), this, SLOT(onButtonAddFeature(bool))); - connect(ui->buttonRemoveFeature, SIGNAL(toggled(bool)), this, SLOT(onButtonRemoveFeature(bool))); + connect(ui->buttonAddFeature, &QToolButton::toggled, + this, &TaskLinearPatternParameters::onButtonAddFeature); + connect(ui->buttonRemoveFeature, &QToolButton::toggled, + this, &TaskLinearPatternParameters::onButtonRemoveFeature); // Create context menu QAction* action = new QAction(tr("Remove"), this); @@ -109,27 +112,27 @@ void TaskLinearPatternParameters::connectSignals() action->setShortcutVisibleInContextMenu(true); #endif ui->listWidgetFeatures->addAction(action); - connect(action, SIGNAL(triggered()), this, SLOT(onFeatureDeleted())); + connect(action, &QAction::triggered, this, &TaskLinearPatternParameters::onFeatureDeleted); ui->listWidgetFeatures->setContextMenuPolicy(Qt::ActionsContextMenu); - connect(ui->listWidgetFeatures->model(), - SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int)), this, SLOT(indexesMoved())); + connect(ui->listWidgetFeatures->model(), &QAbstractListModel::rowsMoved, + this, &TaskLinearPatternParameters::indexesMoved); updateViewTimer = new QTimer(this); updateViewTimer->setSingleShot(true); updateViewTimer->setInterval(getUpdateViewTimeout()); - connect(updateViewTimer, SIGNAL(timeout()), - this, SLOT(onUpdateViewTimer())); + connect(updateViewTimer, &QTimer::timeout, + this, &TaskLinearPatternParameters::onUpdateViewTimer); - connect(ui->comboDirection, SIGNAL(activated(int)), - this, SLOT(onDirectionChanged(int))); - connect(ui->checkReverse, SIGNAL(toggled(bool)), - this, SLOT(onCheckReverse(bool))); - connect(ui->spinLength, SIGNAL(valueChanged(double)), - this, SLOT(onLength(double))); - connect(ui->spinOccurrences, SIGNAL(valueChanged(uint)), - this, SLOT(onOccurrences(uint))); - connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)), - this, SLOT(onUpdateView(bool))); + connect(ui->comboDirection, qOverload(&QComboBox::activated), + this, &TaskLinearPatternParameters::onDirectionChanged); + connect(ui->checkReverse, &QCheckBox::toggled, + this, &TaskLinearPatternParameters::onCheckReverse); + connect(ui->spinLength, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskLinearPatternParameters::onLength); + connect(ui->spinOccurrences, &Gui::UIntSpinBox::unsignedChanged, + this, &TaskLinearPatternParameters::onOccurrences); + connect(ui->checkBoxUpdateView, &QCheckBox::toggled, + this, &TaskLinearPatternParameters::onUpdateView); } void TaskLinearPatternParameters::setupUI() diff --git a/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.h b/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.h index ba64fce804..f3aa234c5f 100644 --- a/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.h +++ b/src/Mod/PartDesign/Gui/TaskLinearPatternParameters.h @@ -61,7 +61,7 @@ private Q_SLOTS: void onCheckReverse(const bool on); void onLength(const double l); void onOccurrences(const uint n); - virtual void onUpdateView(bool); + void onUpdateView(bool) override; void onFeatureDeleted() override; protected: diff --git a/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp b/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp index 4518461eda..36e48cefce 100644 --- a/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskLoftParameters.cpp @@ -55,18 +55,18 @@ TaskLoftParameters::TaskLoftParameters(ViewProviderLoft *LoftView, bool /*newObj ui->setupUi(proxy); QMetaObject::connectSlotsByName(this); - connect(ui->buttonProfileBase, SIGNAL(toggled(bool)), - this, SLOT(onProfileButton(bool))); - connect(ui->buttonRefAdd, SIGNAL(toggled(bool)), - this, SLOT(onRefButtonAdd(bool))); - connect(ui->buttonRefRemove, SIGNAL(toggled(bool)), - this, SLOT(onRefButtonRemove(bool))); - connect(ui->checkBoxRuled, SIGNAL(toggled(bool)), - this, SLOT(onRuled(bool))); - connect(ui->checkBoxClosed, SIGNAL(toggled(bool)), - this, SLOT(onClosed(bool))); - connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)), - this, SLOT(onUpdateView(bool))); + connect(ui->buttonProfileBase, &QToolButton::toggled, + this, &TaskLoftParameters::onProfileButton); + connect(ui->buttonRefAdd, &QToolButton::toggled, + this, &TaskLoftParameters::onRefButtonAdd); + connect(ui->buttonRefRemove, &QToolButton::toggled, + this, &TaskLoftParameters::onRefButtonRemove); + connect(ui->checkBoxRuled, &QCheckBox::toggled, + this, &TaskLoftParameters::onRuled); + connect(ui->checkBoxClosed, &QCheckBox::toggled, + this, &TaskLoftParameters::onClosed); + connect(ui->checkBoxUpdateView, &QCheckBox::toggled, + this, &TaskLoftParameters::onUpdateView); // Create context menu QAction* remove = new QAction(tr("Remove"), this); @@ -77,10 +77,10 @@ TaskLoftParameters::TaskLoftParameters(ViewProviderLoft *LoftView, bool /*newObj #endif ui->listWidgetReferences->addAction(remove); ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu); - connect(remove, SIGNAL(triggered()), this, SLOT(onDeleteSection())); + connect(remove, &QAction::triggered, this, &TaskLoftParameters::onDeleteSection); - connect(ui->listWidgetReferences->model(), - SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int)), this, SLOT(indexesMoved())); + connect(ui->listWidgetReferences->model(), &QAbstractListModel::rowsMoved, + this, &TaskLoftParameters::indexesMoved); this->groupLayout()->addWidget(proxy); diff --git a/src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp b/src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp index ee2f302440..0e9087ad30 100644 --- a/src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp @@ -74,8 +74,8 @@ TaskMirroredParameters::TaskMirroredParameters(TaskMultiTransformParameters *par { proxy = new QWidget(parentTask); ui->setupUi(proxy); - connect(ui->buttonOK, SIGNAL(pressed()), - parentTask, SLOT(onSubTaskButtonOK())); + connect(ui->buttonOK, &QToolButton::pressed, + parentTask, &TaskMirroredParameters::onSubTaskButtonOK); QMetaObject::connectSlotsByName(this); layout->addWidget(proxy); @@ -94,8 +94,8 @@ TaskMirroredParameters::TaskMirroredParameters(TaskMultiTransformParameters *par void TaskMirroredParameters::setupUI() { - connect(ui->buttonAddFeature, SIGNAL(toggled(bool)), this, SLOT(onButtonAddFeature(bool))); - connect(ui->buttonRemoveFeature, SIGNAL(toggled(bool)), this, SLOT(onButtonRemoveFeature(bool))); + connect(ui->buttonAddFeature, &QToolButton::toggled, this, &TaskMirroredParameters::onButtonAddFeature); + connect(ui->buttonRemoveFeature, &QToolButton::toggled, this, &TaskMirroredParameters::onButtonRemoveFeature); // Create context menu QAction* action = new QAction(tr("Remove"), this); @@ -105,15 +105,15 @@ void TaskMirroredParameters::setupUI() action->setShortcutVisibleInContextMenu(true); #endif ui->listWidgetFeatures->addAction(action); - connect(action, SIGNAL(triggered()), this, SLOT(onFeatureDeleted())); + connect(action, &QAction::triggered, this, &TaskMirroredParameters::onFeatureDeleted); ui->listWidgetFeatures->setContextMenuPolicy(Qt::ActionsContextMenu); - connect(ui->listWidgetFeatures->model(), - SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int)), this, SLOT(indexesMoved())); + connect(ui->listWidgetFeatures->model(), &QAbstractListModel::rowsMoved, + this, &TaskMirroredParameters::indexesMoved); - connect(ui->comboPlane, SIGNAL(activated(int)), - this, SLOT(onPlaneChanged(int))); - connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)), - this, SLOT(onUpdateView(bool))); + connect(ui->comboPlane, qOverload(&QComboBox::activated), + this, &TaskMirroredParameters::onPlaneChanged); + connect(ui->checkBoxUpdateView, &QCheckBox::toggled, + this, &TaskMirroredParameters::onUpdateView); // Get the feature data PartDesign::Mirrored* pcMirrored = static_cast(getObject()); diff --git a/src/Mod/PartDesign/Gui/TaskMirroredParameters.h b/src/Mod/PartDesign/Gui/TaskMirroredParameters.h index b5782c7b29..6f464b97a6 100644 --- a/src/Mod/PartDesign/Gui/TaskMirroredParameters.h +++ b/src/Mod/PartDesign/Gui/TaskMirroredParameters.h @@ -59,7 +59,7 @@ public: private Q_SLOTS: void onPlaneChanged(int num); - virtual void onUpdateView(bool); + void onUpdateView(bool) override; void onFeatureDeleted() override; protected: diff --git a/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp b/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp index ea624c1214..473a1626c5 100644 --- a/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.cpp @@ -66,8 +66,10 @@ TaskMultiTransformParameters::TaskMultiTransformParameters(ViewProviderTransform QMetaObject::connectSlotsByName(this); this->groupLayout()->addWidget(proxy); - connect(ui->buttonAddFeature, SIGNAL(toggled(bool)), this, SLOT(onButtonAddFeature(bool))); - connect(ui->buttonRemoveFeature, SIGNAL(toggled(bool)), this, SLOT(onButtonRemoveFeature(bool))); + connect(ui->buttonAddFeature, &QToolButton::toggled, + this, &TaskMultiTransformParameters::onButtonAddFeature); + connect(ui->buttonRemoveFeature, &QToolButton::toggled, + this, &TaskMultiTransformParameters::onButtonRemoveFeature); // Create context menu QAction* action = new QAction(tr("Remove"), this); @@ -77,50 +79,51 @@ TaskMultiTransformParameters::TaskMultiTransformParameters(ViewProviderTransform action->setShortcutVisibleInContextMenu(true); #endif ui->listWidgetFeatures->addAction(action); - connect(action, SIGNAL(triggered()), this, SLOT(onFeatureDeleted())); + connect(action, &QAction::triggered, + this, &TaskMultiTransformParameters::onFeatureDeleted); ui->listWidgetFeatures->setContextMenuPolicy(Qt::ActionsContextMenu); - connect(ui->listWidgetFeatures->model(), - SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int)), this, SLOT(indexesMoved())); + connect(ui->listWidgetFeatures->model(), &QAbstractListModel::rowsMoved, + this, &TaskMultiTransformParameters::indexesMoved); // Create a context menu for the listview of transformation features action = new QAction(tr("Edit"), ui->listTransformFeatures); - action->connect(action, SIGNAL(triggered()), - this, SLOT(onTransformEdit())); + action->connect(action, &QAction::triggered, + this, &TaskMultiTransformParameters::onTransformEdit); ui->listTransformFeatures->addAction(action); action = new QAction(tr("Delete"), ui->listTransformFeatures); - action->connect(action, SIGNAL(triggered()), - this, SLOT(onTransformDelete())); + action->connect(action, &QAction::triggered, + this, &TaskMultiTransformParameters::onTransformDelete); ui->listTransformFeatures->addAction(action); action = new QAction(tr("Add mirrored transformation"), ui->listTransformFeatures); - action->connect(action, SIGNAL(triggered()), - this, SLOT(onTransformAddMirrored())); + action->connect(action, &QAction::triggered, + this, &TaskMultiTransformParameters::onTransformAddMirrored); ui->listTransformFeatures->addAction(action); action = new QAction(tr("Add linear pattern"), ui->listTransformFeatures); - action->connect(action, SIGNAL(triggered()), - this, SLOT(onTransformAddLinearPattern())); + action->connect(action, &QAction::triggered, + this, &TaskMultiTransformParameters::onTransformAddLinearPattern); ui->listTransformFeatures->addAction(action); action = new QAction(tr("Add polar pattern"), ui->listTransformFeatures); - action->connect(action, SIGNAL(triggered()), - this, SLOT(onTransformAddPolarPattern())); + action->connect(action, &QAction::triggered, + this, &TaskMultiTransformParameters::onTransformAddPolarPattern); ui->listTransformFeatures->addAction(action); action = new QAction(tr("Add scaled transformation"), ui->listTransformFeatures); - action->connect(action, SIGNAL(triggered()), - this, SLOT(onTransformAddScaled())); + action->connect(action, &QAction::triggered, + this, &TaskMultiTransformParameters::onTransformAddScaled); ui->listTransformFeatures->addAction(action); action = new QAction(tr("Move up"), ui->listTransformFeatures); - action->connect(action, SIGNAL(triggered()), - this, SLOT(onMoveUp())); + action->connect(action, &QAction::triggered, + this, &TaskMultiTransformParameters::onMoveUp); ui->listTransformFeatures->addAction(action); action = new QAction(tr("Move down"), ui->listTransformFeatures); - action->connect(action, SIGNAL(triggered()), - this, SLOT(onMoveDown())); + action->connect(action, &QAction::triggered, + this, &TaskMultiTransformParameters::onMoveDown); ui->listTransformFeatures->addAction(action); ui->listTransformFeatures->setContextMenuPolicy(Qt::ActionsContextMenu); - connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)), - this, SLOT(onUpdateView(bool))); + connect(ui->checkBoxUpdateView, &QCheckBox::toggled, + this, &TaskMultiTransformParameters::onUpdateView); - connect(ui->listTransformFeatures, SIGNAL(activated(QModelIndex)), - this, SLOT(onTransformActivated(QModelIndex))); + connect(ui->listTransformFeatures, &QListWidget::activated, + this, &TaskMultiTransformParameters::onTransformActivated); // Get the transformFeatures data PartDesign::MultiTransform* pcMultiTransform = static_cast(TransformedView->getObject()); @@ -270,8 +273,8 @@ void TaskMultiTransformParameters::onTransformEdit() return; // TODO: Show an error? subTask->setEnabledTransaction(isEnabledTransaction()); - connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)), - subTask, SLOT(onUpdateView(bool))); + connect(ui->checkBoxUpdateView, &QCheckBox::toggled, + subTask, &TaskTransformedParameters::onUpdateView); } void TaskMultiTransformParameters::onTransformActivated(const QModelIndex& index) @@ -492,7 +495,8 @@ void TaskMultiTransformParameters::onMoveDown() moveTransformFeature(+1); } -void TaskMultiTransformParameters::onSubTaskButtonOK() { +void TaskMultiTransformParameters::onSubTaskButtonOK() +{ closeSubTask(); } diff --git a/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.h b/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.h index fdd989f5ef..74e5c06b63 100644 --- a/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.h +++ b/src/Mod/PartDesign/Gui/TaskMultiTransformParameters.h @@ -63,6 +63,10 @@ public: void apply() override; +public Q_SLOTS: + /// User finished editing a subFeature + void onSubTaskButtonOK() override; + private Q_SLOTS: void onTransformDelete(); void onTransformEdit(); @@ -73,11 +77,9 @@ private Q_SLOTS: void onTransformAddScaled(); void onMoveUp(); void onMoveDown(); - /// User finished editing a subFeature - void onSubTaskButtonOK() override; // Note: There is no Cancel button because I couldn't work out how to save the state of // a subFeature so as to revert the changes of an edit operation - virtual void onUpdateView(bool); + void onUpdateView(bool) override; void onFeatureDeleted() override; /** Notifies when the object is about to be removed. */ void slotDeletedObject(const Gui::ViewProviderDocumentObject& Obj) override; diff --git a/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp b/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp index ba68286861..57af563c61 100644 --- a/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPipeParameters.cpp @@ -76,10 +76,10 @@ TaskPipeParameters::TaskPipeParameters(ViewProviderPipe *PipeView, bool /*newObj QMetaObject::connectSlotsByName(this); // some buttons are handled in a buttongroup - connect(ui->buttonProfileBase, SIGNAL(toggled(bool)), - this, SLOT(onProfileButton(bool))); - connect(ui->comboBoxTransition, SIGNAL(currentIndexChanged(int)), - this, SLOT(onTransitionChanged(int))); + connect(ui->buttonProfileBase, &QToolButton::toggled, + this, &TaskPipeParameters::onProfileButton); + connect(ui->comboBoxTransition, qOverload(&QComboBox::currentIndexChanged), + this, &TaskPipeParameters::onTransitionChanged); // Create context menu QAction* remove = new QAction(tr("Remove"), this); @@ -90,7 +90,7 @@ TaskPipeParameters::TaskPipeParameters(ViewProviderPipe *PipeView, bool /*newObj remove->setShortcutVisibleInContextMenu(true); #endif ui->listWidgetReferences->addAction(remove); - connect(remove, SIGNAL(triggered()), this, SLOT(onDeleteEdge())); + connect(remove, &QAction::triggered, this, &TaskPipeParameters::onDeleteEdge); ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu); this->groupLayout()->addWidget(proxy); @@ -547,20 +547,20 @@ TaskPipeOrientation::TaskPipeOrientation(ViewProviderPipe* PipeView, bool /*newO QMetaObject::connectSlotsByName(this); // some buttons are handled in a buttongroup - connect(ui->comboBoxMode, SIGNAL(currentIndexChanged(int)), - this, SLOT(onOrientationChanged(int))); - connect(ui->buttonProfileClear, SIGNAL(clicked()), - this, SLOT(onClearButton())); - connect(ui->stackedWidget, SIGNAL(currentChanged(int)), - this, SLOT(updateUI(int))); - connect(ui->curvelinear, SIGNAL(toggled(bool)), - this, SLOT(onCurvelinearChanged(bool))); - connect(ui->doubleSpinBoxX, SIGNAL(valueChanged(double)), - this, SLOT(onBinormalChanged(double))); - connect(ui->doubleSpinBoxY, SIGNAL(valueChanged(double)), - this, SLOT(onBinormalChanged(double))); - connect(ui->doubleSpinBoxZ, SIGNAL(valueChanged(double)), - this, SLOT(onBinormalChanged(double))); + connect(ui->comboBoxMode, qOverload(&QComboBox::currentIndexChanged), + this, &TaskPipeOrientation::onOrientationChanged); + connect(ui->buttonProfileClear, &QToolButton::clicked, + this, &TaskPipeOrientation::onClearButton); + connect(ui->stackedWidget, &QStackedWidget::currentChanged, + this, &TaskPipeOrientation::updateUI); + connect(ui->curvelinear, &QCheckBox::toggled, + this, &TaskPipeOrientation::onCurvelinearChanged); + connect(ui->doubleSpinBoxX, qOverload(&QDoubleSpinBox::valueChanged), + this, &TaskPipeOrientation::onBinormalChanged); + connect(ui->doubleSpinBoxY, qOverload(&QDoubleSpinBox::valueChanged), + this, &TaskPipeOrientation::onBinormalChanged); + connect(ui->doubleSpinBoxZ, qOverload(&QDoubleSpinBox::valueChanged), + this, &TaskPipeOrientation::onBinormalChanged); // Create context menu QAction* remove = new QAction(tr("Remove"), this); @@ -571,7 +571,7 @@ TaskPipeOrientation::TaskPipeOrientation(ViewProviderPipe* PipeView, bool /*newO remove->setShortcutVisibleInContextMenu(true); #endif ui->listWidgetReferences->addAction(remove); - connect(remove, SIGNAL(triggered()), this, SLOT(onDeleteItem())); + connect(remove, &QAction::triggered, this, &TaskPipeOrientation::onDeleteItem); ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu); this->groupLayout()->addWidget(proxy); @@ -815,10 +815,10 @@ TaskPipeScaling::TaskPipeScaling(ViewProviderPipe* PipeView, bool /*newObj*/, QW QMetaObject::connectSlotsByName(this); // some buttons are handled in a buttongroup - connect(ui->comboBoxScaling, SIGNAL(currentIndexChanged(int)), - this, SLOT(onScalingChanged(int))); - connect(ui->stackedWidget, SIGNAL(currentChanged(int)), - this, SLOT(updateUI(int))); + connect(ui->comboBoxScaling, qOverload(&QComboBox::currentIndexChanged), + this, &TaskPipeScaling::onScalingChanged); + connect(ui->stackedWidget, &QStackedWidget::currentChanged, + this, &TaskPipeScaling::updateUI); // Create context menu QAction* remove = new QAction(tr("Remove"), this); @@ -830,10 +830,10 @@ TaskPipeScaling::TaskPipeScaling(ViewProviderPipe* PipeView, bool /*newObj*/, QW #endif ui->listWidgetReferences->addAction(remove); ui->listWidgetReferences->setContextMenuPolicy(Qt::ActionsContextMenu); - connect(remove, SIGNAL(triggered()), this, SLOT(onDeleteSection())); + connect(remove, &QAction::triggered, this, &TaskPipeScaling::onDeleteSection); - connect(ui->listWidgetReferences->model(), - SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int)), this, SLOT(indexesMoved())); + connect(ui->listWidgetReferences->model(), &QAbstractListModel::rowsMoved, + this, &TaskPipeScaling::indexesMoved); this->groupLayout()->addWidget(proxy); diff --git a/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp b/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp index 8c75e55e3d..d0fa35c64a 100644 --- a/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp @@ -85,8 +85,8 @@ TaskPolarPatternParameters::TaskPolarPatternParameters(TaskMultiTransformParamet { proxy = new QWidget(parentTask); ui->setupUi(proxy); - connect(ui->buttonOK, SIGNAL(pressed()), - parentTask, SLOT(onSubTaskButtonOK())); + connect(ui->buttonOK, &QToolButton::pressed, + parentTask, &TaskMultiTransformParameters::onSubTaskButtonOK); QMetaObject::connectSlotsByName(this); layout->addWidget(proxy); @@ -105,8 +105,10 @@ TaskPolarPatternParameters::TaskPolarPatternParameters(TaskMultiTransformParamet void TaskPolarPatternParameters::connectSignals() { - connect(ui->buttonAddFeature, SIGNAL(toggled(bool)), this, SLOT(onButtonAddFeature(bool))); - connect(ui->buttonRemoveFeature, SIGNAL(toggled(bool)), this, SLOT(onButtonRemoveFeature(bool))); + connect(ui->buttonAddFeature, &QToolButton::toggled, + this, &TaskPolarPatternParameters::onButtonAddFeature); + connect(ui->buttonRemoveFeature, &QToolButton::toggled, + this, &TaskPolarPatternParameters::onButtonRemoveFeature); // Create context menu QAction* action = new QAction(tr("Remove"), this); @@ -116,27 +118,27 @@ void TaskPolarPatternParameters::connectSignals() action->setShortcutVisibleInContextMenu(true); #endif ui->listWidgetFeatures->addAction(action); - connect(action, SIGNAL(triggered()), this, SLOT(onFeatureDeleted())); + connect(action, &QAction::triggered, + this, &TaskPolarPatternParameters::onFeatureDeleted); ui->listWidgetFeatures->setContextMenuPolicy(Qt::ActionsContextMenu); - connect(ui->listWidgetFeatures->model(), - SIGNAL(rowsMoved(QModelIndex, int, int, QModelIndex, int)), this, SLOT(indexesMoved())); + connect(ui->listWidgetFeatures->model(), &QAbstractListModel::rowsMoved, + this, &TaskPolarPatternParameters::indexesMoved); updateViewTimer = new QTimer(this); updateViewTimer->setSingleShot(true); updateViewTimer->setInterval(getUpdateViewTimeout()); - connect(updateViewTimer, SIGNAL(timeout()), - this, SLOT(onUpdateViewTimer())); - - connect(ui->comboAxis, SIGNAL(activated(int)), - this, SLOT(onAxisChanged(int))); - connect(ui->checkReverse, SIGNAL(toggled(bool)), - this, SLOT(onCheckReverse(bool))); - connect(ui->polarAngle, SIGNAL(valueChanged(double)), - this, SLOT(onAngle(double))); - connect(ui->spinOccurrences, SIGNAL(valueChanged(uint)), - this, SLOT(onOccurrences(uint))); - connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)), - this, SLOT(onUpdateView(bool))); + connect(updateViewTimer, &QTimer::timeout, + this, &TaskPolarPatternParameters::onUpdateViewTimer); + connect(ui->comboAxis, qOverload(&QComboBox::activated), + this, &TaskPolarPatternParameters::onAxisChanged); + connect(ui->checkReverse, &QCheckBox::toggled, + this, &TaskPolarPatternParameters::onCheckReverse); + connect(ui->polarAngle, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskPolarPatternParameters::onAngle); + connect(ui->spinOccurrences, &Gui::UIntSpinBox::unsignedChanged, + this, &TaskPolarPatternParameters::onOccurrences); + connect(ui->checkBoxUpdateView, &QCheckBox::toggled, + this, &TaskPolarPatternParameters::onUpdateView); } void TaskPolarPatternParameters::setupUI() diff --git a/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.h b/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.h index ed799b3863..b25c8da9e1 100644 --- a/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.h +++ b/src/Mod/PartDesign/Gui/TaskPolarPatternParameters.h @@ -61,7 +61,7 @@ private Q_SLOTS: void onCheckReverse(const bool on); void onAngle(const double a); void onOccurrences(const uint n); - virtual void onUpdateView(bool); + void onUpdateView(bool) override; void onFeatureDeleted() override; protected: diff --git a/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.cpp b/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.cpp index 8ecb833bb4..6de96f988a 100644 --- a/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.cpp @@ -269,62 +269,104 @@ TaskBoxPrimitives::TaskBoxPrimitives(ViewProviderPrimitive* vp, QWidget* parent) } // box - connect(ui->boxLength, SIGNAL(valueChanged(double)), this, SLOT(onBoxLengthChanged(double))); - connect(ui->boxWidth, SIGNAL(valueChanged(double)), this, SLOT(onBoxWidthChanged(double))); - connect(ui->boxHeight, SIGNAL(valueChanged(double)), this, SLOT(onBoxHeightChanged(double))); + connect(ui->boxLength, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onBoxLengthChanged); + connect(ui->boxWidth, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onBoxWidthChanged); + connect(ui->boxHeight, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onBoxHeightChanged); // cylinder - connect(ui->cylinderRadius, SIGNAL(valueChanged(double)), this, SLOT(onCylinderRadiusChanged(double))); - connect(ui->cylinderHeight, SIGNAL(valueChanged(double)), this, SLOT(onCylinderHeightChanged(double))); - connect(ui->cylinderXSkew, SIGNAL(valueChanged(double)), this, SLOT(onCylinderXSkewChanged(double))); - connect(ui->cylinderYSkew, SIGNAL(valueChanged(double)), this, SLOT(onCylinderYSkewChanged(double))); - connect(ui->cylinderAngle, SIGNAL(valueChanged(double)), this, SLOT(onCylinderAngleChanged(double))); + connect(ui->cylinderRadius, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onCylinderRadiusChanged); + connect(ui->cylinderHeight, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onCylinderHeightChanged); + connect(ui->cylinderXSkew, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onCylinderXSkewChanged); + connect(ui->cylinderYSkew, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onCylinderYSkewChanged); + connect(ui->cylinderAngle, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onCylinderAngleChanged); // cone - connect(ui->coneRadius1, SIGNAL(valueChanged(double)), this, SLOT(onConeRadius1Changed(double))); - connect(ui->coneRadius2, SIGNAL(valueChanged(double)), this, SLOT(onConeRadius2Changed(double))); - connect(ui->coneAngle, SIGNAL(valueChanged(double)), this, SLOT(onConeAngleChanged(double))); - connect(ui->coneHeight, SIGNAL(valueChanged(double)), this, SLOT(onConeHeightChanged(double))); + connect(ui->coneRadius1, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onConeRadius1Changed); + connect(ui->coneRadius2, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onConeRadius2Changed); + connect(ui->coneAngle, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onConeAngleChanged); + connect(ui->coneHeight, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onConeHeightChanged); // sphere - connect(ui->sphereRadius, SIGNAL(valueChanged(double)), this, SLOT(onSphereRadiusChanged(double))); - connect(ui->sphereAngle1, SIGNAL(valueChanged(double)), this, SLOT(onSphereAngle1Changed(double))); - connect(ui->sphereAngle2, SIGNAL(valueChanged(double)), this, SLOT(onSphereAngle2Changed(double))); - connect(ui->sphereAngle3, SIGNAL(valueChanged(double)), this, SLOT(onSphereAngle3Changed(double))); + connect(ui->sphereRadius, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onSphereRadiusChanged); + connect(ui->sphereAngle1, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onSphereAngle1Changed); + connect(ui->sphereAngle2, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onSphereAngle2Changed); + connect(ui->sphereAngle3, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onSphereAngle3Changed); // ellipsoid - connect(ui->ellipsoidRadius1, SIGNAL(valueChanged(double)), this, SLOT(onEllipsoidRadius1Changed(double))); - connect(ui->ellipsoidRadius2, SIGNAL(valueChanged(double)), this, SLOT(onEllipsoidRadius2Changed(double))); - connect(ui->ellipsoidRadius3, SIGNAL(valueChanged(double)), this, SLOT(onEllipsoidRadius3Changed(double))); - connect(ui->ellipsoidAngle1, SIGNAL(valueChanged(double)), this, SLOT(onEllipsoidAngle1Changed(double))); - connect(ui->ellipsoidAngle2, SIGNAL(valueChanged(double)), this, SLOT(onEllipsoidAngle2Changed(double))); - connect(ui->ellipsoidAngle3, SIGNAL(valueChanged(double)), this, SLOT(onEllipsoidAngle3Changed(double))); + connect(ui->ellipsoidRadius1, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onEllipsoidRadius1Changed); + connect(ui->ellipsoidRadius2, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onEllipsoidRadius2Changed); + connect(ui->ellipsoidRadius3, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onEllipsoidRadius3Changed); + connect(ui->ellipsoidAngle1, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onEllipsoidAngle1Changed); + connect(ui->ellipsoidAngle2, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onEllipsoidAngle2Changed); + connect(ui->ellipsoidAngle3, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onEllipsoidAngle3Changed); // torus - connect(ui->torusRadius1, SIGNAL(valueChanged(double)), this, SLOT(onTorusRadius1Changed(double))); - connect(ui->torusRadius2, SIGNAL(valueChanged(double)), this, SLOT(onTorusRadius2Changed(double))); - connect(ui->torusAngle1, SIGNAL(valueChanged(double)), this, SLOT(onTorusAngle1Changed(double))); - connect(ui->torusAngle2, SIGNAL(valueChanged(double)), this, SLOT(onTorusAngle2Changed(double))); - connect(ui->torusAngle3, SIGNAL(valueChanged(double)), this, SLOT(onTorusAngle3Changed(double))); + connect(ui->torusRadius1, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onTorusRadius1Changed); + connect(ui->torusRadius2, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onTorusRadius2Changed); + connect(ui->torusAngle1, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onTorusAngle1Changed); + connect(ui->torusAngle2, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onTorusAngle2Changed); + connect(ui->torusAngle3, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onTorusAngle3Changed); //prism - connect(ui->prismCircumradius, SIGNAL(valueChanged(double)), this, SLOT(onPrismCircumradiusChanged(double))); - connect(ui->prismHeight, SIGNAL(valueChanged(double)), this, SLOT(onPrismHeightChanged(double))); - connect(ui->prismXSkew, SIGNAL(valueChanged(double)), this, SLOT(onPrismXSkewChanged(double))); - connect(ui->prismYSkew, SIGNAL(valueChanged(double)), this, SLOT(onPrismYSkewChanged(double))); - connect(ui->prismPolygon, SIGNAL(valueChanged(int)), this, SLOT(onPrismPolygonChanged(int))); + connect(ui->prismCircumradius, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onPrismCircumradiusChanged); + connect(ui->prismHeight, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onPrismHeightChanged); + connect(ui->prismXSkew, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onPrismXSkewChanged); + connect(ui->prismYSkew, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onPrismYSkewChanged); + connect(ui->prismPolygon, qOverload(&QSpinBox::valueChanged), + this, &TaskBoxPrimitives::onPrismPolygonChanged); // wedge - connect(ui->wedgeXmax, SIGNAL(valueChanged(double)), this, SLOT(onWedgeXmaxChanged(double))); - connect(ui->wedgeXmin, SIGNAL(valueChanged(double)), this, SLOT(onWedgeXminChanged(double))); - connect(ui->wedgeYmax, SIGNAL(valueChanged(double)), this, SLOT(onWedgeYmaxChanged(double))); - connect(ui->wedgeYmin, SIGNAL(valueChanged(double)), this, SLOT(onWedgeYminChanged(double))); - connect(ui->wedgeZmax, SIGNAL(valueChanged(double)), this, SLOT(onWedgeZmaxChanged(double))); - connect(ui->wedgeZmin, SIGNAL(valueChanged(double)), this, SLOT(onWedgeZminChanged(double))); - connect(ui->wedgeX2max, SIGNAL(valueChanged(double)), this, SLOT(onWedgeX2maxChanged(double))); - connect(ui->wedgeX2min, SIGNAL(valueChanged(double)), this, SLOT(onWedgeX2minChanged(double))); - connect(ui->wedgeZ2max, SIGNAL(valueChanged(double)), this, SLOT(onWedgeZ2maxChanged(double))); - connect(ui->wedgeZ2min, SIGNAL(valueChanged(double)), this, SLOT(onWedgeZ2minChanged(double))); + connect(ui->wedgeXmax, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onWedgeXmaxChanged); + connect(ui->wedgeXmin, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onWedgeXminChanged); + connect(ui->wedgeYmax, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onWedgeYmaxChanged); + connect(ui->wedgeYmin, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onWedgeYminChanged); + connect(ui->wedgeZmax, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onWedgeZmaxChanged); + connect(ui->wedgeZmin, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onWedgeZminChanged); + connect(ui->wedgeX2max, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onWedgeX2maxChanged); + connect(ui->wedgeX2min, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onWedgeX2minChanged); + connect(ui->wedgeZ2max, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onWedgeZ2maxChanged); + connect(ui->wedgeZ2min, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskBoxPrimitives::onWedgeZ2minChanged); } /* diff --git a/src/Mod/PartDesign/Gui/TaskScaledParameters.cpp b/src/Mod/PartDesign/Gui/TaskScaledParameters.cpp index bfe4f907f1..6d6f5553ef 100644 --- a/src/Mod/PartDesign/Gui/TaskScaledParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskScaledParameters.cpp @@ -67,8 +67,8 @@ TaskScaledParameters::TaskScaledParameters(TaskMultiTransformParameters *parentT { proxy = new QWidget(parentTask); ui->setupUi(proxy); - connect(ui->buttonOK, SIGNAL(pressed()), - parentTask, SLOT(onSubTaskButtonOK())); + connect(ui->buttonOK, &QPushButton::pressed, + parentTask, &TaskScaledParameters::onSubTaskButtonOK); QMetaObject::connectSlotsByName(this); layout->addWidget(proxy); @@ -85,8 +85,8 @@ TaskScaledParameters::TaskScaledParameters(TaskMultiTransformParameters *parentT void TaskScaledParameters::setupUI() { - connect(ui->buttonAddFeature, SIGNAL(toggled(bool)), this, SLOT(onButtonAddFeature(bool))); - connect(ui->buttonRemoveFeature, SIGNAL(toggled(bool)), this, SLOT(onButtonRemoveFeature(bool))); + connect(ui->buttonAddFeature, &QPushButton::toggled, this, &TaskScaledParameters::onButtonAddFeature); + connect(ui->buttonRemoveFeature, &QPushButton::toggled, this, &TaskScaledParameters::onButtonRemoveFeature); // Create context menu QAction* action = new QAction(tr("Remove"), this); @@ -96,15 +96,15 @@ void TaskScaledParameters::setupUI() action->setShortcutVisibleInContextMenu(true); #endif ui->listWidgetFeatures->addAction(action); - connect(action, SIGNAL(triggered()), this, SLOT(onFeatureDeleted())); + connect(action, &QAction::triggered, this, &TaskScaledParameters::onFeatureDeleted); ui->listWidgetFeatures->setContextMenuPolicy(Qt::ActionsContextMenu); - connect(ui->spinFactor, SIGNAL(valueChanged(double)), - this, SLOT(onFactor(double))); - connect(ui->spinOccurrences, SIGNAL(valueChanged(uint)), - this, SLOT(onOccurrences(uint))); - connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)), - this, SLOT(onUpdateView(bool))); + connect(ui->spinFactor, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskScaledParameters::onFactor); + connect(ui->spinOccurrences, &Gui::UIntSpinBox::unsignedChanged, + this, &TaskScaledParameters::onOccurrences); + connect(ui->checkBoxUpdateView, &QCheckBox::toggled, + this, &TaskScaledParameters::onUpdateView); // Get the feature data PartDesign::Scaled* pcScaled = static_cast(getObject()); diff --git a/src/Mod/PartDesign/Gui/TaskScaledParameters.h b/src/Mod/PartDesign/Gui/TaskScaledParameters.h index 7a89055963..2b0d654b90 100644 --- a/src/Mod/PartDesign/Gui/TaskScaledParameters.h +++ b/src/Mod/PartDesign/Gui/TaskScaledParameters.h @@ -57,7 +57,7 @@ public: private Q_SLOTS: void onFactor(const double f); void onOccurrences(const uint n); - virtual void onUpdateView(bool); + void onUpdateView(bool) override; void onFeatureDeleted() override; protected: diff --git a/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp b/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp index b80e3896e8..cefa05518f 100644 --- a/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskThicknessParameters.cpp @@ -80,31 +80,31 @@ TaskThicknessParameters::TaskThicknessParameters(ViewProviderDressUp *DressUpVie QMetaObject::connectSlotsByName(this); - connect(ui->Value, SIGNAL(valueChanged(double)), - this, SLOT(onValueChanged(double))); - connect(ui->checkReverse, SIGNAL(toggled(bool)), - this, SLOT(onReversedChanged(bool))); - connect(ui->checkIntersection, SIGNAL(toggled(bool)), - this, SLOT(onIntersectionChanged(bool))); - connect(ui->buttonRefAdd, SIGNAL(toggled(bool)), - this, SLOT(onButtonRefAdd(bool))); - connect(ui->buttonRefRemove, SIGNAL(toggled(bool)), - this, SLOT(onButtonRefRemove(bool))); - connect(ui->modeComboBox, SIGNAL(currentIndexChanged(int)), - this, SLOT(onModeChanged(int))); - connect(ui->joinComboBox, SIGNAL(currentIndexChanged(int)), - this, SLOT(onJoinTypeChanged(int))); + connect(ui->Value, qOverload(&Gui::QuantitySpinBox::valueChanged), + this, &TaskThicknessParameters::onValueChanged); + connect(ui->checkReverse, &QCheckBox::toggled, + this, &TaskThicknessParameters::onReversedChanged); + connect(ui->checkIntersection, &QCheckBox::toggled, + this, &TaskThicknessParameters::onIntersectionChanged); + connect(ui->buttonRefAdd, &QToolButton::toggled, + this, &TaskThicknessParameters::onButtonRefAdd); + connect(ui->buttonRefRemove, &QToolButton::toggled, + this, &TaskThicknessParameters::onButtonRefRemove); + connect(ui->modeComboBox, qOverload(&QComboBox::currentIndexChanged), + this, &TaskThicknessParameters::onModeChanged); + connect(ui->joinComboBox, qOverload(&QComboBox::currentIndexChanged), + this, &TaskThicknessParameters::onJoinTypeChanged); // Create context menu createDeleteAction(ui->listWidgetReferences, ui->buttonRefRemove); - connect(deleteAction, SIGNAL(triggered()), this, SLOT(onRefDeleted())); + connect(deleteAction, &QAction::triggered, this, &TaskThicknessParameters::onRefDeleted); - connect(ui->listWidgetReferences, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), - this, SLOT(setSelection(QListWidgetItem*))); - connect(ui->listWidgetReferences, SIGNAL(itemClicked(QListWidgetItem*)), - this, SLOT(setSelection(QListWidgetItem*))); - connect(ui->listWidgetReferences, SIGNAL(itemDoubleClicked(QListWidgetItem*)), - this, SLOT(doubleClicked(QListWidgetItem*))); + connect(ui->listWidgetReferences, &QListWidget::currentItemChanged, + this, &TaskThicknessParameters::setSelection); + connect(ui->listWidgetReferences, &QListWidget::itemClicked, + this, &TaskThicknessParameters::setSelection); + connect(ui->listWidgetReferences, &QListWidget::itemDoubleClicked, + this, &TaskThicknessParameters::doubleClicked); int mode = pcThickness->Mode.getValue(); ui->modeComboBox->setCurrentIndex(mode); diff --git a/src/Mod/PartDesign/Gui/TaskTransformedParameters.h b/src/Mod/PartDesign/Gui/TaskTransformedParameters.h index 3efb7bb7ef..d474b7c0a1 100644 --- a/src/Mod/PartDesign/Gui/TaskTransformedParameters.h +++ b/src/Mod/PartDesign/Gui/TaskTransformedParameters.h @@ -141,6 +141,7 @@ public: void exitSelectionMode(); virtual void apply() = 0; + virtual void onUpdateView(bool) = 0; /*! * \brief setEnabledTransaction