QskRgbValue -> QskRgb

This commit is contained in:
Uwe Rathmann 2020-08-15 13:29:17 +02:00
parent 3519e92e91
commit 5bd66a27a8
24 changed files with 82 additions and 80 deletions

View File

@ -90,7 +90,7 @@ static void addRectangles2( QskLinearBox* parent )
static void addRectangles3( QskLinearBox* parent )
{
using namespace QskRgbValue;
using namespace QskRgb;
const auto borderTheme = QskRgbPalette::Grey;
const auto fillTheme = QskRgbPalette::Blue;
@ -141,7 +141,7 @@ static void addRectangles5( QskLinearBox* parent )
static void addRectangles6( QskLinearBox* parent )
{
using namespace QskRgbValue;
using namespace QskRgb;
const auto borderTheme = QskRgbPalette::Grey;
const auto fillTheme = QskRgbPalette::Lime;
@ -192,7 +192,7 @@ static void addRectangles8( QskLinearBox* parent )
static void addRectangles9( QskLinearBox* parent )
{
using namespace QskRgbValue;
using namespace QskRgb;
const auto borderTheme = QskRgbPalette::Grey;
const auto fillTheme = QskRgbPalette::Lime;
@ -350,7 +350,7 @@ static void addRectanglesRest( QskLinearBox* parent )
box->setShape( 20, Qt::AbsoluteSize );
box->setBorderWidth( 2, 10, 40, 2 );
box->setBorderColor( "Crimson" );
box->setGradient( QskRgbValue::WhiteSmoke );
box->setGradient( QskRgb::WhiteSmoke );
box = new Box( parent );
box->setShape( 100, Qt::RelativeSize );

View File

@ -15,7 +15,7 @@ Page::Page( Qt::Orientation orientation, QQuickItem* parent )
setPanel( true );
setBoxShapeHint( QskBox::Panel, 8 );
setGradient( QskRgbValue::GhostWhite );
setGradient( QskRgb::GhostWhite );
setMargins( 5 );
setPadding( 10 );

View File

@ -67,7 +67,7 @@ namespace
LabelPage::LabelPage( QQuickItem* parent )
: Page( Qt::Vertical, parent )
{
setGradient( QskRgbValue::AliceBlue );
setGradient( QskRgb::AliceBlue );
setSpacing( 40 );
(void) new TextBox( this );

View File

@ -45,7 +45,7 @@ namespace
ProgressBarPage::ProgressBarPage( QQuickItem* parent )
: Page( Qt::Horizontal, parent )
{
setGradient( QskRgbValue::AliceBlue );
setGradient( QskRgb::AliceBlue );
setSpacing( 40 );
populate();

View File

@ -24,19 +24,19 @@ CustomSlider::CustomSlider( QQuickItem* parentItem )
#if 0
const QskGradient fillGradient( QskGradient::Horizontal,
QskRgbValue::Grey700, QskRgbValue::Grey500 );
QskRgb::Grey700, QskRgb::Grey500 );
#else
const QskGradient fillGradient( QskRgbValue::Grey700 );
const QskGradient fillGradient( QskRgb::Grey700 );
#endif
setBoxShapeHint( Fill, 0 );
setGradientHint( Fill, fillGradient );
setColor( Scale, qRgb( 178, 178, 178 ) ); // for the ticks
setColor( QskSlider::Handle, QskRgbValue::Grey800 );
setColor( QskSlider::Handle, QskRgb::Grey800 );
for ( auto state : { Pressed, Focused | Hovered, Hovered, Focused } )
setColor( QskSlider::Handle | Color | state, QskRgbValue::Orange600 );
setColor( QskSlider::Handle | Color | state, QskRgb::Orange600 );
setAnimation( QskSlider::Handle | Color, 1000 );
for ( auto state : { Focused | Hovered, Hovered, Focused } )

View File

@ -301,7 +301,7 @@ QSGNode* CustomSliderSkinlet::updateDecorationNode(
auto labelText = QString::number( slider->minimum() + slider->stepSize() * i, 'f', 0 );
labelNode->setTextData( slider, labelText, QRectF( x, y, 0, 0 ),
qskLabelFont, QskTextOptions(), QskTextColors( QskRgbValue::Grey700 ),
qskLabelFont, QskTextOptions(), QskTextColors( QskRgb::Grey700 ),
Qt::AlignHCenter, Qsk::Normal );
labelNode = static_cast< decltype( labelNode ) >( labelNode->nextSibling() );

View File

@ -17,7 +17,7 @@ OtherSlider::OtherSlider( QQuickItem* parentItem )
: QskSlider( parentItem )
{
using namespace QskAspect;
using namespace QskRgbValue;
using namespace QskRgb;
const qreal h = 30;
const qreal w = 2.0 * h;

View File

@ -12,7 +12,7 @@
SliderPage::SliderPage( QQuickItem* parentItem )
: Page( Qt::Vertical, parentItem )
{
setGradient( QskRgbValue::PeachPuff );
setGradient( QskRgb::PeachPuff );
setMargins( 10 );
setSpacing( 20 );

View File

@ -129,7 +129,7 @@ DynamicConstraintsPage::DynamicConstraintsPage( QQuickItem* parent )
: QskLinearBox( Qt::Vertical, parent )
{
setMargins( 10 );
setBackgroundColor( QskRgbValue::LightSteelBlue );
setBackgroundColor( QskRgb::LightSteelBlue );
auto box = new Box();

View File

@ -89,7 +89,7 @@ FlowLayoutPage::FlowLayoutPage( QQuickItem* parent )
: QskLinearBox( Qt::Vertical, parent )
{
setMargins( 10 );
setBackgroundColor( QskRgbValue::LightSteelBlue );
setBackgroundColor( QskRgb::LightSteelBlue );
auto box = new Box();

View File

@ -67,7 +67,7 @@ GridLayoutPage::GridLayoutPage( QQuickItem* parent )
: QskControl( parent )
{
setMargins( 10 );
setBackgroundColor( QskRgbValue::LightSteelBlue );
setBackgroundColor( QskRgb::LightSteelBlue );
setAutoLayoutChildren( true );

View File

@ -82,7 +82,7 @@ LinearLayoutPage::LinearLayoutPage( QQuickItem* parent )
: QskLinearBox( Qt::Vertical, parent )
{
setMargins( 10 );
setBackgroundColor( QskRgbValue::LightSteelBlue );
setBackgroundColor( QskRgb::LightSteelBlue );
auto box = new Box();

View File

@ -160,7 +160,7 @@ StackLayoutPage::StackLayoutPage( QQuickItem* parent )
setObjectName( "StackLayoutPage" );
setMargins( 10 );
setBackgroundColor( QskRgbValue::LightSteelBlue );
setBackgroundColor( QskRgb::LightSteelBlue );
auto box = new StackBox();

View File

@ -161,7 +161,7 @@ class MySkin : public QskSkin
void setGraphicFilter( int role, QRgb rgb )
{
QskColorFilter filter;
filter.addColorSubstitution( QskRgbValue::Khaki, rgb );
filter.addColorSubstitution( QskRgb::Khaki, rgb );
QskSkin::setGraphicFilter( role, filter );
}
@ -176,10 +176,10 @@ class MySkin1 : public MySkin
public:
MySkin1()
{
using namespace QskRgbValue;
using namespace QskRgb;
setGraphicFilter( GraphicRoleNormal, QskRgbValue::Crimson );
setGraphicFilter( GraphicRoleInverted, QskRgbValue::Gold );
setGraphicFilter( GraphicRoleNormal, Crimson );
setGraphicFilter( GraphicRoleInverted, Gold );
initFocusIndicatorHints( 2, 3, 6, DarkBlue );
initBoxHints( 2, 8, DarkCyan, LightCyan );
@ -198,10 +198,10 @@ class MySkin2 : public MySkin
public:
MySkin2()
{
using namespace QskRgbValue;
using namespace QskRgb;
setGraphicFilter( GraphicRoleNormal, QskRgbValue::HotPink );
setGraphicFilter( GraphicRoleInverted, QskRgbValue::White );
setGraphicFilter( GraphicRoleNormal, HotPink );
setGraphicFilter( GraphicRoleInverted, White );
initFocusIndicatorHints( 2, 6, 6, Crimson );
initBoxHints( 4, 30, LightPink, MistyRose );

View File

@ -54,7 +54,7 @@ class GraphicLabel : public QskGraphicLabel
}
else
{
gradient.setColor( QskRgbValue::Wheat );
gradient.setColor( QskRgb::Wheat );
setGraphicRole( Normal );
}

View File

@ -58,9 +58,9 @@ namespace
class ColorPalette
{
public:
ColorPalette( const QColor base = QColor::fromRgba( QskRgbValue::Grey100 ),
const QColor& accent = QColor::fromRgba( QskRgbValue::Blue500 ),
const QColor& contrast = QColor::fromRgba( QskRgbValue::White ) )
ColorPalette( const QColor base = QColor::fromRgba( QskRgb::Grey100 ),
const QColor& accent = QColor::fromRgba( QskRgb::Blue500 ),
const QColor& contrast = QColor::fromRgba( QskRgb::White ) )
{
baseColor = base;
accentColor = accent;
@ -75,7 +75,7 @@ namespace
lighter200 = baseColor.lighter( 200 );
textColor = ( baseColor.value() > 128 )
? QskRgbValue::Black : QskRgbValue::White;
? QskRgb::Black : QskRgb::White;
}
QColor accentColor;
@ -105,8 +105,8 @@ QskMaterialSkin::QskMaterialSkin( QObject* parent )
: Inherited( parent )
, m_data( new PrivateData() )
{
m_data->palette = ColorPalette( QskRgbValue::Grey100,
QskRgbValue::Blue500, QskRgbValue::White );
m_data->palette = ColorPalette( QskRgb::Grey100,
QskRgb::Blue500, QskRgb::White );
// Default theme colors
setupFonts( "Roboto" );
@ -239,7 +239,7 @@ void QskMaterialSkin::initTextInputHints()
void QskMaterialSkin::initProgressBarHints()
{
using namespace QskAspect;
using namespace QskRgbValue;
using namespace QskRgb;
using Q = QskProgressBar;
const auto& pal = m_data->palette;
@ -322,7 +322,7 @@ void QskMaterialSkin::initPageIndicatorHints()
void QskMaterialSkin::initPushButtonHints()
{
using namespace QskAspect;
using namespace QskRgbValue;
using namespace QskRgb;
using Q = QskPushButton;
const auto& pal = m_data->palette;
@ -383,7 +383,7 @@ void QskMaterialSkin::initPushButtonHints()
void QskMaterialSkin::initDialogButtonHints()
{
using namespace QskAspect;
using namespace QskRgbValue;
using namespace QskRgb;
using Q = QskDialogButton;
const auto& pal = m_data->palette;
@ -449,7 +449,7 @@ void QskMaterialSkin::initDialogButtonBoxHints()
void QskMaterialSkin::initSliderHints()
{
using namespace QskAspect;
using namespace QskRgbValue;
using namespace QskRgb;
using Q = QskSlider;
const auto& pal = m_data->palette;
@ -556,7 +556,7 @@ void QskMaterialSkin::initTabButtonHints()
edge = Qt::Edge( 0 ); // making gcc4 happy
}
setGradient( aspect, QskRgbValue::White );
setGradient( aspect, QskRgb::White );
// The highlighted button has a accented bar at one edge
setBoxShape( aspect, 0 );
@ -565,7 +565,7 @@ void QskMaterialSkin::initTabButtonHints()
border.setWidthAt( edge, 3 );
setBoxBorderMetrics( aspect, border );
QskBoxBorderColors borderColors( QskRgbValue::White );
QskBoxBorderColors borderColors( QskRgb::White );
setBoxBorderColors( aspect, borderColors );
borderColors.setColorsAt( edge, pal.accentColor );
@ -581,7 +581,7 @@ void QskMaterialSkin::initTabButtonHints()
setColor( Q::Text, pal.textColor );
setColor( Q::Text | Q::Checkable | Q::Disabled, qskShadedColor( pal.textColor, 0.6 ) );
setColor( Q::Text | Q::Disabled, QskRgbValue::Grey600 );
setColor( Q::Text | Q::Disabled, QskRgb::Grey600 );
}
void QskMaterialSkin::initTabBarHints()
@ -665,7 +665,7 @@ void QskMaterialSkin::initScrollViewHints()
setBoxShape( Q::Viewport, 5 );
setBoxBorderMetrics( Q::Viewport, 1 );
setGradient( Q::Viewport, QskRgbValue::White );
setGradient( Q::Viewport, QskRgb::White );
setBoxBorderColors( Q::Viewport, Qt::black );
for ( auto subControl : { Q::HorizontalScrollBar, Q::VerticalScrollBar } )
@ -682,7 +682,7 @@ void QskMaterialSkin::initScrollViewHints()
setBoxShape( subControl, 3 );
setBoxBorderMetrics( subControl, 1 );
setGradient( subControl, pal.accentColor );
setBoxBorderColors( subControl, QskRgbValue::White );
setBoxBorderColors( subControl, QskRgb::White );
setAnimation( subControl | Color, qskDuration );
}

View File

@ -46,7 +46,7 @@ namespace
class ColorPalette
{
public:
ColorPalette( const QColor& themeColor = QskRgbValue::Silver )
ColorPalette( const QColor& themeColor = QskRgb::Silver )
{
const bool isBright = themeColor.value() > 128;
@ -61,30 +61,32 @@ namespace
darker150 = themeColor.darker( 150 );
darker200 = themeColor.darker( 200 );
using namespace QskRgb;
if ( isBright )
{
themeForeground = QskRgbValue::Black;
themeForeground = Black;
contrasted = QskRgbValue::Gainsboro;
contrastedText = QskRgbValue::Black;
contrasted = Gainsboro;
contrastedText = Black;
highlighted = QskRgbValue::RoyalBlue;
highlightedText = QskRgbValue::White;
highlighted = RoyalBlue;
highlightedText = White;
base = QskRgbValue::White;
baseActive = QskRgbValue::Beige;
base = White;
baseActive = Beige;
}
else
{
themeForeground = QskRgbValue::White;
themeForeground = White;
contrasted = QskRgbValue::DarkGrey;
contrastedText = QskRgbValue::White;
contrasted = DarkGrey;
contrastedText = White;
highlighted = QskRgbValue::BlueGrey500;
highlightedText = QskRgbValue::White;
highlighted = BlueGrey500;
highlightedText = White;
base = QskRgbValue::Black;
base = Black;
baseActive = base.lighter( 110 );
}
}

View File

@ -166,7 +166,7 @@ QskBoxBorderColors QskBoxBorderColors::interpolated(
for ( size_t i = 0; i < 4; i++ )
{
colors.m_colors[ i ] = QskRgbValue::interpolated(
colors.m_colors[ i ] = QskRgb::interpolated(
m_colors[ i ], to.m_colors[ i ], ratio );
}

View File

@ -68,7 +68,7 @@ static inline QColor qskInterpolated(
return s1.color();
const qreal ratio = ( pos - s1.position() ) / ( s2.position() - s1.position() );
return QskRgbValue::interpolated( s1.color(), s2.color(), ratio );
return QskRgb::interpolated( s1.color(), s2.color(), ratio );
}
static inline bool qskComparePositions(
@ -216,7 +216,7 @@ QColor QskGradientStop::interpolated(
return max->color();
const qreal r = ( position - min->position() ) / ( max->position() - min->position() );
return QskRgbValue::interpolated( min->color(), max->color(), r );
return QskRgb::interpolated( min->color(), max->color(), r );
}
QskGradient::QskGradient()
@ -507,7 +507,7 @@ QskGradient QskGradient::interpolated(
QVector< QskGradientStop > s2 = to.m_stops;
for ( int i = 0; i < s2.count(); i++ )
{
const QColor c2 = QskRgbValue::interpolated(
const QColor c2 = QskRgb::interpolated(
c, s2[ i ].color(), value );
s2[ i ].setColor( c2 );
@ -525,7 +525,7 @@ QskGradient QskGradient::interpolated(
QVector< QskGradientStop > s2 = m_stops;
for ( int i = 0; i < s2.count(); i++ )
{
const QColor c2 = QskRgbValue::interpolated(
const QColor c2 = QskRgb::interpolated(
s2[ i ].color(), c, value );
s2[ i ].setColor( c2 );
@ -546,7 +546,7 @@ QskGradient QskGradient::interpolated(
for ( int i = 0; i < s1.count(); i++ )
{
const QColor c2 = QskRgbValue::interpolated(
const QColor c2 = QskRgb::interpolated(
s1[ i ].color(), s2[ i ].color(), value );
s2[ i ].setColor( c2 );
@ -571,7 +571,7 @@ QskGradient QskGradient::interpolated(
for ( int i = 0; i < s2.count(); i++ )
{
const QColor c2 = QskRgbValue::interpolated(
const QColor c2 = QskRgb::interpolated(
s2[ i ].color(), c, 2 * value );
s2[ i ].setColor( c2 );
@ -585,7 +585,7 @@ QskGradient QskGradient::interpolated(
for ( int i = 0; i < s2.count(); i++ )
{
const QColor c2 = QskRgbValue::interpolated(
const QColor c2 = QskRgb::interpolated(
c, s2[ i ].color(), 2 * ( value - 0.5 ) );
s2[ i ].setColor( c2 );

View File

@ -22,7 +22,7 @@ namespace
public:
Palette( int index )
{
using namespace QskRgbValue;
using namespace QskRgb;
static constexpr QRgb table[][ Palette::NumWeights ] =
{

View File

@ -78,7 +78,7 @@ static inline QColor qskInterpolatedColor(
return c2;
}
QRgb QskRgbValue::interpolated( QRgb rgb1, QRgb rgb2, qreal ratio )
QRgb QskRgb::interpolated( QRgb rgb1, QRgb rgb2, qreal ratio )
{
// interpolating in HSV usually provides better results !!
@ -93,7 +93,7 @@ QRgb QskRgbValue::interpolated( QRgb rgb1, QRgb rgb2, qreal ratio )
return qRgba( r, g, b, a );
}
QColor QskRgbValue::interpolated( const QColor& c1, const QColor& c2, qreal ratio )
QColor QskRgb::interpolated( const QColor& c1, const QColor& c2, qreal ratio )
{
if ( c1 == c2 )
return c2;
@ -123,9 +123,9 @@ QColor QskRgbValue::interpolated( const QColor& c1, const QColor& c2, qreal rati
return qskInterpolatedColor( c1.convertTo( c2.spec() ), c2, ratio );
}
QRgb QskRgbValue::rgb( Qt::GlobalColor color )
QRgb QskRgb::rgb( Qt::GlobalColor color )
{
using namespace QskRgbValue;
using namespace QskRgb;
static constexpr QRgb rgbValues[] =
{
@ -154,7 +154,7 @@ QRgb QskRgbValue::rgb( Qt::GlobalColor color )
return rgbValues[ color ];
}
QRgb QskRgbValue::lighter( QRgb rgb, int factor ) noexcept
QRgb QskRgb::lighter( QRgb rgb, int factor ) noexcept
{
if ( factor <= 0 )
return rgb;
@ -163,7 +163,7 @@ QRgb QskRgbValue::lighter( QRgb rgb, int factor ) noexcept
return QColor::fromRgba( rgb ).lighter( factor ).rgba();
}
QRgb QskRgbValue::darker( QRgb rgb, int factor ) noexcept
QRgb QskRgb::darker( QRgb rgb, int factor ) noexcept
{
if ( factor <= 0 )
return rgb;

View File

@ -435,7 +435,7 @@
RGB( AlphaMask, 0xff000000 ) \
RGB( ColorMask, 0x00ffffff )
namespace QskRgbValue
namespace QskRgb
{
#define RGB( name, value ) static constexpr const QRgb name = value;
QSK_RGB_VALUES

View File

@ -19,9 +19,9 @@ QskTextColors QskTextColors::interpolated(
const QskTextColors& to, qreal ratio ) const
{
QskTextColors colors;
colors.textColor = QskRgbValue::interpolated( textColor, to.textColor, ratio );
colors.styleColor = QskRgbValue::interpolated( styleColor, to.styleColor, ratio );
colors.linkColor = QskRgbValue::interpolated( linkColor, to.linkColor, ratio );
colors.textColor = QskRgb::interpolated( textColor, to.textColor, ratio );
colors.styleColor = QskRgb::interpolated( styleColor, to.styleColor, ratio );
colors.linkColor = QskRgb::interpolated( linkColor, to.linkColor, ratio );
return colors;
}

View File

@ -16,14 +16,14 @@ static inline QRgb qskSubstitutedRgb(
// usually we have 2-3 substitutions, so we can simply iterate
// and don't need to introduce some sort of sorting or search index
const QRgb rgb = rgba | QskRgbValue::AlphaMask;
const QRgb rgb = rgba | QskRgb::AlphaMask;
for ( const auto& s : substitions )
{
if ( rgb == s.first )
{
return ( s.second & QskRgbValue::ColorMask ) |
( rgba & QskRgbValue::AlphaMask );
return ( s.second & QskRgb::ColorMask ) |
( rgba & QskRgb::AlphaMask );
}
}
@ -105,7 +105,7 @@ static inline QskColorFilter qskInterpolatedFilter(
}
}
rgb = QskRgbValue::interpolated( rgb, pairTo.second, progress );
rgb = QskRgb::interpolated( rgb, pairTo.second, progress );
if ( rgb != pairTo.first )
interpolated.addColorSubstitution( pairTo.first, rgb );
@ -132,7 +132,7 @@ static inline QskColorFilter qskInterpolatedFilter(
if ( !hasRgb )
{
const auto rgb = QskRgbValue::interpolated(
const auto rgb = QskRgb::interpolated(
pairFrom.second, pairFrom.first, progress );
if ( rgb != pairFrom.first )