Fix bug Tool seam allowance. The tool returned to previous position after
selecting Apply or Ok buttons in the tool's dialog. --HG-- branch : feature
This commit is contained in:
parent
878fdb6156
commit
585bfec12f
|
@ -38,8 +38,9 @@
|
|||
DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||
: DialogTool(data, toolId, parent),
|
||||
ui(new Ui::DialogSeamAllowance),
|
||||
m_piece(),
|
||||
applyAllowed(false)// By default disabled
|
||||
applyAllowed(false),// By default disabled
|
||||
m_mx(0),
|
||||
m_my(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -110,22 +111,24 @@ void DialogSeamAllowance::EnableApply(bool enable)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPiece DialogSeamAllowance::GetPiece() const
|
||||
{
|
||||
return m_piece;
|
||||
return CreatePiece();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
||||
{
|
||||
m_piece = piece;
|
||||
ui->listWidget->clear();
|
||||
for (int i = 0; i < m_piece.CountNodes(); ++i)
|
||||
for (int i = 0; i < piece.CountNodes(); ++i)
|
||||
{
|
||||
NewItem(m_piece.at(i));
|
||||
NewItem(piece.at(i));
|
||||
}
|
||||
|
||||
ui->checkBoxForbidFlipping->setChecked(m_piece.IsForbidFlipping());
|
||||
ui->doubleSpinBoxSeams->setValue(m_piece.GetSAWidth());
|
||||
ui->checkBoxSeams->setChecked(m_piece.IsSeamAllowance());
|
||||
ui->checkBoxForbidFlipping->setChecked(piece.IsForbidFlipping());
|
||||
ui->doubleSpinBoxSeams->setValue(piece.GetSAWidth());
|
||||
ui->checkBoxSeams->setChecked(piece.IsSeamAllowance());
|
||||
|
||||
m_mx = piece.GetMx();
|
||||
m_my = piece.GetMy();
|
||||
|
||||
ValidObjects(MainPathIsValid());
|
||||
|
||||
|
@ -217,10 +220,7 @@ void DialogSeamAllowance::ShowDialog(bool click)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::SaveData()
|
||||
{
|
||||
m_piece.Clear();
|
||||
m_piece = CreatePiece();
|
||||
}
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::CheckState()
|
||||
|
@ -397,6 +397,8 @@ VPiece DialogSeamAllowance::CreatePiece() const
|
|||
piece.SetForbidFlipping(ui->checkBoxForbidFlipping->isChecked());
|
||||
piece.SetSeamAllowance(ui->checkBoxSeams->isChecked());
|
||||
piece.SetSAWidth(ui->doubleSpinBoxSeams->value());
|
||||
piece.SetMx(m_mx);
|
||||
piece.SetMy(m_my);
|
||||
|
||||
return piece;
|
||||
}
|
||||
|
|
|
@ -73,8 +73,9 @@ private:
|
|||
Q_DISABLE_COPY(DialogSeamAllowance)
|
||||
|
||||
Ui::DialogSeamAllowance *ui;
|
||||
VPiece m_piece;
|
||||
bool applyAllowed;
|
||||
qreal m_mx;
|
||||
qreal m_my;
|
||||
|
||||
VPiece CreatePiece() const;
|
||||
|
||||
|
|
|
@ -437,6 +437,11 @@ QVariant VToolSeamAllowance::itemChange(QGraphicsItem::GraphicsItemChange change
|
|||
}
|
||||
}
|
||||
// Don't forget to update geometry, because first change never call full parse
|
||||
VPiece detail = VAbstractTool::data.GetPiece(id);
|
||||
detail.SetMx(newPos.x());
|
||||
detail.SetMy(newPos.y());
|
||||
VAbstractTool::data.UpdatePiece(id, detail);
|
||||
|
||||
RefreshGeometry();
|
||||
changeFinished = true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user