aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/shapes/qquickshape_p.h
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2017-06-06 14:54:37 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2017-06-08 10:32:18 +0000
commitf4f89858cffa1107af5139dfb1e1d7b16ca3a1a0 (patch)
tree848471b6d85eebfea8915f1da89b26286f0dbbc7 /src/imports/shapes/qquickshape_p.h
parent8a5837467d153c50c869625390a584b0335b77b7 (diff)
Use GradientStop and rename ShapeLinearGradient to LinearGradient
Thus application code becomes: ShapePath { ... fillGradient: LinearGradient { ... GradientStop { ... } } } which is even more clean and readable. The duplication for stops is now avoided. Change-Id: I50ae2f388e21683a37dc4787763dc71e16eef4f5 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/imports/shapes/qquickshape_p.h')
-rw-r--r--src/imports/shapes/qquickshape_p.h36
1 files changed, 2 insertions, 34 deletions
diff --git a/src/imports/shapes/qquickshape_p.h b/src/imports/shapes/qquickshape_p.h
index a01c36e971..50b242e492 100644
--- a/src/imports/shapes/qquickshape_p.h
+++ b/src/imports/shapes/qquickshape_p.h
@@ -55,38 +55,16 @@
#include <private/qtquickglobal_p.h>
#include <private/qquickpath_p_p.h>
-#include <private/qv8engine_p.h>
-#include <QGradientStops>
+#include <private/qquickrectangle_p.h>
QT_BEGIN_NAMESPACE
class QQuickShapePathPrivate;
class QQuickShapePrivate;
-class QQuickShapeGradientStop : public QObject
+class QQuickShapeGradient : public QQuickGradient
{
Q_OBJECT
- Q_PROPERTY(qreal position READ position WRITE setPosition)
- Q_PROPERTY(QColor color READ color WRITE setColor)
-
-public:
- QQuickShapeGradientStop(QObject *parent = nullptr);
-
- qreal position() const;
- void setPosition(qreal position);
-
- QColor color() const;
- void setColor(const QColor &color);
-
-private:
- qreal m_position;
- QColor m_color;
-};
-
-class QQuickShapeGradient : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QQmlListProperty<QObject> stops READ stops)
Q_PROPERTY(SpreadMode spread READ spread WRITE setSpread NOTIFY spreadChanged)
Q_CLASSINFO("DefaultProperty", "stops")
@@ -100,23 +78,13 @@ public:
QQuickShapeGradient(QObject *parent = nullptr);
- QQmlListProperty<QObject> stops();
-
- QGradientStops sortedGradientStops() const;
-
SpreadMode spread() const;
void setSpread(SpreadMode mode);
signals:
- void updated();
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;
SpreadMode m_spread;
};