diff --git a/src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.cpp b/src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.cpp index cd12389193c7..9b73a8f8b640 100644 --- a/src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.cpp +++ b/src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.cpp @@ -125,75 +125,92 @@ SketcherToolDefaultWidget::SketcherToolDefaultWidget(QWidget* parent) ui->setupUi(this); // connecting the needed signals + setupConnections(); + + ui->parameterOne->installEventFilter(this); + ui->parameterTwo->installEventFilter(this); + ui->parameterThree->installEventFilter(this); + ui->parameterFour->installEventFilter(this); + ui->parameterFive->installEventFilter(this); + ui->parameterSix->installEventFilter(this); + + reset(); +} + +SketcherToolDefaultWidget::~SketcherToolDefaultWidget() = default; + +void SketcherToolDefaultWidget::setupConnections() +{ connect(ui->parameterOne, - SIGNAL(valueChanged(double)), + qOverload(&Gui::QuantitySpinBox::valueChanged), this, - SLOT(parameterOne_valueChanged(double))); + &SketcherToolDefaultWidget::parameterOne_valueChanged); connect(ui->parameterTwo, - SIGNAL(valueChanged(double)), + qOverload(&Gui::QuantitySpinBox::valueChanged), this, - SLOT(parameterTwo_valueChanged(double))); + &SketcherToolDefaultWidget::parameterTwo_valueChanged); connect(ui->parameterThree, - SIGNAL(valueChanged(double)), + qOverload(&Gui::QuantitySpinBox::valueChanged), this, - SLOT(parameterThree_valueChanged(double))); + &SketcherToolDefaultWidget::parameterThree_valueChanged); connect(ui->parameterFour, - SIGNAL(valueChanged(double)), + qOverload(&Gui::QuantitySpinBox::valueChanged), this, - SLOT(parameterFour_valueChanged(double))); + &SketcherToolDefaultWidget::parameterFour_valueChanged); connect(ui->parameterFive, - SIGNAL(valueChanged(double)), + qOverload(&Gui::QuantitySpinBox::valueChanged), this, - SLOT(parameterFive_valueChanged(double))); + &SketcherToolDefaultWidget::parameterFive_valueChanged); connect(ui->parameterSix, - SIGNAL(valueChanged(double)), + qOverload(&Gui::QuantitySpinBox::valueChanged), this, - SLOT(parameterSix_valueChanged(double))); + &SketcherToolDefaultWidget::parameterSix_valueChanged); connect(ui->parameterSeven, - SIGNAL(valueChanged(double)), + qOverload(&Gui::QuantitySpinBox::valueChanged), this, - SLOT(parameterSeven_valueChanged(double))); + &SketcherToolDefaultWidget::parameterSeven_valueChanged); connect(ui->parameterEight, - SIGNAL(valueChanged(double)), + qOverload(&Gui::QuantitySpinBox::valueChanged), this, - SLOT(parameterEight_valueChanged(double))); + &SketcherToolDefaultWidget::parameterEight_valueChanged); connect(ui->parameterNine, - SIGNAL(valueChanged(double)), + qOverload(&Gui::QuantitySpinBox::valueChanged), this, - SLOT(parameterNine_valueChanged(double))); + &SketcherToolDefaultWidget::parameterNine_valueChanged); connect(ui->parameterTen, - SIGNAL(valueChanged(double)), + qOverload(&Gui::QuantitySpinBox::valueChanged), + this, + &SketcherToolDefaultWidget::parameterTen_valueChanged); + connect(ui->checkBoxTS1, + &QCheckBox::toggled, this, - SLOT(parameterTen_valueChanged(double))); - connect(ui->checkBoxTS1, SIGNAL(toggled(bool)), this, SLOT(checkBoxTS1_toggled(bool))); - connect(ui->checkBoxTS2, SIGNAL(toggled(bool)), this, SLOT(checkBoxTS2_toggled(bool))); - connect(ui->checkBoxTS3, SIGNAL(toggled(bool)), this, SLOT(checkBoxTS3_toggled(bool))); - connect(ui->checkBoxTS4, SIGNAL(toggled(bool)), this, SLOT(checkBoxTS4_toggled(bool))); + &SketcherToolDefaultWidget::checkBoxTS1_toggled); + connect(ui->checkBoxTS2, + &QCheckBox::toggled, + this, + &SketcherToolDefaultWidget::checkBoxTS2_toggled); + connect(ui->checkBoxTS3, + &QCheckBox::toggled, + this, + &SketcherToolDefaultWidget::checkBoxTS3_toggled); + connect(ui->checkBoxTS4, + &QCheckBox::toggled, + this, + &SketcherToolDefaultWidget::checkBoxTS4_toggled); connect(ui->comboBox1, - SIGNAL(currentIndexChanged(int)), + qOverload(&QComboBox::currentIndexChanged), this, - SLOT(comboBox1_currentIndexChanged(int))); + &SketcherToolDefaultWidget::comboBox1_currentIndexChanged); connect(ui->comboBox2, - SIGNAL(currentIndexChanged(int)), + qOverload(&QComboBox::currentIndexChanged), this, - SLOT(comboBox2_currentIndexChanged(int))); + &SketcherToolDefaultWidget::comboBox2_currentIndexChanged); connect(ui->comboBox3, - SIGNAL(currentIndexChanged(int)), + qOverload(&QComboBox::currentIndexChanged), this, - SLOT(comboBox3_currentIndexChanged(int))); - - ui->parameterOne->installEventFilter(this); - ui->parameterTwo->installEventFilter(this); - ui->parameterThree->installEventFilter(this); - ui->parameterFour->installEventFilter(this); - ui->parameterFive->installEventFilter(this); - ui->parameterSix->installEventFilter(this); - - reset(); + &SketcherToolDefaultWidget::comboBox3_currentIndexChanged); } -SketcherToolDefaultWidget::~SketcherToolDefaultWidget() = default; - // pre-select the number of the spinbox when it gets the focus. bool SketcherToolDefaultWidget::eventFilter(QObject* object, QEvent* event) { diff --git a/src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.h b/src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.h index 79f254e0da68..275d03b23918 100644 --- a/src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.h +++ b/src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.h @@ -226,6 +226,7 @@ protected Q_SLOTS: void changeEvent(QEvent* ev) override; private: + void setupConnections(); QLabel* getParameterLabel(int parameterindex); Gui::PrefQuantitySpinBox* getParameterSpinBox(int parameterindex); Gui::PrefCheckBox* getCheckBox(int checkboxindex);