Fixed issue #662. Valentina closes when creating details on 64 bit systems.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2017-04-15 13:25:07 +03:00
parent 73c035ecc9
commit e8917bd10d
4 changed files with 19 additions and 9 deletions

View File

@ -643,6 +643,7 @@ void MainWindow::ClosedDialog(int result)
SCASSERT(scene != nullptr) SCASSERT(scene != nullptr)
QGraphicsItem *tool = dynamic_cast<QGraphicsItem *>(DrawTool::Create(dialogTool, scene, doc, pattern)); QGraphicsItem *tool = dynamic_cast<QGraphicsItem *>(DrawTool::Create(dialogTool, scene, doc, pattern));
SCASSERT(tool != nullptr)
ui->view->itemClicked(tool); ui->view->itemClicked(tool);
} }
ArrowTool(); ArrowTool();
@ -664,23 +665,25 @@ void MainWindow::ClosedDialogWithApply(int result, VMainGraphicsScene *scene)
{ {
SCASSERT(scene != nullptr) SCASSERT(scene != nullptr)
dialogTool->SetAssociatedTool( dialogTool->SetAssociatedTool(DrawTool::Create(dialogTool, scene, doc, pattern));
dynamic_cast<VAbstractTool * > (DrawTool::Create(dialogTool, scene, doc, pattern)));
} }
else else
{ // Or update associated tool with data { // Or update associated tool with data
VDrawTool * vtool= static_cast<VDrawTool *>(dialogTool->GetAssociatedTool()); DrawTool * vtool= qobject_cast<DrawTool *>(dialogTool->GetAssociatedTool());
SCASSERT(vtool != nullptr)
vtool->FullUpdateFromGuiApply(); vtool->FullUpdateFromGuiApply();
} }
} }
SCASSERT(not dialogTool.isNull()) SCASSERT(not dialogTool.isNull())
QGraphicsItem *tool = dynamic_cast<QGraphicsItem *>(dialogTool->GetAssociatedTool()); QGraphicsItem *tool = dynamic_cast<QGraphicsItem *>(dialogTool->GetAssociatedTool());
SCASSERT(tool != nullptr)
ui->view->itemClicked(tool); ui->view->itemClicked(tool);
if (dialogTool->GetAssociatedTool() != nullptr) if (dialogTool->GetAssociatedTool() != nullptr)
{ {
VDrawTool *vtool= static_cast<VDrawTool *>(dialogTool->GetAssociatedTool()); DrawTool *vtool= qobject_cast<DrawTool *>(dialogTool->GetAssociatedTool());
SCASSERT(vtool != nullptr)
vtool->DialogLinkDestroy(); vtool->DialogLinkDestroy();
connect(vtool, &VDrawTool::ToolTip, this, &MainWindow::ShowToolTip); connect(vtool, &DrawTool::ToolTip, this, &MainWindow::ShowToolTip);
} }
ArrowTool(); ArrowTool();
// If insert not to the end of file call lite parse // If insert not to the end of file call lite parse
@ -708,12 +711,11 @@ void MainWindow::ApplyDialog(VMainGraphicsScene *scene)
{ {
SCASSERT(scene != nullptr) SCASSERT(scene != nullptr)
dialogTool->SetAssociatedTool( dialogTool->SetAssociatedTool(DrawTool::Create(dialogTool, scene, doc, pattern));
static_cast<VAbstractTool * > (DrawTool::Create(dialogTool, scene, doc, pattern)));
} }
else else
{ // Or update associated tool with data { // Or update associated tool with data
VDrawTool * vtool= static_cast<VDrawTool *>(dialogTool->GetAssociatedTool()); DrawTool * vtool= qobject_cast<DrawTool *>(dialogTool->GetAssociatedTool());
SCASSERT(vtool != nullptr) SCASSERT(vtool != nullptr)
vtool->FullUpdateFromGuiApply(); vtool->FullUpdateFromGuiApply();
} }

View File

@ -69,7 +69,8 @@ public:
/** @brief setDialog set dialog when user want change tool option. */ /** @brief setDialog set dialog when user want change tool option. */
virtual void setDialog() {} virtual void setDialog() {}
virtual void DialogLinkDestroy();
void DialogLinkDestroy();
QString getLineType() const; QString getLineType() const;
virtual void SetTypeLine(const QString &value); virtual void SetTypeLine(const QString &value);

View File

@ -167,6 +167,12 @@ void VToolSeamAllowance::Remove(bool ask)
} }
} }
//---------------------------------------------------------------------------------------------------------------------
void VToolSeamAllowance::DialogLinkDestroy()
{
m_dialog=nullptr;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolSeamAllowance::InsertNode(VPieceNode node, quint32 pieceId, VMainGraphicsScene *scene, void VToolSeamAllowance::InsertNode(VPieceNode node, quint32 pieceId, VMainGraphicsScene *scene,
VContainer *data, VAbstractPattern *doc) VContainer *data, VAbstractPattern *doc)

View File

@ -74,6 +74,7 @@ public:
static const QString AttrBottomPin; static const QString AttrBottomPin;
void Remove(bool ask); void Remove(bool ask);
void DialogLinkDestroy();
static void InsertNode(VPieceNode node, quint32 pieceId, VMainGraphicsScene *scene, VContainer *data, static void InsertNode(VPieceNode node, quint32 pieceId, VMainGraphicsScene *scene, VContainer *data,
VAbstractPattern *doc); VAbstractPattern *doc);