diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index fa1ef109f..b2c93467c 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -37,11 +37,13 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &toolId, QWidget *parent) : DialogTool(data, toolId, parent), ui(new Ui::DialogSeamAllowance), - m_piece() + m_piece(), + applyAllowed(false)// By default disabled { ui->setupUi(this); InitOkCancelApply(ui); + EnableApply(applyAllowed); flagName = true;//We have default name of piece. flagError = MainPathIsValid(); @@ -57,6 +59,14 @@ DialogSeamAllowance::~DialogSeamAllowance() delete ui; } +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::EnableApply(bool enable) +{ + SCASSERT(bApply != nullptr); + bApply->setEnabled(enable); + applyAllowed = enable; +} + //--------------------------------------------------------------------------------------------------------------------- VPiece DialogSeamAllowance::GetPiece() const { @@ -128,7 +138,7 @@ void DialogSeamAllowance::CheckState() SCASSERT(bOk != nullptr); bOk->setEnabled(flagName && flagError); // In case dialog hasn't apply button - if ( bApply != nullptr) + if ( bApply != nullptr && applyAllowed) { bApply->setEnabled(bOk->isEnabled()); } diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.h b/src/libs/vtools/dialogs/tools/dialogseamallowance.h index ff1095a72..beb4c2477 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.h +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.h @@ -45,6 +45,8 @@ public: DialogSeamAllowance(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr); virtual ~DialogSeamAllowance(); + void EnableApply(bool enable); + VPiece GetPiece() const; void SetPiece(const VPiece &m_piece); @@ -64,6 +66,7 @@ private: Ui::DialogSeamAllowance *ui; VPiece m_piece; + bool applyAllowed; VPiece CreatePiece() const;