From 8da486a13f3e4d8d6c4fc524ab801a7c82c9d42c Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Thu, 13 Oct 2022 19:37:49 +0200 Subject: [PATCH] QskGradientStops moved from QskGradient.h to QskGradientStop.h --- src/common/QskGradient.h | 2 -- src/common/QskGradientStop.h | 10 ++++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/common/QskGradient.h b/src/common/QskGradient.h index 2a29926b..07fe8185 100644 --- a/src/common/QskGradient.h +++ b/src/common/QskGradient.h @@ -11,7 +11,6 @@ #include #include -#include class QVariant; @@ -19,7 +18,6 @@ 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 { diff --git a/src/common/QskGradientStop.h b/src/common/QskGradientStop.h index 3149eea4..9776de2d 100644 --- a/src/common/QskGradientStop.h +++ b/src/common/QskGradientStop.h @@ -10,6 +10,7 @@ #include #include +#include class QSK_EXPORT QskGradientStop { @@ -38,6 +39,8 @@ class QSK_EXPORT QskGradientStop void setColor( const QColor& ) noexcept; void resetColor() noexcept; + QRgb rgb() const noexcept; + static QColor interpolated( const QskGradientStop&, const QskGradientStop&, qreal position ) noexcept; @@ -54,6 +57,8 @@ class QSK_EXPORT QskGradientStop Q_DECLARE_METATYPE( QskGradientStop ) +typedef QVector< QskGradientStop > QskGradientStops; + inline constexpr QskGradientStop::QskGradientStop() noexcept : m_position( -1.0 ) { @@ -88,6 +93,11 @@ inline constexpr const QColor& QskGradientStop::color() const noexcept return m_color; } +inline QRgb QskGradientStop::rgb() const noexcept +{ + return m_color.rgba(); +} + inline constexpr bool QskGradientStop::operator==( const QskGradientStop& other ) const noexcept { return ( m_position == other.m_position ) && ( m_color == other.m_color );