When user creates new piece button Apply should be disabled.
--HG-- branch : feature
This commit is contained in:
parent
f40bf977c8
commit
f8ee078ef7
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user