Resolved issue #965. Control passmark length with formula.
--HG-- branch : develop
This commit is contained in:
parent
b500650cf1
commit
52dfb912ee
|
@ -13,6 +13,7 @@
|
|||
- [#936] Improve list of predefined paper size formats for layout export. Added format Tabloid.
|
||||
- Extend Label language to support Czech alphabet.
|
||||
- [#916] Improve layout generation.
|
||||
- [#965] Control passmark length with formula.
|
||||
|
||||
# Version 0.6.2 (unreleased)
|
||||
- [#903] Bug in tool Cut Spline path.
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
<file>schema/pattern/v0.8.0.xsd</file>
|
||||
<file>schema/pattern/v0.8.1.xsd</file>
|
||||
<file>schema/pattern/v0.8.2.xsd</file>
|
||||
<file>schema/pattern/v0.8.3.xsd</file>
|
||||
<file>schema/standard_measurements/v0.3.0.xsd</file>
|
||||
<file>schema/standard_measurements/v0.4.0.xsd</file>
|
||||
<file>schema/standard_measurements/v0.4.1.xsd</file>
|
||||
|
|
1166
src/libs/ifc/schema/pattern/v0.8.3.xsd
Normal file
1166
src/libs/ifc/schema/pattern/v0.8.3.xsd
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -130,6 +130,8 @@ const QString VAbstractPattern::AttrIncludeAs = QStringLiteral("includeA
|
|||
const QString VAbstractPattern::AttrRotation = QStringLiteral("rotation");
|
||||
const QString VAbstractPattern::AttrNumber = QStringLiteral("number");
|
||||
const QString VAbstractPattern::AttrCheckUniqueness = QStringLiteral("checkUniqueness");
|
||||
const QString VAbstractPattern::AttrManualPassmarkLength = QStringLiteral("manualPassmarkLength");
|
||||
const QString VAbstractPattern::AttrPassmarkLength = QStringLiteral("passmarkLength");
|
||||
|
||||
const QString VAbstractPattern::AttrAll = QStringLiteral("all");
|
||||
|
||||
|
@ -764,6 +766,10 @@ VPieceNode VAbstractPattern::ParseSANode(const QDomElement &domElement)
|
|||
|
||||
const bool showSecond = VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrNodeShowSecondPassmark,
|
||||
trueStr);
|
||||
const bool manualPassmarkLength =
|
||||
VDomDocument::GetParametrBool(domElement, VAbstractPattern::AttrManualPassmarkLength, falseStr);
|
||||
const QString passmarkLength =
|
||||
VDomDocument::GetParametrEmptyString(domElement, VAbstractPattern::AttrPassmarkLength);
|
||||
|
||||
const QString t = VDomDocument::GetParametrString(domElement, AttrType, VAbstractPattern::NodePoint);
|
||||
Tool tool;
|
||||
|
@ -808,6 +814,8 @@ VPieceNode VAbstractPattern::ParseSANode(const QDomElement &domElement)
|
|||
node.SetPassmark(passmark);
|
||||
node.SetPassmarkLineType(passmarkLine);
|
||||
node.SetPassmarkAngleType(passmarkAngle);
|
||||
node.SetManualPassmarkLength(manualPassmarkLength);
|
||||
node.SetFormulaPassmarkLength(passmarkLength);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
|
|
@ -278,6 +278,8 @@ public:
|
|||
static const QString AttrRotation;
|
||||
static const QString AttrNumber;
|
||||
static const QString AttrCheckUniqueness;
|
||||
static const QString AttrManualPassmarkLength;
|
||||
static const QString AttrPassmarkLength;
|
||||
|
||||
static const QString AttrAll;
|
||||
|
||||
|
|
|
@ -59,8 +59,8 @@ class QDomElement;
|
|||
*/
|
||||
|
||||
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.4");
|
||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.2");
|
||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.2.xsd");
|
||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.3");
|
||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.3.xsd");
|
||||
|
||||
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||
|
@ -232,7 +232,8 @@ QString VPatternConverter::XSDSchema(int ver) const
|
|||
std::make_pair(FORMAT_VERSION(0, 7, 13), QStringLiteral("://schema/pattern/v0.7.13.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 0), QStringLiteral("://schema/pattern/v0.8.0.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 1), QStringLiteral("://schema/pattern/v0.8.1.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 2), CurrentSchema)
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 2), QStringLiteral("://schema/pattern/v0.8.2.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 3), CurrentSchema)
|
||||
};
|
||||
|
||||
if (schemas.contains(ver))
|
||||
|
@ -461,6 +462,10 @@ void VPatternConverter::ApplyPatches()
|
|||
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 2)), m_convertedFileName);
|
||||
Q_FALLTHROUGH();
|
||||
case (FORMAT_VERSION(0, 8, 2)):
|
||||
ToV0_8_3();
|
||||
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 3)), m_convertedFileName);
|
||||
Q_FALLTHROUGH();
|
||||
case (FORMAT_VERSION(0, 8, 3)):
|
||||
break;
|
||||
default:
|
||||
InvalidVersion(m_ver);
|
||||
|
@ -478,7 +483,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion()
|
|||
bool VPatternConverter::IsReadOnly() const
|
||||
{
|
||||
// Check if attribute readOnly was not changed in file format
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FORMAT_VERSION(0, 8, 2),
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FORMAT_VERSION(0, 8, 3),
|
||||
"Check attribute readOnly.");
|
||||
|
||||
// Possibly in future attribute readOnly will change position etc.
|
||||
|
@ -1068,6 +1073,16 @@ void VPatternConverter::ToV0_8_2()
|
|||
Save();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::ToV0_8_3()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.8.3
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FORMAT_VERSION(0, 8, 3),
|
||||
"Time to refactor the code.");
|
||||
SetVersion(QStringLiteral("0.8.3"));
|
||||
Save();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::TagUnitToV0_2_0()
|
||||
{
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
static const QString PatternMaxVerStr;
|
||||
static const QString CurrentSchema;
|
||||
static Q_DECL_CONSTEXPR const int PatternMinVer = FORMAT_VERSION(0, 1, 4);
|
||||
static Q_DECL_CONSTEXPR const int PatternMaxVer = FORMAT_VERSION(0, 8, 2);
|
||||
static Q_DECL_CONSTEXPR const int PatternMaxVer = FORMAT_VERSION(0, 8, 3);
|
||||
|
||||
protected:
|
||||
virtual int MinVer() const override;
|
||||
|
@ -125,6 +125,7 @@ private:
|
|||
void ToV0_8_0();
|
||||
void ToV0_8_1();
|
||||
void ToV0_8_2();
|
||||
void ToV0_8_3();
|
||||
|
||||
void TagUnitToV0_2_0();
|
||||
void TagIncrementToV0_2_0();
|
||||
|
|
|
@ -1570,11 +1570,18 @@ qreal VSAPoint::MaxLocalSA(qreal width) const
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VSAPoint::PassmarkLength(qreal width) const
|
||||
{
|
||||
if (not m_manualPassmarkLength)
|
||||
{
|
||||
qreal passmarkLength = MaxLocalSA(width) * passmarkFactor;
|
||||
passmarkLength = qMin(passmarkLength, maxPassmarkLength);
|
||||
return passmarkLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_passmarkLength;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
// Because artificial loop can lead to wrong clipping we must rollback current seam allowance points
|
||||
|
|
|
@ -57,7 +57,7 @@ class VSAPoint : public QPointF
|
|||
public:
|
||||
Q_DECL_CONSTEXPR VSAPoint();
|
||||
Q_DECL_CONSTEXPR VSAPoint(qreal xpos, qreal ypos);
|
||||
Q_DECL_CONSTEXPR explicit VSAPoint(const QPointF &p);
|
||||
Q_DECL_CONSTEXPR explicit VSAPoint(QPointF p);
|
||||
|
||||
Q_DECL_CONSTEXPR qreal GetSABefore() const;
|
||||
qreal GetSABefore(qreal width) const;
|
||||
|
@ -70,6 +70,12 @@ public:
|
|||
Q_DECL_CONSTEXPR PieceNodeAngle GetAngleType() const;
|
||||
void SetAngleType(PieceNodeAngle value);
|
||||
|
||||
Q_DECL_CONSTEXPR bool IsManualPasskmarkLength() const;
|
||||
Q_DECL_CONSTEXPR void SetManualPasskmarkLength(bool value);
|
||||
|
||||
Q_DECL_CONSTEXPR qreal GetPasskmarkLength() const;
|
||||
Q_DECL_CONSTEXPR void SetPasskmarkLength(qreal value);
|
||||
|
||||
qreal MaxLocalSA(qreal width) const;
|
||||
qreal PassmarkLength(qreal width) const;
|
||||
|
||||
|
@ -77,9 +83,11 @@ public:
|
|||
static const qreal maxPassmarkLength;
|
||||
|
||||
private:
|
||||
qreal m_before;
|
||||
qreal m_after;
|
||||
PieceNodeAngle m_angle;
|
||||
qreal m_before{-1};
|
||||
qreal m_after{-1};
|
||||
PieceNodeAngle m_angle{PieceNodeAngle::ByLength};
|
||||
bool m_manualPassmarkLength{false};
|
||||
qreal m_passmarkLength{0};
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(VSAPoint)
|
||||
|
@ -87,26 +95,16 @@ Q_DECLARE_TYPEINFO(VSAPoint, Q_MOVABLE_TYPE);
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Q_DECL_CONSTEXPR inline VSAPoint::VSAPoint()
|
||||
: QPointF(),
|
||||
m_before(-1),
|
||||
m_after(-1),
|
||||
m_angle(PieceNodeAngle::ByLength)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Q_DECL_CONSTEXPR inline VSAPoint::VSAPoint(qreal xpos, qreal ypos)
|
||||
: QPointF(xpos, ypos),
|
||||
m_before(-1),
|
||||
m_after(-1),
|
||||
m_angle(PieceNodeAngle::ByLength)
|
||||
: QPointF(xpos, ypos)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Q_DECL_CONSTEXPR inline VSAPoint::VSAPoint(const QPointF &p)
|
||||
: QPointF(p),
|
||||
m_before(-1),
|
||||
m_after(-1),
|
||||
m_angle(PieceNodeAngle::ByLength)
|
||||
Q_DECL_CONSTEXPR inline VSAPoint::VSAPoint(QPointF p)
|
||||
: QPointF(p)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -145,6 +143,30 @@ inline void VSAPoint::SetAngleType(PieceNodeAngle value)
|
|||
m_angle = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Q_DECL_CONSTEXPR inline bool VSAPoint::IsManualPasskmarkLength() const
|
||||
{
|
||||
return m_manualPassmarkLength;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Q_DECL_CONSTEXPR inline void VSAPoint::SetManualPasskmarkLength(bool value)
|
||||
{
|
||||
m_manualPassmarkLength = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Q_DECL_CONSTEXPR inline qreal VSAPoint::GetPasskmarkLength() const
|
||||
{
|
||||
return m_passmarkLength;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Q_DECL_CONSTEXPR inline void VSAPoint::SetPasskmarkLength(qreal value)
|
||||
{
|
||||
m_passmarkLength = value;
|
||||
}
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
class VAbstractPiece
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "vformula.h"
|
||||
#include "vformula_p.h"
|
||||
|
||||
#include <qnumeric.h>
|
||||
#include <QMessageLogger>
|
||||
|
@ -45,26 +46,12 @@
|
|||
//VFormula
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VFormula::VFormula()
|
||||
: formula(QString()),
|
||||
value(tr("Error")),
|
||||
checkZero(true),
|
||||
data(nullptr),
|
||||
toolId(NULL_ID),
|
||||
postfix(QString()),
|
||||
_error(true),
|
||||
dValue(0)
|
||||
: d(new VFormulaData)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VFormula::VFormula(const QString &formula, const VContainer *container)
|
||||
: formula(qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator())),
|
||||
value(tr("Error")),
|
||||
checkZero(true),
|
||||
data(container),
|
||||
toolId(NULL_ID),
|
||||
postfix(QString()),
|
||||
_error(true),
|
||||
dValue(0)
|
||||
: d(new VFormulaData(formula, container))
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -74,41 +61,26 @@ VFormula &VFormula::operator=(const VFormula &formula)
|
|||
{
|
||||
return *this;
|
||||
}
|
||||
this->formula = formula.formula;
|
||||
this->value = formula.value;
|
||||
this->checkZero = formula.checkZero;
|
||||
this->data = formula.data;
|
||||
this->toolId = formula.toolId;
|
||||
this->postfix = formula.postfix;
|
||||
this->_error = formula._error;
|
||||
this->dValue = formula.dValue;
|
||||
d = formula.d;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VFormula::VFormula(const VFormula &formula)
|
||||
: formula(formula.formula),
|
||||
value(formula.value),
|
||||
checkZero(formula.checkZero),
|
||||
data(formula.getData()),
|
||||
toolId(formula.toolId),
|
||||
postfix(formula.postfix),
|
||||
_error(formula._error),
|
||||
dValue(formula.dValue)
|
||||
: d (formula.d)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VFormula::~VFormula()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VFormula::operator==(const VFormula &formula) const
|
||||
{
|
||||
bool isEqual = false;
|
||||
if (this->formula == formula.GetFormula() && this->value == formula.getStringValue() &&
|
||||
this->checkZero == formula.getCheckZero() && this->data == formula.getData() &&
|
||||
this->toolId == formula.getToolId() && this->postfix == formula.getPostfix() &&
|
||||
this->_error == formula.error() && VFuzzyComparePossibleNulls(this->dValue, formula.getDoubleValue()))
|
||||
{
|
||||
isEqual = true;
|
||||
}
|
||||
return isEqual;
|
||||
return d->formula == formula.GetFormula() && d->strValue == formula.getStringValue() &&
|
||||
d->checkZero == formula.getCheckZero() && d->checkLessThanZero == formula.getCheckLessThanZero() &&
|
||||
d->data == formula.getData() && d->toolId == formula.getToolId() && d->postfix == formula.getPostfix() &&
|
||||
d->error == formula.error() && VFuzzyComparePossibleNulls(d->dValue, formula.getDoubleValue());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -122,103 +94,120 @@ QString VFormula::GetFormula(FormulaType type) const
|
|||
{
|
||||
if (type == FormulaType::ToUser)
|
||||
{
|
||||
return formula;
|
||||
return qApp->TrVars()->TryFormulaToUser(d->formula, qApp->Settings()->GetOsSeparator());
|
||||
}
|
||||
else
|
||||
{
|
||||
return qApp->TrVars()->TryFormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
||||
return d->formula;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VFormula::SetFormula(const QString &value, FormulaType type)
|
||||
{
|
||||
if (formula != value)
|
||||
if (d->formula != value)
|
||||
{
|
||||
if (type == FormulaType::ToUser)
|
||||
if (type == FormulaType::FromUser)
|
||||
{
|
||||
formula = qApp->TrVars()->FormulaToUser(value, qApp->Settings()->GetOsSeparator());
|
||||
d->formula = qApp->TrVars()->FormulaFromUser(value, qApp->Settings()->GetOsSeparator());
|
||||
}
|
||||
else
|
||||
{
|
||||
formula = value;
|
||||
d->formula = value;
|
||||
}
|
||||
|
||||
ResetState();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VFormula::getStringValue() const
|
||||
{
|
||||
return value;
|
||||
return d->strValue;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VFormula::getDoubleValue() const
|
||||
{
|
||||
return dValue;
|
||||
return d->dValue;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VFormula::getCheckZero() const
|
||||
{
|
||||
return checkZero;
|
||||
return d->checkZero;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VFormula::setCheckZero(bool value)
|
||||
{
|
||||
if (checkZero != value)
|
||||
{
|
||||
checkZero = value;
|
||||
d->checkZero = value;
|
||||
ResetState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VFormula::getCheckLessThanZero() const
|
||||
{
|
||||
return d->checkLessThanZero;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VFormula::setCheckLessThanZero(bool value)
|
||||
{
|
||||
d->checkLessThanZero = value;
|
||||
ResetState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
const VContainer *VFormula::getData() const
|
||||
{
|
||||
return data;
|
||||
return d->data;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VFormula::setData(const VContainer *value)
|
||||
{
|
||||
if (data != value && value != nullptr)
|
||||
if (d->data != value && value != nullptr)
|
||||
{
|
||||
data = value;
|
||||
d->data = value;
|
||||
ResetState();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VFormula::getToolId() const
|
||||
{
|
||||
return toolId;
|
||||
return d->toolId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VFormula::setToolId(const quint32 &value)
|
||||
void VFormula::setToolId(quint32 value)
|
||||
{
|
||||
toolId = value;
|
||||
d->toolId = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VFormula::getPostfix() const
|
||||
{
|
||||
return postfix;
|
||||
return d->postfix;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VFormula::setPostfix(const QString &value)
|
||||
{
|
||||
if (postfix != value)
|
||||
{
|
||||
postfix = value;
|
||||
}
|
||||
d->postfix = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VFormula::error() const
|
||||
{
|
||||
return _error;
|
||||
return d->error;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VFormula::Reason() const
|
||||
{
|
||||
return d->reason;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -230,39 +219,64 @@ int VFormula::FormulaTypeId()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VFormula::Eval()
|
||||
{
|
||||
if (data == nullptr)
|
||||
ResetState();
|
||||
|
||||
if (d->data == nullptr)
|
||||
{
|
||||
d->reason = tr("Data container is empty");
|
||||
return;
|
||||
}
|
||||
|
||||
value = tr("Error");
|
||||
_error = true;
|
||||
dValue = 0;
|
||||
qreal result = 0;
|
||||
|
||||
if (not formula.isEmpty())
|
||||
if (not d->formula.isEmpty())
|
||||
{
|
||||
try
|
||||
{
|
||||
QScopedPointer<Calculator> cal(new Calculator());
|
||||
const QString expression = qApp->TrVars()->FormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
||||
result = cal->EvalFormula(data->DataVariables(), expression);
|
||||
result = cal->EvalFormula(d->data->DataVariables(), d->formula);
|
||||
}
|
||||
catch (qmu::QmuParserError &e)
|
||||
{
|
||||
qDebug() << "\nMath parser error:\n"
|
||||
<< "--------------------------------------\n"
|
||||
<< "Message: " << e.GetMsg() << "\n"
|
||||
<< "Expression: " << e.GetExpr() << "\n"
|
||||
<< "--------------------------------------";
|
||||
d->reason = tr("Math parser error: %1").arg(e.GetMsg());
|
||||
return;
|
||||
}
|
||||
|
||||
if (not qIsInf(result) && not qIsNaN(result) && not (checkZero && qFuzzyIsNull(result)))
|
||||
d->dValue = result;
|
||||
|
||||
if (qIsInf(result))
|
||||
{
|
||||
dValue = result;
|
||||
value = qApp->LocaleToString(result) + QLatin1Char(' ') + postfix;
|
||||
_error = false;
|
||||
d->reason = tr("Result is infinite");
|
||||
}
|
||||
else if (qIsNaN(result))
|
||||
{
|
||||
d->reason = tr("Result is NaN");
|
||||
}
|
||||
else if (d->checkZero && qFuzzyIsNull(result))
|
||||
{
|
||||
d->reason = tr("Result is zero");
|
||||
}
|
||||
else if (d->checkLessThanZero && result < 0)
|
||||
{
|
||||
d->reason = tr("Result less than zero");
|
||||
}
|
||||
else
|
||||
{
|
||||
d->strValue = qApp->LocaleToString(result) + QLatin1Char(' ') + d->postfix;
|
||||
d->error = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
d->reason = tr("Formula is empty");
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VFormula::ResetState()
|
||||
{
|
||||
d->strValue = tr("Error");
|
||||
d->error = true;
|
||||
d->dValue = NAN;
|
||||
d->reason = tr("Not evaluated");
|
||||
}
|
||||
|
|
|
@ -30,13 +30,16 @@
|
|||
#define VFORMULA_H
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QSharedDataPointer>
|
||||
#include <QMetaType>
|
||||
#include <QTypeInfo>
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
|
||||
enum class FormulaType : char{ToUser, FromUser};
|
||||
|
||||
class VContainer;
|
||||
class VFormulaData;
|
||||
|
||||
class VFormula
|
||||
{
|
||||
|
@ -46,6 +49,8 @@ public:
|
|||
VFormula(const QString &formula, const VContainer *container);
|
||||
VFormula &operator=(const VFormula &formula);
|
||||
VFormula(const VFormula &formula);
|
||||
~VFormula();
|
||||
|
||||
bool operator==(const VFormula &formula) const;
|
||||
bool operator!=(const VFormula &formula) const;
|
||||
|
||||
|
@ -58,30 +63,30 @@ public:
|
|||
bool getCheckZero() const;
|
||||
void setCheckZero(bool value);
|
||||
|
||||
bool getCheckLessThanZero() const;
|
||||
void setCheckLessThanZero(bool value);
|
||||
|
||||
const VContainer *getData() const;
|
||||
void setData(const VContainer *value);
|
||||
|
||||
quint32 getToolId() const;
|
||||
void setToolId(const quint32 &value);
|
||||
void setToolId(quint32 value);
|
||||
|
||||
QString getPostfix() const;
|
||||
void setPostfix(const QString &value);
|
||||
|
||||
bool error() const;
|
||||
QString Reason() const;
|
||||
|
||||
static int FormulaTypeId();
|
||||
|
||||
void Eval();
|
||||
private:
|
||||
QString formula;
|
||||
QString value;
|
||||
bool checkZero;
|
||||
const VContainer *data;
|
||||
quint32 toolId;
|
||||
QString postfix;
|
||||
bool _error;
|
||||
qreal dValue;
|
||||
QSharedDataPointer<VFormulaData> d;
|
||||
|
||||
void ResetState();
|
||||
};
|
||||
Q_DECLARE_METATYPE(VFormula)
|
||||
Q_DECLARE_TYPEINFO(VFormula, Q_MOVABLE_TYPE);
|
||||
|
||||
#endif // VFORMULA_H
|
||||
|
|
90
src/libs/vpatterndb/vformula_p.h
Normal file
90
src/libs/vpatterndb/vformula_p.h
Normal file
|
@ -0,0 +1,90 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vformula_p.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 17 4, 2019
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentina project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2019 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** Valentina is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** Valentina is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
#ifndef VFORMULA_P_H
|
||||
#define VFORMULA_P_H
|
||||
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#include "../vmisc/typedef.h"
|
||||
#include "../vmisc/vmath.h"
|
||||
|
||||
#include <QSharedData>
|
||||
#include <QCoreApplication>
|
||||
|
||||
class VContainer;
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_GCC("-Weffc++")
|
||||
QT_WARNING_DISABLE_GCC("-Wnon-virtual-dtor")
|
||||
|
||||
class VFormulaData : public QSharedData
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(VFormulaData)
|
||||
public:
|
||||
VFormulaData()
|
||||
{}
|
||||
|
||||
VFormulaData(const QString &formula, const VContainer *container)
|
||||
: formula(formula),
|
||||
data(container),
|
||||
reason(tr("Not evaluated"))
|
||||
{}
|
||||
|
||||
VFormulaData (const VFormulaData& formula)
|
||||
: QSharedData(formula),
|
||||
formula(formula.formula),
|
||||
strValue(formula.strValue),
|
||||
checkZero(formula.checkZero),
|
||||
checkLessThanZero(formula.checkLessThanZero),
|
||||
data(formula.data),
|
||||
toolId(formula.toolId),
|
||||
postfix(formula.postfix),
|
||||
error(formula.error),
|
||||
dValue(formula.dValue),
|
||||
reason(formula.reason)
|
||||
{}
|
||||
|
||||
~VFormulaData() {}
|
||||
|
||||
QString formula{};
|
||||
QString strValue{tr("Error")};
|
||||
bool checkZero{true};
|
||||
bool checkLessThanZero{false};
|
||||
const VContainer *data{nullptr};
|
||||
quint32 toolId{NULL_ID};
|
||||
QString postfix{};
|
||||
bool error{true};
|
||||
qreal dValue{NAN};
|
||||
QString reason{tr("Formula is empty")};
|
||||
|
||||
private:
|
||||
VFormulaData &operator=(const VFormulaData &) Q_DECL_EQ_DELETE;
|
||||
};
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
#endif // VFORMULA_P_H
|
|
@ -74,4 +74,5 @@ HEADERS += \
|
|||
$$PWD/floatItemData/vpatternlabeldata_p.h \
|
||||
$$PWD/floatItemData/vpiecelabeldata_p.h \
|
||||
$$PWD/measurements.h \
|
||||
$$PWD/pmsystems.h
|
||||
$$PWD/pmsystems.h \
|
||||
$$PWD/vformula_p.h
|
||||
|
|
|
@ -1365,6 +1365,11 @@ QVector<QLineF> VPiece::CreatePassmark(const QVector<VPieceNode> &path, int prev
|
|||
|
||||
const QVector<QPointF> mainPath = MainPathPoints(data);
|
||||
|
||||
if (passmarkSAPoint.IsManualPasskmarkLength() && passmarkSAPoint.GetPasskmarkLength() <= 0)
|
||||
{
|
||||
return QVector<QLineF>();
|
||||
}
|
||||
|
||||
if (not IsSeamAllowanceBuiltIn())
|
||||
{
|
||||
// Because rollback cannot be calulated if passmark is not first point in main path we rotate it.
|
||||
|
@ -1434,8 +1439,14 @@ QVector<QLineF> VPiece::SAPassmark(const VPiecePassmarkData &passmarkData, const
|
|||
if (intersections.last() != passmarkData.passmarkSAPoint)
|
||||
{
|
||||
line = QLineF(intersections.last(), passmarkData.passmarkSAPoint);
|
||||
if (not passmarkData.passmarkSAPoint.IsManualPasskmarkLength())
|
||||
{
|
||||
line.setLength(qMin(width * VSAPoint::passmarkFactor, VSAPoint::maxPassmarkLength));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
line.setLength(passmarkData.passmarkSAPoint.GetPasskmarkLength());
|
||||
}
|
||||
passmarksLines += CreatePassmarkLines(passmarkData.passmarkLineType, passmarkData.passmarkAngleType,
|
||||
line, seamAllowance);
|
||||
}
|
||||
|
|
|
@ -30,41 +30,12 @@
|
|||
#include "vpiecenode_p.h"
|
||||
#include "vcontainer.h"
|
||||
#include "calculator.h"
|
||||
#include "vformula.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
|
||||
#include <QDataStream>
|
||||
#include <QtNumeric>
|
||||
|
||||
namespace
|
||||
{
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal EvalFormula(const VContainer *data, QString formula)
|
||||
{
|
||||
if (formula.isEmpty())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
QScopedPointer<Calculator> cal(new Calculator());
|
||||
const qreal result = cal->EvalFormula(data->DataVariables(), formula);
|
||||
|
||||
if (qIsInf(result) || qIsNaN(result))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
catch (qmu::QmuParserError &e)
|
||||
{
|
||||
Q_UNUSED(e)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPieceNode::VPieceNode()
|
||||
: d(new VPieceNodeData)
|
||||
|
@ -157,7 +128,25 @@ qreal VPieceNode::GetSABefore(const VContainer *data) const
|
|||
return -1;
|
||||
}
|
||||
|
||||
return EvalFormula(data, d->m_formulaWidthBefore);
|
||||
VFormula formula(d->m_formulaWidthBefore, data);
|
||||
formula.Eval();
|
||||
|
||||
if (formula.error())
|
||||
{
|
||||
QString nodeName;
|
||||
try
|
||||
{
|
||||
nodeName = data->GetGObject(d->m_id)->name();
|
||||
}
|
||||
catch (const VExceptionBadId &)
|
||||
{}
|
||||
|
||||
const QString errorMsg = QObject::tr("Cannot calculate seam allowance before for point '%1'. Reason: %2.")
|
||||
.arg(nodeName, formula.Reason());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
||||
return -1;
|
||||
}
|
||||
return formula.getDoubleValue();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -168,7 +157,26 @@ qreal VPieceNode::GetSABefore(const VContainer *data, Unit unit) const
|
|||
return -1;
|
||||
}
|
||||
|
||||
qreal value = EvalFormula(data, d->m_formulaWidthBefore);
|
||||
VFormula formula(d->m_formulaWidthBefore, data);
|
||||
formula.Eval();
|
||||
|
||||
if (formula.error())
|
||||
{
|
||||
QString nodeName;
|
||||
try
|
||||
{
|
||||
nodeName = data->GetGObject(d->m_id)->name();
|
||||
}
|
||||
catch (const VExceptionBadId &)
|
||||
{}
|
||||
|
||||
const QString errorMsg = QObject::tr("Cannot calculate seam allowance before for point '%1'. Reason: %2.")
|
||||
.arg(nodeName, formula.Reason());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
||||
return -1;
|
||||
}
|
||||
|
||||
qreal value = formula.getDoubleValue();
|
||||
if (value >= 0)
|
||||
{
|
||||
value = ToPixel(value, unit);
|
||||
|
@ -199,7 +207,26 @@ qreal VPieceNode::GetSAAfter(const VContainer *data) const
|
|||
return -1;
|
||||
}
|
||||
|
||||
return EvalFormula(data, d->m_formulaWidthAfter);
|
||||
VFormula formula(d->m_formulaWidthAfter, data);
|
||||
formula.Eval();
|
||||
|
||||
if (formula.error())
|
||||
{
|
||||
QString nodeName;
|
||||
try
|
||||
{
|
||||
nodeName = data->GetGObject(d->m_id)->name();
|
||||
}
|
||||
catch (const VExceptionBadId &)
|
||||
{}
|
||||
|
||||
const QString errorMsg = QObject::tr("Cannot calculate seam allowance after for point '%1'. Reason: %2.")
|
||||
.arg(nodeName, formula.Reason());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return formula.getDoubleValue();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -210,7 +237,27 @@ qreal VPieceNode::GetSAAfter(const VContainer *data, Unit unit) const
|
|||
return -1;
|
||||
}
|
||||
|
||||
qreal value = EvalFormula(data, d->m_formulaWidthAfter);
|
||||
VFormula formula(d->m_formulaWidthAfter, data);
|
||||
formula.Eval();
|
||||
|
||||
if (formula.error())
|
||||
{
|
||||
QString nodeName;
|
||||
try
|
||||
{
|
||||
nodeName = data->GetGObject(d->m_id)->name();
|
||||
}
|
||||
catch (const VExceptionBadId &)
|
||||
{}
|
||||
|
||||
const QString errorMsg = QObject::tr("Cannot calculate seam allowance after for point '%1'. Reason: ")
|
||||
.arg(nodeName, formula.Reason());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
||||
return -1;
|
||||
}
|
||||
|
||||
qreal value = formula.getDoubleValue();
|
||||
|
||||
if (value >= 0)
|
||||
{
|
||||
value = ToPixel(value, unit);
|
||||
|
@ -233,6 +280,52 @@ void VPieceNode::SetFormulaSAAfter(const QString &formula)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VPieceNode::GetFormulaPassmarkLength() const
|
||||
{
|
||||
return d->m_formulaPassmarkLength;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPieceNode::SetFormulaPassmarkLength(const QString &formula)
|
||||
{
|
||||
if (d->m_typeTool == Tool::NodePoint)
|
||||
{
|
||||
d->m_formulaPassmarkLength = formula;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VPieceNode::GetPassmarkLength(const VContainer *data, Unit unit) const
|
||||
{
|
||||
if (d->m_manualPassmarkLength)
|
||||
{
|
||||
VFormula formula(d->m_formulaPassmarkLength, data);
|
||||
formula.setCheckZero(false);
|
||||
formula.setCheckLessThanZero(false);
|
||||
formula.Eval();
|
||||
|
||||
if (formula.error())
|
||||
{
|
||||
QString nodeName;
|
||||
try
|
||||
{
|
||||
nodeName = data->GetGObject(d->m_id)->name();
|
||||
}
|
||||
catch (const VExceptionBadId &)
|
||||
{}
|
||||
|
||||
const QString errorMsg = QObject::tr("Cannot calculate passmark length for point '%1'. Reason: %2.")
|
||||
.arg(nodeName, formula.Reason());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
||||
return VSAPoint::maxPassmarkLength;
|
||||
}
|
||||
|
||||
return ToPixel(formula.getDoubleValue(), unit);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
PieceNodeAngle VPieceNode::GetAngleType() const
|
||||
{
|
||||
|
@ -323,6 +416,18 @@ void VPieceNode::SetCheckUniqueness(bool value)
|
|||
d->m_checkUniqueness = (d->m_typeTool == Tool::NodePoint ? value : true);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VPieceNode::IsManualPassmarkLength() const
|
||||
{
|
||||
return d->m_manualPassmarkLength;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPieceNode::SetManualPassmarkLength(bool value)
|
||||
{
|
||||
d->m_manualPassmarkLength = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VPieceNode::IsExcluded() const
|
||||
{
|
||||
|
|
|
@ -82,6 +82,11 @@ public:
|
|||
QString GetFormulaSAAfter() const;
|
||||
void SetFormulaSAAfter(const QString &formula);
|
||||
|
||||
QString GetFormulaPassmarkLength() const;
|
||||
void SetFormulaPassmarkLength(const QString &formula);
|
||||
|
||||
qreal GetPassmarkLength(const VContainer *data, Unit unit) const;
|
||||
|
||||
PieceNodeAngle GetAngleType() const;
|
||||
void SetAngleType(PieceNodeAngle type);
|
||||
|
||||
|
@ -102,6 +107,9 @@ public:
|
|||
|
||||
bool IsCheckUniqueness() const;
|
||||
void SetCheckUniqueness(bool value);
|
||||
|
||||
bool IsManualPassmarkLength() const;
|
||||
void SetManualPassmarkLength(bool value);
|
||||
private:
|
||||
QSharedDataPointer<VPieceNodeData> d;
|
||||
};
|
||||
|
|
|
@ -89,11 +89,13 @@ public:
|
|||
m_isMainPathNode(node.m_isMainPathNode),
|
||||
m_formulaWidthBefore(node.m_formulaWidthBefore),
|
||||
m_formulaWidthAfter(node.m_formulaWidthAfter),
|
||||
m_formulaPassmarkLength(node.m_formulaPassmarkLength),
|
||||
m_angleType(node.m_angleType),
|
||||
m_passmarkLineType(node.m_passmarkLineType),
|
||||
m_passmarkAngleType(node.m_passmarkAngleType),
|
||||
m_isShowSecondPassmark(node.m_isShowSecondPassmark),
|
||||
m_checkUniqueness(node.m_checkUniqueness)
|
||||
m_checkUniqueness(node.m_checkUniqueness),
|
||||
m_manualPassmarkLength(node.m_manualPassmarkLength)
|
||||
{}
|
||||
|
||||
~VPieceNodeData() Q_DECL_EQ_DEFAULT;
|
||||
|
@ -122,6 +124,7 @@ public:
|
|||
|
||||
QString m_formulaWidthBefore;
|
||||
QString m_formulaWidthAfter;
|
||||
QString m_formulaPassmarkLength{};
|
||||
|
||||
PieceNodeAngle m_angleType;
|
||||
|
||||
|
@ -135,6 +138,8 @@ public:
|
|||
* gradation change a piece shape and the seond point should be remaind.*/
|
||||
bool m_checkUniqueness;
|
||||
|
||||
bool m_manualPassmarkLength{false};
|
||||
|
||||
private:
|
||||
VPieceNodeData &operator=(const VPieceNodeData &) Q_DECL_EQ_DELETE;
|
||||
};
|
||||
|
|
|
@ -1059,6 +1059,8 @@ VSAPoint VPiecePath::PreparePointEkv(const VPieceNode &node, const VContainer *d
|
|||
p.SetSAAfter(node.GetSAAfter(data, *data->GetPatternUnit()));
|
||||
p.SetSABefore(node.GetSABefore(data, *data->GetPatternUnit()));
|
||||
p.SetAngleType(node.GetAngleType());
|
||||
p.SetManualPasskmarkLength(node.IsManualPassmarkLength());
|
||||
p.SetPasskmarkLength(node.GetPassmarkLength(data, *data->GetPatternUnit()));
|
||||
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget
|
|||
m_timerWidthBefore(new QTimer(this)),
|
||||
m_timerWidthAfter(new QTimer(this)),
|
||||
m_timerVisible(new QTimer(this)),
|
||||
m_timerPassmarkLength(new QTimer(this)),
|
||||
m_formulaBaseWidth(0),
|
||||
m_formulaBaseWidthBefore(0),
|
||||
m_formulaBaseWidthAfter(0),
|
||||
|
@ -225,6 +226,7 @@ void DialogPiecePath::CheckState()
|
|||
m_flagFormula = true;
|
||||
m_flagFormulaBefore = true;
|
||||
m_flagFormulaAfter = true;
|
||||
m_flagFormulaPassmarkLength = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -234,6 +236,7 @@ void DialogPiecePath::CheckState()
|
|||
m_flagFormula = true;
|
||||
m_flagFormulaBefore = true;
|
||||
m_flagFormulaAfter = true;
|
||||
m_flagFormulaPassmarkLength = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,6 +254,8 @@ void DialogPiecePath::CheckState()
|
|||
ui->tabWidget->setTabIcon(tabSeamAllowanceIndex, icon);
|
||||
}
|
||||
|
||||
ui->comboBoxNodes->setEnabled(m_flagFormulaBefore && m_flagFormulaAfter);
|
||||
|
||||
const int tabControlIndex = ui->tabWidget->indexOf(ui->tabControl);
|
||||
if (m_flagFormulaVisible)
|
||||
{
|
||||
|
@ -262,6 +267,25 @@ void DialogPiecePath::CheckState()
|
|||
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
||||
ui->tabWidget->setTabIcon(tabControlIndex, icon);
|
||||
}
|
||||
|
||||
if (ui->comboBoxPassmarks->count() == 0)
|
||||
{
|
||||
m_flagFormulaPassmarkLength = true;
|
||||
}
|
||||
|
||||
const int tabPassmarksIndex = ui->tabWidget->indexOf(ui->tabPassmarks);
|
||||
if (m_flagFormulaPassmarkLength)
|
||||
{
|
||||
ui->tabWidget->setTabIcon(tabPassmarksIndex, QIcon());
|
||||
}
|
||||
else
|
||||
{
|
||||
const QIcon icon = QIcon::fromTheme("dialog-warning",
|
||||
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
||||
ui->tabWidget->setTabIcon(tabPassmarksIndex, icon);
|
||||
}
|
||||
|
||||
ui->comboBoxPassmarks->setEnabled(m_flagFormulaPassmarkLength);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -286,6 +310,7 @@ void DialogPiecePath::closeEvent(QCloseEvent *event)
|
|||
ui->plainTextEditFormulaWidthBefore->blockSignals(true);
|
||||
ui->plainTextEditFormulaWidthAfter->blockSignals(true);
|
||||
ui->plainTextEditFormulaVisible->blockSignals(true);
|
||||
ui->plainTextEditPassmarkLength->blockSignals(true);
|
||||
DialogTool::closeEvent(event);
|
||||
}
|
||||
|
||||
|
@ -483,28 +508,19 @@ void DialogPiecePath::NodeChanged(int index)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPiecePath::PassmarkChanged(int index)
|
||||
{
|
||||
ui->radioButtonOneLine->setDisabled(true);
|
||||
ui->radioButtonTwoLines->setDisabled(true);
|
||||
ui->radioButtonThreeLines->setDisabled(true);
|
||||
ui->radioButtonTMark->setDisabled(true);
|
||||
ui->radioButtonVMark->setDisabled(true);
|
||||
ui->radioButtonVMark2->setDisabled(true);
|
||||
|
||||
ui->radioButtonStraightforward->setDisabled(true);
|
||||
ui->radioButtonBisector->setDisabled(true);
|
||||
ui->radioButtonIntersection->setDisabled(true);
|
||||
ui->radioButtonIntersectionOnlyLeft->setDisabled(true);
|
||||
ui->radioButtonIntersectionOnlyRight->setDisabled(true);
|
||||
ui->radioButtonIntersection2->setDisabled(true);
|
||||
ui->radioButtonIntersection2OnlyLeft->setDisabled(true);
|
||||
ui->radioButtonIntersection2OnlyRight->setDisabled(true);
|
||||
ui->groupBoxMarkType->setDisabled(true);
|
||||
ui->groupBoxAngleType->setDisabled(true);
|
||||
ui->groupBoxManualLength->setDisabled(true);
|
||||
|
||||
ui->checkBoxShowSecondPassmark->setDisabled(true);
|
||||
ui->checkBoxShowSecondPassmark->blockSignals(true);
|
||||
|
||||
ui->groupBoxManualLength->blockSignals(true);
|
||||
ui->groupBoxMarkType->blockSignals(true);
|
||||
ui->groupBoxAngleType->blockSignals(true);
|
||||
|
||||
ui->groupBoxManualLength->setChecked(false);
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
const VPiecePath path = CreatePath();
|
||||
|
@ -513,13 +529,40 @@ void DialogPiecePath::PassmarkChanged(int index)
|
|||
{
|
||||
const VPieceNode &node = path.at(nodeIndex);
|
||||
|
||||
// Passmark length
|
||||
ui->groupBoxManualLength->setEnabled(true);
|
||||
|
||||
if (node.IsManualPassmarkLength())
|
||||
{
|
||||
ui->groupBoxManualLength->setChecked(true);
|
||||
|
||||
QString passmarkLength = node.GetFormulaPassmarkLength();
|
||||
passmarkLength = qApp->TrVars()->FormulaToUser(passmarkLength, qApp->Settings()->GetOsSeparator());
|
||||
if (passmarkLength.length() > 80)// increase height if needed.
|
||||
{
|
||||
this->DeployPassmarkLength();
|
||||
}
|
||||
|
||||
if (passmarkLength.isEmpty())
|
||||
{
|
||||
qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnit());
|
||||
ui->plainTextEditPassmarkLength->setPlainText(qApp->LocaleToString(length));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->plainTextEditPassmarkLength->setPlainText(passmarkLength);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnit());
|
||||
ui->plainTextEditPassmarkLength->setPlainText(qApp->LocaleToString(length));
|
||||
}
|
||||
|
||||
MoveCursorToEnd(ui->plainTextEditPassmarkLength);
|
||||
|
||||
// Line type
|
||||
ui->radioButtonOneLine->setEnabled(true);
|
||||
ui->radioButtonTwoLines->setEnabled(true);
|
||||
ui->radioButtonThreeLines->setEnabled(true);
|
||||
ui->radioButtonTMark->setEnabled(true);
|
||||
ui->radioButtonVMark->setEnabled(true);
|
||||
ui->radioButtonVMark2->setEnabled(true);
|
||||
ui->groupBoxMarkType->setEnabled(true);
|
||||
|
||||
switch(node.GetPassmarkLineType())
|
||||
{
|
||||
|
@ -546,14 +589,7 @@ void DialogPiecePath::PassmarkChanged(int index)
|
|||
}
|
||||
|
||||
// Angle type
|
||||
ui->radioButtonStraightforward->setEnabled(true);
|
||||
ui->radioButtonBisector->setEnabled(true);
|
||||
ui->radioButtonIntersection->setEnabled(true);
|
||||
ui->radioButtonIntersectionOnlyLeft->setEnabled(true);
|
||||
ui->radioButtonIntersectionOnlyRight->setEnabled(true);
|
||||
ui->radioButtonIntersection2->setEnabled(true);
|
||||
ui->radioButtonIntersection2OnlyLeft->setEnabled(true);
|
||||
ui->radioButtonIntersection2OnlyRight->setEnabled(true);
|
||||
ui->groupBoxAngleType->setEnabled(true);
|
||||
|
||||
switch(node.GetPassmarkAngleType())
|
||||
{
|
||||
|
@ -593,6 +629,7 @@ void DialogPiecePath::PassmarkChanged(int index)
|
|||
|
||||
ui->checkBoxShowSecondPassmark->blockSignals(false);
|
||||
|
||||
ui->groupBoxManualLength->blockSignals(false);
|
||||
ui->groupBoxMarkType->blockSignals(false);
|
||||
ui->groupBoxAngleType->blockSignals(false);
|
||||
}
|
||||
|
@ -851,6 +888,24 @@ void DialogPiecePath::EvalVisible()
|
|||
Eval(formulaData, m_flagFormulaVisible);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPiecePath::EvalPassmarkLength()
|
||||
{
|
||||
FormulaData formulaData;
|
||||
formulaData.formula = ui->plainTextEditPassmarkLength->toPlainText();
|
||||
formulaData.variables = data->DataVariables();
|
||||
formulaData.labelEditFormula = ui->labelEditPassmarkLength;
|
||||
formulaData.labelResult = ui->labelResultPassmarkLength;
|
||||
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
|
||||
formulaData.checkZero = false;
|
||||
formulaData.checkLessThanZero = false;
|
||||
|
||||
Eval(formulaData, m_flagFormulaPassmarkLength);
|
||||
|
||||
UpdateNodePassmarkLength(qApp->TrVars()->TryFormulaFromUser(ui->plainTextEditPassmarkLength->toPlainText(),
|
||||
qApp->Settings()->GetOsSeparator()));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPiecePath::FXWidth()
|
||||
{
|
||||
|
@ -905,6 +960,19 @@ void DialogPiecePath::FXVisible()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPiecePath::FXPassmarkLength()
|
||||
{
|
||||
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
||||
dialog->setWindowTitle(tr("Edit passmark length"));
|
||||
dialog->SetFormula(GetFormulaPassmarkLength());
|
||||
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
|
||||
if (dialog->exec() == QDialog::Accepted)
|
||||
{
|
||||
SetFormulaPassmarkLength(dialog->GetFormula());
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPiecePath::DeployWidthFormulaTextEdit()
|
||||
{
|
||||
|
@ -929,6 +997,12 @@ void DialogPiecePath::DeployVisibleFormulaTextEdit()
|
|||
DeployFormula(this, ui->plainTextEditFormulaVisible, ui->pushButtonGrowVisible, m_formulaBaseVisible);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPiecePath::DeployPassmarkLength()
|
||||
{
|
||||
DeployFormula(this, ui->plainTextEditPassmarkLength, ui->pushButtonGrowPassmarkLength, m_formulaBasePassmarkLength);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPiecePath::SetMoveControls()
|
||||
{
|
||||
|
@ -1054,6 +1128,14 @@ void DialogPiecePath::InitSeamAllowanceTab()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPiecePath::InitPassmarksTab()
|
||||
{
|
||||
this->m_formulaBasePassmarkLength = ui->plainTextEditPassmarkLength->height();
|
||||
ui->plainTextEditPassmarkLength->installEventFilter(this);
|
||||
|
||||
m_timerPassmarkLength->setSingleShot(true);
|
||||
connect(m_timerPassmarkLength, &QTimer::timeout, this, &DialogPiecePath::EvalPassmarkLength);
|
||||
|
||||
connect(ui->groupBoxManualLength, &QGroupBox::toggled, this, &DialogPiecePath::EnabledManualPassmarkLength);
|
||||
|
||||
InitPassmarksList();
|
||||
connect(ui->comboBoxPassmarks, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &DialogPiecePath::PassmarkChanged);
|
||||
|
@ -1064,6 +1146,14 @@ void DialogPiecePath::InitPassmarksTab()
|
|||
this, &DialogPiecePath::PassmarkAngleTypeChanged);
|
||||
connect(ui->checkBoxShowSecondPassmark, &QCheckBox::stateChanged, this,
|
||||
&DialogPiecePath::PassmarkShowSecondChanged);
|
||||
connect(ui->toolButtonExprLength, &QPushButton::clicked, this, &DialogPiecePath::FXPassmarkLength);
|
||||
|
||||
connect(ui->plainTextEditPassmarkLength, &QPlainTextEdit::textChanged, this, [this]()
|
||||
{
|
||||
m_timerPassmarkLength->start(formulaTimerTimeout);
|
||||
});
|
||||
|
||||
connect(ui->pushButtonGrowPassmarkLength, &QPushButton::clicked, this, &DialogPiecePath::DeployPassmarkLength);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1348,6 +1438,39 @@ void DialogPiecePath::UpdateNodeSAAfter(const QString &formula)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPiecePath::UpdateNodePassmarkLength(const QString &formula)
|
||||
{
|
||||
const int index = ui->comboBoxPassmarks->currentIndex();
|
||||
if (index != -1)
|
||||
{
|
||||
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
rowNode.SetFormulaPassmarkLength(formula);
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPiecePath::EnabledManualPassmarkLength()
|
||||
{
|
||||
const int index = ui->comboBoxPassmarks->currentIndex();
|
||||
if (index != -1)
|
||||
{
|
||||
QListWidgetItem *rowItem = GetItemById(ui->comboBoxPassmarks->currentData().toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
rowNode.SetManualPassmarkLength(ui->groupBoxManualLength->isChecked());
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||
EvalPassmarkLength();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPiecePath::SetFormulaSAWidth(const QString &formula)
|
||||
{
|
||||
|
@ -1553,6 +1676,26 @@ void DialogPiecePath::SetFormulaVisible(const QString &formula)
|
|||
MoveCursorToEnd(ui->plainTextEditFormulaVisible);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogPiecePath::GetFormulaPassmarkLength() const
|
||||
{
|
||||
QString formula = ui->plainTextEditPassmarkLength->toPlainText();
|
||||
return qApp->TrVars()->TryFormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPiecePath::SetFormulaPassmarkLength(const QString &formula)
|
||||
{
|
||||
const QString f = qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator());
|
||||
// increase height if needed.
|
||||
if (f.length() > 80)
|
||||
{
|
||||
this->DeployPassmarkLength();
|
||||
}
|
||||
ui->plainTextEditPassmarkLength->setPlainText(f);
|
||||
MoveCursorToEnd(ui->plainTextEditPassmarkLength);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPiecePath::RefreshPathList(const VPiecePath &path)
|
||||
{
|
||||
|
|
|
@ -83,16 +83,19 @@ private slots:
|
|||
void EvalWidthBefore();
|
||||
void EvalWidthAfter();
|
||||
void EvalVisible();
|
||||
void EvalPassmarkLength();
|
||||
|
||||
void FXWidth();
|
||||
void FXWidthBefore();
|
||||
void FXWidthAfter();
|
||||
void FXVisible();
|
||||
void FXPassmarkLength();
|
||||
|
||||
void DeployWidthFormulaTextEdit();
|
||||
void DeployWidthBeforeFormulaTextEdit();
|
||||
void DeployWidthAfterFormulaTextEdit();
|
||||
void DeployVisibleFormulaTextEdit();
|
||||
void DeployPassmarkLength();
|
||||
|
||||
void SetMoveControls();
|
||||
|
||||
|
@ -106,15 +109,18 @@ private:
|
|||
QTimer *m_timerWidthBefore;
|
||||
QTimer *m_timerWidthAfter;
|
||||
QTimer *m_timerVisible;
|
||||
QTimer *m_timerPassmarkLength;
|
||||
|
||||
int m_formulaBaseWidth;
|
||||
int m_formulaBaseWidthBefore;
|
||||
int m_formulaBaseWidthAfter;
|
||||
int m_formulaBaseVisible;
|
||||
int m_formulaBasePassmarkLength{0};
|
||||
|
||||
bool m_flagFormulaBefore;
|
||||
bool m_flagFormulaAfter;
|
||||
bool m_flagFormulaVisible;
|
||||
bool m_flagFormulaPassmarkLength{true};
|
||||
bool m_flagName;
|
||||
bool m_flagError;
|
||||
bool m_flagFormula;
|
||||
|
@ -152,6 +158,9 @@ private:
|
|||
|
||||
void UpdateNodeSABefore(const QString &formula);
|
||||
void UpdateNodeSAAfter(const QString &formula);
|
||||
void UpdateNodePassmarkLength(const QString &formula);
|
||||
|
||||
void EnabledManualPassmarkLength();
|
||||
|
||||
QString GetFormulaSAWidthBefore() const;
|
||||
QString GetFormulaSAWidthAfter() const;
|
||||
|
@ -159,6 +168,9 @@ private:
|
|||
QString GetFormulaVisible() const;
|
||||
void SetFormulaVisible(const QString &formula);
|
||||
|
||||
QString GetFormulaPassmarkLength() const;
|
||||
void SetFormulaPassmarkLength(const QString &formula);
|
||||
|
||||
bool IsShowNotch() const;
|
||||
|
||||
void RefreshPathList(const VPiecePath &path);
|
||||
|
@ -168,7 +180,7 @@ private:
|
|||
inline bool DialogPiecePath::IsValid() const
|
||||
{
|
||||
return m_flagName && m_flagError && m_flagFormula && m_flagFormulaBefore && m_flagFormulaAfter
|
||||
&& m_flagFormulaVisible;
|
||||
&& m_flagFormulaVisible && m_flagFormulaPassmarkLength;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>436</width>
|
||||
<height>627</height>
|
||||
<width>394</width>
|
||||
<height>583</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -908,7 +908,7 @@
|
|||
<attribute name="title">
|
||||
<string>Passmarks</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
|
@ -926,6 +926,231 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxManualLength">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Manual length</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QLabel" name="labelEditPassmarkLength">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>159</red>
|
||||
<green>158</green>
|
||||
<blue>158</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Length:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item alignment="Qt::AlignRight">
|
||||
<widget class="QToolButton" name="toolButtonExprLength">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Formula wizard</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">f(x)</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../vmisc/share/resources/icon.qrc">
|
||||
<normaloff>:/icon/24x24/fx.png</normaloff>:/icon/24x24/fx.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>36</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>=</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="labelResultPassmarkLength">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>87</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Value</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">_</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="VPlainTextEdit" name="plainTextEditPassmarkLength">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Calculation</string>
|
||||
</property>
|
||||
<property name="tabChangesFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonGrowPassmarkLength">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Show full calculation in message box</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-down">
|
||||
<normaloff>../</normaloff>../</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxMarkType">
|
||||
<property name="enabled">
|
||||
|
@ -938,7 +1163,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonOneLine">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>One line</string>
|
||||
|
@ -951,7 +1176,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonTwoLines">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Two lines</string>
|
||||
|
@ -964,7 +1189,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonThreeLines">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Three lines</string>
|
||||
|
@ -977,7 +1202,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonTMark">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>T mark</string>
|
||||
|
@ -990,7 +1215,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonVMark">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Acute angle that looks inside of piece</string>
|
||||
|
@ -1006,7 +1231,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonVMark2">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Acute angle that looks outside of piece</string>
|
||||
|
@ -1024,6 +1249,9 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxAngleType">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Angle</string>
|
||||
</property>
|
||||
|
@ -1031,7 +1259,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonStraightforward">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Straightforward</string>
|
||||
|
@ -1044,7 +1272,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonBisector">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bisector</string>
|
||||
|
@ -1057,7 +1285,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonIntersection">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select if need designate the corner point as a passmark</string>
|
||||
|
@ -1073,7 +1301,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonIntersectionOnlyLeft">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select if need designate the corner point as a passmark. Show only left passmark.</string>
|
||||
|
@ -1089,7 +1317,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonIntersectionOnlyRight">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select if need designate the corner point as a passmark. Show only right passmark.</string>
|
||||
|
@ -1105,7 +1333,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonIntersection2">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select if need designate the corner point as a passmark</string>
|
||||
|
@ -1121,7 +1349,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonIntersection2OnlyLeft">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select if need designate the corner point as a passmark. Show only left passmark.</string>
|
||||
|
@ -1137,7 +1365,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonIntersection2OnlyRight">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select if need designate the corner point as a passmark. Show only right passmark.</string>
|
||||
|
@ -1153,10 +1381,12 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxShowSecondPassmark">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>This option has effect only if the second passmark on seam line enabled in global preferences. The option helps disable the second passmark for this passmark only.</string>
|
||||
|
@ -1422,8 +1652,8 @@
|
|||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
<x>257</x>
|
||||
<y>573</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
|
@ -1438,8 +1668,8 @@
|
|||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
<x>325</x>
|
||||
<y>573</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
|
|
|
@ -135,6 +135,7 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, quint32 toolId,
|
|||
m_timerWidth(new QTimer(this)),
|
||||
m_timerWidthBefore(new QTimer(this)),
|
||||
m_timerWidthAfter(new QTimer(this)),
|
||||
m_timerPassmarkLength(new QTimer(this)),
|
||||
m_saWidth(0),
|
||||
m_templateLines(),
|
||||
m_undoStack(),
|
||||
|
@ -531,6 +532,22 @@ void DialogSeamAllowance::CheckState()
|
|||
}
|
||||
|
||||
uiTabPaths->comboBoxNodes->setEnabled(flagFormulaBefore && flagFormulaAfter);
|
||||
|
||||
if (uiTabPassmarks->comboBoxPassmarks->count() == 0)
|
||||
{
|
||||
flagFormulaPassmarkLength = true;
|
||||
}
|
||||
|
||||
if (flagFormulaPassmarkLength)
|
||||
{
|
||||
m_ftb->SetTabText(TabOrder::Passmarks, tr("Passmarks"));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ftb->SetTabText(TabOrder::Passmarks, tr("Passmarks") + '*');
|
||||
}
|
||||
|
||||
uiTabPassmarks->comboBoxPassmarks->setEnabled(flagFormulaPassmarkLength);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -541,6 +558,7 @@ void DialogSeamAllowance::closeEvent(QCloseEvent *event)
|
|||
uiTabPaths->plainTextEditFormulaWidthAfter->blockSignals(true);
|
||||
uiTabGrainline->lineEditRotFormula->blockSignals(true);
|
||||
uiTabGrainline->lineEditLenFormula->blockSignals(true);
|
||||
uiTabPassmarks->plainTextEditPassmarkLength->blockSignals(true);
|
||||
DialogTool::closeEvent(event);
|
||||
}
|
||||
|
||||
|
@ -989,28 +1007,19 @@ void DialogSeamAllowance::NodeChanged(int index)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::PassmarkChanged(int index)
|
||||
{
|
||||
uiTabPassmarks->radioButtonOneLine->setDisabled(true);
|
||||
uiTabPassmarks->radioButtonTwoLines->setDisabled(true);
|
||||
uiTabPassmarks->radioButtonThreeLines->setDisabled(true);
|
||||
uiTabPassmarks->radioButtonTMark->setDisabled(true);
|
||||
uiTabPassmarks->radioButtonVMark->setDisabled(true);
|
||||
uiTabPassmarks->radioButtonVMark2->setDisabled(true);
|
||||
|
||||
uiTabPassmarks->radioButtonStraightforward->setDisabled(true);
|
||||
uiTabPassmarks->radioButtonBisector->setDisabled(true);
|
||||
uiTabPassmarks->radioButtonIntersection->setDisabled(true);
|
||||
uiTabPassmarks->radioButtonIntersectionOnlyLeft->setDisabled(true);
|
||||
uiTabPassmarks->radioButtonIntersectionOnlyRight->setDisabled(true);
|
||||
uiTabPassmarks->radioButtonIntersection2->setDisabled(true);
|
||||
uiTabPassmarks->radioButtonIntersection2OnlyLeft->setDisabled(true);
|
||||
uiTabPassmarks->radioButtonIntersection2OnlyRight->setDisabled(true);
|
||||
uiTabPassmarks->groupBoxMarkType->setDisabled(true);
|
||||
uiTabPassmarks->groupBoxAngleType->setDisabled(true);
|
||||
uiTabPassmarks->groupBoxManualLength->setDisabled(true);
|
||||
|
||||
uiTabPassmarks->checkBoxShowSecondPassmark->setDisabled(true);
|
||||
uiTabPassmarks->checkBoxShowSecondPassmark->blockSignals(true);
|
||||
|
||||
uiTabPassmarks->groupBoxManualLength->blockSignals(true);
|
||||
uiTabPassmarks->groupBoxMarkType->blockSignals(true);
|
||||
uiTabPassmarks->groupBoxAngleType->blockSignals(true);
|
||||
|
||||
uiTabPassmarks->groupBoxManualLength->setChecked(false);
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
const VPiece piece = CreatePiece();
|
||||
|
@ -1019,13 +1028,40 @@ void DialogSeamAllowance::PassmarkChanged(int index)
|
|||
{
|
||||
const VPieceNode &node = piece.GetPath().at(nodeIndex);
|
||||
|
||||
// Passmark length
|
||||
uiTabPassmarks->groupBoxManualLength->setEnabled(true);
|
||||
|
||||
if (node.IsManualPassmarkLength())
|
||||
{
|
||||
uiTabPassmarks->groupBoxManualLength->setChecked(true);
|
||||
|
||||
QString passmarkLength = node.GetFormulaPassmarkLength();
|
||||
passmarkLength = qApp->TrVars()->FormulaToUser(passmarkLength, qApp->Settings()->GetOsSeparator());
|
||||
if (passmarkLength.length() > 80)// increase height if needed.
|
||||
{
|
||||
this->DeployPassmarkLength();
|
||||
}
|
||||
|
||||
if (passmarkLength.isEmpty())
|
||||
{
|
||||
qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnit());
|
||||
uiTabPassmarks->plainTextEditPassmarkLength->setPlainText(qApp->LocaleToString(length));
|
||||
}
|
||||
else
|
||||
{
|
||||
uiTabPassmarks->plainTextEditPassmarkLength->setPlainText(passmarkLength);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qreal length = UnitConvertor(1, Unit::Cm, qApp->patternUnit());
|
||||
uiTabPassmarks->plainTextEditPassmarkLength->setPlainText(qApp->LocaleToString(length));
|
||||
}
|
||||
|
||||
MoveCursorToEnd(uiTabPassmarks->plainTextEditPassmarkLength);
|
||||
|
||||
// Line type
|
||||
uiTabPassmarks->radioButtonOneLine->setEnabled(true);
|
||||
uiTabPassmarks->radioButtonTwoLines->setEnabled(true);
|
||||
uiTabPassmarks->radioButtonThreeLines->setEnabled(true);
|
||||
uiTabPassmarks->radioButtonTMark->setEnabled(true);
|
||||
uiTabPassmarks->radioButtonVMark->setEnabled(true);
|
||||
uiTabPassmarks->radioButtonVMark2->setEnabled(true);
|
||||
uiTabPassmarks->groupBoxMarkType->setEnabled(true);
|
||||
|
||||
switch(node.GetPassmarkLineType())
|
||||
{
|
||||
|
@ -1052,14 +1088,7 @@ void DialogSeamAllowance::PassmarkChanged(int index)
|
|||
}
|
||||
|
||||
// Angle type
|
||||
uiTabPassmarks->radioButtonStraightforward->setEnabled(true);
|
||||
uiTabPassmarks->radioButtonBisector->setEnabled(true);
|
||||
uiTabPassmarks->radioButtonIntersection->setEnabled(true);
|
||||
uiTabPassmarks->radioButtonIntersectionOnlyLeft->setEnabled(true);
|
||||
uiTabPassmarks->radioButtonIntersectionOnlyRight->setEnabled(true);
|
||||
uiTabPassmarks->radioButtonIntersection2->setEnabled(true);
|
||||
uiTabPassmarks->radioButtonIntersection2OnlyLeft->setEnabled(true);
|
||||
uiTabPassmarks->radioButtonIntersection2OnlyRight->setEnabled(true);
|
||||
uiTabPassmarks->groupBoxAngleType->setEnabled(true);
|
||||
|
||||
switch(node.GetPassmarkAngleType())
|
||||
{
|
||||
|
@ -1098,7 +1127,7 @@ void DialogSeamAllowance::PassmarkChanged(int index)
|
|||
}
|
||||
|
||||
uiTabPassmarks->checkBoxShowSecondPassmark->blockSignals(false);
|
||||
|
||||
uiTabPassmarks->groupBoxManualLength->blockSignals(false);
|
||||
uiTabPassmarks->groupBoxMarkType->blockSignals(false);
|
||||
uiTabPassmarks->groupBoxAngleType->blockSignals(false);
|
||||
}
|
||||
|
@ -1822,6 +1851,23 @@ void DialogSeamAllowance::EnabledPatternLabel()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::EnabledManualPassmarkLength()
|
||||
{
|
||||
const int index = uiTabPassmarks->comboBoxPassmarks->currentIndex();
|
||||
if (index != -1)
|
||||
{
|
||||
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
rowNode.SetManualPassmarkLength(uiTabPassmarks->groupBoxManualLength->isChecked());
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||
EvalPassmarkLength();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::EditGrainlineFormula()
|
||||
{
|
||||
|
@ -2150,6 +2196,35 @@ void DialogSeamAllowance::EvalWidthAfter()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::EvalPassmarkLength()
|
||||
{
|
||||
if (uiTabPassmarks->groupBoxManualLength->isChecked())
|
||||
{
|
||||
if (uiTabPassmarks->comboBoxPassmarks->count() > 0)
|
||||
{
|
||||
FormulaData formulaData;
|
||||
formulaData.formula = uiTabPassmarks->plainTextEditPassmarkLength->toPlainText();
|
||||
formulaData.variables = data->DataVariables();
|
||||
formulaData.labelEditFormula = uiTabPassmarks->labelEditPassmarkLength;
|
||||
formulaData.labelResult = uiTabPassmarks->labelResultPassmarkLength;
|
||||
formulaData.postfix = UnitsToStr(qApp->patternUnit(), true);
|
||||
formulaData.checkZero = false;
|
||||
formulaData.checkLessThanZero = false;
|
||||
|
||||
Eval(formulaData, flagFormulaPassmarkLength);
|
||||
|
||||
UpdateNodePassmarkLength(GetFormulaFromUser(uiTabPassmarks->plainTextEditPassmarkLength));
|
||||
}
|
||||
else
|
||||
{
|
||||
ChangeColor(uiTabPassmarks->labelEditPassmarkLength, OkColor(this));
|
||||
uiTabPassmarks->labelResultPassmarkLength->setText(tr("<Empty>"));
|
||||
flagFormulaPassmarkLength = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::FXWidth()
|
||||
{
|
||||
|
@ -2192,6 +2267,19 @@ void DialogSeamAllowance::FXWidthAfter()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::FXPassmarkLength()
|
||||
{
|
||||
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
||||
dialog->setWindowTitle(tr("Edit passmark length"));
|
||||
dialog->SetFormula(GetFormulaFromUser(uiTabPassmarks->plainTextEditPassmarkLength));
|
||||
dialog->setPostfix(UnitsToStr(qApp->patternUnit(), true));
|
||||
if (dialog->exec() == QDialog::Accepted)
|
||||
{
|
||||
SetFormularPassmarkLength(dialog->GetFormula());
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::DeployWidthFormulaTextEdit()
|
||||
{
|
||||
|
@ -2212,6 +2300,13 @@ void DialogSeamAllowance::DeployWidthAfterFormulaTextEdit()
|
|||
m_formulaBaseWidthAfter);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::DeployPassmarkLength()
|
||||
{
|
||||
DeployFormula(this, uiTabPassmarks->plainTextEditPassmarkLength, uiTabPassmarks->pushButtonGrowPassmarkLength,
|
||||
m_formulaBasePassmarkLength);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::GrainlinePinPointChanged()
|
||||
{
|
||||
|
@ -2654,6 +2749,22 @@ void DialogSeamAllowance::UpdateNodeSAAfter(const QString &formula)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::UpdateNodePassmarkLength(const QString &formula)
|
||||
{
|
||||
const int index = uiTabPassmarks->comboBoxPassmarks->currentIndex();
|
||||
if (index != -1)
|
||||
{
|
||||
QListWidgetItem *rowItem = GetItemById(uiTabPassmarks->comboBoxPassmarks->currentData().toUInt());
|
||||
if (rowItem)
|
||||
{
|
||||
VPieceNode rowNode = qvariant_cast<VPieceNode>(rowItem->data(Qt::UserRole));
|
||||
rowNode.SetFormulaPassmarkLength(formula);
|
||||
rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::InitFancyTabBar()
|
||||
{
|
||||
|
@ -3035,6 +3146,15 @@ void DialogSeamAllowance::InitPinsTab()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::InitPassmarksTab()
|
||||
{
|
||||
this->m_formulaBasePassmarkLength = uiTabPassmarks->plainTextEditPassmarkLength->height();
|
||||
uiTabPassmarks->plainTextEditPassmarkLength->installEventFilter(this);
|
||||
|
||||
m_timerPassmarkLength->setSingleShot(true);
|
||||
connect(m_timerPassmarkLength, &QTimer::timeout, this, &DialogSeamAllowance::EvalPassmarkLength);
|
||||
|
||||
connect(uiTabPassmarks->groupBoxManualLength, &QGroupBox::toggled, this,
|
||||
&DialogSeamAllowance::EnabledManualPassmarkLength);
|
||||
|
||||
InitPassmarksList();
|
||||
connect(uiTabPassmarks->comboBoxPassmarks, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &DialogSeamAllowance::PassmarkChanged);
|
||||
|
@ -3045,6 +3165,15 @@ void DialogSeamAllowance::InitPassmarksTab()
|
|||
this, &DialogSeamAllowance::PassmarkAngleTypeChanged);
|
||||
connect(uiTabPassmarks->checkBoxShowSecondPassmark, &QCheckBox::stateChanged, this,
|
||||
&DialogSeamAllowance::PassmarkShowSecondChanged);
|
||||
connect(uiTabPassmarks->toolButtonExprLength, &QPushButton::clicked, this, &DialogSeamAllowance::FXPassmarkLength);
|
||||
|
||||
connect(uiTabPassmarks->plainTextEditPassmarkLength, &QPlainTextEdit::textChanged, this, [this]()
|
||||
{
|
||||
m_timerPassmarkLength->start(formulaTimerTimeout);
|
||||
});
|
||||
|
||||
connect(uiTabPassmarks->pushButtonGrowPassmarkLength, &QPushButton::clicked, this,
|
||||
&DialogSeamAllowance::DeployPassmarkLength);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -3115,6 +3244,20 @@ void DialogSeamAllowance::SetFormulaSAWidth(const QString &formula)
|
|||
MoveCursorToEnd(uiTabPaths->plainTextEditFormulaWidth);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::SetFormularPassmarkLength(const QString &formula)
|
||||
{
|
||||
const QString width = qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator());
|
||||
// increase height if needed.
|
||||
if (width.length() > 80)
|
||||
{
|
||||
this->DeployPassmarkLength();
|
||||
}
|
||||
uiTabPassmarks->plainTextEditPassmarkLength->setPlainText(width);
|
||||
|
||||
MoveCursorToEnd(uiTabPassmarks->plainTextEditPassmarkLength);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::UpdateCurrentCustomSARecord()
|
||||
{
|
||||
|
|
|
@ -134,18 +134,22 @@ private slots:
|
|||
void EnabledGrainline();
|
||||
void EnabledDetailLabel();
|
||||
void EnabledPatternLabel();
|
||||
void EnabledManualPassmarkLength();
|
||||
|
||||
void EvalWidth();
|
||||
void EvalWidthBefore();
|
||||
void EvalWidthAfter();
|
||||
void EvalPassmarkLength();
|
||||
|
||||
void FXWidth();
|
||||
void FXWidthBefore();
|
||||
void FXWidthAfter();
|
||||
void FXPassmarkLength();
|
||||
|
||||
void DeployWidthFormulaTextEdit();
|
||||
void DeployWidthBeforeFormulaTextEdit();
|
||||
void DeployWidthAfterFormulaTextEdit();
|
||||
void DeployPassmarkLength();
|
||||
|
||||
void GrainlinePinPointChanged();
|
||||
void DetailPinPointChanged();
|
||||
|
@ -185,6 +189,7 @@ private:
|
|||
bool flagPLFormulas;
|
||||
bool flagFormulaBefore;
|
||||
bool flagFormulaAfter;
|
||||
bool flagFormulaPassmarkLength{true};
|
||||
bool flagMainPathIsValid;
|
||||
bool flagName;
|
||||
bool flagFormula;
|
||||
|
@ -204,10 +209,12 @@ private:
|
|||
int m_formulaBaseWidth;
|
||||
int m_formulaBaseWidthBefore;
|
||||
int m_formulaBaseWidthAfter;
|
||||
int m_formulaBasePassmarkLength{0};
|
||||
|
||||
QTimer *m_timerWidth;
|
||||
QTimer *m_timerWidthBefore;
|
||||
QTimer *m_timerWidthAfter;
|
||||
QTimer *m_timerPassmarkLength;
|
||||
qreal m_saWidth;
|
||||
|
||||
QVector<VLabelTemplateLine> m_templateLines;
|
||||
|
@ -236,6 +243,7 @@ private:
|
|||
|
||||
void UpdateNodeSABefore(const QString &formula);
|
||||
void UpdateNodeSAAfter(const QString &formula);
|
||||
void UpdateNodePassmarkLength(const QString &formula);
|
||||
|
||||
void InitFancyTabBar();
|
||||
void InitMainPathTab();
|
||||
|
@ -255,6 +263,7 @@ private:
|
|||
void InitAllPinComboboxes();
|
||||
|
||||
void SetFormulaSAWidth(const QString &formula);
|
||||
void SetFormularPassmarkLength(const QString &formula);
|
||||
|
||||
void SetGrainlineAngle(QString angleFormula);
|
||||
void SetGrainlineLength(QString lengthFormula);
|
||||
|
@ -285,7 +294,7 @@ inline bool DialogSeamAllowance::IsValid() const
|
|||
{
|
||||
return flagName && flagMainPathIsValid && flagFormula && flagFormulaBefore && flagFormulaAfter
|
||||
&& (flagGFormulas || flagGPin) && flagDLAngle && (flagDLFormulas || flagDPin) && flagPLAngle
|
||||
&& (flagPLFormulas || flagPPin);
|
||||
&& (flagPLFormulas || flagPPin) && flagFormulaPassmarkLength;
|
||||
}
|
||||
|
||||
#endif // DIALOGSEAMALLOWANCE_H
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>352</width>
|
||||
<height>594</height>
|
||||
<width>394</width>
|
||||
<height>552</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -24,11 +24,11 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>332</width>
|
||||
<height>574</height>
|
||||
<width>374</width>
|
||||
<height>532</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
|
@ -46,6 +46,234 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxManualLength">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Manual length</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QLabel" name="labelEditPassmarkLength">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>159</red>
|
||||
<green>158</green>
|
||||
<blue>158</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Length:</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>
|
||||
<item alignment="Qt::AlignRight">
|
||||
<widget class="QToolButton" name="toolButtonExprLength">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Formula wizard</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">f(x)</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../../vmisc/share/resources/icon.qrc">
|
||||
<normaloff>:/icon/24x24/fx.png</normaloff>:/icon/24x24/fx.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>36</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>=</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignRight">
|
||||
<widget class="QLabel" name="labelResultPassmarkLength">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>87</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Value</string>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">_</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="VPlainTextEdit" name="plainTextEditPassmarkLength">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>28</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Calculation</string>
|
||||
</property>
|
||||
<property name="tabChangesFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonGrowPassmarkLength">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>18</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Show full calculation in message box</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="go-down">
|
||||
<normaloff>../../</normaloff>../../</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxMarkType">
|
||||
<property name="enabled">
|
||||
|
@ -58,7 +286,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonOneLine">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>One line</string>
|
||||
|
@ -71,7 +299,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonTwoLines">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Two lines</string>
|
||||
|
@ -84,7 +312,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonThreeLines">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Three lines</string>
|
||||
|
@ -97,7 +325,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonTMark">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>T mark</string>
|
||||
|
@ -110,7 +338,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonVMark">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Acute angle that looks intside of piece</string>
|
||||
|
@ -126,7 +354,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonVMark2">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Acute angle that looks outside of piece</string>
|
||||
|
@ -144,6 +372,9 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxAngleType">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Angle</string>
|
||||
</property>
|
||||
|
@ -151,7 +382,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonStraightforward">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Straightforward</string>
|
||||
|
@ -164,7 +395,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonBisector">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bisector</string>
|
||||
|
@ -177,7 +408,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonIntersection">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select if need designate the corner point as a passmark</string>
|
||||
|
@ -193,7 +424,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonIntersectionOnlyLeft">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select if need designate the corner point as a passmark. Show only left passmark.</string>
|
||||
|
@ -209,7 +440,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonIntersectionOnlyRight">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select if need designate the corner point as a passmark. Show only right passmark.</string>
|
||||
|
@ -225,7 +456,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonIntersection2">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select if need designate the corner point as a passmark</string>
|
||||
|
@ -241,7 +472,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonIntersection2OnlyLeft">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select if need designate the corner point as a passmark. Show only left passmark.</string>
|
||||
|
@ -257,7 +488,7 @@
|
|||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonIntersection2OnlyRight">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select if need designate the corner point as a passmark. Show only right passmark.</string>
|
||||
|
@ -273,10 +504,12 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxShowSecondPassmark">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>This option has effect only if the second passmark on seam line enabled in global preferences. The option helps disable the second passmark for this passmark only.</string>
|
||||
|
@ -305,7 +538,16 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>VPlainTextEdit</class>
|
||||
<extends>QPlainTextEdit</extends>
|
||||
<header location="global">vplaintextedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../../../vmisc/share/resources/icon.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="buttonGroupLineType"/>
|
||||
|
|
|
@ -584,6 +584,11 @@ QDomElement VAbstractTool::AddSANode(VAbstractPattern *doc, const QString &tagNa
|
|||
doc->SetAttributeOrRemoveIf(nod, VAbstractPattern::AttrNodeShowSecondPassmark, node.IsShowSecondPassmark(),
|
||||
node.IsShowSecondPassmark());
|
||||
|
||||
doc->SetAttributeOrRemoveIf(nod, VAbstractPattern::AttrManualPassmarkLength, node.IsManualPassmarkLength(),
|
||||
not node.IsManualPassmarkLength());
|
||||
doc->SetAttributeOrRemoveIf(nod, VAbstractPattern::AttrPassmarkLength, node.GetFormulaPassmarkLength(),
|
||||
not node.IsManualPassmarkLength());
|
||||
|
||||
return nod;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user