New layout option --nestQuantity.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-07-04 14:33:45 +03:00
parent 3212fc6136
commit e8804c90bb
22 changed files with 170 additions and 55 deletions

View File

@ -21,6 +21,7 @@
- Move Tool options and Group menu to Window section. - Move Tool options and Group menu to Window section.
- Raise the minimum value for curve approximation to 0.2. - Raise the minimum value for curve approximation to 0.2.
- Make piece labels transparent. - Make piece labels transparent.
- New layout option --nestQuantity.
# Version 0.6.2 (unreleased) # Version 0.6.2 (unreleased)
- [#903] Bug in tool Cut Spline path. - [#903] Bug in tool Cut Spline path.

View File

@ -1,6 +1,6 @@
.\" Manpage for valentina. .\" Manpage for valentina.
.\" Contact dismine@gmail.com to correct errors. .\" Contact dismine@gmail.com to correct errors.
.TH valentina 1 "30 March, 2019" "valentina man page" .TH valentina 1 "4 July, 2019" "valentina man page"
.SH NAME .SH NAME
Valentina \- Pattern making program. Valentina \- Pattern making program.
.SH SYNOPSIS .SH SYNOPSIS
@ -188,6 +188,8 @@ The path to output destination folder. By default the directory at which the app
.RB "Page bottom margin in current units like 3.0 (" "export mode" "). If not set will be used value from default printer. Or 0 if none printers was found." .RB "Page bottom margin in current units like 3.0 (" "export mode" "). If not set will be used value from default printer. Or 0 if none printers was found."
.IP "--followGrainline" .IP "--followGrainline"
.RB "Order detail to follow grainline direction (" "export mode" "). .RB "Order detail to follow grainline direction (" "export mode" ").
.IP "--nestQuantity"
.RB "Nest quantity copies of each piece (" "export mode" ").
.IP "-c, --crop" .IP "-c, --crop"
.RB "Auto crop unused length (" "export mode" ")." .RB "Auto crop unused length (" "export mode" ")."
.IP "-u, --unite" .IP "-u, --unite"

View File

@ -225,6 +225,7 @@ VLayoutGeneratorPtr VCommandLine::DefaultGenerator() const
diag.SetFields(margins); diag.SetFields(margins);
diag.SetFollowGrainline(IsOptionSet(LONG_OPTION_FOLLOW_GRAINLINE)); diag.SetFollowGrainline(IsOptionSet(LONG_OPTION_FOLLOW_GRAINLINE));
diag.SetNestQuantity(IsOptionSet(LONG_OPTION_NEST_QUANTITY));
diag.SetNestingTime(OptNestingTime()); diag.SetNestingTime(OptNestingTime());
diag.SetEfficiencyCoefficient(OptEfficiencyCoefficient()); diag.SetEfficiencyCoefficient(OptEfficiencyCoefficient());
@ -655,6 +656,8 @@ void VCommandLine::InitCommandLineOptions()
//================================================================================================================= //=================================================================================================================
{LONG_OPTION_FOLLOW_GRAINLINE, {LONG_OPTION_FOLLOW_GRAINLINE,
translate("VCommandLine", "Order detail to follow grainline direction (export mode).")}, translate("VCommandLine", "Order detail to follow grainline direction (export mode).")},
{LONG_OPTION_NEST_QUANTITY,
translate("VCommandLine", "Nest quantity copies of each piece (export mode).")},
{{SINGLE_OPTION_CROP, LONG_OPTION_CROP}, {{SINGLE_OPTION_CROP, LONG_OPTION_CROP},
translate("VCommandLine", "Auto crop unused length (export mode).")}, translate("VCommandLine", "Auto crop unused length (export mode).")},
{{SINGLE_OPTION_UNITE, LONG_OPTION_UNITE}, {{SINGLE_OPTION_UNITE, LONG_OPTION_UNITE},

View File

@ -328,6 +328,18 @@ void DialogLayoutSettings::SetTextAsPaths(bool value)
ui->checkBoxTextAsPaths->setChecked(value); ui->checkBoxTextAsPaths->setChecked(value);
} }
//---------------------------------------------------------------------------------------------------------------------
bool DialogLayoutSettings::IsNestQuantity() const
{
return ui->checkBoxNestQuantity->isChecked();
}
//---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::SetNestQuantity(bool state)
{
ui->checkBoxNestQuantity->setChecked(state);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QString DialogLayoutSettings::SelectedPrinter() const QString DialogLayoutSettings::SelectedPrinter() const
{ {
@ -566,6 +578,7 @@ void DialogLayoutSettings::DialogAccepted()
generator->SetStripOptimization(IsStripOptimization()); generator->SetStripOptimization(IsStripOptimization());
generator->SetMultiplier(GetMultiplier()); generator->SetMultiplier(GetMultiplier());
generator->SetTextAsPaths(IsTextAsPaths()); generator->SetTextAsPaths(IsTextAsPaths());
generator->SetNestQuantity(IsNestQuantity());
if (IsIgnoreAllFields()) if (IsIgnoreAllFields())
{ {
@ -654,6 +667,7 @@ void DialogLayoutSettings::RestoreDefaults()
SetMultiplier(VSettings::GetDefMultiplier()); SetMultiplier(VSettings::GetDefMultiplier());
SetNestingTime(VSettings::GetDefNestingTime()); SetNestingTime(VSettings::GetDefNestingTime());
SetEfficiencyCoefficient(VSettings::GetDefEfficiencyCoefficient()); SetEfficiencyCoefficient(VSettings::GetDefEfficiencyCoefficient());
SetNestQuantity(VSettings::GetDefLayoutNestQuantity());
CorrectMaxFileds(); CorrectMaxFileds();
IgnoreAllFields(ui->checkBoxIgnoreFileds->isChecked()); IgnoreAllFields(ui->checkBoxIgnoreFileds->isChecked());
@ -982,6 +996,7 @@ void DialogLayoutSettings::ReadSettings()
SetStripOptimization(settings->GetStripOptimization()); SetStripOptimization(settings->GetStripOptimization());
SetMultiplier(settings->GetMultiplier()); SetMultiplier(settings->GetMultiplier());
SetTextAsPaths(settings->GetTextAsPaths()); SetTextAsPaths(settings->GetTextAsPaths());
SetNestQuantity(settings->GetLayoutNestQuantity());
FindTemplate(); FindTemplate();
@ -1008,6 +1023,7 @@ void DialogLayoutSettings::WriteSettings() const
settings->SetTextAsPaths(IsTextAsPaths()); settings->SetTextAsPaths(IsTextAsPaths());
settings->SetNestingTime(GetNestingTime()); settings->SetNestingTime(GetNestingTime());
settings->SetEfficiencyCoefficient(GetEfficiencyCoefficient()); settings->SetEfficiencyCoefficient(GetEfficiencyCoefficient());
settings->SetLayoutNestQuantity(IsNestQuantity());
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -95,6 +95,9 @@ public:
bool IsTextAsPaths() const; bool IsTextAsPaths() const;
void SetTextAsPaths(bool value); void SetTextAsPaths(bool value);
bool IsNestQuantity() const;
void SetNestQuantity(bool state);
QString SelectedPrinter() const; QString SelectedPrinter() const;
void EnableLandscapeOrientation(); void EnableLandscapeOrientation();

View File

@ -518,6 +518,16 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="checkBoxNestQuantity">
<property name="toolTip">
<string>Nest quantity of copies according to piece settings.</string>
</property>
<property name="text">
<string>Nest quantity</string>
</property>
</widget>
</item>
<item> <item>
<widget class="Line" name="line_4"> <widget class="Line" name="line_4">
<property name="orientation"> <property name="orientation">

View File

@ -1028,7 +1028,7 @@ VPieceLabelData VPattern::ParsePieceDataTag(const QDomElement &domElement, VPiec
ppData.SetRotationWay(GetParametrEmptyString(domElement, AttrRotationWay)); ppData.SetRotationWay(GetParametrEmptyString(domElement, AttrRotationWay));
ppData.SetTilt(GetParametrEmptyString(domElement, AttrTilt)); ppData.SetTilt(GetParametrEmptyString(domElement, AttrTilt));
ppData.SetFoldPosition(GetParametrEmptyString(domElement, AttrFoldPosition)); ppData.SetFoldPosition(GetParametrEmptyString(domElement, AttrFoldPosition));
ppData.SetQuantity(static_cast<int>(GetParametrUInt(domElement, AttrQuantity, QChar('1')))); ppData.SetQuantity(static_cast<quint16>(GetParametrUInt(domElement, AttrQuantity, QChar('1'))));
ppData.SetOnFold(GetParametrBool(domElement, AttrOnFold, falseStr)); ppData.SetOnFold(GetParametrBool(domElement, AttrOnFold, falseStr));
ppData.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, QChar('0')), ppData.SetPos(QPointF(GetParametrDouble(domElement, AttrMx, QChar('0')),
GetParametrDouble(domElement, AttrMy, QChar('0')))); GetParametrDouble(domElement, AttrMy, QChar('0'))));

View File

@ -50,6 +50,24 @@ QT_WARNING_POP
#undef small #undef small
#endif #endif
namespace
{
QVector<VLayoutPiece> PrepareQuantity(const QVector<VLayoutPiece> &details)
{
QVector<VLayoutPiece> withQuantity;
withQuantity.reserve(details.size());
for(auto &piece : details)
{
for (int i = 0; i < piece.GetQuantity(); ++i)
{
withQuantity.append(piece);
}
}
return withQuantity;
}
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VBank::VBank() VBank::VBank()
: details(), : details(),
@ -76,6 +94,18 @@ void VBank::SetLayoutWidth(qreal value)
Reset(); Reset();
} }
//---------------------------------------------------------------------------------------------------------------------
bool VBank::IsNestQuantity() const
{
return m_nestQuantity;
}
//---------------------------------------------------------------------------------------------------------------------
void VBank::SetNestQuantity(bool value)
{
m_nestQuantity = value;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VBank::SetDetails(const QVector<VLayoutPiece> &details) void VBank::SetDetails(const QVector<VLayoutPiece> &details)
{ {
@ -213,6 +243,11 @@ bool VBank::PrepareDetails()
return prepare; return prepare;
} }
if (m_nestQuantity)
{
details = PrepareQuantity(details);
}
diagonal = 0; diagonal = 0;
for (int i=0; i < details.size(); ++i) for (int i=0; i < details.size(); ++i)

View File

@ -54,6 +54,8 @@ public:
qreal GetLayoutWidth() const; qreal GetLayoutWidth() const;
void SetLayoutWidth(qreal value); void SetLayoutWidth(qreal value);
bool IsNestQuantity() const;
void SetNestQuantity(bool value);
void SetDetails(const QVector<VLayoutPiece> &details); void SetDetails(const QVector<VLayoutPiece> &details);
int GetNext(); int GetNext();
@ -90,6 +92,7 @@ private:
Cases caseType; Cases caseType;
bool prepare; bool prepare;
qreal diagonal; qreal diagonal;
bool m_nestQuantity{false};
void PrepareGroup(); void PrepareGroup();

View File

@ -728,6 +728,18 @@ void VLayoutGenerator::SetFollowGrainline(bool value)
followGrainline = value; followGrainline = value;
} }
//---------------------------------------------------------------------------------------------------------------------
bool VLayoutGenerator::IsNestQuantity() const
{
return bank->IsNestQuantity();
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutGenerator::SetNestQuantity(bool value)
{
bank->SetNestQuantity(value);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
qreal VLayoutGenerator::GetPaperWidth() const qreal VLayoutGenerator::GetPaperWidth() const
{ {

View File

@ -99,6 +99,9 @@ public:
bool GetFollowGrainline() const; bool GetFollowGrainline() const;
void SetFollowGrainline(bool value); void SetFollowGrainline(bool value);
bool IsNestQuantity() const;
void SetNestQuantity(bool value);
int GetRotationNumber() const; int GetRotationNumber() const;
void SetRotationNumber(int value); void SetRotationNumber(int value);

View File

@ -60,7 +60,7 @@
#include "vgraphicsfillitem.h" #include "vgraphicsfillitem.h"
const quint32 VLayoutPieceData::streamHeader = 0x80D7D009; // CRC-32Q string "VLayoutPieceData" const quint32 VLayoutPieceData::streamHeader = 0x80D7D009; // CRC-32Q string "VLayoutPieceData"
const quint16 VLayoutPieceData::classVersion = 1; const quint16 VLayoutPieceData::classVersion = 2;
namespace namespace
{ {
@ -443,13 +443,14 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern
} }
const VPieceLabelData& data = piece.GetPatternPieceData(); const VPieceLabelData& data = piece.GetPatternPieceData();
if (data.IsVisible() == true) det.SetQuantity(data.GetQuantity());
if (data.IsVisible())
{ {
det.SetPieceText(piece.GetName(), data, qApp->Settings()->GetLabelFont(), pattern); det.SetPieceText(piece.GetName(), data, qApp->Settings()->GetLabelFont(), pattern);
} }
const VPatternLabelData& geom = piece.GetPatternInfo(); const VPatternLabelData& geom = piece.GetPatternInfo();
if (geom.IsVisible() == true) if (geom.IsVisible())
{ {
VAbstractPattern* pDoc = qApp->getCurrentDocument(); VAbstractPattern* pDoc = qApp->getCurrentDocument();
det.SetPatternInfo(pDoc, geom, qApp->Settings()->GetLabelFont(), pattern); det.SetPatternInfo(pDoc, geom, qApp->Settings()->GetLabelFont(), pattern);
@ -757,6 +758,18 @@ void VLayoutPiece::SetLayoutWidth(qreal value)
d->layoutWidth = value; d->layoutWidth = value;
} }
//---------------------------------------------------------------------------------------------------------------------
quint16 VLayoutPiece::GetQuantity() const
{
return d->m_quantity;
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutPiece::SetQuantity(quint16 value)
{
d->m_quantity = qMax(static_cast<quint16>(1), value);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLayoutPiece::Translate(qreal dx, qreal dy) void VLayoutPiece::Translate(qreal dx, qreal dy)
{ {

View File

@ -116,6 +116,9 @@ public:
qreal GetLayoutWidth() const; qreal GetLayoutWidth() const;
void SetLayoutWidth(qreal value); void SetLayoutWidth(qreal value);
quint16 GetQuantity() const;
void SetQuantity(quint16 value);
bool IsMirror() const; bool IsMirror() const;
void SetMirror(bool value); void SetMirror(bool value);

View File

@ -52,23 +52,6 @@ class VLayoutPieceData : public QSharedData
{ {
public: public:
VLayoutPieceData() VLayoutPieceData()
: contour(),
seamAllowance(),
layoutAllowance(),
passmarks(),
m_internalPaths(),
matrix(),
layoutWidth(0),
mirror(false),
detailLabel(),
patternInfo(),
grainlinePoints(),
grainlineArrowType(ArrowType::atFront),
grainlineAngle(0),
grainlineEnabled(false),
m_tmDetail(),
m_tmPattern(),
m_placeLabels()
{} {}
VLayoutPieceData(const VLayoutPieceData &detail) VLayoutPieceData(const VLayoutPieceData &detail)
@ -90,7 +73,8 @@ public:
m_tmDetail(detail.m_tmDetail), m_tmDetail(detail.m_tmDetail),
m_tmPattern(detail.m_tmPattern), m_tmPattern(detail.m_tmPattern),
m_placeLabels(detail.m_placeLabels), m_placeLabels(detail.m_placeLabels),
m_square(detail.m_square) m_square(detail.m_square),
m_quantity(detail.m_quantity)
{} {}
~VLayoutPieceData() Q_DECL_EQ_DEFAULT; ~VLayoutPieceData() Q_DECL_EQ_DEFAULT;
@ -99,52 +83,54 @@ public:
friend QDataStream& operator>>(QDataStream& dataStream, VLayoutPieceData& piece); friend QDataStream& operator>>(QDataStream& dataStream, VLayoutPieceData& piece);
/** @brief contour list of contour points. */ /** @brief contour list of contour points. */
QVector<QPointF> contour; QVector<QPointF> contour{};
/** @brief seamAllowance list of seam allowance points. */ /** @brief seamAllowance list of seam allowance points. */
QVector<QPointF> seamAllowance; QVector<QPointF> seamAllowance{};
/** @brief layoutAllowance list of layout allowance points. */ /** @brief layoutAllowance list of layout allowance points. */
QVector<QPointF> layoutAllowance; QVector<QPointF> layoutAllowance{};
/** @brief passmarks list of passmakrs. */ /** @brief passmarks list of passmakrs. */
QVector<VLayoutPassmark> passmarks; QVector<VLayoutPassmark> passmarks{};
/** @brief m_internalPaths list of internal paths. */ /** @brief m_internalPaths list of internal paths. */
QVector<VLayoutPiecePath> m_internalPaths; QVector<VLayoutPiecePath> m_internalPaths{};
/** @brief matrix transformation matrix*/ /** @brief matrix transformation matrix*/
QTransform matrix; QTransform matrix{};
/** @brief layoutWidth value layout allowance width in pixels. */ /** @brief layoutWidth value layout allowance width in pixels. */
qreal layoutWidth; qreal layoutWidth{0};
bool mirror; bool mirror{false};
/** @brief detailLabel detail label rectangle */ /** @brief detailLabel detail label rectangle */
QVector<QPointF> detailLabel; QVector<QPointF> detailLabel{};
/** @brief patternInfo pattern info rectangle */ /** @brief patternInfo pattern info rectangle */
QVector<QPointF> patternInfo; QVector<QPointF> patternInfo{};
/** @brief grainlineInfo line */ /** @brief grainlineInfo line */
QVector<QPointF> grainlinePoints; QVector<QPointF> grainlinePoints{};
ArrowType grainlineArrowType; ArrowType grainlineArrowType{ArrowType::atFront};
qreal grainlineAngle; qreal grainlineAngle{0};
bool grainlineEnabled; bool grainlineEnabled{false};
/** @brief m_tmDetail text manager for laying out detail info */ /** @brief m_tmDetail text manager for laying out detail info */
VTextManager m_tmDetail; VTextManager m_tmDetail{};
/** @brief m_tmPattern text manager for laying out pattern info */ /** @brief m_tmPattern text manager for laying out pattern info */
VTextManager m_tmPattern; VTextManager m_tmPattern{};
/** @brief m_placeLabels list of place labels. */ /** @brief m_placeLabels list of place labels. */
QVector<VLayoutPlaceLabel> m_placeLabels; QVector<VLayoutPlaceLabel> m_placeLabels{};
qint64 m_square{0}; qint64 m_square{0};
quint16 m_quantity{1};
private: private:
Q_DISABLE_ASSIGN(VLayoutPieceData) Q_DISABLE_ASSIGN(VLayoutPieceData)
@ -177,6 +163,7 @@ inline QDataStream &operator<<(QDataStream &dataStream, const VLayoutPieceData &
dataStream << piece.m_square; dataStream << piece.m_square;
// Added in classVersion = 2 // Added in classVersion = 2
dataStream << piece.m_quantity;
return dataStream; return dataStream;
} }
@ -224,10 +211,10 @@ inline QDataStream &operator>>(QDataStream &dataStream, VLayoutPieceData &piece)
dataStream >> piece.m_placeLabels; dataStream >> piece.m_placeLabels;
dataStream >> piece.m_square; dataStream >> piece.m_square;
// if (actualClassVersion >= 2) if (actualClassVersion >= 2)
// { {
dataStream >> piece.m_quantity;
// } }
return dataStream; return dataStream;
} }

View File

@ -130,6 +130,8 @@ const QString LONG_OPTION_FOLLOW_GRAINLINE = QStringLiteral("followGrainline");
const QString LONG_OPTION_LANDSCAPE_ORIENTATION = QStringLiteral("landscapeOrientation"); const QString LONG_OPTION_LANDSCAPE_ORIENTATION = QStringLiteral("landscapeOrientation");
const QString LONG_OPTION_NEST_QUANTITY = QStringLiteral("nestQuantity");
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief AllKeys return list with all command line keys (short and long forms). Used for testing on conflicts. * @brief AllKeys return list with all command line keys (short and long forms). Used for testing on conflicts.
@ -181,6 +183,7 @@ QStringList AllKeys()
LONG_OPTION_TILED_PDF_BOTTOM_MARGIN, LONG_OPTION_TILED_PDF_BOTTOM_MARGIN,
LONG_OPTION_TILED_PDF_LANDSCAPE, LONG_OPTION_TILED_PDF_LANDSCAPE,
LONG_OPTION_FOLLOW_GRAINLINE, LONG_OPTION_FOLLOW_GRAINLINE,
LONG_OPTION_LANDSCAPE_ORIENTATION LONG_OPTION_LANDSCAPE_ORIENTATION,
LONG_OPTION_NEST_QUANTITY
}; };
} }

View File

@ -124,6 +124,7 @@ extern const QString LONG_OPTION_TILED_PDF_BOTTOM_MARGIN;
extern const QString LONG_OPTION_TILED_PDF_LANDSCAPE; extern const QString LONG_OPTION_TILED_PDF_LANDSCAPE;
extern const QString LONG_OPTION_FOLLOW_GRAINLINE; extern const QString LONG_OPTION_FOLLOW_GRAINLINE;
extern const QString LONG_OPTION_LANDSCAPE_ORIENTATION; extern const QString LONG_OPTION_LANDSCAPE_ORIENTATION;
extern const QString LONG_OPTION_NEST_QUANTITY;
QStringList AllKeys(); QStringList AllKeys();

View File

@ -83,6 +83,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSorting, (QLatin1String("l
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPaperHeight, (QLatin1String("layout/paperHeight"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPaperHeight, (QLatin1String("layout/paperHeight")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPaperWidth, (QLatin1String("layout/paperWidth"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutPaperWidth, (QLatin1String("layout/paperWidth")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutFollowGrainline, (QLatin1String("layout/followGrainline"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutFollowGrainline, (QLatin1String("layout/followGrainline")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutNestQuantity, (QLatin1String("layout/nestQuantity")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutAutoCrop, (QLatin1String("layout/autoCrop"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutAutoCrop, (QLatin1String("layout/autoCrop")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSaveLength, (QLatin1String("layout/saveLength"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSaveLength, (QLatin1String("layout/saveLength")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutUnitePages, (QLatin1String("layout/unitePages"))) Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutUnitePages, (QLatin1String("layout/unitePages")))
@ -292,6 +293,24 @@ void VSettings::SetLayoutFollowGrainline(bool value)
setValue(*settingLayoutFollowGrainline, value); setValue(*settingLayoutFollowGrainline, value);
} }
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetLayoutNestQuantity() const
{
return value(*settingLayoutNestQuantity, GetDefLayoutNestQuantity()).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetDefLayoutNestQuantity()
{
return false;
}
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetLayoutNestQuantity(bool value)
{
setValue(*settingLayoutNestQuantity, value);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetLayoutAutoCrop() const bool VSettings::GetLayoutAutoCrop() const
{ {

View File

@ -92,6 +92,10 @@ public:
static bool GetDefLayoutFollowGrainline(); static bool GetDefLayoutFollowGrainline();
void SetLayoutFollowGrainline(bool value); void SetLayoutFollowGrainline(bool value);
bool GetLayoutNestQuantity() const;
static bool GetDefLayoutNestQuantity();
void SetLayoutNestQuantity(bool value);
bool GetLayoutAutoCrop() const; bool GetLayoutAutoCrop() const;
static bool GetDefLayoutAutoCrop(); static bool GetDefLayoutAutoCrop();
void SetLayoutAutoCrop(bool value); void SetLayoutAutoCrop(bool value);

View File

@ -138,18 +138,15 @@ void VPieceLabelData::SetFoldPosition(const QString &val)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VPieceLabelData::GetQuantity() const quint16 VPieceLabelData::GetQuantity() const
{ {
return d->m_quantity; return d->m_quantity;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPieceLabelData::SetQuantity(int val) void VPieceLabelData::SetQuantity(quint16 val)
{ {
if (val >= 1) d->m_quantity = qMax(static_cast<quint16>(1), val);
{
d->m_quantity = val;
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -78,8 +78,8 @@ public:
QString GetFoldPosition() const; QString GetFoldPosition() const;
void SetFoldPosition(const QString &val); void SetFoldPosition(const QString &val);
int GetQuantity() const; quint16 GetQuantity() const;
void SetQuantity(int val); void SetQuantity(quint16 val);
bool IsOnFold() const; bool IsOnFold() const;
void SetOnFold(bool onFold); void SetOnFold(bool onFold);

View File

@ -81,7 +81,7 @@ public:
QString m_tilt; QString m_tilt;
QString m_foldPosition; QString m_foldPosition;
int m_quantity; quint16 m_quantity;
bool m_onFold; bool m_onFold;
QVector<VLabelTemplateLine> m_lines; QVector<VLabelTemplateLine> m_lines;

View File

@ -2460,7 +2460,7 @@ VPiece DialogSeamAllowance::CreatePiece() const
piece.GetPatternPieceData().SetRotationWay(uiTabLabels->lineEditRotation->text()); piece.GetPatternPieceData().SetRotationWay(uiTabLabels->lineEditRotation->text());
piece.GetPatternPieceData().SetTilt(uiTabLabels->lineEditTilt->text()); piece.GetPatternPieceData().SetTilt(uiTabLabels->lineEditTilt->text());
piece.GetPatternPieceData().SetFoldPosition(uiTabLabels->lineEditFoldPosition->text()); piece.GetPatternPieceData().SetFoldPosition(uiTabLabels->lineEditFoldPosition->text());
piece.GetPatternPieceData().SetQuantity(uiTabLabels->spinBoxQuantity->value()); piece.GetPatternPieceData().SetQuantity(static_cast<quint16>(uiTabLabels->spinBoxQuantity->value()));
piece.GetPatternPieceData().SetOnFold(uiTabLabels->checkBoxFold->isChecked()); piece.GetPatternPieceData().SetOnFold(uiTabLabels->checkBoxFold->isChecked());
piece.GetPatternPieceData().SetLabelTemplate(m_templateLines); piece.GetPatternPieceData().SetLabelTemplate(m_templateLines);
piece.GetPatternPieceData().SetRotation(GetFormulaFromUser(uiTabLabels->lineEditDLAngleFormula)); piece.GetPatternPieceData().SetRotation(GetFormulaFromUser(uiTabLabels->lineEditDLAngleFormula));