diff options
Diffstat (limited to 'src/quick')
-rw-r--r-- | src/quick/items/qquickpathitem.cpp | 20 | ||||
-rw-r--r-- | src/quick/items/qquickpathitem_p.h | 2 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/quick/items/qquickpathitem.cpp b/src/quick/items/qquickpathitem.cpp index b14fc1caba..fff666c205 100644 --- a/src/quick/items/qquickpathitem.cpp +++ b/src/quick/items/qquickpathitem.cpp @@ -1155,6 +1155,20 @@ QQuickPathGradient::QQuickPathGradient(QObject *parent) { } +int QQuickPathGradient::countStops(QQmlListProperty<QObject> *list) +{ + QQuickPathGradient *grad = qobject_cast<QQuickPathGradient *>(list->object); + Q_ASSERT(grad); + return grad->m_stops.count(); +} + +QObject *QQuickPathGradient::atStop(QQmlListProperty<QObject> *list, int index) +{ + QQuickPathGradient *grad = qobject_cast<QQuickPathGradient *>(list->object); + Q_ASSERT(grad); + return grad->m_stops.at(index); +} + void QQuickPathGradient::appendStop(QQmlListProperty<QObject> *list, QObject *stop) { QQuickPathGradientStop *sstop = qobject_cast<QQuickPathGradientStop *>(stop); @@ -1178,7 +1192,11 @@ void QQuickPathGradient::appendStop(QQmlListProperty<QObject> *list, QObject *st QQmlListProperty<QObject> QQuickPathGradient::stops() { - return QQmlListProperty<QObject>(this, nullptr, &QQuickPathGradient::appendStop, nullptr, nullptr, nullptr); + return QQmlListProperty<QObject>(this, nullptr, + &QQuickPathGradient::appendStop, + &QQuickPathGradient::countStops, + &QQuickPathGradient::atStop, + nullptr); } QGradientStops QQuickPathGradient::sortedGradientStops() const diff --git a/src/quick/items/qquickpathitem_p.h b/src/quick/items/qquickpathitem_p.h index 6d789aadbc..37b23dee6f 100644 --- a/src/quick/items/qquickpathitem_p.h +++ b/src/quick/items/qquickpathitem_p.h @@ -114,6 +114,8 @@ signals: void spreadChanged(); private: + static int countStops(QQmlListProperty<QObject> *list); + static QObject *atStop(QQmlListProperty<QObject> *list, int index); static void appendStop(QQmlListProperty<QObject> *list, QObject *stop); QVector<QObject *> m_stops; |