From 32f509cba1468ff048bf575fff6926ac46fc8401 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 7 Jun 2014 20:14:00 +0200 Subject: [PATCH] + do not close placement dialog if an error occured when pressing OK --- src/Gui/Placement.cpp | 17 ++++++++++++----- src/Gui/Placement.h | 1 + 2 files changed, 13 insertions(+), 5 deletions(-) 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;