diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index e431ca71c..af4077ad2 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -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; diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index 8b05e458f..c659ed967 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -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 > * 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() { diff --git a/src/app/valentina/mainwindowsnogui.h b/src/app/valentina/mainwindowsnogui.h index 3c23bf983..1af1651ef 100644 --- a/src/app/valentina/mainwindowsnogui.h +++ b/src/app/valentina/mainwindowsnogui.h @@ -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);