Sketcher: Constrain Contextual implementation.

This commit is contained in:
Paddle
2023-06-22 22:32:28 +02:00
parent 423cc42ac8
commit 8a858ae7ec
12 changed files with 1859 additions and 14 deletions

View File

@@ -53,6 +53,7 @@ using namespace SketcherGui;
EditDatumDialog::EditDatumDialog(ViewProviderSketch* vp, int ConstrNbr)
: ConstrNbr(ConstrNbr)
, success(false)
{
sketch = vp->getSketchObject();
const std::vector<Sketcher::Constraint*>& Constraints = sketch->Constraints.getValues();
@@ -70,7 +71,7 @@ EditDatumDialog::EditDatumDialog(Sketcher::SketchObject* pcSketch, int ConstrNbr
EditDatumDialog::~EditDatumDialog()
{}
void EditDatumDialog::exec(bool atCursor)
int EditDatumDialog::exec(bool atCursor)
{
// Return if constraint doesn't have editable value
if (Constr->isDimensional()) {
@@ -80,7 +81,7 @@ void EditDatumDialog::exec(bool atCursor)
QObject::tr("Dimensional constraint"),
QObject::tr("Not allowed to edit the datum because the "
"sketch contains conflicting constraints"));
return;
return QDialog::Rejected;
}
Base::Quantity init_val;
@@ -173,8 +174,10 @@ void EditDatumDialog::exec(bool atCursor)
dlg.setGeometry(x, y, dlg.geometry().width(), dlg.geometry().height());
}
dlg.exec();
return dlg.exec();
}
return QDialog::Rejected;
}
void EditDatumDialog::accepted()
@@ -233,6 +236,7 @@ void EditDatumDialog::accepted()
//}
tryAutoRecompute(sketch);
success = true;
}
catch (const Base::Exception& e) {
Gui::NotifyUserError(
@@ -253,6 +257,11 @@ void EditDatumDialog::rejected()
sketch->recomputeFeature();
}
bool EditDatumDialog::isSuccess()
{
return success;
}
void EditDatumDialog::drivingToggled(bool state)
{
if (state) {