Skip to content

Commit

Permalink
Sketch: use new-style connect() in new code
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Oct 20, 2023
1 parent 7f23467 commit ce9c573
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 41 deletions.
99 changes: 58 additions & 41 deletions src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>(&Gui::QuantitySpinBox::valueChanged),
this,
SLOT(parameterOne_valueChanged(double)));
&SketcherToolDefaultWidget::parameterOne_valueChanged);
connect(ui->parameterTwo,
SIGNAL(valueChanged(double)),
qOverload<double>(&Gui::QuantitySpinBox::valueChanged),
this,
SLOT(parameterTwo_valueChanged(double)));
&SketcherToolDefaultWidget::parameterTwo_valueChanged);
connect(ui->parameterThree,
SIGNAL(valueChanged(double)),
qOverload<double>(&Gui::QuantitySpinBox::valueChanged),
this,
SLOT(parameterThree_valueChanged(double)));
&SketcherToolDefaultWidget::parameterThree_valueChanged);
connect(ui->parameterFour,
SIGNAL(valueChanged(double)),
qOverload<double>(&Gui::QuantitySpinBox::valueChanged),
this,
SLOT(parameterFour_valueChanged(double)));
&SketcherToolDefaultWidget::parameterFour_valueChanged);
connect(ui->parameterFive,
SIGNAL(valueChanged(double)),
qOverload<double>(&Gui::QuantitySpinBox::valueChanged),
this,
SLOT(parameterFive_valueChanged(double)));
&SketcherToolDefaultWidget::parameterFive_valueChanged);
connect(ui->parameterSix,
SIGNAL(valueChanged(double)),
qOverload<double>(&Gui::QuantitySpinBox::valueChanged),
this,
SLOT(parameterSix_valueChanged(double)));
&SketcherToolDefaultWidget::parameterSix_valueChanged);
connect(ui->parameterSeven,
SIGNAL(valueChanged(double)),
qOverload<double>(&Gui::QuantitySpinBox::valueChanged),
this,
SLOT(parameterSeven_valueChanged(double)));
&SketcherToolDefaultWidget::parameterSeven_valueChanged);
connect(ui->parameterEight,
SIGNAL(valueChanged(double)),
qOverload<double>(&Gui::QuantitySpinBox::valueChanged),
this,
SLOT(parameterEight_valueChanged(double)));
&SketcherToolDefaultWidget::parameterEight_valueChanged);
connect(ui->parameterNine,
SIGNAL(valueChanged(double)),
qOverload<double>(&Gui::QuantitySpinBox::valueChanged),
this,
SLOT(parameterNine_valueChanged(double)));
&SketcherToolDefaultWidget::parameterNine_valueChanged);
connect(ui->parameterTen,
SIGNAL(valueChanged(double)),
qOverload<double>(&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<int>(&QComboBox::currentIndexChanged),
this,
SLOT(comboBox1_currentIndexChanged(int)));
&SketcherToolDefaultWidget::comboBox1_currentIndexChanged);
connect(ui->comboBox2,
SIGNAL(currentIndexChanged(int)),
qOverload<int>(&QComboBox::currentIndexChanged),
this,
SLOT(comboBox2_currentIndexChanged(int)));
&SketcherToolDefaultWidget::comboBox2_currentIndexChanged);
connect(ui->comboBox3,
SIGNAL(currentIndexChanged(int)),
qOverload<int>(&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)
{
Expand Down
1 change: 1 addition & 0 deletions src/Mod/Sketcher/Gui/SketcherToolDefaultWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ce9c573

Please sign in to comment.