From 464a54c7ee5dfc206a0855a80e89320716504999 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 19 Aug 2017 19:52:33 +0300 Subject: [PATCH] Update label after changing date/time format. --HG-- branch : feature --- src/libs/ifc/xml/vabstractpattern.cpp | 2 ++ src/libs/vlayout/vlayoutpiece.cpp | 2 +- src/libs/vlayout/vlayoutpiece.h | 2 +- src/libs/vlayout/vtextmanager.cpp | 3 ++- src/libs/vlayout/vtextmanager.h | 2 +- src/libs/vwidgets/vtextgraphicsitem.cpp | 2 +- src/libs/vwidgets/vtextgraphicsitem.h | 2 +- 7 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 1683610cb..2985fe318 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -1349,6 +1349,7 @@ void VAbstractPattern::SetLabelDateFormat(const QString &format) { QDomElement tag = CheckTagExists(TagPatternLabel); SetAttribute(tag, AttrDateFormat, format); + patternLabelWasChanged = true; modified = true; emit patternChanged(false); } @@ -1373,6 +1374,7 @@ void VAbstractPattern::SetLabelTimeFormat(const QString &format) { QDomElement tag = CheckTagExists(TagPatternLabel); SetAttribute(tag, AttrTimeFormat, format); + patternLabelWasChanged = true; modified = true; emit patternChanged(false); } diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index 2655f9068..9b66429d3 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -543,7 +543,7 @@ QStringList VLayoutPiece::GetPatternText() const } //--------------------------------------------------------------------------------------------------------------------- -void VLayoutPiece::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternLabelData& geom, const QFont &font, +void VLayoutPiece::SetPatternInfo(VAbstractPattern* pDoc, const VPatternLabelData& geom, const QFont &font, const VContainer *pattern) { QPointF ptPos; diff --git a/src/libs/vlayout/vlayoutpiece.h b/src/libs/vlayout/vlayoutpiece.h index 194460ab5..2a0c9a5ad 100644 --- a/src/libs/vlayout/vlayoutpiece.h +++ b/src/libs/vlayout/vlayoutpiece.h @@ -95,7 +95,7 @@ public: QPointF GetPatternTextPosition() const; QStringList GetPatternText() const; - void SetPatternInfo(const VAbstractPattern* pDoc, const VPatternLabelData& geom, const QFont& font, + void SetPatternInfo(VAbstractPattern *pDoc, const VPatternLabelData& geom, const QFont& font, const VContainer *pattern); void SetGrainline(const VGrainlineData& geom, const VContainer *pattern); diff --git a/src/libs/vlayout/vtextmanager.cpp b/src/libs/vlayout/vtextmanager.cpp index 55522db77..8ca64f1a2 100644 --- a/src/libs/vlayout/vtextmanager.cpp +++ b/src/libs/vlayout/vtextmanager.cpp @@ -346,7 +346,7 @@ void VTextManager::Update(const QString& qsName, const VPieceLabelData& data) * @brief VTextManager::Update updates the text lines with pattern info * @param pDoc pointer to the abstract pattern object */ -void VTextManager::Update(const VAbstractPattern *pDoc) +void VTextManager::Update(VAbstractPattern *pDoc) { m_liLines.clear(); @@ -365,6 +365,7 @@ void VTextManager::Update(const VAbstractPattern *pDoc) lines[i].line = ReplacePlaceholders(placeholders, lines.at(i).line); } + pDoc->SetPatternWasChanged(false); m_patternLabelLines = PrepareLines(lines); } diff --git a/src/libs/vlayout/vtextmanager.h b/src/libs/vlayout/vtextmanager.h index b5df15baf..1acaad8fb 100644 --- a/src/libs/vlayout/vtextmanager.h +++ b/src/libs/vlayout/vtextmanager.h @@ -84,7 +84,7 @@ public: const TextLine& GetSourceLine(int i) const; void Update(const QString& qsName, const VPieceLabelData& data); - void Update(const VAbstractPattern* pDoc); + void Update(VAbstractPattern* pDoc); private: QFont m_font; diff --git a/src/libs/vwidgets/vtextgraphicsitem.cpp b/src/libs/vwidgets/vtextgraphicsitem.cpp index 9cc1121a5..ce28ee4d6 100644 --- a/src/libs/vwidgets/vtextgraphicsitem.cpp +++ b/src/libs/vwidgets/vtextgraphicsitem.cpp @@ -343,7 +343,7 @@ void VTextGraphicsItem::UpdateData(const QString &qsName, const VPieceLabelData * @brief VTextGraphicsItem::UpdateData Updates the pattern label * @param pDoc pointer to the pattern object */ -void VTextGraphicsItem::UpdateData(const VAbstractPattern* pDoc) +void VTextGraphicsItem::UpdateData(VAbstractPattern* pDoc) { m_tm.Update(pDoc); } diff --git a/src/libs/vwidgets/vtextgraphicsitem.h b/src/libs/vwidgets/vtextgraphicsitem.h index be29a12f1..0b321ca07 100644 --- a/src/libs/vwidgets/vtextgraphicsitem.h +++ b/src/libs/vwidgets/vtextgraphicsitem.h @@ -66,7 +66,7 @@ public: void SetSize(qreal fW, qreal fH); bool IsContained(QRectF rectBB, qreal dRot, qreal& dX, qreal& dY) const; void UpdateData(const QString& qsName, const VPieceLabelData& data); - void UpdateData(const VAbstractPattern* pDoc); + void UpdateData(VAbstractPattern* pDoc); int GetTextLines() const; protected: