Fix Valentina crash.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-08-21 17:29:25 +03:00
parent ae870b8b2e
commit d8a6ce669e
3 changed files with 28 additions and 5 deletions

View File

@ -62,7 +62,6 @@
#include "../vtools/undocommands/addgroup.h"
#include "dialogs/vwidgetdetails.h"
#include "../vpatterndb/vpiecepath.h"
#include "../vpatterndb/measurements.h"
#include "../qmuparser/qmuparsererror.h"
#include "../vtools/dialogs/support/dialogeditlabel.h"
@ -478,8 +477,7 @@ bool MainWindow::LoadMeasurements(const QString &path)
}
else if (m->Type() == MeasurementsType::Individual)
{
VContainer::SetSize(*pattern->DataVariables()->value(size_M)->GetValue());
VContainer::SetHeight(*pattern->DataVariables()->value(height_M)->GetValue());
SetSizeHeightForIndividualM();
}
return true;
@ -528,8 +526,7 @@ bool MainWindow::UpdateMeasurements(const QString &path, int size, int height)
}
else if (m->Type() == MeasurementsType::Individual)
{
VContainer::SetSize(*pattern->DataVariables()->value(size_M)->GetValue());
VContainer::SetHeight(*pattern->DataVariables()->value(height_M)->GetValue());
SetSizeHeightForIndividualM();
}
return true;

View File

@ -40,6 +40,7 @@
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
#include "../vpatterndb/floatItemData/vgrainlinedata.h"
#include "../vpatterndb/measurements.h"
#include "../vtools/tools/vabstracttool.h"
#include "../vtools/tools/vtoolseamallowance.h"
@ -1515,6 +1516,30 @@ QString MainWindowsNoGUI::FileName() const
return QFileInfo(fileName).baseName();
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindowsNoGUI::SetSizeHeightForIndividualM() const
{
const QHash<QString, QSharedPointer<VInternalVariable> > * vars = pattern->DataVariables();
if (vars->contains(size_M))
{
VContainer::SetSize(*vars->value(size_M)->GetValue());
}
else
{
VContainer::SetSize(0);
}
if (vars->contains(height_M))
{
VContainer::SetHeight(*vars->value(height_M)->GetValue());
}
else
{
VContainer::SetHeight(0);
}
}
//---------------------------------------------------------------------------------------------------------------------
int MainWindowsNoGUI::ContinueIfLayoutStale()
{

View File

@ -99,6 +99,7 @@ protected:
bool LayoutSettings(VLayoutGenerator& lGenerator);
int ContinueIfLayoutStale();
QString FileName() const;
void SetSizeHeightForIndividualM() const;
private slots:
void PrintPages (QPrinter *printer);
void ErrorConsoleMode(const LayoutErrors &state);