QskRgbPalette added
This commit is contained in:
parent
6871b7a0b8
commit
39f4d80153
|
|
@ -21,7 +21,7 @@ Box::Box( QQuickItem* parentItem )
|
||||||
setGradientHint( QskBox::Panel, QskGradient() );
|
setGradientHint( QskBox::Panel, QskGradient() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Box::setBackground( FillType type, Palette::Color color, bool inverted )
|
void Box::setBackground( FillType type, QskRgbPalette::Theme theme, bool inverted )
|
||||||
{
|
{
|
||||||
if ( type == Unfilled )
|
if ( type == Unfilled )
|
||||||
{
|
{
|
||||||
|
|
@ -29,10 +29,10 @@ void Box::setBackground( FillType type, Palette::Color color, bool inverted )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto pal = Palette::palette( color );
|
const auto pal = QskRgbPalette::palette( theme );
|
||||||
|
|
||||||
const QColor light = pal.color( Palette::W300 );
|
const QColor light = pal.color( QskRgbPalette::W300 );
|
||||||
const QColor mid = pal.color( Palette::W600 );
|
const QColor mid = pal.color( QskRgbPalette::W600 );
|
||||||
|
|
||||||
switch ( type )
|
switch ( type )
|
||||||
{
|
{
|
||||||
|
|
@ -57,15 +57,15 @@ void Box::setBackground( FillType type, Palette::Color color, bool inverted )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Box::setBorder( BorderType type, Palette::Color color )
|
void Box::setBorder( BorderType type, QskRgbPalette::Theme theme )
|
||||||
{
|
{
|
||||||
const auto pal = Palette::palette( color );
|
const auto pal = QskRgbPalette::palette( theme );
|
||||||
|
|
||||||
setBorderWidth( 5 );
|
setBorderWidth( 5 );
|
||||||
|
|
||||||
QColor dark = pal.color( Palette::W700 );
|
QColor dark = pal.color( QskRgbPalette::W700 );
|
||||||
QColor mid = pal.color( Palette::W500 );
|
QColor mid = pal.color( QskRgbPalette::W500 );
|
||||||
QColor light = pal.color( Palette::W300 );
|
QColor light = pal.color( QskRgbPalette::W300 );
|
||||||
#if 0
|
#if 0
|
||||||
dark.setAlpha( 100 );
|
dark.setAlpha( 100 );
|
||||||
mid.setAlpha( 100 );
|
mid.setAlpha( 100 );
|
||||||
|
|
@ -177,26 +177,26 @@ void Box::setGradient( const QskGradient& gradient )
|
||||||
}
|
}
|
||||||
|
|
||||||
void Box::setGradient(
|
void Box::setGradient(
|
||||||
const QskGradient::Orientation orientation, Palette::Color color )
|
const QskGradient::Orientation orientation, QskRgbPalette::Theme theme )
|
||||||
{
|
{
|
||||||
const auto pal = Palette::palette( color );
|
const auto pal = QskRgbPalette::palette( theme );
|
||||||
|
|
||||||
QVector< QskGradientStop > stops;
|
QVector< QskGradientStop > stops;
|
||||||
|
|
||||||
stops += QskGradientStop( 0.0, pal.color( static_cast< Palette::Weight >( 0 ) ) );
|
stops += QskGradientStop( 0.0, pal.color( static_cast< QskRgbPalette::Weight >( 0 ) ) );
|
||||||
|
|
||||||
const int count = Palette::NumWeights - 1;
|
const int count = QskRgbPalette::NumWeights - 1;
|
||||||
for ( int i = 1; i < count; i++ )
|
for ( int i = 1; i < count; i++ )
|
||||||
{
|
{
|
||||||
const qreal pos = qreal( i ) / count;
|
const qreal pos = qreal( i ) / count;
|
||||||
const auto weight = static_cast< Palette::Weight >( i );
|
const auto weight = static_cast< QskRgbPalette::Weight >( i );
|
||||||
|
|
||||||
stops += QskGradientStop( pos, stops.last().color() );
|
stops += QskGradientStop( pos, stops.last().color() );
|
||||||
stops += QskGradientStop( pos, pal.color( weight ) );
|
stops += QskGradientStop( pos, pal.color( weight ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
stops += QskGradientStop( 1.0,
|
stops += QskGradientStop( 1.0,
|
||||||
pal.color( static_cast< Palette::Weight >( Palette::NumWeights - 1 ) ) );
|
pal.color( static_cast< QskRgbPalette::Weight >( QskRgbPalette::NumWeights - 1 ) ) );
|
||||||
|
|
||||||
setGradient( QskGradient( orientation, stops ) );
|
setGradient( QskGradient( orientation, stops ) );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#ifndef BOX_H
|
#ifndef BOX_H
|
||||||
#define BOX_H
|
#define BOX_H
|
||||||
|
|
||||||
#include "Palette.h"
|
#include <QskRgbPalette.h>
|
||||||
#include <QskBox.h>
|
#include <QskBox.h>
|
||||||
|
|
||||||
class Box : public QskBox
|
class Box : public QskBox
|
||||||
|
|
@ -33,8 +33,8 @@ class Box : public QskBox
|
||||||
|
|
||||||
Box( QQuickItem* parentItem = nullptr );
|
Box( QQuickItem* parentItem = nullptr );
|
||||||
|
|
||||||
void setBackground( FillType, Palette::Color, bool inverted = false );
|
void setBackground( FillType, QskRgbPalette::Theme, bool inverted = false );
|
||||||
void setBorder( BorderType type, Palette::Color );
|
void setBorder( BorderType type, QskRgbPalette::Theme );
|
||||||
|
|
||||||
void setShape( const QskBoxShapeMetrics& );
|
void setShape( const QskBoxShapeMetrics& );
|
||||||
void setShape( qreal radius, Qt::SizeMode );
|
void setShape( qreal radius, Qt::SizeMode );
|
||||||
|
|
@ -57,7 +57,7 @@ class Box : public QskBox
|
||||||
const QColor&, const QColor&, const QColor& );
|
const QColor&, const QColor&, const QColor& );
|
||||||
|
|
||||||
void setGradient( const QskGradient& gradient );
|
void setGradient( const QskGradient& gradient );
|
||||||
void setGradient( const QskGradient::Orientation, Palette::Color );
|
void setGradient( const QskGradient::Orientation, QskRgbPalette::Theme );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
CONFIG += qskexample
|
CONFIG += qskexample
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
Box.h \
|
Box.h
|
||||||
Palette.h
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
Box.cpp \
|
Box.cpp \
|
||||||
Palette.cpp \
|
|
||||||
main.cpp
|
main.cpp
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ static void addTestRectangle( QskLinearBox* parent )
|
||||||
auto box = new Box( parent );
|
auto box = new Box( parent );
|
||||||
box->setMargins( 50 );
|
box->setMargins( 50 );
|
||||||
|
|
||||||
box->setBorder( Box::Flat, Palette::DeepOrange );
|
box->setBorder( Box::Flat, QskRgbPalette::DeepOrange );
|
||||||
box->setBorderWidth( 10, 20, 40, 20 );
|
box->setBorderWidth( 10, 20, 40, 20 );
|
||||||
|
|
||||||
QskBoxShapeMetrics shape( 50, Qt::RelativeSize );
|
QskBoxShapeMetrics shape( 50, Qt::RelativeSize );
|
||||||
|
|
@ -64,7 +64,7 @@ static void addTestRectangle( QskLinearBox* parent )
|
||||||
shape.setRadius( Qt::TopRightCorner, 70 );
|
shape.setRadius( Qt::TopRightCorner, 70 );
|
||||||
|
|
||||||
box->setShape( shape );
|
box->setShape( shape );
|
||||||
box->setGradient( QskGradient::Diagonal, Palette::Blue );
|
box->setGradient( QskGradient::Diagonal, QskRgbPalette::Blue );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addRectangles1( QskLinearBox* parent )
|
static void addRectangles1( QskLinearBox* parent )
|
||||||
|
|
@ -73,7 +73,7 @@ static void addRectangles1( QskLinearBox* parent )
|
||||||
Box::Horizontal, Box::Vertical, Box::Diagonal } )
|
Box::Horizontal, Box::Vertical, Box::Diagonal } )
|
||||||
{
|
{
|
||||||
auto* rectangle = new MyRectangle( parent );
|
auto* rectangle = new MyRectangle( parent );
|
||||||
rectangle->setBackground( type, Palette::Teal );
|
rectangle->setBackground( type, QskRgbPalette::Teal );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -83,8 +83,8 @@ static void addRectangles2( QskLinearBox* parent )
|
||||||
Box::Horizontal, Box::Vertical, Box::Diagonal } )
|
Box::Horizontal, Box::Vertical, Box::Diagonal } )
|
||||||
{
|
{
|
||||||
auto* rectangle = new MyRectangle( parent );
|
auto* rectangle = new MyRectangle( parent );
|
||||||
rectangle->setBorder( Box::Flat, Palette::Brown );
|
rectangle->setBorder( Box::Flat, QskRgbPalette::Brown );
|
||||||
rectangle->setBackground( type, Palette::Yellow );
|
rectangle->setBackground( type, QskRgbPalette::Yellow );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,30 +92,30 @@ static void addRectangles3( QskLinearBox* parent )
|
||||||
{
|
{
|
||||||
using namespace QskRgbValue;
|
using namespace QskRgbValue;
|
||||||
|
|
||||||
const Palette::Color borderColor = Palette::Grey;
|
const auto borderTheme = QskRgbPalette::Grey;
|
||||||
const Palette::Color fillColor = Palette::Blue;
|
const auto fillTheme = QskRgbPalette::Blue;
|
||||||
|
|
||||||
Box* box;
|
Box* box;
|
||||||
|
|
||||||
box = new MyRectangle( parent );
|
box = new MyRectangle( parent );
|
||||||
box->setBorder( Box::Raised1, borderColor );
|
box->setBorder( Box::Raised1, borderTheme );
|
||||||
box->setGradient( Grey400 );
|
box->setGradient( Grey400 );
|
||||||
|
|
||||||
box = new MyRectangle( parent );
|
box = new MyRectangle( parent );
|
||||||
box->setBorder( Box::Sunken1, borderColor );
|
box->setBorder( Box::Sunken1, borderTheme );
|
||||||
box->setGradient( QskGradient::Diagonal, Grey400, Grey500 );
|
box->setGradient( QskGradient::Diagonal, Grey400, Grey500 );
|
||||||
|
|
||||||
box = new MyRectangle( parent );
|
box = new MyRectangle( parent );
|
||||||
box->setBorder( Box::Raised2, borderColor );
|
box->setBorder( Box::Raised2, borderTheme );
|
||||||
box->setGradient( QskGradient::Vertical, Grey400, Grey500 );
|
box->setGradient( QskGradient::Vertical, Grey400, Grey500 );
|
||||||
|
|
||||||
box = new MyRectangle( parent );
|
box = new MyRectangle( parent );
|
||||||
box->setBorder( Box::Raised2, borderColor );
|
box->setBorder( Box::Raised2, borderTheme );
|
||||||
box->setBackground( Box::Vertical, fillColor, false );
|
box->setBackground( Box::Vertical, fillTheme, false );
|
||||||
|
|
||||||
box = new MyRectangle( parent );
|
box = new MyRectangle( parent );
|
||||||
box->setBorder( Box::Sunken2, borderColor );
|
box->setBorder( Box::Sunken2, borderTheme );
|
||||||
box->setBackground( Box::Vertical, fillColor, true );
|
box->setBackground( Box::Vertical, fillTheme, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addRectangles4( QskLinearBox* parent )
|
static void addRectangles4( QskLinearBox* parent )
|
||||||
|
|
@ -124,7 +124,7 @@ static void addRectangles4( QskLinearBox* parent )
|
||||||
Box::Horizontal, Box::Vertical, Box::Diagonal } )
|
Box::Horizontal, Box::Vertical, Box::Diagonal } )
|
||||||
{
|
{
|
||||||
auto* box = new MyRoundedRectangle( parent );
|
auto* box = new MyRoundedRectangle( parent );
|
||||||
box->setBackground( type, Palette::DeepOrange );
|
box->setBackground( type, QskRgbPalette::DeepOrange );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -134,8 +134,8 @@ static void addRectangles5( QskLinearBox* parent )
|
||||||
Box::Horizontal, Box::Vertical, Box::Diagonal } )
|
Box::Horizontal, Box::Vertical, Box::Diagonal } )
|
||||||
{
|
{
|
||||||
auto* box = new MyRoundedRectangle( parent );
|
auto* box = new MyRoundedRectangle( parent );
|
||||||
box->setBorder( Box::Flat, Palette::Indigo );
|
box->setBorder( Box::Flat, QskRgbPalette::Indigo );
|
||||||
box->setBackground( type, Palette::Pink );
|
box->setBackground( type, QskRgbPalette::Pink );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -143,30 +143,30 @@ static void addRectangles6( QskLinearBox* parent )
|
||||||
{
|
{
|
||||||
using namespace QskRgbValue;
|
using namespace QskRgbValue;
|
||||||
|
|
||||||
const Palette::Color borderColor = Palette::Grey;
|
const auto borderTheme = QskRgbPalette::Grey;
|
||||||
const Palette::Color fillColor = Palette::Lime;
|
const auto fillTheme = QskRgbPalette::Lime;
|
||||||
|
|
||||||
Box* box;
|
Box* box;
|
||||||
|
|
||||||
box = new MyRoundedRectangle( parent );
|
box = new MyRoundedRectangle( parent );
|
||||||
box->setBorder( Box::Raised1, borderColor );
|
box->setBorder( Box::Raised1, borderTheme );
|
||||||
box->setGradient( Grey400 );
|
box->setGradient( Grey400 );
|
||||||
|
|
||||||
box = new MyRoundedRectangle( parent );
|
box = new MyRoundedRectangle( parent );
|
||||||
box->setBorder( Box::Sunken1, borderColor );
|
box->setBorder( Box::Sunken1, borderTheme );
|
||||||
box->setGradient( QskGradient::Diagonal, Grey400, Grey500 );
|
box->setGradient( QskGradient::Diagonal, Grey400, Grey500 );
|
||||||
|
|
||||||
box = new MyRoundedRectangle( parent );
|
box = new MyRoundedRectangle( parent );
|
||||||
box->setBorder( Box::Raised2, borderColor );
|
box->setBorder( Box::Raised2, borderTheme );
|
||||||
box->setGradient( QskGradient::Vertical, Grey400, Grey500 );
|
box->setGradient( QskGradient::Vertical, Grey400, Grey500 );
|
||||||
|
|
||||||
box = new MyRoundedRectangle( parent );
|
box = new MyRoundedRectangle( parent );
|
||||||
box->setBorder( Box::Raised2, borderColor );
|
box->setBorder( Box::Raised2, borderTheme );
|
||||||
box->setBackground( Box::Vertical, fillColor, false );
|
box->setBackground( Box::Vertical, fillTheme, false );
|
||||||
|
|
||||||
box = new MyRoundedRectangle( parent );
|
box = new MyRoundedRectangle( parent );
|
||||||
box->setBorder( Box::Sunken2, borderColor );
|
box->setBorder( Box::Sunken2, borderTheme );
|
||||||
box->setBackground( Box::Vertical, fillColor, true );
|
box->setBackground( Box::Vertical, fillTheme, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addRectangles7( QskLinearBox* parent )
|
static void addRectangles7( QskLinearBox* parent )
|
||||||
|
|
@ -175,7 +175,7 @@ static void addRectangles7( QskLinearBox* parent )
|
||||||
Box::Horizontal, Box::Vertical, Box::Diagonal } )
|
Box::Horizontal, Box::Vertical, Box::Diagonal } )
|
||||||
{
|
{
|
||||||
auto* box = new MyEllipse( parent );
|
auto* box = new MyEllipse( parent );
|
||||||
box->setBackground( type, Palette::BlueGrey );
|
box->setBackground( type, QskRgbPalette::BlueGrey );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -185,8 +185,8 @@ static void addRectangles8( QskLinearBox* parent )
|
||||||
Box::Horizontal, Box::Vertical, Box::Diagonal } )
|
Box::Horizontal, Box::Vertical, Box::Diagonal } )
|
||||||
{
|
{
|
||||||
auto* box = new MyEllipse( parent );
|
auto* box = new MyEllipse( parent );
|
||||||
box->setBorder( Box::Flat, Palette::Indigo );
|
box->setBorder( Box::Flat, QskRgbPalette::Indigo );
|
||||||
box->setBackground( type, Palette::Red );
|
box->setBackground( type, QskRgbPalette::Red );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -194,36 +194,36 @@ static void addRectangles9( QskLinearBox* parent )
|
||||||
{
|
{
|
||||||
using namespace QskRgbValue;
|
using namespace QskRgbValue;
|
||||||
|
|
||||||
const Palette::Color borderColor = Palette::Grey;
|
const auto borderTheme = QskRgbPalette::Grey;
|
||||||
const Palette::Color fillColor = Palette::Lime;
|
const auto fillTheme = QskRgbPalette::Lime;
|
||||||
|
|
||||||
Box* box;
|
Box* box;
|
||||||
|
|
||||||
box = new MyEllipse( parent );
|
box = new MyEllipse( parent );
|
||||||
box->setBorder( Box::Raised1, borderColor );
|
box->setBorder( Box::Raised1, borderTheme );
|
||||||
box->setGradient( Grey400 );
|
box->setGradient( Grey400 );
|
||||||
|
|
||||||
box = new MyEllipse( parent );
|
box = new MyEllipse( parent );
|
||||||
box->setBorder( Box::Sunken1, borderColor );
|
box->setBorder( Box::Sunken1, borderTheme );
|
||||||
box->setGradient( QskGradient::Diagonal, Grey400, Grey500 );
|
box->setGradient( QskGradient::Diagonal, Grey400, Grey500 );
|
||||||
|
|
||||||
box = new MyEllipse( parent );
|
box = new MyEllipse( parent );
|
||||||
box->setBorder( Box::Raised2, borderColor );
|
box->setBorder( Box::Raised2, borderTheme );
|
||||||
box->setGradient( QskGradient::Vertical, Grey400, Grey500 );
|
box->setGradient( QskGradient::Vertical, Grey400, Grey500 );
|
||||||
|
|
||||||
box = new MyEllipse( parent );
|
box = new MyEllipse( parent );
|
||||||
box->setBorder( Box::Raised2, borderColor );
|
box->setBorder( Box::Raised2, borderTheme );
|
||||||
box->setBackground( Box::Vertical, fillColor, false );
|
box->setBackground( Box::Vertical, fillTheme, false );
|
||||||
|
|
||||||
box = new MyEllipse( parent );
|
box = new MyEllipse( parent );
|
||||||
box->setBorder( Box::Sunken2, borderColor );
|
box->setBorder( Box::Sunken2, borderTheme );
|
||||||
box->setBackground( Box::Vertical, fillColor, true );
|
box->setBackground( Box::Vertical, fillTheme, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addRectangles10( QskLinearBox* parent )
|
static void addRectangles10( QskLinearBox* parent )
|
||||||
{
|
{
|
||||||
QColor borderColor( "Indigo" );
|
QColor borderTheme( "Indigo" );
|
||||||
// borderColor.setAlpha( 100 );
|
// borderTheme.setAlpha( 100 );
|
||||||
|
|
||||||
Box* box;
|
Box* box;
|
||||||
|
|
||||||
|
|
@ -232,25 +232,25 @@ static void addRectangles10( QskLinearBox* parent )
|
||||||
|
|
||||||
box = new Box( parent );
|
box = new Box( parent );
|
||||||
box->setBorderWidth( 10 );
|
box->setBorderWidth( 10 );
|
||||||
box->setBorderColor( borderColor );
|
box->setBorderColor( borderTheme );
|
||||||
box->setGradient( QskGradient::Diagonal, "DeepPink", "DarkOrange", "HotPink" );
|
box->setGradient( QskGradient::Diagonal, "DeepPink", "DarkOrange", "HotPink" );
|
||||||
|
|
||||||
box = new Box( parent );
|
box = new Box( parent );
|
||||||
box->setShape( 100, Qt::RelativeSize );
|
box->setShape( 100, Qt::RelativeSize );
|
||||||
box->setBorderWidth( 5 );
|
box->setBorderWidth( 5 );
|
||||||
box->setBorderColor( borderColor );
|
box->setBorderColor( borderTheme );
|
||||||
box->setGradient( QskGradient::Vertical, "DeepPink", "DarkOrange", "HotPink" );
|
box->setGradient( QskGradient::Vertical, "DeepPink", "DarkOrange", "HotPink" );
|
||||||
|
|
||||||
box = new Box( parent );
|
box = new Box( parent );
|
||||||
box->setShape( 100, Qt::RelativeSize );
|
box->setShape( 100, Qt::RelativeSize );
|
||||||
box->setBorderWidth( 5 );
|
box->setBorderWidth( 5 );
|
||||||
box->setBorderColor( borderColor );
|
box->setBorderColor( borderTheme );
|
||||||
box->setGradient( QskGradient::Diagonal, "DeepPink", "DarkOrange", "HotPink" );
|
box->setGradient( QskGradient::Diagonal, "DeepPink", "DarkOrange", "HotPink" );
|
||||||
|
|
||||||
box = new Box( parent );
|
box = new Box( parent );
|
||||||
box->setShape( 100, Qt::RelativeSize );
|
box->setShape( 100, Qt::RelativeSize );
|
||||||
box->setBorderWidth( 5, 20, 30, 5 );
|
box->setBorderWidth( 5, 20, 30, 5 );
|
||||||
box->setBorderColor( borderColor );
|
box->setBorderColor( borderTheme );
|
||||||
box->setGradient( QskGradient::Vertical, "DeepPink", "DarkOrange", "HotPink" );
|
box->setGradient( QskGradient::Vertical, "DeepPink", "DarkOrange", "HotPink" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -264,14 +264,14 @@ static void addRectangles11( QskLinearBox* parent )
|
||||||
{
|
{
|
||||||
auto box = new MyRectangle( parent );
|
auto box = new MyRectangle( parent );
|
||||||
|
|
||||||
box->setBorder( Box::Flat, Palette::Teal );
|
box->setBorder( Box::Flat, QskRgbPalette::Teal );
|
||||||
|
|
||||||
qreal bw[ 4 ] = { border, border, border, border };
|
qreal bw[ 4 ] = { border, border, border, border };
|
||||||
if ( i != 0 )
|
if ( i != 0 )
|
||||||
bw[ i - 1 ] = 0;
|
bw[ i - 1 ] = 0;
|
||||||
|
|
||||||
box->setBorderWidth( bw[ 0 ], bw[ 1 ], bw[ 2 ], bw[ 3 ] );
|
box->setBorderWidth( bw[ 0 ], bw[ 1 ], bw[ 2 ], bw[ 3 ] );
|
||||||
box->setBackground( fillType[ i ], Palette::Brown, i >= 3 );
|
box->setBackground( fillType[ i ], QskRgbPalette::Brown, i >= 3 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -282,14 +282,14 @@ static void addRectangles12( QskLinearBox* parent )
|
||||||
{
|
{
|
||||||
auto* box = new Box( parent );
|
auto* box = new Box( parent );
|
||||||
box->setBorderWidth( 0 );
|
box->setBorderWidth( 0 );
|
||||||
box->setGradient( orientation, Palette::Brown );
|
box->setGradient( orientation, QskRgbPalette::Brown );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( auto orientation : { QskGradient::Vertical, QskGradient::Diagonal } )
|
for ( auto orientation : { QskGradient::Vertical, QskGradient::Diagonal } )
|
||||||
{
|
{
|
||||||
auto* box = new Box( parent );
|
auto* box = new Box( parent );
|
||||||
box->setBorder( Box::Flat, Palette::DeepOrange );
|
box->setBorder( Box::Flat, QskRgbPalette::DeepOrange );
|
||||||
box->setGradient( orientation, Palette::Blue );
|
box->setGradient( orientation, QskRgbPalette::Blue );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( auto orientation : { QskGradient::Vertical,
|
for ( auto orientation : { QskGradient::Vertical,
|
||||||
|
|
@ -298,15 +298,15 @@ static void addRectangles12( QskLinearBox* parent )
|
||||||
auto* box = new Box( parent );
|
auto* box = new Box( parent );
|
||||||
box->setBorderWidth( 0 );
|
box->setBorderWidth( 0 );
|
||||||
box->setShape( 30, 40, Qt::RelativeSize );
|
box->setShape( 30, 40, Qt::RelativeSize );
|
||||||
box->setGradient( orientation, Palette::Brown );
|
box->setGradient( orientation, QskRgbPalette::Brown );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( auto orientation : { QskGradient::Vertical, QskGradient::Diagonal } )
|
for ( auto orientation : { QskGradient::Vertical, QskGradient::Diagonal } )
|
||||||
{
|
{
|
||||||
auto* box = new Box( parent );
|
auto* box = new Box( parent );
|
||||||
box->setBorder( Box::Flat, Palette::DeepOrange );
|
box->setBorder( Box::Flat, QskRgbPalette::DeepOrange );
|
||||||
box->setShape( 30, 40, Qt::RelativeSize );
|
box->setShape( 30, 40, Qt::RelativeSize );
|
||||||
box->setGradient( orientation, Palette::Blue );
|
box->setGradient( orientation, QskRgbPalette::Blue );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( auto orientation : { QskGradient::Vertical,
|
for ( auto orientation : { QskGradient::Vertical,
|
||||||
|
|
@ -315,15 +315,15 @@ static void addRectangles12( QskLinearBox* parent )
|
||||||
auto* box = new Box( parent );
|
auto* box = new Box( parent );
|
||||||
box->setBorderWidth( 0 );
|
box->setBorderWidth( 0 );
|
||||||
box->setShape( 100, 100, Qt::RelativeSize );
|
box->setShape( 100, 100, Qt::RelativeSize );
|
||||||
box->setGradient( orientation, Palette::Brown );
|
box->setGradient( orientation, QskRgbPalette::Brown );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( auto orientation : { QskGradient::Vertical, QskGradient::Diagonal } )
|
for ( auto orientation : { QskGradient::Vertical, QskGradient::Diagonal } )
|
||||||
{
|
{
|
||||||
auto* box = new Box( parent );
|
auto* box = new Box( parent );
|
||||||
box->setBorder( Box::Flat, Palette::DeepOrange );
|
box->setBorder( Box::Flat, QskRgbPalette::DeepOrange );
|
||||||
box->setShape( 100, 100, Qt::RelativeSize );
|
box->setShape( 100, 100, Qt::RelativeSize );
|
||||||
box->setGradient( orientation, Palette::Blue );
|
box->setGradient( orientation, QskRgbPalette::Blue );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||||
* This file may be used under the terms of the 3-clause BSD License
|
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "Palette.h"
|
#include "QskRgbPalette.h"
|
||||||
#include <QskRgbValue.h>
|
#include "QskRgbValue.h"
|
||||||
|
|
||||||
#define RGB( color, weight ) color ## weight
|
#define RGB( color, weight ) color ## weight
|
||||||
|
|
||||||
|
|
@ -16,14 +16,14 @@
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
class StandardPalette : public Palette
|
class Palette : public QskRgbPalette
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StandardPalette( int index )
|
Palette( int index )
|
||||||
{
|
{
|
||||||
using namespace QskRgbValue;
|
using namespace QskRgbValue;
|
||||||
|
|
||||||
static QRgb table[][ Palette::NumWeights ] =
|
static constexpr QRgb table[][ Palette::NumWeights ] =
|
||||||
{
|
{
|
||||||
RGBTABLE( Red ),
|
RGBTABLE( Red ),
|
||||||
RGBTABLE( Pink ),
|
RGBTABLE( Pink ),
|
||||||
|
|
@ -52,7 +52,7 @@ namespace
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Palette Palette::palette( Color color )
|
QskRgbPalette QskRgbPalette::palette( Theme theme )
|
||||||
{
|
{
|
||||||
return StandardPalette( static_cast< int >( color ) );
|
return Palette( static_cast< int >( theme ) );
|
||||||
}
|
}
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||||
* This file may be used under the terms of the 3-clause BSD License
|
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef PALETTE_H
|
#ifndef QSK_RGB_PALETTE_H
|
||||||
#define PALETTE_H 1
|
#define QSK_RGB_PALETTE_H
|
||||||
|
|
||||||
#include <QColor>
|
#include "QskGlobal.h"
|
||||||
#include <QVector>
|
#include <qmetaobject.h>
|
||||||
|
#include <qcolor.h>
|
||||||
|
|
||||||
class Palette
|
class QSK_EXPORT QskRgbPalette
|
||||||
{
|
{
|
||||||
|
Q_GADGET
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Weight
|
enum Weight
|
||||||
{
|
{
|
||||||
|
|
@ -27,8 +30,9 @@ class Palette
|
||||||
|
|
||||||
NumWeights
|
NumWeights
|
||||||
};
|
};
|
||||||
|
Q_ENUM( Weight )
|
||||||
|
|
||||||
enum Color
|
enum Theme
|
||||||
{
|
{
|
||||||
Red,
|
Red,
|
||||||
Pink,
|
Pink,
|
||||||
|
|
@ -50,11 +54,15 @@ class Palette
|
||||||
Grey,
|
Grey,
|
||||||
BlueGrey,
|
BlueGrey,
|
||||||
|
|
||||||
NumColors
|
NumThemes
|
||||||
};
|
};
|
||||||
|
Q_ENUM( Theme )
|
||||||
|
|
||||||
QRgb rgb( Weight weight ) const
|
inline QRgb rgb( Weight weight ) const
|
||||||
{
|
{
|
||||||
|
if ( weight < 0 || weight >= NumWeights )
|
||||||
|
return 0;
|
||||||
|
|
||||||
return m_rgb[ weight ];
|
return m_rgb[ weight ];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,10 +71,10 @@ class Palette
|
||||||
return QColor::fromRgba( rgb( weight ) );
|
return QColor::fromRgba( rgb( weight ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
static Palette palette( Color );
|
static QskRgbPalette palette( Theme );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QRgb* m_rgb;
|
const QRgb* m_rgb;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -29,6 +29,7 @@ HEADERS += \
|
||||||
common/QskNamespace.h \
|
common/QskNamespace.h \
|
||||||
common/QskObjectCounter.h \
|
common/QskObjectCounter.h \
|
||||||
common/QskRgbValue.h \
|
common/QskRgbValue.h \
|
||||||
|
common/QskRgbPalette.h \
|
||||||
common/QskSizePolicy.h \
|
common/QskSizePolicy.h \
|
||||||
common/QskTextColors.h \
|
common/QskTextColors.h \
|
||||||
common/QskTextOptions.h
|
common/QskTextOptions.h
|
||||||
|
|
@ -47,6 +48,7 @@ SOURCES += \
|
||||||
common/QskMetaInvokable.cpp \
|
common/QskMetaInvokable.cpp \
|
||||||
common/QskObjectCounter.cpp \
|
common/QskObjectCounter.cpp \
|
||||||
common/QskRgbValue.cpp \
|
common/QskRgbValue.cpp \
|
||||||
|
common/QskRgbPalette.cpp \
|
||||||
common/QskSizePolicy.cpp \
|
common/QskSizePolicy.cpp \
|
||||||
common/QskTextColors.cpp \
|
common/QskTextColors.cpp \
|
||||||
common/QskTextOptions.cpp
|
common/QskTextOptions.cpp
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue