QskGradientStops moved from QskGradient.h to QskGradientStop.h

This commit is contained in:
Uwe Rathmann 2022-10-13 19:37:49 +02:00
parent cfc3d8f079
commit 8da486a13f
2 changed files with 10 additions and 2 deletions

View File

@ -11,7 +11,6 @@
#include <qbrush.h>
#include <qmetatype.h>
#include <qvector.h>
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
{

View File

@ -10,6 +10,7 @@
#include <qcolor.h>
#include <qmetatype.h>
#include <qvector.h>
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 );