From 9a2b68a8255b716033ec3f26b436ea093a195590 Mon Sep 17 00:00:00 2001 From: Kwanghyo Park Date: Tue, 15 Jul 2025 12:47:35 +0300 Subject: [PATCH] Graphs: rename drawOrder property to zValue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on API review: the drawOrder property has been renamed to zValue for consistency within the Qt Graphics API. Pick-to: 6.10 Task-number: QTBUG-137478 Change-Id: I8b82a998ca2d5165169d3184c493708b3214f24a Reviewed-by: Tomi Korpipää --- src/graphs2d/qabstractseries.cpp | 18 +++++++-------- src/graphs2d/qabstractseries.h | 9 ++++---- src/graphs2d/qgraphsview.cpp | 26 +++++++++++----------- src/graphs2d/qsgrenderer/barsrenderer.cpp | 4 ++-- src/graphs2d/qsgrenderer/pointrenderer.cpp | 2 +- 5 files changed, 29 insertions(+), 30 deletions(-) diff --git a/src/graphs2d/qabstractseries.cpp b/src/graphs2d/qabstractseries.cpp index 85394324..34d3f305 100644 --- a/src/graphs2d/qabstractseries.cpp +++ b/src/graphs2d/qabstractseries.cpp @@ -203,21 +203,21 @@ QT_BEGIN_NAMESPACE */ /*! - \property QAbstractSeries::drawOrder + \property QAbstractSeries::zValue \brief Controls the order in which the series is drawn \since 6.10 - The series list of GraphsView is sorted by the drawOrder property. Since each series type is + The series list of GraphsView is sorted by the zValue property. Since each series type is rendered at once, the order mostly works as an internal order of each series type. The highest - drawOrder of each series type determines the order of rendering among series types. The default + zValue of each series type determines the order of rendering among series types. The default value is 0. */ /*! - \qmlproperty int AbstractSeries::drawOrder + \qmlproperty int AbstractSeries::zValue \since 6.10 - The series list of GraphsView is sorted by the drawOrder property. Since each series type is + The series list of GraphsView is sorted by the zValue property. Since each series type is rendered at once, the order mostly works as an internal order of each series type. The highest - drawOrder of each series type determines the order of rendering among series types. The default + zValue of each series type determines the order of rendering among series types. The default value is 0. */ @@ -528,20 +528,20 @@ void QAbstractSeries::setValuesMultiplier(qreal valuesMultiplier) } } -int QAbstractSeries::drawOrder() const +int QAbstractSeries::zValue() const { Q_D(const QAbstractSeries); return d->m_drawOrder; } -void QAbstractSeries::setDrawOrder(int newDrawOrder) +void QAbstractSeries::setZValue(int newDrawOrder) { Q_D(QAbstractSeries); if (d->m_drawOrder == newDrawOrder) return; d->m_drawOrder = newDrawOrder; update(); - emit drawOrderChanged(newDrawOrder); + emit zValueChanged(newDrawOrder); } /*! diff --git a/src/graphs2d/qabstractseries.h b/src/graphs2d/qabstractseries.h index 409aa754..c377e7ee 100644 --- a/src/graphs2d/qabstractseries.h +++ b/src/graphs2d/qabstractseries.h @@ -50,7 +50,7 @@ class Q_GRAPHS_EXPORT QAbstractSeries : public QObject, public QQmlParserStatus Q_PROPERTY(bool hovered READ isHovered NOTIFY hoveredChanged REVISION(6, 10)) Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION(6, 10)) Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION(6, 10)) - Q_PROPERTY(int drawOrder READ drawOrder WRITE setDrawOrder NOTIFY drawOrderChanged REVISION(6, 10)) + Q_PROPERTY(int zValue READ zValue WRITE setZValue NOTIFY zValueChanged REVISION(6, 10)) Q_CLASSINFO("DefaultProperty", "seriesChildren") QML_ANONYMOUS @@ -115,8 +115,8 @@ public: QAbstractAxis *axisY() const; void setAxisY(QAbstractAxis *newAxisY); - int drawOrder() const; - void setDrawOrder(int newDrawOrder); + int zValue() const; + void setZValue(int newDrawOrder); Q_SIGNALS: void update(); @@ -134,8 +134,7 @@ Q_SIGNALS: Q_REVISION(6, 10) void axisXChanged(QAbstractAxis *newAxis); Q_REVISION(6, 10) void axisYChanged(QAbstractAxis *newAxis); - - Q_REVISION(6, 10) void drawOrderChanged(int newDrawOrder); + Q_REVISION(6, 10) void zValueChanged(int z); protected: friend class BarsRenderer; diff --git a/src/graphs2d/qgraphsview.cpp b/src/graphs2d/qgraphsview.cpp index 6a67830b..c5ad8261 100644 --- a/src/graphs2d/qgraphsview.cpp +++ b/src/graphs2d/qgraphsview.cpp @@ -861,7 +861,7 @@ void QGraphsView::updatePolish() auto series2 = qobject_cast(rhs); if (series1 && series2) - return series1->drawOrder() < series2->drawOrder(); + return series1->zValue() < series2->zValue(); return false; }); @@ -892,8 +892,8 @@ void QGraphsView::updatePolish() if (m_barsRenderer) { if (auto barSeries = qobject_cast(series)) { m_barsRenderer->handlePolish(barSeries, barSeriesIndex, barSeriesCount); - if (barSeries->drawOrder() > highestBarsZ) - highestBarsZ = barSeries->drawOrder(); + if (barSeries->zValue() > highestBarsZ) + highestBarsZ = barSeries->zValue(); barSeriesIndex++; } } @@ -904,24 +904,24 @@ void QGraphsView::updatePolish() #ifdef USE_LINEGRAPH if (auto lineSeries = qobject_cast(series)) { m_pointRenderer->handlePolish(lineSeries); - if (lineSeries->drawOrder() > highestPointZ) - highestPointZ = lineSeries->drawOrder(); + if (lineSeries->zValue() > highestPointZ) + highestPointZ = lineSeries->zValue(); } #endif #ifdef USE_SCATTERGRAPH if (auto scatterSeries = qobject_cast(series)) { m_pointRenderer->handlePolish(scatterSeries); - if (scatterSeries->drawOrder() > highestPointZ) - highestPointZ = scatterSeries->drawOrder(); + if (scatterSeries->zValue() > highestPointZ) + highestPointZ = scatterSeries->zValue(); } #endif #ifdef USE_SPLINEGRAPH if (auto splineSeries = qobject_cast(series)) { m_pointRenderer->handlePolish(splineSeries); - if (splineSeries->drawOrder() > highestPointZ) - highestPointZ = splineSeries->drawOrder(); + if (splineSeries->zValue() > highestPointZ) + highestPointZ = splineSeries->zValue(); } #endif } @@ -931,8 +931,8 @@ void QGraphsView::updatePolish() if (m_pieRenderer) { if (auto pieSeries = qobject_cast(series)) { m_pieRenderer->handlePolish(pieSeries); - if (pieSeries->drawOrder() > highestPieZ) - highestPieZ = pieSeries->drawOrder(); + if (pieSeries->zValue() > highestPieZ) + highestPieZ = pieSeries->zValue(); } } #endif @@ -941,8 +941,8 @@ void QGraphsView::updatePolish() if (m_areaRenderer) { if (auto areaSeries = qobject_cast(series)) { m_areaRenderer->handlePolish(areaSeries); - if (areaSeries->drawOrder() > highestAreaZ) - highestAreaZ = areaSeries->drawOrder(); + if (areaSeries->zValue() > highestAreaZ) + highestAreaZ = areaSeries->zValue(); } } #endif diff --git a/src/graphs2d/qsgrenderer/barsrenderer.cpp b/src/graphs2d/qsgrenderer/barsrenderer.cpp index 0a9e2973..88dd9007 100644 --- a/src/graphs2d/qsgrenderer/barsrenderer.cpp +++ b/src/graphs2d/qsgrenderer/barsrenderer.cpp @@ -170,7 +170,7 @@ void BarsRenderer::updateComponents(QBarSeries *series) auto &barItem = barItems[barIndex]; barItem->setX(d.rect.x()); barItem->setY(d.rect.y()); - barItem->setZ(series->drawOrder()); + barItem->setZ(series->zValue()); barItem->setWidth(d.rect.width()); barItem->setHeight(d.rect.height()); barItem->setVisible(series->isVisible()); @@ -195,7 +195,7 @@ void BarsRenderer::updateComponents(QBarSeries *series) if (barItem) { barItem->setX(d.rect.x()); barItem->setY(d.rect.y()); - barItem->setZ(series->drawOrder()); + barItem->setZ(series->zValue()); barItem->setWidth(d.rect.width()); barItem->setHeight(d.rect.height()); barItem->setVisible(series->isVisible()); diff --git a/src/graphs2d/qsgrenderer/pointrenderer.cpp b/src/graphs2d/qsgrenderer/pointrenderer.cpp index 88876665..d47060f7 100644 --- a/src/graphs2d/qsgrenderer/pointrenderer.cpp +++ b/src/graphs2d/qsgrenderer/pointrenderer.cpp @@ -649,7 +649,7 @@ void PointRenderer::handlePolish(QXYSeries *series) } for (auto &&marker : group->markers) - marker->setZ(group->series->drawOrder()); + marker->setZ(group->series->zValue()); if (group->colorIndex < 0) { group->colorIndex = m_graph->graphSeriesCount();