more APIs for working with QRgb
This commit is contained in:
parent
5a43165126
commit
33bb68d903
|
@ -43,6 +43,11 @@ void QskGradientStop::resetColor() noexcept
|
|||
m_color = QColor();
|
||||
}
|
||||
|
||||
void QskGradientStop::setRgb( QRgb rgb ) noexcept
|
||||
{
|
||||
m_color = QColor::fromRgba( rgb );
|
||||
}
|
||||
|
||||
void QskGradientStop::setStop( qreal position, const QColor& color ) noexcept
|
||||
{
|
||||
m_position = position;
|
||||
|
|
|
@ -22,7 +22,7 @@ class QSK_EXPORT QskGradientStop
|
|||
Q_PROPERTY( QColor color READ color WRITE setColor RESET resetColor )
|
||||
|
||||
public:
|
||||
constexpr QskGradientStop() noexcept;
|
||||
constexpr QskGradientStop() noexcept = default;
|
||||
constexpr QskGradientStop( qreal position, const QColor& ) noexcept;
|
||||
constexpr QskGradientStop( const QGradientStop& ) noexcept;
|
||||
|
||||
|
@ -33,6 +33,7 @@ class QSK_EXPORT QskGradientStop
|
|||
constexpr bool operator!=( const QskGradientStop& ) const noexcept;
|
||||
|
||||
void setStop( qreal position, const QColor& ) noexcept;
|
||||
void setStop( qreal position, QRgb ) noexcept;
|
||||
|
||||
constexpr qreal position() const noexcept;
|
||||
void setPosition( qreal position ) noexcept;
|
||||
|
@ -42,6 +43,7 @@ class QSK_EXPORT QskGradientStop
|
|||
void setColor( const QColor& ) noexcept;
|
||||
void resetColor() noexcept;
|
||||
|
||||
void setRgb( QRgb ) noexcept;
|
||||
QRgb rgb() const noexcept;
|
||||
|
||||
static QColor interpolated(
|
||||
|
@ -50,8 +52,8 @@ class QSK_EXPORT QskGradientStop
|
|||
QskHashValue hash( QskHashValue seed ) const noexcept;
|
||||
|
||||
private:
|
||||
qreal m_position;
|
||||
QColor m_color; // using RGBA instead ?
|
||||
qreal m_position = -1.0;
|
||||
QColor m_color; // using QRgb instead ?
|
||||
};
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
|
||||
|
@ -60,11 +62,6 @@ class QSK_EXPORT QskGradientStop
|
|||
|
||||
Q_DECLARE_METATYPE( QskGradientStop )
|
||||
|
||||
inline constexpr QskGradientStop::QskGradientStop() noexcept
|
||||
: m_position( -1.0 )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr QskGradientStop::QskGradientStop(
|
||||
qreal position, const QColor& color ) noexcept
|
||||
: m_position( position )
|
||||
|
|
Loading…
Reference in New Issue