diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2019-10-07 17:49:59 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2019-10-08 11:14:00 +0300 |
commit | e0b267cfb7c5f6ee84e66c52efb4dffb0c750984 (patch) | |
tree | f4d3ddd9deca6234b6d05ae3458117545126f6d9 /src | |
parent | 73efdb1066dcf5b4690de44f712f3de4d5f1fc18 (diff) |
Pass CategoryRange label change to parent QCategoryAxis
Fixes: QTBUG-78439
Change-Id: I1c0de505c73ea42e67947fed91a535a117a2ad5b
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/chartsqml2/declarativecategoryaxis.cpp | 8 | ||||
-rw-r--r-- | src/chartsqml2/declarativecategoryaxis_p.h | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/chartsqml2/declarativecategoryaxis.cpp b/src/chartsqml2/declarativecategoryaxis.cpp index 1b1826fd..8f6a2b20 100644 --- a/src/chartsqml2/declarativecategoryaxis.cpp +++ b/src/chartsqml2/declarativecategoryaxis.cpp @@ -64,6 +64,14 @@ DeclarativeCategoryRange::DeclarativeCategoryRange(QObject *parent) : { } +void DeclarativeCategoryRange::setLabel(const QString &label) +{ + auto catAxis = qobject_cast<QCategoryAxis *>(parent()); + if (catAxis) + catAxis->replaceLabel(m_label, label); + m_label = label; +} + DeclarativeCategoryAxis::DeclarativeCategoryAxis(QObject *parent) : QCategoryAxis(parent), m_labelsPosition(AxisLabelsPositionCenter) diff --git a/src/chartsqml2/declarativecategoryaxis_p.h b/src/chartsqml2/declarativecategoryaxis_p.h index 9bcd7ba8..1c1ba850 100644 --- a/src/chartsqml2/declarativecategoryaxis_p.h +++ b/src/chartsqml2/declarativecategoryaxis_p.h @@ -58,7 +58,7 @@ public: qreal endValue() { return m_endValue; } void setEndValue(qreal endValue) { m_endValue = endValue; } QString label() { return m_label; } - void setLabel(QString label) { m_label = label; } + void setLabel(const QString &label); private: qreal m_endValue; |