From cfe341e7b94a21d4ad444e983f7072c13157b317 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 2 Jan 2023 14:19:46 +0200 Subject: [PATCH] Placeholder for area units. #193 --- src/libs/vlayout/vtextmanager.cpp | 4 +++- src/libs/vmisc/literals.cpp | 1 + src/libs/vmisc/literals.h | 1 + src/libs/vtools/dialogs/support/dialogeditlabel.cpp | 6 ++++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/libs/vlayout/vtextmanager.cpp b/src/libs/vlayout/vtextmanager.cpp index b9738657e..f3880a064 100644 --- a/src/libs/vlayout/vtextmanager.cpp +++ b/src/libs/vlayout/vtextmanager.cpp @@ -189,8 +189,10 @@ auto PreparePlaceholders(const VAbstractPattern *doc, const VContainer *data) -> placeholders.insert(pl_author, doc->GetCompanyName()); placeholders.insert(pl_mUnits, UnitsToStr(VAbstractValApplication::VApp()->MeasurementsUnits(), true)); - placeholders.insert(pl_pUnits, UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true)); + const QString pUnits = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true); + placeholders.insert(pl_pUnits, pUnits); placeholders.insert(pl_mSizeUnits, UnitsToStr(VAbstractValApplication::VApp()->DimensionSizeUnits(), true)); + placeholders.insert(pl_areaUnits, pUnits + QStringLiteral("²")); if (VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Individual) { diff --git a/src/libs/vmisc/literals.cpp b/src/libs/vmisc/literals.cpp index 66fe758f9..eee3f9bd3 100644 --- a/src/libs/vmisc/literals.cpp +++ b/src/libs/vmisc/literals.cpp @@ -138,6 +138,7 @@ const QString pl_mFileName = QStringLiteral("mFileName"); const QString pl_mExt = QStringLiteral("mExt"); const QString pl_mUnits = QStringLiteral("mUnits"); const QString pl_mSizeUnits = QStringLiteral("mSizeUnits"); +const QString pl_areaUnits = QStringLiteral("areaUnits"); const QString pl_pLetter = QStringLiteral("pLetter"); const QString pl_pAnnotation = QStringLiteral("pAnnotation"); const QString pl_pOrientation = QStringLiteral("pOrientation"); diff --git a/src/libs/vmisc/literals.h b/src/libs/vmisc/literals.h index c7a359db6..a3508a9e6 100644 --- a/src/libs/vmisc/literals.h +++ b/src/libs/vmisc/literals.h @@ -121,6 +121,7 @@ extern const QString pl_mFileName; extern const QString pl_mExt; extern const QString pl_mUnits; extern const QString pl_mSizeUnits; +extern const QString pl_areaUnits; extern const QString pl_pLetter; extern const QString pl_pAnnotation; extern const QString pl_pOrientation; diff --git a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp index a83b608a6..918952283 100644 --- a/src/libs/vtools/dialogs/support/dialogeditlabel.cpp +++ b/src/libs/vtools/dialogs/support/dialogeditlabel.cpp @@ -519,11 +519,13 @@ void DialogEditLabel::InitPlaceholders() m_placeholders.insert(pl_mUnits, qMakePair(tr("Measurements units"), UnitsToStr(VAbstractValApplication::VApp()->MeasurementsUnits(), true))); - m_placeholders.insert(pl_pUnits, qMakePair(tr("Pattern units"), - UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true))); + + const QString pUnits = UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true); + m_placeholders.insert(pl_pUnits, qMakePair(tr("Pattern units"), pUnits)); m_placeholders.insert(pl_mSizeUnits, qMakePair(tr("Size units"), UnitsToStr(VAbstractValApplication::VApp()->DimensionSizeUnits(), true))); + m_placeholders.insert(pl_areaUnits, qMakePair(tr("Area units"), pUnits + QStringLiteral("²"))); if (VAbstractValApplication::VApp()->GetMeasurementsType() == MeasurementsType::Individual) {