From 419095300e399a494d488492890a08981afa79f1 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 15 Apr 2019 21:15:56 +0300 Subject: [PATCH] Disable seam allowance options if seam allowance is built in. --HG-- branch : develop --- .../tools/piece/dialogseamallowance.cpp | 39 ++++++++++++------- .../dialogs/tools/piece/dialogseamallowance.h | 1 - 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp index 311e6bf66..7e2cd8af0 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.cpp @@ -917,19 +917,6 @@ void DialogSeamAllowance::ListChanged() SetMoveControls(); } -//--------------------------------------------------------------------------------------------------------------------- -void DialogSeamAllowance::EnableSeamAllowance(bool enable) -{ - uiTabPaths->checkBoxBuiltIn->setEnabled(enable); - uiTabPaths->groupBoxAutomatic->setEnabled(enable); - uiTabPaths->groupBoxCustom->setEnabled(enable); - - if (enable) - { - InitNodesList(); - } -} - //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::NodeChanged(int index) { @@ -2775,7 +2762,31 @@ void DialogSeamAllowance::InitSeamAllowanceTab() m_timerWidthAfter->setSingleShot(true); connect(m_timerWidthAfter, &QTimer::timeout, this, &DialogSeamAllowance::EvalWidthAfter); - connect(uiTabPaths->checkBoxSeams, &QCheckBox::toggled, this, &DialogSeamAllowance::EnableSeamAllowance); + connect(uiTabPaths->checkBoxSeams, &QCheckBox::toggled, this, [this](bool enable) + { + uiTabPaths->checkBoxBuiltIn->setEnabled(enable); + + if (not enable) + { + uiTabPaths->groupBoxAutomatic->setEnabled(enable); + uiTabPaths->groupBoxCustom->setEnabled(enable); + } + else + { + uiTabPaths->checkBoxBuiltIn->toggled(uiTabPaths->checkBoxBuiltIn->isChecked()); + } + }); + + connect(uiTabPaths->checkBoxBuiltIn, &QCheckBox::toggled, this, [this](bool enable) + { + uiTabPaths->groupBoxAutomatic->setEnabled(not enable); + uiTabPaths->groupBoxCustom->setEnabled(not enable); + + if (not enable) + { + InitNodesList(); + } + }); // init the default seam allowance, convert the value if app unit is different than pattern unit m_saWidth = UnitConvertor(qApp->Settings()->GetDefaultSeamAllowance(), diff --git a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.h b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.h index b110ef3bb..d569151e8 100644 --- a/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.h +++ b/src/libs/vtools/dialogs/tools/piece/dialogseamallowance.h @@ -92,7 +92,6 @@ private slots: void ShowPlaceLabelsContextMenu(const QPoint &pos); void ListChanged(); - void EnableSeamAllowance(bool enable); void NodeChanged(int index); void PassmarkChanged(int index); void CSAStartPointChanged(int index);