diff --git a/src/Gui/DlgDisplayPropertiesImp.cpp b/src/Gui/DlgDisplayPropertiesImp.cpp index c9d3b09f90..7a5495080a 100644 --- a/src/Gui/DlgDisplayPropertiesImp.cpp +++ b/src/Gui/DlgDisplayPropertiesImp.cpp @@ -128,6 +128,8 @@ DlgDisplayPropertiesImp::DlgDisplayPropertiesImp(bool floating, QWidget* parent, , d(new Private) { d->ui.setupUi(this); + setupConnections(); + d->ui.textLabel1_3->hide(); d->ui.changePlot->hide(); d->ui.buttonLineColor->setModal(false); @@ -174,6 +176,22 @@ DlgDisplayPropertiesImp::~DlgDisplayPropertiesImp() Gui::Selection().Detach(this); } +void DlgDisplayPropertiesImp::setupConnections() +{ + connect(d->ui.changeMaterial, qOverload(&QComboBox::activated), this, &DlgDisplayPropertiesImp::onChangeMaterialActivated); + connect(d->ui.changeMode, qOverload(&QComboBox::activated), this, &DlgDisplayPropertiesImp::onChangeModeActivated); + connect(d->ui.changePlot, qOverload(&QComboBox::activated), this, &DlgDisplayPropertiesImp::onChangePlotActivated); + connect(d->ui.buttonColor, &ColorButton::changed, this, &DlgDisplayPropertiesImp::onButtonColorChanged); + connect(d->ui.spinTransparency, qOverload(&QSpinBox::valueChanged), this, &DlgDisplayPropertiesImp::onSpinTransparencyValueChanged); + connect(d->ui.spinPointSize, qOverload(&QSpinBox::valueChanged), this, &DlgDisplayPropertiesImp::onSpinPointSizeValueChanged); + connect(d->ui.buttonLineColor, &ColorButton::changed, this, &DlgDisplayPropertiesImp::onButtonLineColorChanged); + connect(d->ui.buttonPointColor, &ColorButton::changed, this, &DlgDisplayPropertiesImp::onButtonPointColorChanged); + connect(d->ui.spinLineWidth, qOverload(&QSpinBox::valueChanged), this, &DlgDisplayPropertiesImp::onSpinLineWidthValueChanged); + connect(d->ui.spinLineTransparency, qOverload(&QSpinBox::valueChanged), this, &DlgDisplayPropertiesImp::onSpinLineTransparencyValueChanged); + connect(d->ui.buttonUserDefinedMaterial, &ColorButton::clicked, this, &DlgDisplayPropertiesImp::onButtonUserDefinedMaterialClicked); + connect(d->ui.buttonColorPlot, &ColorButton::clicked, this, &DlgDisplayPropertiesImp::onButtonColorPlotClicked); +} + void DlgDisplayPropertiesImp::showDefaultButtons(bool ok) { d->ui.buttonBox->setVisible(ok); @@ -302,7 +320,7 @@ void DlgDisplayPropertiesImp::reject() /** * Opens a dialog that allows to modify the 'ShapeMaterial' property of all selected view providers. */ -void DlgDisplayPropertiesImp::on_buttonUserDefinedMaterial_clicked() +void DlgDisplayPropertiesImp::onButtonUserDefinedMaterialClicked() { std::vector Provider = getSelection(); DlgMaterialPropertiesImp dlg("ShapeMaterial", this); @@ -315,7 +333,7 @@ void DlgDisplayPropertiesImp::on_buttonUserDefinedMaterial_clicked() /** * Opens a dialog that allows to modify the 'ShapeMaterial' property of all selected view providers. */ -void DlgDisplayPropertiesImp::on_buttonColorPlot_clicked() +void DlgDisplayPropertiesImp::onButtonColorPlotClicked() { std::vector Provider = getSelection(); static QPointer dlg = nullptr; @@ -330,7 +348,7 @@ void DlgDisplayPropertiesImp::on_buttonColorPlot_clicked() /** * Sets the 'ShapeMaterial' property of all selected view providers. */ -void DlgDisplayPropertiesImp::on_changeMaterial_activated(int index) +void DlgDisplayPropertiesImp::onChangeMaterialActivated(int index) { std::vector Provider = getSelection(); App::Material::MaterialType matType = static_cast(d->ui.changeMaterial->itemData(index).toInt()); @@ -352,7 +370,7 @@ void DlgDisplayPropertiesImp::on_changeMaterial_activated(int index) /** * Sets the 'Display' property of all selected view providers. */ -void DlgDisplayPropertiesImp::on_changeMode_activated(const QString& s) +void DlgDisplayPropertiesImp::onChangeModeActivated(const QString& s) { Gui::WaitCursor wc; std::vector Provider = getSelection(); @@ -365,7 +383,7 @@ void DlgDisplayPropertiesImp::on_changeMode_activated(const QString& s) } } -void DlgDisplayPropertiesImp::on_changePlot_activated(const QString&s) +void DlgDisplayPropertiesImp::onChangePlotActivated(const QString&s) { Base::Console().Log("Plot = %s\n",(const char*)s.toLatin1()); } @@ -373,7 +391,7 @@ void DlgDisplayPropertiesImp::on_changePlot_activated(const QString&s) /** * Sets the 'ShapeColor' property of all selected view providers. */ -void DlgDisplayPropertiesImp::on_buttonColor_changed() +void DlgDisplayPropertiesImp::onButtonColorChanged() { std::vector Provider = getSelection(); QColor s = d->ui.buttonColor->color(); @@ -390,7 +408,7 @@ void DlgDisplayPropertiesImp::on_buttonColor_changed() /** * Sets the 'Transparency' property of all selected view providers. */ -void DlgDisplayPropertiesImp::on_spinTransparency_valueChanged(int transparency) +void DlgDisplayPropertiesImp::onSpinTransparencyValueChanged(int transparency) { std::vector Provider = getSelection(); for (auto It= Provider.begin();It!=Provider.end();++It) { @@ -405,7 +423,7 @@ void DlgDisplayPropertiesImp::on_spinTransparency_valueChanged(int transparency) /** * Sets the 'PointSize' property of all selected view providers. */ -void DlgDisplayPropertiesImp::on_spinPointSize_valueChanged(int pointsize) +void DlgDisplayPropertiesImp::onSpinPointSizeValueChanged(int pointsize) { std::vector Provider = getSelection(); for (const auto & It : Provider) { @@ -420,7 +438,7 @@ void DlgDisplayPropertiesImp::on_spinPointSize_valueChanged(int pointsize) /** * Sets the 'LineWidth' property of all selected view providers. */ -void DlgDisplayPropertiesImp::on_spinLineWidth_valueChanged(int linewidth) +void DlgDisplayPropertiesImp::onSpinLineWidthValueChanged(int linewidth) { std::vector Provider = getSelection(); for (const auto & It : Provider) { @@ -432,7 +450,7 @@ void DlgDisplayPropertiesImp::on_spinLineWidth_valueChanged(int linewidth) } } -void DlgDisplayPropertiesImp::on_buttonLineColor_changed() +void DlgDisplayPropertiesImp::onButtonLineColorChanged() { std::vector Provider = getSelection(); QColor s = d->ui.buttonLineColor->color(); @@ -446,7 +464,7 @@ void DlgDisplayPropertiesImp::on_buttonLineColor_changed() } } -void DlgDisplayPropertiesImp::on_buttonPointColor_changed() +void DlgDisplayPropertiesImp::onButtonPointColorChanged() { std::vector Provider = getSelection(); QColor s = d->ui.buttonPointColor->color(); @@ -460,7 +478,7 @@ void DlgDisplayPropertiesImp::on_buttonPointColor_changed() } } -void DlgDisplayPropertiesImp::on_spinLineTransparency_valueChanged(int transparency) +void DlgDisplayPropertiesImp::onSpinLineTransparencyValueChanged(int transparency) { std::vector Provider = getSelection(); for (const auto & It : Provider) { diff --git a/src/Gui/DlgDisplayPropertiesImp.h b/src/Gui/DlgDisplayPropertiesImp.h index 1e7421fa86..662d1f083f 100644 --- a/src/Gui/DlgDisplayPropertiesImp.h +++ b/src/Gui/DlgDisplayPropertiesImp.h @@ -65,23 +65,24 @@ public: void reject() override; private Q_SLOTS: - void on_changeMaterial_activated(int); - void on_changeMode_activated(const QString&); - void on_changePlot_activated(const QString&); - void on_buttonColor_changed(); - void on_spinTransparency_valueChanged(int); - void on_spinPointSize_valueChanged(int); - void on_buttonLineColor_changed(); - void on_buttonPointColor_changed(); - void on_spinLineWidth_valueChanged(int); - void on_spinLineTransparency_valueChanged(int); - void on_buttonUserDefinedMaterial_clicked(); - void on_buttonColorPlot_clicked(); + void onChangeMaterialActivated(int); + void onChangeModeActivated(const QString&); + void onChangePlotActivated(const QString&); + void onButtonColorChanged(); + void onSpinTransparencyValueChanged(int); + void onSpinPointSizeValueChanged(int); + void onButtonLineColorChanged(); + void onButtonPointColorChanged(); + void onSpinLineWidthValueChanged(int); + void onSpinLineTransparencyValueChanged(int); + void onButtonUserDefinedMaterialClicked(); + void onButtonColorPlotClicked(); protected: void changeEvent(QEvent *e) override; private: + void setupConnections(); void slotChangedObject(const Gui::ViewProvider&, const App::Property& Prop); void setDisplayModes(const std::vector&); void setMaterial(const std::vector&);