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.
|
||||
- [#862] Force Valentina to immediately terminate if a pattern contains a parsing warning.
|
||||
- [#865] New feature. Dynamic Way to define Material in piece label.
|
||||
- [#867] Visibility control for place labels.
|
||||
|
||||
# Version 0.5.1 (unreleased)
|
||||
- [#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");
|
||||
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')));
|
||||
|
||||
VToolPlaceLabel::Create(initData);
|
||||
|
||||
//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, AttrHeight, initData.height);
|
||||
SetAttribute(domElement, AttrAngle, initData.angle);
|
||||
SetAttribute(domElement, VAbstractPattern::AttrVisible, initData.visibilityTrigger);
|
||||
modified = true;
|
||||
haveLiteChange();
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
<file>schema/pattern/v0.7.6.xsd</file>
|
||||
<file>schema/pattern/v0.7.7.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.4.0.xsd</file>
|
||||
<file>schema/standard_measurements/v0.4.1.xsd</file>
|
||||
|
@ -63,5 +64,5 @@
|
|||
<file>schema/individual_measurements/v0.3.3.xsd</file>
|
||||
<file>schema/individual_measurements/v0.4.0.xsd</file>
|
||||
<file>schema/label_template/v1.0.0.xsd</file>
|
||||
</qresource>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
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::PatternMaxVerStr = QStringLiteral("0.7.8");
|
||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.7.8.xsd");
|
||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.7.9");
|
||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.7.9.xsd");
|
||||
|
||||
//VPatternConverter::PatternMinVer; // <== 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(0x000706, QStringLiteral("://schema/pattern/v0.7.6.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))
|
||||
|
@ -443,6 +444,10 @@ void VPatternConverter::ApplyPatches()
|
|||
ValidateXML(XSDSchema(0x000708), m_convertedFileName);
|
||||
V_FALLTHROUGH
|
||||
case (0x000708):
|
||||
ToV0_7_9();
|
||||
ValidateXML(XSDSchema(0x000709), m_convertedFileName);
|
||||
V_FALLTHROUGH
|
||||
case (0x000709):
|
||||
break;
|
||||
default:
|
||||
InvalidVersion(m_ver);
|
||||
|
@ -460,7 +465,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion()
|
|||
bool VPatternConverter::IsReadOnly() const
|
||||
{
|
||||
// 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.");
|
||||
|
||||
// Possibly in future attribute readOnly will change position etc.
|
||||
|
@ -1014,6 +1019,15 @@ void VPatternConverter::ToV0_7_8()
|
|||
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()
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
static const QString PatternMaxVerStr;
|
||||
static const QString CurrentSchema;
|
||||
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:
|
||||
virtual int MinVer() const override;
|
||||
|
@ -121,6 +121,7 @@ private:
|
|||
void ToV0_7_6();
|
||||
void ToV0_7_7();
|
||||
void ToV0_7_8();
|
||||
void ToV0_7_9();
|
||||
|
||||
void TagUnitToV0_2_0();
|
||||
void TagIncrementToV0_2_0();
|
||||
|
|
|
@ -125,6 +125,41 @@ void VPlaceLabelItem::SetAngle(qreal value, const QString &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
|
||||
{
|
||||
|
|
|
@ -68,6 +68,11 @@ public:
|
|||
qreal GetAngle() const;
|
||||
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;
|
||||
void SetCorrectionAngle(qreal value);
|
||||
|
||||
|
|
|
@ -44,12 +44,14 @@ public:
|
|||
: width(),
|
||||
height(),
|
||||
angle('0'),
|
||||
visibilityTrigger('1'),
|
||||
type(PlaceLabelType::Button),
|
||||
centerPoint(0),
|
||||
wValue(0),
|
||||
hValue(0),
|
||||
aValue(0),
|
||||
correctionAngle(0)
|
||||
correctionAngle(0),
|
||||
isVisible(1)
|
||||
{}
|
||||
|
||||
VPlaceLabelItemData(const VPlaceLabelItemData &item)
|
||||
|
@ -57,12 +59,14 @@ public:
|
|||
width(item.width),
|
||||
height(item.height),
|
||||
angle(item.angle),
|
||||
visibilityTrigger(item.visibilityTrigger),
|
||||
type(item.type),
|
||||
centerPoint(item.centerPoint),
|
||||
wValue(item.wValue),
|
||||
hValue(item.hValue),
|
||||
aValue(item.aValue),
|
||||
correctionAngle(item.correctionAngle)
|
||||
correctionAngle(item.correctionAngle),
|
||||
isVisible(item.isVisible)
|
||||
{}
|
||||
|
||||
virtual ~VPlaceLabelItemData();
|
||||
|
@ -70,6 +74,7 @@ public:
|
|||
QString width;
|
||||
QString height;
|
||||
QString angle;
|
||||
QString visibilityTrigger;
|
||||
PlaceLabelType type;
|
||||
quint32 centerPoint;
|
||||
|
||||
|
@ -77,6 +82,7 @@ public:
|
|||
qreal hValue;
|
||||
qreal aValue;
|
||||
qreal correctionAngle;
|
||||
qreal isVisible;
|
||||
|
||||
private:
|
||||
VPlaceLabelItemData &operator=(const VPlaceLabelItemData &) Q_DECL_EQ_DELETE;
|
||||
|
|
|
@ -352,11 +352,14 @@ QVector<VLayoutPlaceLabel> ConvertPlaceLabels(const VPiece &piece, const VContai
|
|||
for(auto placeLabel : placeLabels)
|
||||
{
|
||||
const auto label = pattern->GeometricObject<VPlaceLabelItem>(placeLabel);
|
||||
VLayoutPlaceLabel layoutLabel;
|
||||
layoutLabel.shape = label->LabelShape();
|
||||
layoutLabel.center = label->toQPointF();
|
||||
layoutLabel.type = label->GetLabelType();
|
||||
labels.append(layoutLabel);
|
||||
if (label->IsVisible())
|
||||
{
|
||||
VLayoutPlaceLabel layoutLabel;
|
||||
layoutLabel.shape = label->LabelShape();
|
||||
layoutLabel.center = label->toQPointF();
|
||||
layoutLabel.type = label->GetLabelType();
|
||||
labels.append(layoutLabel);
|
||||
}
|
||||
}
|
||||
return labels;
|
||||
}
|
||||
|
|
|
@ -452,7 +452,10 @@ QVector<PlaceLabelImg> VPiece::PlaceLabelPoints(const VContainer *data) const
|
|||
try
|
||||
{
|
||||
const auto label = data->GeometricObject<VPlaceLabelItem>(placeLabel);
|
||||
points.append(label->LabelShape());
|
||||
if (label->IsVisible())
|
||||
{
|
||||
points.append(label->LabelShape());
|
||||
}
|
||||
}
|
||||
catch (const VExceptionBadId &e)
|
||||
{
|
||||
|
|
|
@ -45,50 +45,27 @@ DialogPlaceLabel::DialogPlaceLabel(const VContainer *data, quint32 toolId, QWidg
|
|||
m_flagWidth(false),
|
||||
m_flagHeight(false),
|
||||
m_flagAngle(false),
|
||||
m_flagFormulaVisible(false),
|
||||
m_formulaBaseHeightWidth(0),
|
||||
m_formulaBaseHeightHeight(0),
|
||||
m_formulaBaseHeightAngle(0),
|
||||
m_formulaBaseVisible(0),
|
||||
timerAngle(new QTimer(this)),
|
||||
timerWidth(new QTimer(this)),
|
||||
timerHeight(new QTimer(this))
|
||||
timerHeight(new QTimer(this)),
|
||||
m_timerVisible(new QTimer(this))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
InitOkCancel(ui);
|
||||
|
||||
FillComboBoxPoints(ui->comboBoxPoint);
|
||||
FillPlaceLabelTypes();
|
||||
InitPlaceLabelTab();
|
||||
InitControlTab();
|
||||
|
||||
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())));
|
||||
EvalVisible();
|
||||
|
||||
flagError = false;
|
||||
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]()
|
||||
{
|
||||
CheckPieces();
|
||||
|
@ -287,7 +264,7 @@ void DialogPlaceLabel::ChosenObject(quint32 id, const SceneObject &type)
|
|||
void DialogPlaceLabel::CheckState()
|
||||
{
|
||||
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->plainTextEditFormulaHeight->blockSignals(true);
|
||||
ui->plainTextEditFormulaAngle->blockSignals(true);
|
||||
ui->plainTextEditFormulaVisible->blockSignals(true);
|
||||
DialogTool::closeEvent(event);
|
||||
}
|
||||
|
||||
|
@ -326,6 +304,12 @@ void DialogPlaceLabel::DeployFormulaAngleEdit()
|
|||
DeployFormula(ui->plainTextEditFormulaAngle, ui->pushButtonGrowAngle, m_formulaBaseHeightAngle);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPlaceLabel::DeployVisibleFormulaTextEdit()
|
||||
{
|
||||
DeployFormula(ui->plainTextEditFormulaVisible, ui->pushButtonGrowVisible, m_formulaBaseVisible);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPlaceLabel::FormulaWidthChanged()
|
||||
{
|
||||
|
@ -352,6 +336,14 @@ void DialogPlaceLabel::FormulaAngleChanged()
|
|||
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()
|
||||
{
|
||||
|
@ -378,6 +370,14 @@ void DialogPlaceLabel::EvalAngle()
|
|||
false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogPlaceLabel::EvalVisible()
|
||||
{
|
||||
labelEditFormula = ui->labelEditVisible;
|
||||
QString formula = ui->plainTextEditFormulaVisible->toPlainText();
|
||||
Eval(formula, m_flagFormulaVisible, ui->labelResultVisible, QString(), false, true);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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()
|
||||
{
|
||||
|
@ -469,3 +530,23 @@ void DialogPlaceLabel::CheckPoint()
|
|||
ChangeColor(ui->labelPoint, color);
|
||||
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;
|
||||
void SetPieceId(quint32 id);
|
||||
|
||||
QString GetFormulaVisible() const;
|
||||
void SetFormulaVisible(const QString &formula);
|
||||
|
||||
virtual void SetPiecesList(const QVector<quint32> &list) override;
|
||||
|
||||
public slots:
|
||||
|
@ -79,18 +82,22 @@ private slots:
|
|||
void DeployFormulaWidthEdit();
|
||||
void DeployFormulaHeightEdit();
|
||||
void DeployFormulaAngleEdit();
|
||||
void DeployVisibleFormulaTextEdit();
|
||||
|
||||
void FormulaWidthChanged();
|
||||
void FormulaHeightChanged();
|
||||
void FormulaAngleChanged();
|
||||
void VisibleChanged();
|
||||
|
||||
void EvalWidth();
|
||||
void EvalHeight();
|
||||
void EvalAngle();
|
||||
void EvalVisible();
|
||||
|
||||
void FXWidth();
|
||||
void FXHeight();
|
||||
void FXAngle();
|
||||
void FXVisible();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogPlaceLabel)
|
||||
|
@ -100,15 +107,21 @@ private:
|
|||
bool m_flagWidth;
|
||||
bool m_flagHeight;
|
||||
bool m_flagAngle;
|
||||
bool m_flagFormulaVisible;
|
||||
|
||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||
int m_formulaBaseHeightWidth;
|
||||
int m_formulaBaseHeightHeight;
|
||||
int m_formulaBaseHeightAngle;
|
||||
int m_formulaBaseVisible;
|
||||
|
||||
QTimer *timerAngle;
|
||||
QTimer *timerWidth;
|
||||
QTimer *timerHeight;
|
||||
QTimer *m_timerVisible;
|
||||
|
||||
void InitPlaceLabelTab();
|
||||
void InitControlTab();
|
||||
|
||||
void FillPlaceLabelTypes();
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -843,6 +843,7 @@ void DialogSeamAllowance::ShowPlaceLabelsContextMenu(const QPoint &pos)
|
|||
dialog->SetWidth(currentLabel.GetWidthFormula());
|
||||
dialog->SetHeight(currentLabel.GetHeightFormula());
|
||||
dialog->SetAngle(currentLabel.GetAngleFormula());
|
||||
dialog->SetFormulaVisible(currentLabel.GetVisibilityTrigger());
|
||||
dialog->SetPieceId(toolId);
|
||||
dialog->EnbleShowMode(true);
|
||||
m_dialog = dialog;
|
||||
|
@ -1295,7 +1296,8 @@ void DialogSeamAllowance::PlaceLabelDialogClosed(int result)
|
|||
const qreal w = qAbs(Visualization::FindLengthFromUser(dialogTool->GetWidth(), vars, false));
|
||||
const qreal h = qAbs(Visualization::FindLengthFromUser(dialogTool->GetHeight(), 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();
|
||||
newLabel.setName(currentLabel.name());
|
||||
|
@ -1306,6 +1308,7 @@ void DialogSeamAllowance::PlaceLabelDialogClosed(int result)
|
|||
newLabel.SetWidth(w, dialogTool->GetWidth());
|
||||
newLabel.SetHeight(h, dialogTool->GetHeight());
|
||||
newLabel.SetAngle(a, dialogTool->GetAngle());
|
||||
newLabel.SetVisibilityTrigger(v, dialogTool->GetFormulaVisible());
|
||||
newLabel.SetLabelType(dialogTool->GetLabelType());
|
||||
newLabel.SetCenterPoint(currentLabel.GetCenterPoint());
|
||||
newLabel.SetCorrectionAngle(currentLabel.GetCorrectionAngle());
|
||||
|
|
|
@ -46,6 +46,7 @@ VToolPlaceLabel *VToolPlaceLabel::Create(QSharedPointer<DialogTool> dialog, VAbs
|
|||
initData.width = dialogTool->GetWidth();
|
||||
initData.height = dialogTool->GetHeight();
|
||||
initData.angle = dialogTool->GetAngle();
|
||||
initData.visibilityTrigger = dialogTool->GetFormulaVisible();
|
||||
initData.type = dialogTool->GetLabelType();
|
||||
initData.centerPoint = dialogTool->GetCenterPoint();
|
||||
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 h = qAbs(qApp->toPixel(CheckFormula(initData.id, initData.height, 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());
|
||||
node->SetWidth(w, initData.width);
|
||||
node->SetHeight(h, initData.height);
|
||||
node->SetAngle(a, initData.angle);
|
||||
node->SetVisibilityTrigger(v, initData.visibilityTrigger);
|
||||
node->SetLabelType(initData.type);
|
||||
node->SetCenterPoint(initData.centerPoint);
|
||||
|
||||
|
@ -159,6 +162,7 @@ void VToolPlaceLabel::AddAttributes(VAbstractPattern *doc, QDomElement &domEleme
|
|||
doc->SetAttribute(domElement, AttrWidth, label.GetWidthFormula());
|
||||
doc->SetAttribute(domElement, AttrHeight, label.GetHeightFormula());
|
||||
doc->SetAttribute(domElement, AttrAngle, label.GetAngleFormula());
|
||||
doc->SetAttribute(domElement, VAbstractPattern::AttrVisible, label.GetVisibilityTrigger());
|
||||
doc->SetAttribute(domElement, AttrPlaceLabelType, static_cast<int>(label.GetLabelType()));
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,8 @@ struct VToolPlaceLabelInitData : VAbstractNodeInitData
|
|||
height('0'),
|
||||
angle('0'),
|
||||
type(PlaceLabelType::Button),
|
||||
centerPoint(NULL_ID)
|
||||
centerPoint(NULL_ID),
|
||||
visibilityTrigger('1')
|
||||
{}
|
||||
|
||||
QString width;
|
||||
|
@ -51,6 +52,7 @@ struct VToolPlaceLabelInitData : VAbstractNodeInitData
|
|||
QString angle;
|
||||
PlaceLabelType type;
|
||||
quint32 centerPoint;
|
||||
QString visibilityTrigger;
|
||||
};
|
||||
|
||||
class VToolPlaceLabel : public VAbstractNode
|
||||
|
|
|
@ -2093,6 +2093,7 @@ QVector<quint32> VToolSeamAllowance::DuplicatePlaceLabels(const QVector<quint32>
|
|||
initNodeData.width = label->GetWidthFormula();
|
||||
initNodeData.height = label->GetHeightFormula();
|
||||
initNodeData.angle = label->GetAngleFormula();
|
||||
initNodeData.visibilityTrigger = label->GetVisibilityTrigger();
|
||||
initNodeData.type = label->GetLabelType();
|
||||
initNodeData.centerPoint = label->GetCenterPoint();
|
||||
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.height = label->GetHeightFormula();
|
||||
initNodeData.angle = label->GetAngleFormula();
|
||||
initNodeData.visibilityTrigger = label->GetVisibilityTrigger();
|
||||
initNodeData.type = label->GetLabelType();
|
||||
|
||||
QScopedPointer<VPlaceLabelItem> label1(new VPlaceLabelItem(*label));
|
||||
|
|
Loading…
Reference in New Issue
Block a user