summaryrefslogtreecommitdiffstats
path: root/src/datavisualization/data/qbar3dseries.cpp
diff options
context:
space:
mode:
authorSami Varanka <sami.varanka@qt.io>2021-09-29 14:53:35 +0300
committerSami Varanka <sami.varanka@qt.io>2021-10-08 13:47:25 +0300
commit6d31e42632f0779212b2a265f3c9a7c97a0e63b0 (patch)
treeaa59e7a7d845c8f5bb44f5690b8c08764975736a /src/datavisualization/data/qbar3dseries.cpp
parent9f9d5bc9d45ea99726cc23b5552cce19918771b9 (diff)
Add row colors for Bar3DSeries
Added rowColors property for Bar3DSeries. The property can be used draw the individual rows in the series in different colors. Autotests and a manualtest for the property were added also. Fixes: QTBUG-96682 Change-Id: I5c4f778189d079206500a9289490792584eab2b9 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/datavisualization/data/qbar3dseries.cpp')
-rw-r--r--src/datavisualization/data/qbar3dseries.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/datavisualization/data/qbar3dseries.cpp b/src/datavisualization/data/qbar3dseries.cpp
index afc3b3ba..1cd4c754 100644
--- a/src/datavisualization/data/qbar3dseries.cpp
+++ b/src/datavisualization/data/qbar3dseries.cpp
@@ -147,6 +147,18 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ * \qmlproperty list<ThemeColor> Bar3DSeries::rowColors
+ * \since 6.3
+ * This property can be used to draw the rows of the series in different colors.
+ * The \l{Theme3D::colorStyle}{Theme3D.colorStyle} must be set to
+ * \c ColorStyleUniform to use this property.
+ * \note If the property is set and the theme is changed,
+ * the rowColors list is not cleared automatically.
+ *
+ * \sa Q3DTheme::ColorStyleUniform
+ */
+
+/*!
* Constructsa bar 3D series with the parent \a parent.
*/
QBar3DSeries::QBar3DSeries(QObject *parent) :
@@ -282,6 +294,27 @@ float QBar3DSeries::meshAngle() const
}
/*!
+ * \property QBar3DSeries::rowColors
+ * \since 6.3
+ *
+ * \brief The list of row colors in the series.
+ *
+ * This property can be used to color
+ * the rows of the series in different colors.
+ * The Q3DTheme::ColorStyle must be set to
+ * Q3DTheme::ColorStyleUniform to use this property.
+ *
+ * \sa Q3DTheme::ColorStyleUniform
+ */
+void QBar3DSeries::setRowColors(const QList<QColor> &colors)
+{
+ dptr()->setRowColors(colors);
+}
+QList<QColor> QBar3DSeries::rowColors() const
+{
+ return dptrc()->m_rowColors;
+}
+/*!
* \internal
*/
QBar3DSeriesPrivate *QBar3DSeries::dptr()
@@ -355,6 +388,8 @@ void QBar3DSeriesPrivate::connectControllerAndProxy(Abstract3DController *newCon
&Bars3DController::handleDataColumnLabelsChanged);
QObject::connect(qptr(), &QBar3DSeries::dataProxyChanged, controller,
&Bars3DController::handleArrayReset);
+ QObject::connect(qptr(), &QBar3DSeries::rowColorsChanged, controller,
+ &Bars3DController::handleRowColorsChanged);
}
}
@@ -432,4 +467,12 @@ void QBar3DSeriesPrivate::connectSignals()
&QBar3DSeriesPrivate::handleMeshRotationChanged);
}
+void QBar3DSeriesPrivate::setRowColors(const QList<QColor> &colors)
+{
+ if (m_rowColors != colors) {
+ m_rowColors = colors;
+ emit qptr()->rowColorsChanged(m_rowColors);
+ }
+}
+
QT_END_NAMESPACE