diff --git a/src/Gui/Placement.cpp b/src/Gui/Placement.cpp index 7b59b0530..f7ba38216 100644 --- a/src/Gui/Placement.cpp +++ b/src/Gui/Placement.cpp @@ -288,13 +288,18 @@ void Placement::reject() void Placement::accept() { - on_applyButton_clicked(); - - revertTransformation(); - QDialog::accept(); + if (onApply()) { + revertTransformation(); + QDialog::accept(); + } } void Placement::on_applyButton_clicked() +{ + onApply(); +} + +bool Placement::onApply() { //only process things when we have valid inputs! if (!hasValidInputs()) { @@ -302,7 +307,7 @@ void Placement::on_applyButton_clicked() msg.setIcon(QMessageBox::Critical); msg.setText(tr("There are input fields with incorrect input, please ensure valid placement values!")); msg.exec(); - return; + return false; } // If there are listeners to the 'placementChanged' signal we rely @@ -324,6 +329,8 @@ void Placement::on_applyButton_clicked() (*it)->blockSignals(false); } } + + return true; } void Placement::on_resetButton_clicked() diff --git a/src/Gui/Placement.h b/src/Gui/Placement.h index 04ff65cef..a6c7965b6 100644 --- a/src/Gui/Placement.h +++ b/src/Gui/Placement.h @@ -65,6 +65,7 @@ private Q_SLOTS: void on_resetButton_clicked(); private: + bool onApply(); void setPlacementData(const Base::Placement&); Base::Placement getPlacementData() const; QString getPlacementString() const;