Skip to content

Commit

Permalink
+ do not close placement dialog if an error occured when pressing OK
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Jun 7, 2014
1 parent 92a565f commit 32f509c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Gui/Placement.cpp
Expand Up @@ -288,21 +288,26 @@ 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()) {
QMessageBox msg;
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
Expand All @@ -324,6 +329,8 @@ void Placement::on_applyButton_clicked()
(*it)->blockSignals(false);
}
}

return true;
}

void Placement::on_resetButton_clicked()
Expand Down
1 change: 1 addition & 0 deletions src/Gui/Placement.h
Expand Up @@ -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;
Expand Down

0 comments on commit 32f509c

Please sign in to comment.