diff --git a/examples/layouts/layouts.qml b/examples/layouts/layouts.qml index 07278e76..e0479b82 100644 --- a/examples/layouts/layouts.qml +++ b/examples/layouts/layouts.qml @@ -12,8 +12,8 @@ GridBox background { stops: [ - { position: 0.0, color: "White" }, - { position: 1.0, color: "White" }, + { position: 0.0, color: "Red" }, + { position: 1.0, color: "Yellow" }, ] } diff --git a/src/common/QskGradient.h b/src/common/QskGradient.h index 9a84a555..5683b707 100644 --- a/src/common/QskGradient.h +++ b/src/common/QskGradient.h @@ -15,6 +15,10 @@ class QVariant; +/* + Don't use QskGradientStops for definitions seen by moc + Otherwise exporting these interfaces to QML does not work. + */ typedef QVector< QskGradientStop > QskGradientStops; class QSK_EXPORT QskGradient @@ -22,7 +26,7 @@ class QSK_EXPORT QskGradient Q_GADGET Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation ) - Q_PROPERTY( QskGradientStops stops READ stops WRITE setStops ) + Q_PROPERTY( QVector< QskGradientStop > stops READ stops WRITE setStops ) Q_PROPERTY( bool valid READ isValid ) Q_PROPERTY( bool visible READ isVisible ) @@ -44,10 +48,10 @@ class QSK_EXPORT QskGradient QskGradient( QRgb ); QskGradient( const QColor& ); - QskGradient( Qt::Orientation, const QskGradientStops& ); + QskGradient( Qt::Orientation, const QVector< QskGradientStop >& ); QskGradient( Qt::Orientation, const QColor&, const QColor& ); - QskGradient( Orientation, const QskGradientStops& ); + QskGradient( Orientation, const QVector< QskGradientStop >& ); QskGradient( Orientation, const QColor&, const QColor& ); ~QskGradient(); @@ -68,8 +72,8 @@ class QSK_EXPORT QskGradient Q_INVOKABLE QColor startColor() const; Q_INVOKABLE QColor endColor() const; - Q_INVOKABLE void setStops( const QskGradientStops& ); - Q_INVOKABLE QskGradientStops stops() const; + Q_INVOKABLE void setStops( const QVector< QskGradientStop >& ); + Q_INVOKABLE QVector< QskGradientStop > stops() const; Q_INVOKABLE bool hasStopAt( qreal value ) const; @@ -100,7 +104,7 @@ class QSK_EXPORT QskGradient void setColorAt( int index, const QColor& color ); Orientation m_orientation; - QskGradientStops m_stops; + QVector< QskGradientStop > m_stops; }; Q_DECLARE_METATYPE( QskGradient )