diff options
Diffstat (limited to 'src/quick/items/qquickrectangle_p.h')
-rw-r--r-- | src/quick/items/qquickrectangle_p.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/quick/items/qquickrectangle_p.h b/src/quick/items/qquickrectangle_p.h index c07ad835fb..d56a03d22d 100644 --- a/src/quick/items/qquickrectangle_p.h +++ b/src/quick/items/qquickrectangle_p.h @@ -119,24 +119,35 @@ class Q_QUICK_PRIVATE_EXPORT QQuickGradient : public QObject Q_OBJECT Q_PROPERTY(QQmlListProperty<QQuickGradientStop> stops READ stops) + Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged REVISION 12) Q_CLASSINFO("DefaultProperty", "stops") + Q_ENUMS(QGradient::Preset) public: QQuickGradient(QObject *parent=nullptr); ~QQuickGradient() override; + enum Orientation { Vertical = Qt::Vertical, + Horizontal = Qt::Horizontal }; + Q_ENUM(Orientation) + QQmlListProperty<QQuickGradientStop> stops(); + Orientation orientation() const { return m_orientation; } + void setOrientation(Orientation orientation); + QGradientStops gradientStops() const; Q_SIGNALS: void updated(); + void orientationChanged(); private: void doUpdate(); private: QList<QQuickGradientStop *> m_stops; + Orientation m_orientation = Vertical; friend class QQuickRectangle; friend class QQuickGradientStop; }; @@ -147,7 +158,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickRectangle : public QQuickItem Q_OBJECT Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) - Q_PROPERTY(QQuickGradient *gradient READ gradient WRITE setGradient RESET resetGradient) + Q_PROPERTY(QJSValue gradient READ gradient WRITE setGradient RESET resetGradient) Q_PROPERTY(QQuickPen * border READ border CONSTANT) Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged) public: @@ -158,8 +169,8 @@ public: QQuickPen *border(); - QQuickGradient *gradient() const; - void setGradient(QQuickGradient *gradient); + QJSValue gradient() const; + void setGradient(const QJSValue &gradient); void resetGradient(); qreal radius() const; |