Returned storing and reading base seam allowance values: width and
enable/disable. --HG-- branch : feature
This commit is contained in:
parent
de6015de4d
commit
a5fc19d7ec
|
@ -618,10 +618,9 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
|
||||||
detail.SetName(GetParametrString(domElement, AttrName, tr("Detail")));
|
detail.SetName(GetParametrString(domElement, AttrName, tr("Detail")));
|
||||||
detail.SetMx(qApp->toPixel(GetParametrDouble(domElement, AttrMx, "0.0")));
|
detail.SetMx(qApp->toPixel(GetParametrDouble(domElement, AttrMx, "0.0")));
|
||||||
detail.SetMy(qApp->toPixel(GetParametrDouble(domElement, AttrMy, "0.0")));
|
detail.SetMy(qApp->toPixel(GetParametrDouble(domElement, AttrMy, "0.0")));
|
||||||
// detail.setSeamAllowance(GetParametrUInt(domElement, VToolDetail::AttrSupplement, "1"));
|
detail.SetSeamAllowance(GetParametrBool(domElement, VToolSeamAllowance::AttrSeamAllowance, falseStr));
|
||||||
// detail.setWidth(GetParametrDouble(domElement, VToolDetail::AttrWidth, "10.0"));
|
detail.SetSAWidth(GetParametrDouble(domElement, VToolSeamAllowance::AttrWidth, "0.0"));
|
||||||
// detail.setClosed(GetParametrUInt(domElement, VToolDetail::AttrClosed, "1"));
|
detail.SetForbidFlipping(GetParametrBool(domElement, VToolSeamAllowance::AttrForbidFlipping,
|
||||||
detail.SetForbidFlipping(GetParametrUInt(domElement, VToolSeamAllowance::AttrForbidFlipping,
|
|
||||||
QString().setNum(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping())));
|
QString().setNum(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping())));
|
||||||
detail.SetInLayout(GetParametrBool(domElement, AttrInLayout, trueStr));
|
detail.SetInLayout(GetParametrBool(domElement, AttrInLayout, trueStr));
|
||||||
|
|
||||||
|
|
|
@ -414,7 +414,9 @@
|
||||||
<xs:attribute name="my" type="xs:double"></xs:attribute>
|
<xs:attribute name="my" type="xs:double"></xs:attribute>
|
||||||
<xs:attribute name="name" type="xs:string"></xs:attribute>
|
<xs:attribute name="name" type="xs:string"></xs:attribute>
|
||||||
<xs:attribute name="inLayout" type="xs:boolean"></xs:attribute>
|
<xs:attribute name="inLayout" type="xs:boolean"></xs:attribute>
|
||||||
<xs:attribute name="forbidFlipping" type="xs:unsignedInt"></xs:attribute>
|
<xs:attribute name="forbidFlipping" type="xs:boolean"></xs:attribute>
|
||||||
|
<xs:attribute name="width" type="xs:double"></xs:attribute>
|
||||||
|
<xs:attribute name="seamAllowance" type="xs:boolean"></xs:attribute>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
|
|
|
@ -129,6 +129,7 @@ const QString strMx = QStringLiteral("mx");
|
||||||
const QString strMy = QStringLiteral("my");
|
const QString strMy = QStringLiteral("my");
|
||||||
const QString strForbidFlipping = QStringLiteral("forbidFlipping");
|
const QString strForbidFlipping = QStringLiteral("forbidFlipping");
|
||||||
const QString strInLayout = QStringLiteral("inLayout");
|
const QString strInLayout = QStringLiteral("inLayout");
|
||||||
|
const QString strSeamAllowance = QStringLiteral("seamAllowance");
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPatternConverter::VPatternConverter(const QString &fileName)
|
VPatternConverter::VPatternConverter(const QString &fileName)
|
||||||
|
@ -1694,9 +1695,10 @@ void VPatternConverter::TagDetailToV0_4_0()
|
||||||
|
|
||||||
if (not dom.isNull())
|
if (not dom.isNull())
|
||||||
{
|
{
|
||||||
|
dom.setAttribute(strSeamAllowance, dom.attribute(strSupplement, "0"));
|
||||||
dom.removeAttribute(strSupplement);
|
dom.removeAttribute(strSupplement);
|
||||||
|
|
||||||
dom.removeAttribute(strClosed);
|
dom.removeAttribute(strClosed);
|
||||||
dom.removeAttribute(strWidth);
|
|
||||||
|
|
||||||
dom.setAttribute(strVersion, "1");
|
dom.setAttribute(strVersion, "1");
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,30 @@ void VAbstractPiece::SetForbidFlipping(bool value)
|
||||||
d->m_forbidFlipping = value;
|
d->m_forbidFlipping = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VAbstractPiece::IsSeamAllowance() const
|
||||||
|
{
|
||||||
|
return d->m_seamAllowance;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractPiece::SetSeamAllowance(bool value)
|
||||||
|
{
|
||||||
|
d->m_seamAllowance = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
qreal VAbstractPiece::GetSAWidth() const
|
||||||
|
{
|
||||||
|
return d->m_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractPiece::SetSAWidth(qreal value)
|
||||||
|
{
|
||||||
|
value >= 0 ? d->m_width = value : d->m_width = 0;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VAbstractPiece::SumTrapezoids(const QVector<QPointF> &points)
|
qreal VAbstractPiece::SumTrapezoids(const QVector<QPointF> &points)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,6 +50,12 @@ public:
|
||||||
bool IsForbidFlipping() const;
|
bool IsForbidFlipping() const;
|
||||||
void SetForbidFlipping(bool value);
|
void SetForbidFlipping(bool value);
|
||||||
|
|
||||||
|
bool IsSeamAllowance() const;
|
||||||
|
void SetSeamAllowance(bool value);
|
||||||
|
|
||||||
|
qreal GetSAWidth() const;
|
||||||
|
void SetSAWidth(qreal value);
|
||||||
|
|
||||||
static qreal SumTrapezoids(const QVector<QPointF> &points);
|
static qreal SumTrapezoids(const QVector<QPointF> &points);
|
||||||
static QVector<QPointF> CheckLoops(const QVector<QPointF> &points);
|
static QVector<QPointF> CheckLoops(const QVector<QPointF> &points);
|
||||||
static QVector<QPointF> CorrectEquidistantPoints(const QVector<QPointF> &points, bool removeFirstAndLast = true);
|
static QVector<QPointF> CorrectEquidistantPoints(const QVector<QPointF> &points, bool removeFirstAndLast = true);
|
||||||
|
|
|
@ -42,13 +42,17 @@ class VAbstractPieceData : public QSharedData
|
||||||
public:
|
public:
|
||||||
VAbstractPieceData()
|
VAbstractPieceData()
|
||||||
: m_name(),
|
: m_name(),
|
||||||
m_forbidFlipping(false)
|
m_forbidFlipping(false),
|
||||||
|
m_seamAllowance(false),
|
||||||
|
m_width(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
VAbstractPieceData(const VAbstractPieceData &piece)
|
VAbstractPieceData(const VAbstractPieceData &piece)
|
||||||
: QSharedData(piece),
|
: QSharedData(piece),
|
||||||
m_name(piece.m_name),
|
m_name(piece.m_name),
|
||||||
m_forbidFlipping(piece.m_forbidFlipping)
|
m_forbidFlipping(piece.m_forbidFlipping),
|
||||||
|
m_seamAllowance(piece.m_seamAllowance),
|
||||||
|
m_width(piece.m_width)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
~VAbstractPieceData();
|
~VAbstractPieceData();
|
||||||
|
@ -56,6 +60,8 @@ public:
|
||||||
QString m_name;
|
QString m_name;
|
||||||
/** @brief forbidFlipping forbid piece be mirrored in a layout. */
|
/** @brief forbidFlipping forbid piece be mirrored in a layout. */
|
||||||
bool m_forbidFlipping;
|
bool m_forbidFlipping;
|
||||||
|
bool m_seamAllowance;
|
||||||
|
qreal m_width;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VAbstractPieceData &operator=(const VAbstractPieceData &) Q_DECL_EQ_DELETE;
|
VAbstractPieceData &operator=(const VAbstractPieceData &) Q_DECL_EQ_DELETE;
|
||||||
|
|
|
@ -51,10 +51,19 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
|
||||||
CheckState();
|
CheckState();
|
||||||
|
|
||||||
ui->checkBoxForbidFlipping->setChecked(qApp->Settings()->GetForbidWorkpieceFlipping());
|
ui->checkBoxForbidFlipping->setChecked(qApp->Settings()->GetForbidWorkpieceFlipping());
|
||||||
|
ui->labelUnit->setText(VDomDocument::UnitsToStr(qApp->patternUnit(), true));
|
||||||
|
|
||||||
|
if(qApp->patternUnit() == Unit::Inch)
|
||||||
|
{
|
||||||
|
ui->doubleSpinBoxSeams->setDecimals(5);
|
||||||
|
}
|
||||||
|
// Default value for seam allowence is 1 cm. But pattern have different units, so just set 1 in dialog not enough.
|
||||||
|
ui->doubleSpinBoxSeams->setValue(UnitConvertor(1, Unit::Cm, qApp->patternUnit()));
|
||||||
|
|
||||||
ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(ui->listWidget, &QListWidget::customContextMenuRequested, this, &DialogSeamAllowance::ShowContextMenu);
|
connect(ui->listWidget, &QListWidget::customContextMenuRequested, this, &DialogSeamAllowance::ShowContextMenu);
|
||||||
connect(ui->listWidget->model(), &QAbstractItemModel::rowsMoved, this, &DialogSeamAllowance::ListChanged);
|
connect(ui->listWidget->model(), &QAbstractItemModel::rowsMoved, this, &DialogSeamAllowance::ListChanged);
|
||||||
|
connect(ui->checkBoxSeams, &QCheckBox::clicked, this, &DialogSeamAllowance::EnableSeamAllowance);
|
||||||
|
|
||||||
if (not applyAllowed)
|
if (not applyAllowed)
|
||||||
{
|
{
|
||||||
|
@ -94,6 +103,9 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->checkBoxForbidFlipping->setChecked(m_piece.IsForbidFlipping());
|
ui->checkBoxForbidFlipping->setChecked(m_piece.IsForbidFlipping());
|
||||||
|
ui->doubleSpinBoxSeams->setValue(m_piece.GetSAWidth());
|
||||||
|
|
||||||
|
EnableSeamAllowance(m_piece.IsSeamAllowance());
|
||||||
|
|
||||||
ValidObjects(MainPathIsValid());
|
ValidObjects(MainPathIsValid());
|
||||||
}
|
}
|
||||||
|
@ -254,6 +266,12 @@ void DialogSeamAllowance::ListChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogSeamAllowance::EnableSeamAllowance(bool enable)
|
||||||
|
{
|
||||||
|
ui->groupBoxAutomatic->setEnabled(enable);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPiece DialogSeamAllowance::CreatePiece() const
|
VPiece DialogSeamAllowance::CreatePiece() const
|
||||||
{
|
{
|
||||||
|
@ -265,6 +283,7 @@ VPiece DialogSeamAllowance::CreatePiece() const
|
||||||
}
|
}
|
||||||
|
|
||||||
piece.SetForbidFlipping(ui->checkBoxForbidFlipping->isChecked());
|
piece.SetForbidFlipping(ui->checkBoxForbidFlipping->isChecked());
|
||||||
|
piece.SetSAWidth(ui->doubleSpinBoxSeams->value());
|
||||||
|
|
||||||
return piece;
|
return piece;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ protected:
|
||||||
private slots:
|
private slots:
|
||||||
void ShowContextMenu(const QPoint &pos);
|
void ShowContextMenu(const QPoint &pos);
|
||||||
void ListChanged();
|
void ListChanged();
|
||||||
|
void EnableSeamAllowance(bool enable);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(DialogSeamAllowance)
|
Q_DISABLE_COPY(DialogSeamAllowance)
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tabMainPath">
|
<widget class="QWidget" name="tabMainPath">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
@ -94,6 +94,111 @@
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>Seam allowance</string>
|
<string>Seam allowance</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxSeams">
|
||||||
|
<property name="text">
|
||||||
|
<string>Seam allowance</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBoxAutomatic">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>Automatic</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelEditWidth">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="locale">
|
||||||
|
<locale language="English" country="UnitedStates"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Width:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBoxSeams">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>900.990000000000009</double>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.100000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>1.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelUnit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>cm</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>219</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -62,6 +62,8 @@ const QString VToolSeamAllowance::TagNode = QStringLiteral("node");
|
||||||
const QString VToolSeamAllowance::AttrVersion = QStringLiteral("version");
|
const QString VToolSeamAllowance::AttrVersion = QStringLiteral("version");
|
||||||
const QString VToolSeamAllowance::AttrNodeReverse = QStringLiteral("reverse");
|
const QString VToolSeamAllowance::AttrNodeReverse = QStringLiteral("reverse");
|
||||||
const QString VToolSeamAllowance::AttrForbidFlipping = QStringLiteral("forbidFlipping");
|
const QString VToolSeamAllowance::AttrForbidFlipping = QStringLiteral("forbidFlipping");
|
||||||
|
const QString VToolSeamAllowance::AttrSeamAllowance = QStringLiteral("seamAllowance");
|
||||||
|
const QString VToolSeamAllowance::AttrWidth = QStringLiteral("width");
|
||||||
|
|
||||||
const QString VToolSeamAllowance::NodeArc = QStringLiteral("NodeArc");
|
const QString VToolSeamAllowance::NodeArc = QStringLiteral("NodeArc");
|
||||||
const QString VToolSeamAllowance::NodePoint = QStringLiteral("NodePoint");
|
const QString VToolSeamAllowance::NodePoint = QStringLiteral("NodePoint");
|
||||||
|
@ -253,7 +255,9 @@ void VToolSeamAllowance::AddAttributes(VAbstractPattern *doc, QDomElement &domEl
|
||||||
doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(piece.GetMx()));
|
doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(piece.GetMx()));
|
||||||
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(piece.GetMy()));
|
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(piece.GetMy()));
|
||||||
doc->SetAttribute(domElement, AttrInLayout, piece.IsInLayout());
|
doc->SetAttribute(domElement, AttrInLayout, piece.IsInLayout());
|
||||||
doc->SetAttribute(domElement, AttrForbidFlipping, static_cast<quint8>(piece.IsForbidFlipping()));
|
doc->SetAttribute(domElement, AttrForbidFlipping, piece.IsForbidFlipping());
|
||||||
|
doc->SetAttribute(domElement, AttrSeamAllowance, piece.IsSeamAllowance());
|
||||||
|
doc->SetAttribute(domElement, AttrWidth, piece.GetSAWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -60,6 +60,8 @@ public:
|
||||||
static const QString AttrVersion;
|
static const QString AttrVersion;
|
||||||
static const QString AttrNodeReverse;
|
static const QString AttrNodeReverse;
|
||||||
static const QString AttrForbidFlipping;
|
static const QString AttrForbidFlipping;
|
||||||
|
static const QString AttrSeamAllowance;
|
||||||
|
static const QString AttrWidth;
|
||||||
|
|
||||||
static const QString NodeArc;
|
static const QString NodeArc;
|
||||||
static const QString NodePoint;
|
static const QString NodePoint;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user