Resolved issue #867. Visibility control for place labels.
--HG-- branch : develop
This commit is contained in:
parent
20b3f034d4
commit
1ae08d6020
|
@ -52,6 +52,7 @@
|
||||||
- Mouse double click zoom fit best current pattern piece.
|
- Mouse double click zoom fit best current pattern piece.
|
||||||
- [#862] Force Valentina to immediately terminate if a pattern contains a parsing warning.
|
- [#862] Force Valentina to immediately terminate if a pattern contains a parsing warning.
|
||||||
- [#865] New feature. Dynamic Way to define Material in piece label.
|
- [#865] New feature. Dynamic Way to define Material in piece label.
|
||||||
|
- [#867] Visibility control for place labels.
|
||||||
|
|
||||||
# Version 0.5.1 (unreleased)
|
# Version 0.5.1 (unreleased)
|
||||||
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.
|
- [#683] Tool Seam allowance's dialog is off screen on small resolutions.
|
||||||
|
|
|
@ -1827,16 +1827,21 @@ void VPattern::ParsePlaceLabel(QDomElement &domElement, const Document &parse)
|
||||||
initData.angle = GetParametrString(domElement, AttrAngle, "0.0");
|
initData.angle = GetParametrString(domElement, AttrAngle, "0.0");
|
||||||
const QString angle = initData.angle;//need for saving fixed formula;
|
const QString angle = initData.angle;//need for saving fixed formula;
|
||||||
|
|
||||||
|
initData.visibilityTrigger = GetParametrString(domElement, VAbstractPattern::AttrVisible, "1.0");
|
||||||
|
const QString visibility = initData.visibilityTrigger;//need for saving fixed formula;
|
||||||
|
|
||||||
initData.type = static_cast<PlaceLabelType>(GetParametrUInt(domElement, AttrPlaceLabelType, QChar('0')));
|
initData.type = static_cast<PlaceLabelType>(GetParametrUInt(domElement, AttrPlaceLabelType, QChar('0')));
|
||||||
|
|
||||||
VToolPlaceLabel::Create(initData);
|
VToolPlaceLabel::Create(initData);
|
||||||
|
|
||||||
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
//Rewrite attribute formula. Need for situation when we have wrong formula.
|
||||||
if (w != initData.width || h != initData.height || angle != initData.angle)
|
if (w != initData.width || h != initData.height || angle != initData.angle
|
||||||
|
|| visibility != initData.visibilityTrigger)
|
||||||
{
|
{
|
||||||
SetAttribute(domElement, AttrWidth, initData.width);
|
SetAttribute(domElement, AttrWidth, initData.width);
|
||||||
SetAttribute(domElement, AttrHeight, initData.height);
|
SetAttribute(domElement, AttrHeight, initData.height);
|
||||||
SetAttribute(domElement, AttrAngle, initData.angle);
|
SetAttribute(domElement, AttrAngle, initData.angle);
|
||||||
|
SetAttribute(domElement, VAbstractPattern::AttrVisible, initData.visibilityTrigger);
|
||||||
modified = true;
|
modified = true;
|
||||||
haveLiteChange();
|
haveLiteChange();
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
<file>schema/pattern/v0.7.6.xsd</file>
|
<file>schema/pattern/v0.7.6.xsd</file>
|
||||||
<file>schema/pattern/v0.7.7.xsd</file>
|
<file>schema/pattern/v0.7.7.xsd</file>
|
||||||
<file>schema/pattern/v0.7.8.xsd</file>
|
<file>schema/pattern/v0.7.8.xsd</file>
|
||||||
|
<file>schema/pattern/v0.7.9.xsd</file>
|
||||||
<file>schema/standard_measurements/v0.3.0.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.0.xsd</file>
|
||||||
<file>schema/standard_measurements/v0.4.1.xsd</file>
|
<file>schema/standard_measurements/v0.4.1.xsd</file>
|
||||||
|
|
1062
src/libs/ifc/schema/pattern/v0.7.9.xsd
Normal file
1062
src/libs/ifc/schema/pattern/v0.7.9.xsd
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -59,8 +59,8 @@ class QDomElement;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
|
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0");
|
||||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.7.8");
|
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.7.9");
|
||||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.7.8.xsd");
|
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.7.9.xsd");
|
||||||
|
|
||||||
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||||
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||||
|
@ -228,7 +228,8 @@ QString VPatternConverter::XSDSchema(int ver) const
|
||||||
std::make_pair(0x000705, QStringLiteral("://schema/pattern/v0.7.5.xsd")),
|
std::make_pair(0x000705, QStringLiteral("://schema/pattern/v0.7.5.xsd")),
|
||||||
std::make_pair(0x000706, QStringLiteral("://schema/pattern/v0.7.6.xsd")),
|
std::make_pair(0x000706, QStringLiteral("://schema/pattern/v0.7.6.xsd")),
|
||||||
std::make_pair(0x000707, QStringLiteral("://schema/pattern/v0.7.7.xsd")),
|
std::make_pair(0x000707, QStringLiteral("://schema/pattern/v0.7.7.xsd")),
|
||||||
std::make_pair(0x000708, CurrentSchema)
|
std::make_pair(0x000708, QStringLiteral("://schema/pattern/v0.7.8.xsd")),
|
||||||
|
std::make_pair(0x000709, CurrentSchema)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (schemas.contains(ver))
|
if (schemas.contains(ver))
|
||||||
|
@ -443,6 +444,10 @@ void VPatternConverter::ApplyPatches()
|
||||||
ValidateXML(XSDSchema(0x000708), m_convertedFileName);
|
ValidateXML(XSDSchema(0x000708), m_convertedFileName);
|
||||||
V_FALLTHROUGH
|
V_FALLTHROUGH
|
||||||
case (0x000708):
|
case (0x000708):
|
||||||
|
ToV0_7_9();
|
||||||
|
ValidateXML(XSDSchema(0x000709), m_convertedFileName);
|
||||||
|
V_FALLTHROUGH
|
||||||
|
case (0x000709):
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
InvalidVersion(m_ver);
|
InvalidVersion(m_ver);
|
||||||
|
@ -460,7 +465,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion()
|
||||||
bool VPatternConverter::IsReadOnly() const
|
bool VPatternConverter::IsReadOnly() const
|
||||||
{
|
{
|
||||||
// Check if attribute readOnly was not changed in file format
|
// Check if attribute readOnly was not changed in file format
|
||||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 7, 8),
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == CONVERTER_VERSION_CHECK(0, 7, 9),
|
||||||
"Check attribute readOnly.");
|
"Check attribute readOnly.");
|
||||||
|
|
||||||
// Possibly in future attribute readOnly will change position etc.
|
// Possibly in future attribute readOnly will change position etc.
|
||||||
|
@ -1014,6 +1019,15 @@ void VPatternConverter::ToV0_7_8()
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPatternConverter::ToV0_7_9()
|
||||||
|
{
|
||||||
|
// TODO. Delete if minimal supported version is 0.7.9
|
||||||
|
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 7, 9),
|
||||||
|
"Time to refactor the code.");
|
||||||
|
SetVersion(QStringLiteral("0.7.9"));
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPatternConverter::TagUnitToV0_2_0()
|
void VPatternConverter::TagUnitToV0_2_0()
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
static const QString PatternMaxVerStr;
|
static const QString PatternMaxVerStr;
|
||||||
static const QString CurrentSchema;
|
static const QString CurrentSchema;
|
||||||
static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
|
static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0);
|
||||||
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 7, 8);
|
static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 7, 9);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int MinVer() const override;
|
virtual int MinVer() const override;
|
||||||
|
@ -121,6 +121,7 @@ private:
|
||||||
void ToV0_7_6();
|
void ToV0_7_6();
|
||||||
void ToV0_7_7();
|
void ToV0_7_7();
|
||||||
void ToV0_7_8();
|
void ToV0_7_8();
|
||||||
|
void ToV0_7_9();
|
||||||
|
|
||||||
void TagUnitToV0_2_0();
|
void TagUnitToV0_2_0();
|
||||||
void TagIncrementToV0_2_0();
|
void TagIncrementToV0_2_0();
|
||||||
|
|
|
@ -125,6 +125,41 @@ void VPlaceLabelItem::SetAngle(qreal value, const QString &formula)
|
||||||
d->angle = formula;
|
d->angle = formula;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString VPlaceLabelItem::GetVisibilityTrigger() const
|
||||||
|
{
|
||||||
|
return d->visibilityTrigger;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString &VPlaceLabelItem::GetVisibilityTrigger()
|
||||||
|
{
|
||||||
|
return d->visibilityTrigger;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VPlaceLabelItem::IsVisible() const
|
||||||
|
{
|
||||||
|
bool visible = true;
|
||||||
|
|
||||||
|
if (qIsInf(d->isVisible) || qIsNaN(d->isVisible))
|
||||||
|
{
|
||||||
|
qWarning() << QObject::tr("Visibility trigger contains error and will be ignored");
|
||||||
|
}
|
||||||
|
else if (qFuzzyIsNull(d->isVisible))
|
||||||
|
{
|
||||||
|
visible = false;
|
||||||
|
}
|
||||||
|
return visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPlaceLabelItem::SetVisibilityTrigger(qreal visible, const QString &formula)
|
||||||
|
{
|
||||||
|
d->visibilityTrigger = formula;
|
||||||
|
d->isVisible = visible;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VPlaceLabelItem::GetCorrectionAngle() const
|
qreal VPlaceLabelItem::GetCorrectionAngle() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,6 +68,11 @@ public:
|
||||||
qreal GetAngle() const;
|
qreal GetAngle() const;
|
||||||
void SetAngle(qreal value, const QString &formula);
|
void SetAngle(qreal value, const QString &formula);
|
||||||
|
|
||||||
|
QString GetVisibilityTrigger() const;
|
||||||
|
QString& GetVisibilityTrigger();
|
||||||
|
bool IsVisible() const;
|
||||||
|
void SetVisibilityTrigger(qreal visible, const QString &formula);
|
||||||
|
|
||||||
qreal GetCorrectionAngle() const;
|
qreal GetCorrectionAngle() const;
|
||||||
void SetCorrectionAngle(qreal value);
|
void SetCorrectionAngle(qreal value);
|
||||||
|
|
||||||
|
|
|
@ -44,12 +44,14 @@ public:
|
||||||
: width(),
|
: width(),
|
||||||
height(),
|
height(),
|
||||||
angle('0'),
|
angle('0'),
|
||||||
|
visibilityTrigger('1'),
|
||||||
type(PlaceLabelType::Button),
|
type(PlaceLabelType::Button),
|
||||||
centerPoint(0),
|
centerPoint(0),
|
||||||
wValue(0),
|
wValue(0),
|
||||||
hValue(0),
|
hValue(0),
|
||||||
aValue(0),
|
aValue(0),
|
||||||
correctionAngle(0)
|
correctionAngle(0),
|
||||||
|
isVisible(1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
VPlaceLabelItemData(const VPlaceLabelItemData &item)
|
VPlaceLabelItemData(const VPlaceLabelItemData &item)
|
||||||
|
@ -57,12 +59,14 @@ public:
|
||||||
width(item.width),
|
width(item.width),
|
||||||
height(item.height),
|
height(item.height),
|
||||||
angle(item.angle),
|
angle(item.angle),
|
||||||
|
visibilityTrigger(item.visibilityTrigger),
|
||||||
type(item.type),
|
type(item.type),
|
||||||
centerPoint(item.centerPoint),
|
centerPoint(item.centerPoint),
|
||||||
wValue(item.wValue),
|
wValue(item.wValue),
|
||||||
hValue(item.hValue),
|
hValue(item.hValue),
|
||||||
aValue(item.aValue),
|
aValue(item.aValue),
|
||||||
correctionAngle(item.correctionAngle)
|
correctionAngle(item.correctionAngle),
|
||||||
|
isVisible(item.isVisible)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual ~VPlaceLabelItemData();
|
virtual ~VPlaceLabelItemData();
|
||||||
|
@ -70,6 +74,7 @@ public:
|
||||||
QString width;
|
QString width;
|
||||||
QString height;
|
QString height;
|
||||||
QString angle;
|
QString angle;
|
||||||
|
QString visibilityTrigger;
|
||||||
PlaceLabelType type;
|
PlaceLabelType type;
|
||||||
quint32 centerPoint;
|
quint32 centerPoint;
|
||||||
|
|
||||||
|
@ -77,6 +82,7 @@ public:
|
||||||
qreal hValue;
|
qreal hValue;
|
||||||
qreal aValue;
|
qreal aValue;
|
||||||
qreal correctionAngle;
|
qreal correctionAngle;
|
||||||
|
qreal isVisible;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VPlaceLabelItemData &operator=(const VPlaceLabelItemData &) Q_DECL_EQ_DELETE;
|
VPlaceLabelItemData &operator=(const VPlaceLabelItemData &) Q_DECL_EQ_DELETE;
|
||||||
|
|
|
@ -352,12 +352,15 @@ QVector<VLayoutPlaceLabel> ConvertPlaceLabels(const VPiece &piece, const VContai
|
||||||
for(auto placeLabel : placeLabels)
|
for(auto placeLabel : placeLabels)
|
||||||
{
|
{
|
||||||
const auto label = pattern->GeometricObject<VPlaceLabelItem>(placeLabel);
|
const auto label = pattern->GeometricObject<VPlaceLabelItem>(placeLabel);
|
||||||
|
if (label->IsVisible())
|
||||||
|
{
|
||||||
VLayoutPlaceLabel layoutLabel;
|
VLayoutPlaceLabel layoutLabel;
|
||||||
layoutLabel.shape = label->LabelShape();
|
layoutLabel.shape = label->LabelShape();
|
||||||
layoutLabel.center = label->toQPointF();
|
layoutLabel.center = label->toQPointF();
|
||||||
layoutLabel.type = label->GetLabelType();
|
layoutLabel.type = label->GetLabelType();
|
||||||
labels.append(layoutLabel);
|
labels.append(layoutLabel);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return labels;
|
return labels;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -452,8 +452,11 @@ QVector<PlaceLabelImg> VPiece::PlaceLabelPoints(const VContainer *data) const
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
const auto label = data->GeometricObject<VPlaceLabelItem>(placeLabel);
|
const auto label = data->GeometricObject<VPlaceLabelItem>(placeLabel);
|
||||||
|
if (label->IsVisible())
|
||||||
|
{
|
||||||
points.append(label->LabelShape());
|
points.append(label->LabelShape());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (const VExceptionBadId &e)
|
catch (const VExceptionBadId &e)
|
||||||
{
|
{
|
||||||
qWarning() << e.ErrorMessage();
|
qWarning() << e.ErrorMessage();
|
||||||
|
|
|
@ -45,50 +45,27 @@ DialogPlaceLabel::DialogPlaceLabel(const VContainer *data, quint32 toolId, QWidg
|
||||||
m_flagWidth(false),
|
m_flagWidth(false),
|
||||||
m_flagHeight(false),
|
m_flagHeight(false),
|
||||||
m_flagAngle(false),
|
m_flagAngle(false),
|
||||||
|
m_flagFormulaVisible(false),
|
||||||
m_formulaBaseHeightWidth(0),
|
m_formulaBaseHeightWidth(0),
|
||||||
m_formulaBaseHeightHeight(0),
|
m_formulaBaseHeightHeight(0),
|
||||||
m_formulaBaseHeightAngle(0),
|
m_formulaBaseHeightAngle(0),
|
||||||
|
m_formulaBaseVisible(0),
|
||||||
timerAngle(new QTimer(this)),
|
timerAngle(new QTimer(this)),
|
||||||
timerWidth(new QTimer(this)),
|
timerWidth(new QTimer(this)),
|
||||||
timerHeight(new QTimer(this))
|
timerHeight(new QTimer(this)),
|
||||||
|
m_timerVisible(new QTimer(this))
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
InitOkCancel(ui);
|
InitOkCancel(ui);
|
||||||
|
|
||||||
FillComboBoxPoints(ui->comboBoxPoint);
|
InitPlaceLabelTab();
|
||||||
FillPlaceLabelTypes();
|
InitControlTab();
|
||||||
|
|
||||||
m_formulaBaseHeightWidth = ui->plainTextEditFormulaWidth->height();
|
EvalVisible();
|
||||||
m_formulaBaseHeightHeight = ui->plainTextEditFormulaHeight->height();
|
|
||||||
m_formulaBaseHeightAngle = ui->plainTextEditFormulaAngle->height();
|
|
||||||
|
|
||||||
ui->plainTextEditFormulaWidth->installEventFilter(this);
|
|
||||||
ui->plainTextEditFormulaHeight->installEventFilter(this);
|
|
||||||
ui->plainTextEditFormulaAngle->installEventFilter(this);
|
|
||||||
|
|
||||||
ui->plainTextEditFormulaWidth->setPlainText(QString::number(UnitConvertor(1, Unit::Cm, qApp->patternUnit())));
|
|
||||||
ui->plainTextEditFormulaHeight->setPlainText(QString::number(UnitConvertor(1, Unit::Cm, qApp->patternUnit())));
|
|
||||||
|
|
||||||
flagError = false;
|
flagError = false;
|
||||||
CheckState();
|
CheckState();
|
||||||
|
|
||||||
connect(ui->toolButtonExprWidth, &QPushButton::clicked, this, &DialogPlaceLabel::FXWidth);
|
|
||||||
connect(ui->toolButtonExprHeight, &QPushButton::clicked, this, &DialogPlaceLabel::FXHeight);
|
|
||||||
connect(ui->toolButtonExprAngle, &QPushButton::clicked, this, &DialogPlaceLabel::FXAngle);
|
|
||||||
|
|
||||||
connect(ui->plainTextEditFormulaWidth, &QPlainTextEdit::textChanged, this, &DialogPlaceLabel::FormulaWidthChanged);
|
|
||||||
connect(ui->plainTextEditFormulaHeight, &QPlainTextEdit::textChanged, this,
|
|
||||||
&DialogPlaceLabel::FormulaHeightChanged);
|
|
||||||
connect(ui->plainTextEditFormulaAngle, &QPlainTextEdit::textChanged, this, &DialogPlaceLabel::FormulaAngleChanged);
|
|
||||||
|
|
||||||
connect(ui->pushButtonGrowWidth, &QPushButton::clicked, this, &DialogPlaceLabel::DeployFormulaWidthEdit);
|
|
||||||
connect(ui->pushButtonGrowHeight, &QPushButton::clicked, this, &DialogPlaceLabel::DeployFormulaHeightEdit);
|
|
||||||
connect(ui->pushButtonGrowAngle, &QPushButton::clicked, this, &DialogPlaceLabel::DeployFormulaAngleEdit);
|
|
||||||
|
|
||||||
connect(timerWidth, &QTimer::timeout, this, &DialogPlaceLabel::EvalWidth);
|
|
||||||
connect(timerHeight, &QTimer::timeout, this, &DialogPlaceLabel::EvalHeight);
|
|
||||||
connect(timerAngle, &QTimer::timeout, this, &DialogPlaceLabel::EvalAngle);
|
|
||||||
|
|
||||||
connect(ui->comboBoxPiece, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
connect(ui->comboBoxPiece, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this]()
|
||||||
{
|
{
|
||||||
CheckPieces();
|
CheckPieces();
|
||||||
|
@ -287,7 +264,7 @@ void DialogPlaceLabel::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
void DialogPlaceLabel::CheckState()
|
void DialogPlaceLabel::CheckState()
|
||||||
{
|
{
|
||||||
SCASSERT(bOk != nullptr);
|
SCASSERT(bOk != nullptr);
|
||||||
bOk->setEnabled(m_flagPoint && flagError && m_flagWidth && m_flagHeight && m_flagAngle);
|
bOk->setEnabled(m_flagPoint && flagError && m_flagWidth && m_flagHeight && m_flagAngle && m_flagFormulaVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -305,6 +282,7 @@ void DialogPlaceLabel::closeEvent(QCloseEvent *event)
|
||||||
ui->plainTextEditFormulaWidth->blockSignals(true);
|
ui->plainTextEditFormulaWidth->blockSignals(true);
|
||||||
ui->plainTextEditFormulaHeight->blockSignals(true);
|
ui->plainTextEditFormulaHeight->blockSignals(true);
|
||||||
ui->plainTextEditFormulaAngle->blockSignals(true);
|
ui->plainTextEditFormulaAngle->blockSignals(true);
|
||||||
|
ui->plainTextEditFormulaVisible->blockSignals(true);
|
||||||
DialogTool::closeEvent(event);
|
DialogTool::closeEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,6 +304,12 @@ void DialogPlaceLabel::DeployFormulaAngleEdit()
|
||||||
DeployFormula(ui->plainTextEditFormulaAngle, ui->pushButtonGrowAngle, m_formulaBaseHeightAngle);
|
DeployFormula(ui->plainTextEditFormulaAngle, ui->pushButtonGrowAngle, m_formulaBaseHeightAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::DeployVisibleFormulaTextEdit()
|
||||||
|
{
|
||||||
|
DeployFormula(ui->plainTextEditFormulaVisible, ui->pushButtonGrowVisible, m_formulaBaseVisible);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPlaceLabel::FormulaWidthChanged()
|
void DialogPlaceLabel::FormulaWidthChanged()
|
||||||
{
|
{
|
||||||
|
@ -352,6 +336,14 @@ void DialogPlaceLabel::FormulaAngleChanged()
|
||||||
ValFormulaChanged(m_flagAngle, ui->plainTextEditFormulaAngle, timerAngle, degreeSymbol);
|
ValFormulaChanged(m_flagAngle, ui->plainTextEditFormulaAngle, timerAngle, degreeSymbol);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::VisibleChanged()
|
||||||
|
{
|
||||||
|
labelEditFormula = ui->labelEditVisible;
|
||||||
|
labelResultCalculation = ui->labelResultVisible;
|
||||||
|
ValFormulaChanged(m_flagFormulaVisible, ui->plainTextEditFormulaVisible, m_timerVisible, QString());
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPlaceLabel::EvalWidth()
|
void DialogPlaceLabel::EvalWidth()
|
||||||
{
|
{
|
||||||
|
@ -378,6 +370,14 @@ void DialogPlaceLabel::EvalAngle()
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::EvalVisible()
|
||||||
|
{
|
||||||
|
labelEditFormula = ui->labelEditVisible;
|
||||||
|
QString formula = ui->plainTextEditFormulaVisible->toPlainText();
|
||||||
|
Eval(formula, m_flagFormulaVisible, ui->labelResultVisible, QString(), false, true);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPlaceLabel::FXWidth()
|
void DialogPlaceLabel::FXWidth()
|
||||||
{
|
{
|
||||||
|
@ -417,6 +417,67 @@ void DialogPlaceLabel::FXAngle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::FXVisible()
|
||||||
|
{
|
||||||
|
QScopedPointer<DialogEditWrongFormula> dialog(new DialogEditWrongFormula(data, toolId, this));
|
||||||
|
dialog->setWindowTitle(tr("Control visibility"));
|
||||||
|
dialog->SetFormula(GetFormulaVisible());
|
||||||
|
if (dialog->exec() == QDialog::Accepted)
|
||||||
|
{
|
||||||
|
SetFormulaVisible(dialog->GetFormula());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::InitPlaceLabelTab()
|
||||||
|
{
|
||||||
|
FillComboBoxPoints(ui->comboBoxPoint);
|
||||||
|
FillPlaceLabelTypes();
|
||||||
|
|
||||||
|
m_formulaBaseHeightWidth = ui->plainTextEditFormulaWidth->height();
|
||||||
|
m_formulaBaseHeightHeight = ui->plainTextEditFormulaHeight->height();
|
||||||
|
m_formulaBaseHeightAngle = ui->plainTextEditFormulaAngle->height();
|
||||||
|
|
||||||
|
ui->plainTextEditFormulaWidth->installEventFilter(this);
|
||||||
|
ui->plainTextEditFormulaHeight->installEventFilter(this);
|
||||||
|
ui->plainTextEditFormulaAngle->installEventFilter(this);
|
||||||
|
|
||||||
|
ui->plainTextEditFormulaWidth->setPlainText(QString::number(UnitConvertor(1, Unit::Cm, qApp->patternUnit())));
|
||||||
|
ui->plainTextEditFormulaHeight->setPlainText(QString::number(UnitConvertor(1, Unit::Cm, qApp->patternUnit())));
|
||||||
|
|
||||||
|
connect(ui->toolButtonExprWidth, &QPushButton::clicked, this, &DialogPlaceLabel::FXWidth);
|
||||||
|
connect(ui->toolButtonExprHeight, &QPushButton::clicked, this, &DialogPlaceLabel::FXHeight);
|
||||||
|
connect(ui->toolButtonExprAngle, &QPushButton::clicked, this, &DialogPlaceLabel::FXAngle);
|
||||||
|
|
||||||
|
connect(ui->plainTextEditFormulaWidth, &QPlainTextEdit::textChanged, this, &DialogPlaceLabel::FormulaWidthChanged);
|
||||||
|
connect(ui->plainTextEditFormulaHeight, &QPlainTextEdit::textChanged, this,
|
||||||
|
&DialogPlaceLabel::FormulaHeightChanged);
|
||||||
|
connect(ui->plainTextEditFormulaAngle, &QPlainTextEdit::textChanged, this, &DialogPlaceLabel::FormulaAngleChanged);
|
||||||
|
|
||||||
|
connect(ui->pushButtonGrowWidth, &QPushButton::clicked, this, &DialogPlaceLabel::DeployFormulaWidthEdit);
|
||||||
|
connect(ui->pushButtonGrowHeight, &QPushButton::clicked, this, &DialogPlaceLabel::DeployFormulaHeightEdit);
|
||||||
|
connect(ui->pushButtonGrowAngle, &QPushButton::clicked, this, &DialogPlaceLabel::DeployFormulaAngleEdit);
|
||||||
|
|
||||||
|
connect(timerWidth, &QTimer::timeout, this, &DialogPlaceLabel::EvalWidth);
|
||||||
|
connect(timerHeight, &QTimer::timeout, this, &DialogPlaceLabel::EvalHeight);
|
||||||
|
connect(timerAngle, &QTimer::timeout, this, &DialogPlaceLabel::EvalAngle);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::InitControlTab()
|
||||||
|
{
|
||||||
|
this->m_formulaBaseVisible = ui->plainTextEditFormulaVisible->height();
|
||||||
|
|
||||||
|
ui->plainTextEditFormulaVisible->installEventFilter(this);
|
||||||
|
|
||||||
|
connect(m_timerVisible, &QTimer::timeout, this, &DialogPlaceLabel::EvalVisible);
|
||||||
|
connect(ui->toolButtonExprVisible, &QPushButton::clicked, this, &DialogPlaceLabel::FXVisible);
|
||||||
|
connect(ui->plainTextEditFormulaVisible, &QPlainTextEdit::textChanged, this, &DialogPlaceLabel::VisibleChanged);
|
||||||
|
connect(ui->pushButtonGrowVisible, &QPushButton::clicked, this,
|
||||||
|
&DialogPlaceLabel::DeployVisibleFormulaTextEdit);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogPlaceLabel::FillPlaceLabelTypes()
|
void DialogPlaceLabel::FillPlaceLabelTypes()
|
||||||
{
|
{
|
||||||
|
@ -469,3 +530,23 @@ void DialogPlaceLabel::CheckPoint()
|
||||||
ChangeColor(ui->labelPoint, color);
|
ChangeColor(ui->labelPoint, color);
|
||||||
CheckState();
|
CheckState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QString DialogPlaceLabel::GetFormulaVisible() const
|
||||||
|
{
|
||||||
|
QString formula = ui->plainTextEditFormulaVisible->toPlainText();
|
||||||
|
return qApp->TrVars()->TryFormulaFromUser(formula, qApp->Settings()->GetOsSeparator());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPlaceLabel::SetFormulaVisible(const QString &formula)
|
||||||
|
{
|
||||||
|
const QString f = qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator());
|
||||||
|
// increase height if needed.
|
||||||
|
if (f.length() > 80)
|
||||||
|
{
|
||||||
|
this->DeployVisibleFormulaTextEdit();
|
||||||
|
}
|
||||||
|
ui->plainTextEditFormulaVisible->setPlainText(f);
|
||||||
|
MoveCursorToEnd(ui->plainTextEditFormulaVisible);
|
||||||
|
}
|
||||||
|
|
|
@ -65,6 +65,9 @@ public:
|
||||||
quint32 GetPieceId() const;
|
quint32 GetPieceId() const;
|
||||||
void SetPieceId(quint32 id);
|
void SetPieceId(quint32 id);
|
||||||
|
|
||||||
|
QString GetFormulaVisible() const;
|
||||||
|
void SetFormulaVisible(const QString &formula);
|
||||||
|
|
||||||
virtual void SetPiecesList(const QVector<quint32> &list) override;
|
virtual void SetPiecesList(const QVector<quint32> &list) override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -79,18 +82,22 @@ private slots:
|
||||||
void DeployFormulaWidthEdit();
|
void DeployFormulaWidthEdit();
|
||||||
void DeployFormulaHeightEdit();
|
void DeployFormulaHeightEdit();
|
||||||
void DeployFormulaAngleEdit();
|
void DeployFormulaAngleEdit();
|
||||||
|
void DeployVisibleFormulaTextEdit();
|
||||||
|
|
||||||
void FormulaWidthChanged();
|
void FormulaWidthChanged();
|
||||||
void FormulaHeightChanged();
|
void FormulaHeightChanged();
|
||||||
void FormulaAngleChanged();
|
void FormulaAngleChanged();
|
||||||
|
void VisibleChanged();
|
||||||
|
|
||||||
void EvalWidth();
|
void EvalWidth();
|
||||||
void EvalHeight();
|
void EvalHeight();
|
||||||
void EvalAngle();
|
void EvalAngle();
|
||||||
|
void EvalVisible();
|
||||||
|
|
||||||
void FXWidth();
|
void FXWidth();
|
||||||
void FXHeight();
|
void FXHeight();
|
||||||
void FXAngle();
|
void FXAngle();
|
||||||
|
void FXVisible();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(DialogPlaceLabel)
|
Q_DISABLE_COPY(DialogPlaceLabel)
|
||||||
|
@ -100,15 +107,21 @@ private:
|
||||||
bool m_flagWidth;
|
bool m_flagWidth;
|
||||||
bool m_flagHeight;
|
bool m_flagHeight;
|
||||||
bool m_flagAngle;
|
bool m_flagAngle;
|
||||||
|
bool m_flagFormulaVisible;
|
||||||
|
|
||||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||||
int m_formulaBaseHeightWidth;
|
int m_formulaBaseHeightWidth;
|
||||||
int m_formulaBaseHeightHeight;
|
int m_formulaBaseHeightHeight;
|
||||||
int m_formulaBaseHeightAngle;
|
int m_formulaBaseHeightAngle;
|
||||||
|
int m_formulaBaseVisible;
|
||||||
|
|
||||||
QTimer *timerAngle;
|
QTimer *timerAngle;
|
||||||
QTimer *timerWidth;
|
QTimer *timerWidth;
|
||||||
QTimer *timerHeight;
|
QTimer *timerHeight;
|
||||||
|
QTimer *m_timerVisible;
|
||||||
|
|
||||||
|
void InitPlaceLabelTab();
|
||||||
|
void InitControlTab();
|
||||||
|
|
||||||
void FillPlaceLabelTypes();
|
void FillPlaceLabelTypes();
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,28 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>338</width>
|
<width>396</width>
|
||||||
<height>363</height>
|
<height>414</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Place label</string>
|
||||||
|
</property>
|
||||||
|
<property name="windowIcon">
|
||||||
|
<iconset resource="../../../../vmisc/share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tabPlaceLabel">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Place label</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item alignment="Qt::AlignLeft">
|
<item alignment="Qt::AlignLeft">
|
||||||
|
@ -603,6 +617,219 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tabControl">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Control</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||||
|
<item alignment="Qt::AlignLeft">
|
||||||
|
<widget class="QLabel" name="labelEditVisible">
|
||||||
|
<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>Visible</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_11">
|
||||||
|
<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="toolButtonExprVisible">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Formula wizard</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">...</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_8">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap resource="../../../../vmisc/share/resources/icon.qrc">:/icon/24x24/equal.png</pixmap>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignRight">
|
||||||
|
<widget class="QLabel" name="labelResultVisible">
|
||||||
|
<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="text">
|
||||||
|
<string notr="true">_</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||||
|
<item>
|
||||||
|
<widget class="VPlainTextEdit" name="plainTextEditFormulaVisible">
|
||||||
|
<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>Create a formula that regulates visibility. Values different from "0" make a path visible.</string>
|
||||||
|
</property>
|
||||||
|
<property name="tabChangesFocus">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="plainText">
|
||||||
|
<string>1</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonGrowVisible">
|
||||||
|
<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>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
|
@ -843,6 +843,7 @@ void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos)
|
||||||
dialog->SetWidth(currentLabel.GetWidthFormula());
|
dialog->SetWidth(currentLabel.GetWidthFormula());
|
||||||
dialog->SetHeight(currentLabel.GetHeightFormula());
|
dialog->SetHeight(currentLabel.GetHeightFormula());
|
||||||
dialog->SetAngle(currentLabel.GetAngleFormula());
|
dialog->SetAngle(currentLabel.GetAngleFormula());
|
||||||
|
dialog->SetFormulaVisible(currentLabel.GetVisibilityTrigger());
|
||||||
dialog->SetPieceId(toolId);
|
dialog->SetPieceId(toolId);
|
||||||
dialog->EnbleShowMode(true);
|
dialog->EnbleShowMode(true);
|
||||||
m_dialog = dialog;
|
m_dialog = dialog;
|
||||||
|
@ -1295,7 +1296,8 @@ void DialogSeamAllowance::PlaceLabelDialogClosed(int result)
|
||||||
const qreal w = qAbs(Visualization::FindLengthFromUser(dialogTool->GetWidth(), vars, false));
|
const qreal w = qAbs(Visualization::FindLengthFromUser(dialogTool->GetWidth(), vars, false));
|
||||||
const qreal h = qAbs(Visualization::FindLengthFromUser(dialogTool->GetHeight(), vars, false));
|
const qreal h = qAbs(Visualization::FindLengthFromUser(dialogTool->GetHeight(), vars, false));
|
||||||
const qreal a = Visualization::FindValFromUser(dialogTool->GetAngle(), vars, false);
|
const qreal a = Visualization::FindValFromUser(dialogTool->GetAngle(), vars, false);
|
||||||
qDebug() << w << h << a;
|
const qreal v = Visualization::FindValFromUser(dialogTool->GetFormulaVisible(), vars, false);
|
||||||
|
qDebug() << w << h << a << v;
|
||||||
|
|
||||||
VPlaceLabelItem newLabel = VPlaceLabelItem();
|
VPlaceLabelItem newLabel = VPlaceLabelItem();
|
||||||
newLabel.setName(currentLabel.name());
|
newLabel.setName(currentLabel.name());
|
||||||
|
@ -1306,6 +1308,7 @@ void DialogSeamAllowance::PlaceLabelDialogClosed(int result)
|
||||||
newLabel.SetWidth(w, dialogTool->GetWidth());
|
newLabel.SetWidth(w, dialogTool->GetWidth());
|
||||||
newLabel.SetHeight(h, dialogTool->GetHeight());
|
newLabel.SetHeight(h, dialogTool->GetHeight());
|
||||||
newLabel.SetAngle(a, dialogTool->GetAngle());
|
newLabel.SetAngle(a, dialogTool->GetAngle());
|
||||||
|
newLabel.SetVisibilityTrigger(v, dialogTool->GetFormulaVisible());
|
||||||
newLabel.SetLabelType(dialogTool->GetLabelType());
|
newLabel.SetLabelType(dialogTool->GetLabelType());
|
||||||
newLabel.SetCenterPoint(currentLabel.GetCenterPoint());
|
newLabel.SetCenterPoint(currentLabel.GetCenterPoint());
|
||||||
newLabel.SetCorrectionAngle(currentLabel.GetCorrectionAngle());
|
newLabel.SetCorrectionAngle(currentLabel.GetCorrectionAngle());
|
||||||
|
|
|
@ -46,6 +46,7 @@ VToolPlaceLabel *VToolPlaceLabel::Create(QSharedPointer<DialogTool> dialog, VAbs
|
||||||
initData.width = dialogTool->GetWidth();
|
initData.width = dialogTool->GetWidth();
|
||||||
initData.height = dialogTool->GetHeight();
|
initData.height = dialogTool->GetHeight();
|
||||||
initData.angle = dialogTool->GetAngle();
|
initData.angle = dialogTool->GetAngle();
|
||||||
|
initData.visibilityTrigger = dialogTool->GetFormulaVisible();
|
||||||
initData.type = dialogTool->GetLabelType();
|
initData.type = dialogTool->GetLabelType();
|
||||||
initData.centerPoint = dialogTool->GetCenterPoint();
|
initData.centerPoint = dialogTool->GetCenterPoint();
|
||||||
initData.idObject = dialogTool->GetPieceId();
|
initData.idObject = dialogTool->GetPieceId();
|
||||||
|
@ -63,11 +64,13 @@ VToolPlaceLabel *VToolPlaceLabel::Create(VToolPlaceLabelInitData &initData)
|
||||||
const qreal w = qAbs(qApp->toPixel(CheckFormula(initData.id, initData.width, initData.data)));
|
const qreal w = qAbs(qApp->toPixel(CheckFormula(initData.id, initData.width, initData.data)));
|
||||||
const qreal h = qAbs(qApp->toPixel(CheckFormula(initData.id, initData.height, initData.data)));
|
const qreal h = qAbs(qApp->toPixel(CheckFormula(initData.id, initData.height, initData.data)));
|
||||||
const qreal a = CheckFormula(initData.id, initData.angle, initData.data);
|
const qreal a = CheckFormula(initData.id, initData.angle, initData.data);
|
||||||
|
const qreal v = CheckFormula(initData.id, initData.visibilityTrigger, initData.data);
|
||||||
|
|
||||||
QSharedPointer<VPlaceLabelItem> node(new VPlaceLabelItem());
|
QSharedPointer<VPlaceLabelItem> node(new VPlaceLabelItem());
|
||||||
node->SetWidth(w, initData.width);
|
node->SetWidth(w, initData.width);
|
||||||
node->SetHeight(h, initData.height);
|
node->SetHeight(h, initData.height);
|
||||||
node->SetAngle(a, initData.angle);
|
node->SetAngle(a, initData.angle);
|
||||||
|
node->SetVisibilityTrigger(v, initData.visibilityTrigger);
|
||||||
node->SetLabelType(initData.type);
|
node->SetLabelType(initData.type);
|
||||||
node->SetCenterPoint(initData.centerPoint);
|
node->SetCenterPoint(initData.centerPoint);
|
||||||
|
|
||||||
|
@ -159,6 +162,7 @@ void VToolPlaceLabel::AddAttributes(VAbstractPattern *doc, QDomElement &domEleme
|
||||||
doc->SetAttribute(domElement, AttrWidth, label.GetWidthFormula());
|
doc->SetAttribute(domElement, AttrWidth, label.GetWidthFormula());
|
||||||
doc->SetAttribute(domElement, AttrHeight, label.GetHeightFormula());
|
doc->SetAttribute(domElement, AttrHeight, label.GetHeightFormula());
|
||||||
doc->SetAttribute(domElement, AttrAngle, label.GetAngleFormula());
|
doc->SetAttribute(domElement, AttrAngle, label.GetAngleFormula());
|
||||||
|
doc->SetAttribute(domElement, VAbstractPattern::AttrVisible, label.GetVisibilityTrigger());
|
||||||
doc->SetAttribute(domElement, AttrPlaceLabelType, static_cast<int>(label.GetLabelType()));
|
doc->SetAttribute(domElement, AttrPlaceLabelType, static_cast<int>(label.GetLabelType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,8 @@ struct VToolPlaceLabelInitData : VAbstractNodeInitData
|
||||||
height('0'),
|
height('0'),
|
||||||
angle('0'),
|
angle('0'),
|
||||||
type(PlaceLabelType::Button),
|
type(PlaceLabelType::Button),
|
||||||
centerPoint(NULL_ID)
|
centerPoint(NULL_ID),
|
||||||
|
visibilityTrigger('1')
|
||||||
{}
|
{}
|
||||||
|
|
||||||
QString width;
|
QString width;
|
||||||
|
@ -51,6 +52,7 @@ struct VToolPlaceLabelInitData : VAbstractNodeInitData
|
||||||
QString angle;
|
QString angle;
|
||||||
PlaceLabelType type;
|
PlaceLabelType type;
|
||||||
quint32 centerPoint;
|
quint32 centerPoint;
|
||||||
|
QString visibilityTrigger;
|
||||||
};
|
};
|
||||||
|
|
||||||
class VToolPlaceLabel : public VAbstractNode
|
class VToolPlaceLabel : public VAbstractNode
|
||||||
|
|
|
@ -2093,6 +2093,7 @@ QVector<quint32> VToolSeamAllowance::DuplicatePlaceLabels(const QVector<quint32>
|
||||||
initNodeData.width = label->GetWidthFormula();
|
initNodeData.width = label->GetWidthFormula();
|
||||||
initNodeData.height = label->GetHeightFormula();
|
initNodeData.height = label->GetHeightFormula();
|
||||||
initNodeData.angle = label->GetAngleFormula();
|
initNodeData.angle = label->GetAngleFormula();
|
||||||
|
initNodeData.visibilityTrigger = label->GetVisibilityTrigger();
|
||||||
initNodeData.type = label->GetLabelType();
|
initNodeData.type = label->GetLabelType();
|
||||||
initNodeData.centerPoint = label->GetCenterPoint();
|
initNodeData.centerPoint = label->GetCenterPoint();
|
||||||
initNodeData.id = initNodeData.data->AddGObject(new VPlaceLabelItem(*label));
|
initNodeData.id = initNodeData.data->AddGObject(new VPlaceLabelItem(*label));
|
||||||
|
|
|
@ -490,6 +490,7 @@ quint32 AddPlaceLabel(quint32 id, const VToolUnionDetailsInitData &initData, QVe
|
||||||
initNodeData.width = label->GetWidthFormula();
|
initNodeData.width = label->GetWidthFormula();
|
||||||
initNodeData.height = label->GetHeightFormula();
|
initNodeData.height = label->GetHeightFormula();
|
||||||
initNodeData.angle = label->GetAngleFormula();
|
initNodeData.angle = label->GetAngleFormula();
|
||||||
|
initNodeData.visibilityTrigger = label->GetVisibilityTrigger();
|
||||||
initNodeData.type = label->GetLabelType();
|
initNodeData.type = label->GetLabelType();
|
||||||
|
|
||||||
QScopedPointer<VPlaceLabelItem> label1(new VPlaceLabelItem(*label));
|
QScopedPointer<VPlaceLabelItem> label1(new VPlaceLabelItem(*label));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user