QML export as QskGadientStops does nor work - we need to stay with

QVector
This commit is contained in:
Uwe Rathmann 2021-10-27 15:08:06 +02:00
parent 4c26392d72
commit 0d9dbf4c58
2 changed files with 12 additions and 8 deletions

View File

@ -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" },
]
}

View File

@ -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 )