QskSkinHintTableEditor introduced
This commit is contained in:
parent
9f2cb6920d
commit
5ecec7892e
|
@ -18,6 +18,7 @@
|
|||
#include <QskAnimationHint.h>
|
||||
#include <QskSetup.h>
|
||||
#include <QskSkinTransition.h>
|
||||
#include <QskSkinHintTableEditor.h>
|
||||
#include <QskSkin.h>
|
||||
|
||||
#include <QEasingCurve>
|
||||
|
@ -56,31 +57,33 @@ namespace
|
|||
const QColor color4( "#E5E5E5" ); // Platinum
|
||||
const QColor color5( "#FFFFFF" ); // white
|
||||
|
||||
setColor( QskTextLabel::Text, color3 );
|
||||
QskSkinHintTableEditor ed( &hintTable() );
|
||||
|
||||
ed.setColor( QskTextLabel::Text, color3 );
|
||||
|
||||
{
|
||||
using Q = Speedometer;
|
||||
|
||||
setBoxBorderMetrics( Q::Panel, 5 );
|
||||
setBoxShape( Q::Panel, 30, Qt::RelativeSize );
|
||||
setGradient( Q::Panel,
|
||||
ed.setBoxBorderMetrics( Q::Panel, 5 );
|
||||
ed.setBoxShape( Q::Panel, 30, Qt::RelativeSize );
|
||||
ed.setGradient( Q::Panel,
|
||||
QskGradient( QskGradient::Vertical, color2, color4 ) );
|
||||
setBoxBorderColors( Q::Panel, color3 );
|
||||
ed.setBoxBorderColors( Q::Panel, color3 );
|
||||
|
||||
setBoxBorderMetrics( Q::Knob, 5 );
|
||||
setStrutSize( Q::Knob, 20, 20 );
|
||||
setBoxShape( Q::Knob, 100, Qt::RelativeSize );
|
||||
setGradient( Q::Knob, color2 );
|
||||
setBoxBorderColors( Q::Knob, color4 );
|
||||
ed.setBoxBorderMetrics( Q::Knob, 5 );
|
||||
ed.setStrutSize( Q::Knob, 20, 20 );
|
||||
ed.setBoxShape( Q::Knob, 100, Qt::RelativeSize );
|
||||
ed.setGradient( Q::Knob, color2 );
|
||||
ed.setBoxBorderColors( Q::Knob, color4 );
|
||||
|
||||
setMetric( Q::Needle | QskAspect::Size, 4 );
|
||||
setMetric( Q::Needle | QskAspect::Margin, 15 );
|
||||
setColor( Q::Needle, color4 );
|
||||
ed.setMetric( Q::Needle | QskAspect::Size, 4 );
|
||||
ed.setMetric( Q::Needle | QskAspect::Margin, 15 );
|
||||
ed.setColor( Q::Needle, color4 );
|
||||
|
||||
setSpacing( Q::TickLabels, 3 );
|
||||
setStrutSize( Q::TickLabels, 3, 25 );
|
||||
setColor( Q::TickLabels, color4 );
|
||||
setFontRole( Q::TickLabels, QskSkin::SmallFont );
|
||||
ed.setSpacing( Q::TickLabels, 3 );
|
||||
ed.setStrutSize( Q::TickLabels, 3, 25 );
|
||||
ed.setColor( Q::TickLabels, color4 );
|
||||
ed.setFontRole( Q::TickLabels, QskSkin::SmallFont );
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -105,30 +108,32 @@ namespace
|
|||
const QColor color4( "#FDFFFC" ); // baby powder
|
||||
const QColor color5( "#B91372" ); // red violet
|
||||
|
||||
setColor( QskTextLabel::Text, color4 );
|
||||
QskSkinHintTableEditor ed( &hintTable() );
|
||||
|
||||
ed.setColor( QskTextLabel::Text, color4 );
|
||||
|
||||
{
|
||||
using Q = Speedometer;
|
||||
|
||||
setBoxBorderMetrics( Q::Panel, 2 );
|
||||
setBoxShape( Q::Panel, 100, Qt::RelativeSize );
|
||||
setGradient( Q::Panel, color1 );
|
||||
setBoxBorderColors( Q::Panel, color3 );
|
||||
ed.setBoxBorderMetrics( Q::Panel, 2 );
|
||||
ed.setBoxShape( Q::Panel, 100, Qt::RelativeSize );
|
||||
ed.setGradient( Q::Panel, color1 );
|
||||
ed.setBoxBorderColors( Q::Panel, color3 );
|
||||
|
||||
setBoxBorderMetrics( Q::Knob, 2 );
|
||||
setStrutSize( Q::Knob, 30, 30 );
|
||||
setBoxShape( Q::Knob, 100, Qt::RelativeSize );
|
||||
setGradient( Q::Knob,
|
||||
ed.setBoxBorderMetrics( Q::Knob, 2 );
|
||||
ed.setStrutSize( Q::Knob, 30, 30 );
|
||||
ed.setBoxShape( Q::Knob, 100, Qt::RelativeSize );
|
||||
ed.setGradient( Q::Knob,
|
||||
QskGradient( QskGradient::Diagonal, color2, color1 ) );
|
||||
|
||||
setMetric( Q::Needle | QskAspect::Size, 2 );
|
||||
setMetric( Q::Needle | QskAspect::Margin, 10 );
|
||||
setColor( Q::Needle, color2 );
|
||||
ed.setMetric( Q::Needle | QskAspect::Size, 2 );
|
||||
ed.setMetric( Q::Needle | QskAspect::Margin, 10 );
|
||||
ed.setColor( Q::Needle, color2 );
|
||||
|
||||
setSpacing( Q::TickLabels, 4 );
|
||||
setStrutSize( Q::TickLabels, 2, 15 );
|
||||
setColor( Q::TickLabels, color4 );
|
||||
setFontRole( Q::TickLabels, QskSkin::SmallFont );
|
||||
ed.setSpacing( Q::TickLabels, 4 );
|
||||
ed.setStrutSize( Q::TickLabels, 2, 15 );
|
||||
ed.setColor( Q::TickLabels, color4 );
|
||||
ed.setFontRole( Q::TickLabels, QskSkin::SmallFont );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -12,19 +12,8 @@
|
|||
#include <QskSetup.h>
|
||||
#include <QskSkin.h>
|
||||
#include <QskSkinTransition.h>
|
||||
|
||||
static void qskResetColors( QskSkin* skin, const QColor& accent )
|
||||
{
|
||||
skin->resetColors( accent );
|
||||
|
||||
/*
|
||||
The current implementation of the skins is not that good
|
||||
and we don't have support for customizing them by a minimal set
|
||||
of attributes. So we do some manual extra work here
|
||||
*/
|
||||
skin->setColor( QskListView::CellSelected, accent.darker( 130 ) );
|
||||
skin->setBoxBorderColors( QskFocusIndicator::Panel, accent.darker( 150 ) );
|
||||
}
|
||||
#include <QskSkinHintTable.h>
|
||||
#include <QskSkinHintTableEditor.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -39,7 +28,18 @@ namespace
|
|||
protected:
|
||||
void updateSkin( QskSkin*, QskSkin* newSkin ) override
|
||||
{
|
||||
qskResetColors( newSkin, m_accent );
|
||||
newSkin->resetColors( m_accent );
|
||||
|
||||
/*
|
||||
The current implementation of the skins is not that good
|
||||
and we don't have support for customizing them by a minimal set
|
||||
of attributes. So we do some manual extra work here
|
||||
*/
|
||||
|
||||
QskSkinHintTableEditor ed( &newSkin->hintTable() );
|
||||
|
||||
ed.setColor( QskListView::CellSelected, m_accent.darker( 130 ) );
|
||||
ed.setBoxBorderColors( QskFocusIndicator::Panel, m_accent.darker( 150 ) );
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -49,7 +49,7 @@ namespace
|
|||
|
||||
Theme::Theme( QObject* parent )
|
||||
: QObject( parent )
|
||||
, m_accent( qskSetup->skin()->color( QskAspect::Color ) )
|
||||
, m_accent( Qt::blue )
|
||||
{
|
||||
connect( qskSetup, &QskSetup::skinChanged,
|
||||
this, [ this ]( QskSkin* ) { updateColors(); } );
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "MyToggleButtonSkinlet.h"
|
||||
|
||||
#include <QskSkin.h>
|
||||
#include <QskSkinHintTableEditor.h>
|
||||
#include <QskAnimationHint.h>
|
||||
#include <QskSetup.h>
|
||||
|
||||
|
@ -40,13 +41,22 @@ class MySkin : public QskSkin
|
|||
declareSkinlet< QskBox, QskBoxSkinlet >();
|
||||
declareSkinlet< QskFocusIndicator, QskFocusIndicatorSkinlet >();
|
||||
declareSkinlet< MyToggleButton, MyToggleButtonSkinlet >();
|
||||
|
||||
#if 1
|
||||
setGradient( QskAspect::Control, Qt::gray );
|
||||
#endif
|
||||
}
|
||||
|
||||
void initFocusIndicatorHints(
|
||||
protected:
|
||||
void setGraphicFilter( int role, QRgb rgb )
|
||||
{
|
||||
QskColorFilter filter;
|
||||
filter.addColorSubstitution( QskRgb::Khaki, rgb );
|
||||
|
||||
QskSkin::setGraphicFilter( role, filter );
|
||||
}
|
||||
};
|
||||
|
||||
class MySkinEditor : public QskSkinHintTableEditor
|
||||
{
|
||||
public:
|
||||
void setupFocusIndicator(
|
||||
qreal border, qreal radius, qreal padding, QRgb rgb )
|
||||
{
|
||||
const auto subControl = QskFocusIndicator::Panel;
|
||||
|
@ -59,7 +69,7 @@ class MySkin : public QskSkin
|
|||
setBoxBorderColors( subControl, rgb );
|
||||
}
|
||||
|
||||
void initBoxHints(
|
||||
void setupBox(
|
||||
qreal border, qreal radius,
|
||||
const QskBoxBorderColors& borderColors,
|
||||
const QskGradient& fillColor )
|
||||
|
@ -73,7 +83,7 @@ class MySkin : public QskSkin
|
|||
setPadding( subControl, 0.5 * radius );
|
||||
}
|
||||
|
||||
void initToggleButtonHints(
|
||||
void setupToggleButton(
|
||||
bool raised, qreal width, qreal height, qreal radius,
|
||||
QRgb baseColor, QRgb baseTextColor,
|
||||
QRgb foregroundColor, QRgb foregroundTextColor )
|
||||
|
@ -154,17 +164,19 @@ class MySkin : public QskSkin
|
|||
setAnimation( Q::Cursor | A::Metric, animator() );
|
||||
}
|
||||
|
||||
void setGraphicFilter( int role, QRgb rgb )
|
||||
void setAnimator( uint duration, QEasingCurve::Type type )
|
||||
{
|
||||
QskColorFilter filter;
|
||||
filter.addColorSubstitution( QskRgb::Khaki, rgb );
|
||||
m_animationHint.duration = duration;
|
||||
m_animationHint.type = type;
|
||||
}
|
||||
|
||||
QskSkin::setGraphicFilter( role, filter );
|
||||
QskAnimationHint animator() const
|
||||
{
|
||||
return m_animationHint;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
virtual QskAnimationHint animator() const = 0;
|
||||
QskAnimationHint m_animationHint;
|
||||
};
|
||||
|
||||
class MySkin1 : public MySkin
|
||||
|
@ -177,15 +189,17 @@ class MySkin1 : public MySkin
|
|||
setGraphicFilter( GraphicRoleNormal, Crimson );
|
||||
setGraphicFilter( GraphicRoleInverted, Gold );
|
||||
|
||||
initFocusIndicatorHints( 2, 3, 6, DarkBlue );
|
||||
initBoxHints( 2, 8, DarkCyan, LightCyan );
|
||||
initToggleButtonHints( false, 150, 120, 6,
|
||||
AliceBlue, Black, CornflowerBlue, White );
|
||||
}
|
||||
MySkinEditor editor;
|
||||
editor.setTable( &hintTable() );
|
||||
editor.setAnimator( 200, QEasingCurve::Linear );
|
||||
|
||||
QskAnimationHint animator() const override
|
||||
{
|
||||
return QskAnimationHint( 200, QEasingCurve::Linear );
|
||||
editor.setGradient( QskAspect::Control, Qt::gray );
|
||||
|
||||
editor.setupFocusIndicator( 2, 3, 6, DarkBlue );
|
||||
editor.setupBox( 2, 8, DarkCyan, LightCyan );
|
||||
|
||||
editor.setupToggleButton( false, 150, 120, 6,
|
||||
AliceBlue, Black, CornflowerBlue, White );
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -199,15 +213,17 @@ class MySkin2 : public MySkin
|
|||
setGraphicFilter( GraphicRoleNormal, HotPink );
|
||||
setGraphicFilter( GraphicRoleInverted, White );
|
||||
|
||||
initFocusIndicatorHints( 2, 6, 6, Crimson );
|
||||
initBoxHints( 4, 30, LightPink, MistyRose );
|
||||
initToggleButtonHints( true, 130, 100, 40,
|
||||
LightPink, Black, HotPink, White );
|
||||
}
|
||||
MySkinEditor editor;
|
||||
editor.setTable( &hintTable() );
|
||||
editor.setAnimator( 100, QEasingCurve::InQuad );
|
||||
|
||||
QskAnimationHint animator() const override
|
||||
{
|
||||
return QskAnimationHint( 100, QEasingCurve::InQuad );
|
||||
editor.setGradient( QskAspect::Control, Qt::gray );
|
||||
|
||||
editor.setupFocusIndicator( 2, 6, 6, Crimson );
|
||||
editor.setupBox( 4, 30, LightPink, MistyRose );
|
||||
|
||||
editor.setupToggleButton( true, 130, 100, 40,
|
||||
LightPink, Black, HotPink, White );
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "QskMaterialSkin.h"
|
||||
|
||||
#include <QskSkinHintTableEditor.h>
|
||||
|
||||
#include <QskBox.h>
|
||||
#include <QskDialogButton.h>
|
||||
#include <QskDialogButtonBox.h>
|
||||
|
@ -25,8 +27,6 @@
|
|||
#include <QskTextLabel.h>
|
||||
#include <QskVirtualKeyboard.h>
|
||||
|
||||
#include <QskSkinlet.h>
|
||||
|
||||
#include <QskAnimationHint.h>
|
||||
#include <QskAspect.h>
|
||||
#include <QskBoxBorderColors.h>
|
||||
|
@ -93,153 +93,144 @@ namespace
|
|||
|
||||
QColor textColor;
|
||||
};
|
||||
|
||||
class Editor : private QskSkinHintTableEditor
|
||||
{
|
||||
public:
|
||||
Editor( QskSkinHintTable* table, const ColorPalette& palette )
|
||||
: QskSkinHintTableEditor( table )
|
||||
, m_pal( palette )
|
||||
{
|
||||
}
|
||||
|
||||
void setup();
|
||||
|
||||
private:
|
||||
void setupControl();
|
||||
|
||||
void setupBox();
|
||||
void setupDialogButtonBox();
|
||||
void setupDialogButton();
|
||||
void setupFocusIndicator();
|
||||
void setupInputPanel();
|
||||
void setupVirtualKeyboard();
|
||||
void setupListView();
|
||||
void setupPageIndicator();
|
||||
void setupPopup();
|
||||
void setupProgressBar();
|
||||
void setupPushButton();
|
||||
void setupScrollView();
|
||||
void setupSeparator();
|
||||
void setupSubWindow();
|
||||
void setupSlider();
|
||||
void setupTabButton();
|
||||
void setupTabBar();
|
||||
void setupTabView();
|
||||
void setupTextInput();
|
||||
void setupTextLabel();
|
||||
|
||||
const ColorPalette& m_pal;
|
||||
};
|
||||
}
|
||||
|
||||
class QskMaterialSkin::PrivateData
|
||||
void Editor::setup()
|
||||
{
|
||||
public:
|
||||
ColorPalette palette;
|
||||
};
|
||||
setupControl();
|
||||
|
||||
QskMaterialSkin::QskMaterialSkin( QObject* parent )
|
||||
: Inherited( parent )
|
||||
, m_data( new PrivateData() )
|
||||
{
|
||||
m_data->palette = ColorPalette( QskRgb::Grey100,
|
||||
QskRgb::Blue500, QskRgb::White );
|
||||
|
||||
// Default theme colors
|
||||
setupFonts( "Roboto" );
|
||||
|
||||
auto buttonFont = font( QskSkin::DefaultFont );
|
||||
buttonFont.setCapitalization( QFont::AllUppercase );
|
||||
setFont( ButtonFontRole, buttonFont );
|
||||
|
||||
initHints();
|
||||
setupBox();
|
||||
setupDialogButtonBox();
|
||||
setupDialogButton();
|
||||
setupFocusIndicator();
|
||||
setupInputPanel();
|
||||
setupVirtualKeyboard();
|
||||
setupListView();
|
||||
setupPageIndicator();
|
||||
setupPopup();
|
||||
setupProgressBar();
|
||||
setupPushButton();
|
||||
setupScrollView();
|
||||
setupSeparator();
|
||||
setupSlider();
|
||||
setupSubWindow();
|
||||
setupTabButton();
|
||||
setupTabBar();
|
||||
setupTabView();
|
||||
setupTextLabel();
|
||||
setupTextInput();
|
||||
}
|
||||
|
||||
QskMaterialSkin::~QskMaterialSkin()
|
||||
{
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initHints()
|
||||
{
|
||||
initCommonHints();
|
||||
|
||||
initBoxHints();
|
||||
initDialogButtonBoxHints();
|
||||
initDialogButtonHints();
|
||||
initFocusIndicatorHints();
|
||||
initInputPanelHints();
|
||||
initVirtualKeyboardHints();
|
||||
initListViewHints();
|
||||
initPageIndicatorHints();
|
||||
initPopupHints();
|
||||
initProgressBarHints();
|
||||
initPushButtonHints();
|
||||
initScrollViewHints();
|
||||
initSeparatorHints();
|
||||
initSliderHints();
|
||||
initSubWindowHints();
|
||||
initTabButtonHints();
|
||||
initTabBarHints();
|
||||
initTabViewHints();
|
||||
initTextLabelHints();
|
||||
initTextInputHints();
|
||||
}
|
||||
|
||||
void QskMaterialSkin::resetColors( const QColor& accent )
|
||||
{
|
||||
m_data->palette = ColorPalette( m_data->palette.baseColor,
|
||||
accent, m_data->palette.contrastColor );
|
||||
|
||||
initHints();
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initCommonHints()
|
||||
void Editor::setupControl()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskControl;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setPadding( A::Control, 4 );
|
||||
|
||||
setGradient( A::Control, pal.baseColor );
|
||||
setColor( A::Control | A::StyleColor, pal.textColor );
|
||||
setGradient( A::Control, m_pal.baseColor );
|
||||
setColor( A::Control | A::StyleColor, m_pal.textColor );
|
||||
setColor( A::Control | A::StyleColor | Q::Disabled,
|
||||
qskShadedColor( m_data->palette.textColor, 0.6 ) );
|
||||
qskShadedColor( m_pal.textColor, 0.6 ) );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initBoxHints()
|
||||
void Editor::setupBox()
|
||||
{
|
||||
using Q = QskBox;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setGradient( Q::Panel, pal.baseColor );
|
||||
setGradient( Q::Panel, m_pal.baseColor );
|
||||
setBoxShape( Q::Panel, 4 );
|
||||
setBoxBorderMetrics( Q::Panel, 0 );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initPopupHints()
|
||||
void Editor::setupPopup()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskPopup;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setSkinHint( Q::Overlay | A::Style, true );
|
||||
setFlagHint( Q::Overlay | A::Style, true );
|
||||
|
||||
const QskGradient gradient( QskGradient::Vertical,
|
||||
qskShadedColor( pal.accentColor, 0.45 ), qskShadedColor( pal.accentColor, 0.7 ) );
|
||||
qskShadedColor( m_pal.accentColor, 0.45 ), qskShadedColor( m_pal.accentColor, 0.7 ) );
|
||||
|
||||
setGradient( Q::Overlay, gradient );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initTextLabelHints()
|
||||
void Editor::setupTextLabel()
|
||||
{
|
||||
using Q = QskTextLabel;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setAlignment( Q::Text, Qt::AlignCenter );
|
||||
setColor( Q::Text, pal.textColor );
|
||||
setColor( Q::Text, m_pal.textColor );
|
||||
|
||||
setPadding( Q::Panel, 5 );
|
||||
setBoxShape( Q::Panel, 4 );
|
||||
setBoxBorderMetrics( Q::Panel, 2 );
|
||||
setBoxBorderColors( Q::Panel, pal.darker125 );
|
||||
setGradient( Q::Panel, pal.baseColor );
|
||||
setBoxBorderColors( Q::Panel, m_pal.darker125 );
|
||||
setGradient( Q::Panel, m_pal.baseColor );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initTextInputHints()
|
||||
void Editor::setupTextInput()
|
||||
{
|
||||
using Q = QskTextInput;
|
||||
|
||||
setAlignment( Q::Text, Qt::AlignLeft | Qt::AlignTop );
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setColor( Q::Text, pal.textColor );
|
||||
setColor( Q::PanelSelected, pal.accentColor );
|
||||
setColor( Q::TextSelected, pal.contrastColor );
|
||||
setColor( Q::Text, m_pal.textColor );
|
||||
setColor( Q::PanelSelected, m_pal.accentColor );
|
||||
setColor( Q::TextSelected, m_pal.contrastColor );
|
||||
|
||||
setPadding( Q::Panel, 5 );
|
||||
setBoxShape( Q::Panel, 4 );
|
||||
setBoxBorderMetrics( Q::Panel, 2 );
|
||||
setBoxBorderColors( Q::Panel, pal.darker125 );
|
||||
setGradient( Q::Panel, pal.baseColor );
|
||||
setBoxBorderColors( Q::Panel, m_pal.darker125 );
|
||||
setGradient( Q::Panel, m_pal.baseColor );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initProgressBarHints()
|
||||
void Editor::setupProgressBar()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using namespace QskRgb;
|
||||
using Q = QskProgressBar;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
for ( auto subControl : { Q::Groove, Q::Bar } )
|
||||
{
|
||||
setMetric( subControl | A::Size, 5 );
|
||||
|
@ -251,29 +242,25 @@ void QskMaterialSkin::initProgressBarHints()
|
|||
|
||||
setGradient( Q::Groove, Grey );
|
||||
setMetric( Q::Groove | A::Size, 5 );
|
||||
setGradient( Q::Bar, pal.accentColor );
|
||||
setGradient( Q::Bar, m_pal.accentColor );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initFocusIndicatorHints()
|
||||
void Editor::setupFocusIndicator()
|
||||
{
|
||||
using Q = QskFocusIndicator;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setPadding( Q::Panel, 5 );
|
||||
setBoxShape( Q::Panel, 4 );
|
||||
setBoxBorderMetrics( Q::Panel, 2 );
|
||||
setBoxBorderColors( Q::Panel, pal.accentColor );
|
||||
setBoxBorderColors( Q::Panel, m_pal.accentColor );
|
||||
setGradient( Q::Panel, QskGradient() );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initSeparatorHints()
|
||||
void Editor::setupSeparator()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskSeparator;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
for ( auto placement : { A::Horizontal, A::Vertical } )
|
||||
{
|
||||
const auto aspect = Q::Panel | placement;
|
||||
|
@ -281,16 +268,14 @@ void QskMaterialSkin::initSeparatorHints()
|
|||
setMetric( aspect | A::Size, 4 );
|
||||
setBoxShape( Q::Panel, 0 );
|
||||
setBoxBorderMetrics( Q::Panel, 0 );
|
||||
setGradient( aspect, pal.baseColor );
|
||||
setGradient( aspect, m_pal.baseColor );
|
||||
}
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initPageIndicatorHints()
|
||||
void Editor::setupPageIndicator()
|
||||
{
|
||||
using Q = QskPageIndicator;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
for ( auto subControl : { Q::Bullet, Q::Highlighted } )
|
||||
{
|
||||
const auto extent = qskDpiScaled( 10 );
|
||||
|
@ -301,7 +286,7 @@ void QskMaterialSkin::initPageIndicatorHints()
|
|||
setBoxBorderMetrics( subControl, 0 );
|
||||
|
||||
const QColor color = ( subControl == Q::Bullet )
|
||||
? pal.lighter150 : pal.accentColor;
|
||||
? m_pal.lighter150 : m_pal.accentColor;
|
||||
|
||||
setGradient( subControl, color );
|
||||
setBoxBorderColors( subControl, color );
|
||||
|
@ -314,14 +299,12 @@ void QskMaterialSkin::initPageIndicatorHints()
|
|||
setSpacing( Q::Panel, 3 );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initPushButtonHints()
|
||||
void Editor::setupPushButton()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using namespace QskRgb;
|
||||
using Q = QskPushButton;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setStrutSize( Q::Panel, qskDpiScaled( 75.0 ), qskDpiScaled( 23.0 ) );
|
||||
setSpacing( Q::Panel, 4 );
|
||||
|
||||
|
@ -343,8 +326,8 @@ void QskMaterialSkin::initPushButtonHints()
|
|||
setGradient( Q::Panel, White );
|
||||
setGradient( Q::Panel | Q::Flat, White & ColorMask );
|
||||
|
||||
setColor( Q::Text, pal.textColor );
|
||||
setColor( Q::Text | Q::Disabled, qskShadedColor( pal.textColor, 0.6 ) );
|
||||
setColor( Q::Text, m_pal.textColor );
|
||||
setColor( Q::Text | Q::Disabled, qskShadedColor( m_pal.textColor, 0.6 ) );
|
||||
setFontRole( Q::Text, ButtonFontRole );
|
||||
setAlignment( Q::Text, Qt::AlignCenter );
|
||||
|
||||
|
@ -359,10 +342,10 @@ void QskMaterialSkin::initPushButtonHints()
|
|||
{
|
||||
const auto states = state1 | state2 | state3;
|
||||
|
||||
setGradient( Q::Panel | states, pal.accentColor );
|
||||
setGradient( Q::Panel | states, m_pal.accentColor );
|
||||
setColor( Q::Text | states, White );
|
||||
|
||||
setGradient( Q::Panel | Q::Flat | states, pal.accentColor );
|
||||
setGradient( Q::Panel | Q::Flat | states, m_pal.accentColor );
|
||||
setColor( Q::Text | Q::Flat | states, White );
|
||||
}
|
||||
}
|
||||
|
@ -373,14 +356,12 @@ void QskMaterialSkin::initPushButtonHints()
|
|||
setAnimation( Q::Text | A::Color, qskDuration );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initDialogButtonHints()
|
||||
void Editor::setupDialogButton()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using namespace QskRgb;
|
||||
using Q = QskDialogButton;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setStrutSize( Q::Panel, 30, 16 );
|
||||
setSpacing( Q::Panel, 4 );
|
||||
|
||||
|
@ -397,8 +378,8 @@ void QskMaterialSkin::initDialogButtonHints()
|
|||
setBoxBorderColors( Q::Panel, noBorderColors );
|
||||
|
||||
setGradient( Q::Panel, White );
|
||||
setColor( Q::Text, pal.textColor );
|
||||
setColor( Q::Text | Q::Disabled, qskShadedColor( pal.textColor, 0.6 ) );
|
||||
setColor( Q::Text, m_pal.textColor );
|
||||
setColor( Q::Text | Q::Disabled, qskShadedColor( m_pal.textColor, 0.6 ) );
|
||||
setFontRole( Q::Text, ButtonFontRole );
|
||||
setAlignment( Q::Text, Qt::AlignCenter );
|
||||
|
||||
|
@ -412,7 +393,7 @@ void QskMaterialSkin::initDialogButtonHints()
|
|||
{
|
||||
const auto states = state1 | state2 | state3;
|
||||
|
||||
setGradient( Q::Panel | states, pal.accentColor );
|
||||
setGradient( Q::Panel | states, m_pal.accentColor );
|
||||
setColor( Q::Text | states, White );
|
||||
}
|
||||
}
|
||||
|
@ -423,25 +404,21 @@ void QskMaterialSkin::initDialogButtonHints()
|
|||
setAnimation( Q::Text | A::Color, qskDuration );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initDialogButtonBoxHints()
|
||||
void Editor::setupDialogButtonBox()
|
||||
{
|
||||
using Q = QskDialogButtonBox;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setGradient( Q::Panel, pal.baseColor );
|
||||
setGradient( Q::Panel, m_pal.baseColor );
|
||||
setBoxShape( Q::Panel, 0 );
|
||||
setBoxBorderMetrics( Q::Panel, 0 );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initSliderHints()
|
||||
void Editor::setupSlider()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using namespace QskRgb;
|
||||
using Q = QskSlider;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
const qreal extent = 30;
|
||||
|
||||
// Panel
|
||||
|
@ -467,8 +444,8 @@ void QskMaterialSkin::initSliderHints()
|
|||
|
||||
setGradient( Q::Groove, Grey );
|
||||
|
||||
setGradient( Q::Fill, pal.accentColor );
|
||||
setBoxBorderColors( Q::Fill, pal.accentColor );
|
||||
setGradient( Q::Fill, m_pal.accentColor );
|
||||
setBoxBorderColors( Q::Fill, m_pal.accentColor );
|
||||
|
||||
// handle
|
||||
|
||||
|
@ -483,12 +460,12 @@ void QskMaterialSkin::initSliderHints()
|
|||
setGradient( Q::Handle | Q::Disabled, Grey );
|
||||
setBoxBorderColors( Q::Handle | Q::Disabled, Grey );
|
||||
|
||||
setGradient( Q::Handle, pal.accentColor );
|
||||
setGradient( Q::Handle | Q::Pressed, pal.accentColor );
|
||||
setGradient( Q::Handle, m_pal.accentColor );
|
||||
setGradient( Q::Handle | Q::Pressed, m_pal.accentColor );
|
||||
|
||||
for ( auto state : { A::NoState, Q::Pressed, Q::Pressed | Q::Hovered } )
|
||||
{
|
||||
setBoxBorderColors( Q::Handle | state, pal.accentColor );
|
||||
setBoxBorderColors( Q::Handle | state, m_pal.accentColor );
|
||||
}
|
||||
|
||||
for ( auto state : { A::NoState, Q::Pressed, Q::Pressed | Q::Hovered } )
|
||||
|
@ -506,13 +483,11 @@ void QskMaterialSkin::initSliderHints()
|
|||
setAnimation( Q::Handle | A::Metric | A::Position | Q::Pressed, 0 );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initTabButtonHints()
|
||||
void Editor::setupTabButton()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskTabButton;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setStrutSize( Q::Panel, 30, 16 );
|
||||
|
||||
for ( const auto placement : { A::Left, A::Right, A::Top, A::Bottom } )
|
||||
|
@ -555,7 +530,7 @@ void QskMaterialSkin::initTabButtonHints()
|
|||
QskBoxBorderColors borderColors( QskRgb::White );
|
||||
setBoxBorderColors( aspect, borderColors );
|
||||
|
||||
borderColors.setColorsAt( edge, pal.accentColor );
|
||||
borderColors.setColorsAt( edge, m_pal.accentColor );
|
||||
for ( auto state : { Q::Checked, Q::Pressed, Q::Checkable | Q::Hovered } )
|
||||
setBoxBorderColors( aspect | state, borderColors );
|
||||
}
|
||||
|
@ -566,12 +541,12 @@ void QskMaterialSkin::initTabButtonHints()
|
|||
setFontRole( Q::Text, ButtonFontRole );
|
||||
setAlignment( Q::Text, Qt::AlignCenter );
|
||||
|
||||
setColor( Q::Text, pal.textColor );
|
||||
setColor( Q::Text | Q::Checkable | Q::Disabled, qskShadedColor( pal.textColor, 0.6 ) );
|
||||
setColor( Q::Text, m_pal.textColor );
|
||||
setColor( Q::Text | Q::Checkable | Q::Disabled, qskShadedColor( m_pal.textColor, 0.6 ) );
|
||||
setColor( Q::Text | Q::Disabled, QskRgb::Grey600 );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initTabBarHints()
|
||||
void Editor::setupTabBar()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskTabBar;
|
||||
|
@ -584,50 +559,44 @@ void QskMaterialSkin::initTabBarHints()
|
|||
setAnimation( Q::Panel | A::Metric, QskAnimationHint( 200, QEasingCurve::InCubic ) );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initTabViewHints()
|
||||
void Editor::setupTabView()
|
||||
{
|
||||
using Q = QskTabView;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setBoxShape( Q::Page, 0 );
|
||||
setBoxBorderMetrics( Q::Page, 0 );
|
||||
setGradient( Q::Page, pal.darker150 );
|
||||
setBoxBorderColors( Q::Page, pal.baseColor );
|
||||
setGradient( Q::Page, m_pal.darker150 );
|
||||
setBoxBorderColors( Q::Page, m_pal.baseColor );
|
||||
|
||||
setAnimation( Q::Page, qskDuration );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initInputPanelHints()
|
||||
void Editor::setupInputPanel()
|
||||
{
|
||||
using Q = QskInputPanelBox;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setBoxShape( Q::Panel, 0 );
|
||||
setBoxBorderMetrics( Q::Panel, 0 );
|
||||
setGradient( Q::Panel, pal.darker150 );
|
||||
setBoxBorderColors( Q::Panel, pal.baseColor );
|
||||
setGradient( Q::Panel, m_pal.darker150 );
|
||||
setBoxBorderColors( Q::Panel, m_pal.baseColor );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initVirtualKeyboardHints()
|
||||
void Editor::setupVirtualKeyboard()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskVirtualKeyboard;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
// key panel
|
||||
setMargin( Q::ButtonPanel, 2 );
|
||||
|
||||
setBoxShape( Q::ButtonPanel, 20.0, Qt::RelativeSize );
|
||||
setBoxBorderMetrics( Q::ButtonPanel, 2 );
|
||||
|
||||
setGradient( Q::ButtonPanel, pal.darker125 );
|
||||
setBoxBorderColors( Q::ButtonPanel, pal.baseColor );
|
||||
setGradient( Q::ButtonPanel, m_pal.darker125 );
|
||||
setBoxBorderColors( Q::ButtonPanel, m_pal.baseColor );
|
||||
|
||||
for ( auto state : { A::NoState, Q::Focused } )
|
||||
setBoxBorderColors( Q::ButtonPanel | QskPushButton::Pressed | state, pal.accentColor );
|
||||
setBoxBorderColors( Q::ButtonPanel | QskPushButton::Pressed | state, m_pal.accentColor );
|
||||
|
||||
setAnimation( Q::ButtonPanel | A::Color, qskDuration );
|
||||
setAnimation( Q::ButtonPanel | A::Metric, qskDuration );
|
||||
|
@ -635,17 +604,15 @@ void QskMaterialSkin::initVirtualKeyboardHints()
|
|||
// panel
|
||||
setBoxShape( Q::Panel, 0 );
|
||||
setBoxBorderMetrics( Q::Panel, 0 );
|
||||
setGradient( Q::Panel, pal.darker150 );
|
||||
setBoxBorderColors( Q::Panel, pal.baseColor );
|
||||
setGradient( Q::Panel, m_pal.darker150 );
|
||||
setBoxBorderColors( Q::Panel, m_pal.baseColor );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initScrollViewHints()
|
||||
void Editor::setupScrollView()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskScrollView;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setSpacing( Q::Panel, 2 );
|
||||
|
||||
setBoxShape( Q::Viewport, 5 );
|
||||
|
@ -667,7 +634,7 @@ void QskMaterialSkin::initScrollViewHints()
|
|||
{
|
||||
setBoxShape( subControl, 3 );
|
||||
setBoxBorderMetrics( subControl, 1 );
|
||||
setGradient( subControl, pal.accentColor );
|
||||
setGradient( subControl, m_pal.accentColor );
|
||||
setBoxBorderColors( subControl, QskRgb::White );
|
||||
|
||||
setAnimation( subControl | A::Color, qskDuration );
|
||||
|
@ -677,54 +644,50 @@ void QskMaterialSkin::initScrollViewHints()
|
|||
Q::HorizontalScrollHandle | Q::HorizontalHandlePressed,
|
||||
Q::VerticalScrollHandle | Q::VerticalHandlePressed } )
|
||||
{
|
||||
setGradient( subControl, pal.accentColor );
|
||||
setBoxBorderColors( subControl, pal.accentColor );
|
||||
setGradient( subControl, m_pal.accentColor );
|
||||
setBoxBorderColors( subControl, m_pal.accentColor );
|
||||
}
|
||||
|
||||
// when changing the position by QskScrollView::scrollTo
|
||||
setAnimation( Q::Viewport | A::Metric, QskAnimationHint( 200, QEasingCurve::InCubic ) );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initListViewHints()
|
||||
void Editor::setupListView()
|
||||
{
|
||||
using Q = QskListView;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
// padding for each cell
|
||||
setPadding( Q::Cell, QskMargins( 4, 8 ) );
|
||||
|
||||
setColor( Q::Cell, pal.baseColor );
|
||||
setColor( Q::Text, pal.textColor );
|
||||
setColor( Q::Cell, m_pal.baseColor );
|
||||
setColor( Q::Text, m_pal.textColor );
|
||||
|
||||
setColor( Q::CellSelected, pal.accentColor );
|
||||
setColor( Q::TextSelected, pal.contrastColor );
|
||||
setColor( Q::CellSelected, m_pal.accentColor );
|
||||
setColor( Q::TextSelected, m_pal.contrastColor );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initSubWindowHints()
|
||||
void Editor::setupSubWindow()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskSubWindow;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
// Panel
|
||||
|
||||
setSkinHint( Q::Panel | A::Decoration, true );
|
||||
setFlagHint( Q::Panel | A::Decoration, true );
|
||||
setPadding( Q::Panel, 10 );
|
||||
setBoxShape( Q::Panel, 0 );
|
||||
setBoxBorderMetrics( Q::Panel, 2 );
|
||||
setGradient( Q::Panel, pal.baseColor );
|
||||
setGradient( Q::Panel, m_pal.baseColor );
|
||||
|
||||
QskBoxBorderColors colors;
|
||||
colors.setColorsAt( Qt::TopEdge | Qt::LeftEdge, pal.lighter125 );
|
||||
colors.setColorsAt( Qt::RightEdge | Qt::BottomEdge, pal.darker200 );
|
||||
colors.setColorsAt( Qt::TopEdge | Qt::LeftEdge, m_pal.lighter125 );
|
||||
colors.setColorsAt( Qt::RightEdge | Qt::BottomEdge, m_pal.darker200 );
|
||||
|
||||
setBoxBorderColors( Q::Panel, colors );
|
||||
|
||||
// TitleBar
|
||||
setGradient( Q::TitleBar, pal.darker200 );
|
||||
setGradient( Q::TitleBar | Q::Focused, pal.accentColor );
|
||||
setGradient( Q::TitleBar, m_pal.darker200 );
|
||||
setGradient( Q::TitleBar | Q::Focused, m_pal.accentColor );
|
||||
|
||||
// TitleBarText
|
||||
setFontRole( Q::TitleBarText, QskSkin::SmallFont );
|
||||
|
@ -735,4 +698,41 @@ void QskMaterialSkin::initSubWindowHints()
|
|||
|
||||
}
|
||||
|
||||
class QskMaterialSkin::PrivateData
|
||||
{
|
||||
public:
|
||||
ColorPalette palette;
|
||||
};
|
||||
|
||||
QskMaterialSkin::QskMaterialSkin( QObject* parent )
|
||||
: Inherited( parent )
|
||||
, m_data( new PrivateData() )
|
||||
{
|
||||
m_data->palette = ColorPalette( QskRgb::Grey100,
|
||||
QskRgb::Blue500, QskRgb::White );
|
||||
|
||||
// Default theme colors
|
||||
setupFonts( "Roboto" );
|
||||
|
||||
auto buttonFont = font( QskSkin::DefaultFont );
|
||||
buttonFont.setCapitalization( QFont::AllUppercase );
|
||||
setFont( ButtonFontRole, buttonFont );
|
||||
|
||||
Editor editor( &hintTable(), m_data->palette );
|
||||
editor.setup();
|
||||
}
|
||||
|
||||
QskMaterialSkin::~QskMaterialSkin()
|
||||
{
|
||||
}
|
||||
|
||||
void QskMaterialSkin::resetColors( const QColor& accent )
|
||||
{
|
||||
m_data->palette = ColorPalette( m_data->palette.baseColor,
|
||||
accent, m_data->palette.contrastColor );
|
||||
|
||||
Editor editor( &hintTable(), m_data->palette );
|
||||
editor.setup();
|
||||
}
|
||||
|
||||
#include "moc_QskMaterialSkin.cpp"
|
||||
|
|
|
@ -23,31 +23,6 @@ class QSK_MATERIAL_EXPORT QskMaterialSkin : public QskSkin
|
|||
private:
|
||||
void resetColors( const QColor& accent ) override;
|
||||
|
||||
void initHints();
|
||||
|
||||
void initCommonHints();
|
||||
|
||||
void initBoxHints();
|
||||
void initDialogButtonBoxHints();
|
||||
void initDialogButtonHints();
|
||||
void initFocusIndicatorHints();
|
||||
void initInputPanelHints();
|
||||
void initVirtualKeyboardHints();
|
||||
void initListViewHints();
|
||||
void initPageIndicatorHints();
|
||||
void initPopupHints();
|
||||
void initProgressBarHints();
|
||||
void initPushButtonHints();
|
||||
void initScrollViewHints();
|
||||
void initSeparatorHints();
|
||||
void initSubWindowHints();
|
||||
void initSliderHints();
|
||||
void initTabButtonHints();
|
||||
void initTabBarHints();
|
||||
void initTabViewHints();
|
||||
void initTextInputHints();
|
||||
void initTextLabelHints();
|
||||
|
||||
class PrivateData;
|
||||
std::unique_ptr< PrivateData > m_data;
|
||||
};
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "QskSquiekSkin.h"
|
||||
|
||||
#include <QskSkinHintTableEditor.h>
|
||||
|
||||
#include <QskBox.h>
|
||||
#include <QskDialogButton.h>
|
||||
#include <QskDialogButtonBox.h>
|
||||
|
@ -26,8 +28,6 @@
|
|||
#include <QskTextLabel.h>
|
||||
#include <QskVirtualKeyboard.h>
|
||||
|
||||
#include <QskSkinlet.h>
|
||||
|
||||
#include <QskAnimationHint.h>
|
||||
#include <QskAspect.h>
|
||||
#include <QskBoxBorderColors.h>
|
||||
|
@ -112,31 +112,63 @@ namespace
|
|||
QColor highlighted;
|
||||
QColor highlightedText;
|
||||
};
|
||||
|
||||
class Editor : private QskSkinHintTableEditor
|
||||
{
|
||||
public:
|
||||
Editor( QskSkinHintTable* table, const ColorPalette& palette )
|
||||
: QskSkinHintTableEditor( table )
|
||||
, m_pal( palette )
|
||||
{
|
||||
}
|
||||
|
||||
void setup();
|
||||
|
||||
private:
|
||||
void setupControl();
|
||||
|
||||
void setupBox();
|
||||
void setupDialogButton();
|
||||
void setupDialogButtonBox();
|
||||
void setupFocusIndicator();
|
||||
void setupInputPanel();
|
||||
void setupInputPredictionBar();
|
||||
void setupVirtualKeyboard();
|
||||
void setupListView();
|
||||
void setupPageIndicator();
|
||||
void setupPopup();
|
||||
void setupProgressBar();
|
||||
void setupPushButton();
|
||||
void setupScrollView();
|
||||
void setupSeparator();
|
||||
void setupSlider();
|
||||
void setupSubWindow();
|
||||
void setupTabButton();
|
||||
void setupTabBar();
|
||||
void setupTabView();
|
||||
void setupTextLabel();
|
||||
void setupTextInput();
|
||||
|
||||
enum PanelStyle
|
||||
{
|
||||
NoPanel,
|
||||
Raised,
|
||||
Sunken,
|
||||
Plain,
|
||||
Flat
|
||||
};
|
||||
|
||||
void setSeparator( QskAspect );
|
||||
void setButton( QskAspect, PanelStyle, qreal border = 2.0 );
|
||||
void setPanel( QskAspect, PanelStyle );
|
||||
|
||||
const ColorPalette& m_pal;
|
||||
};
|
||||
}
|
||||
|
||||
class QskSquiekSkin::PrivateData
|
||||
void Editor::setSeparator( QskAspect aspect )
|
||||
{
|
||||
public:
|
||||
ColorPalette palette;
|
||||
};
|
||||
|
||||
QskSquiekSkin::QskSquiekSkin( QObject* parent )
|
||||
: Inherited( parent )
|
||||
, m_data( new PrivateData() )
|
||||
{
|
||||
initHints();
|
||||
setupFonts( "DejaVuSans" );
|
||||
}
|
||||
|
||||
QskSquiekSkin::~QskSquiekSkin()
|
||||
{
|
||||
}
|
||||
|
||||
void QskSquiekSkin::setSeparator( QskAspect aspect )
|
||||
{
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
QskGradient gradient( QskGradient::Vertical, pal.lighter110, pal.darker125 );
|
||||
QskGradient gradient( QskGradient::Vertical, m_pal.lighter110, m_pal.darker125 );
|
||||
|
||||
if ( aspect.placement() == QskAspect::Vertical )
|
||||
gradient.setOrientation( QskGradient::Horizontal );
|
||||
|
@ -146,14 +178,11 @@ void QskSquiekSkin::setSeparator( QskAspect aspect )
|
|||
setBoxBorderMetrics( aspect, 0 );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::setButton(
|
||||
QskAspect aspect, PanelStyle style, qreal border )
|
||||
void Editor::setButton( QskAspect aspect, PanelStyle style, qreal border )
|
||||
{
|
||||
#if 1
|
||||
// Buttons shift ???
|
||||
#endif
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
QskBoxBorderColors borderColors;
|
||||
|
||||
QskGradient gradient;
|
||||
|
@ -163,31 +192,31 @@ void QskSquiekSkin::setButton(
|
|||
{
|
||||
case Raised:
|
||||
{
|
||||
borderColors.setColorsAt( Qt::TopEdge | Qt::LeftEdge, pal.lighter135 );
|
||||
borderColors.setColorsAt( Qt::RightEdge | Qt::BottomEdge, pal.darker200 );
|
||||
gradient.setColors( pal.lighter125, pal.lighter110 );
|
||||
borderColors.setColorsAt( Qt::TopEdge | Qt::LeftEdge, m_pal.lighter135 );
|
||||
borderColors.setColorsAt( Qt::RightEdge | Qt::BottomEdge, m_pal.darker200 );
|
||||
gradient.setColors( m_pal.lighter125, m_pal.lighter110 );
|
||||
|
||||
break;
|
||||
}
|
||||
case Sunken:
|
||||
{
|
||||
borderColors.setColorsAt( Qt::TopEdge | Qt::LeftEdge, pal.darker200 );
|
||||
borderColors.setColorsAt( Qt::RightEdge | Qt::BottomEdge, pal.lighter135 );
|
||||
gradient.setColors( pal.lighter110, pal.lighter125 );
|
||||
borderColors.setColorsAt( Qt::TopEdge | Qt::LeftEdge, m_pal.darker200 );
|
||||
borderColors.setColorsAt( Qt::RightEdge | Qt::BottomEdge, m_pal.lighter135 );
|
||||
gradient.setColors( m_pal.lighter110, m_pal.lighter125 );
|
||||
|
||||
break;
|
||||
}
|
||||
case Plain:
|
||||
{
|
||||
borderColors.setColors( pal.darker125 );
|
||||
gradient.setColor( pal.lighter125 );
|
||||
borderColors.setColors( m_pal.darker125 );
|
||||
gradient.setColor( m_pal.lighter125 );
|
||||
|
||||
break;
|
||||
}
|
||||
case Flat:
|
||||
case NoPanel:
|
||||
{
|
||||
QColor noColor( pal.theme );
|
||||
QColor noColor( m_pal.theme );
|
||||
noColor.setAlpha( 0 );
|
||||
|
||||
borderColors.setColors( noColor );
|
||||
|
@ -206,86 +235,76 @@ void QskSquiekSkin::setButton(
|
|||
setBoxBorderMetrics( aspect, border );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::setPanel( QskAspect aspect, PanelStyle style )
|
||||
void Editor::setPanel( QskAspect aspect, PanelStyle style )
|
||||
{
|
||||
setButton( aspect, style, 1 );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initHints()
|
||||
void Editor::setup()
|
||||
{
|
||||
initCommonHints();
|
||||
setupControl();
|
||||
|
||||
initBoxHints();
|
||||
initDialogButtonBoxHints();
|
||||
initDialogButtonHints();
|
||||
initFocusIndicatorHints();
|
||||
initInputPanelHints();
|
||||
initInputPredictionBar();
|
||||
initVirtualKeyboardHints();
|
||||
initListViewHints();
|
||||
initPageIndicatorHints();
|
||||
initPopupHints();
|
||||
initProgressBarHints();
|
||||
initPushButtonHints();
|
||||
initScrollViewHints();
|
||||
initSeparatorHints();
|
||||
initSliderHints();
|
||||
initSubWindowHints();
|
||||
initTabButtonHints();
|
||||
initTabBarHints();
|
||||
initTabViewHints();
|
||||
initTextLabelHints();
|
||||
initTextInputHints();
|
||||
setupBox();
|
||||
setupDialogButtonBox();
|
||||
setupDialogButton();
|
||||
setupFocusIndicator();
|
||||
setupInputPanel();
|
||||
setupInputPredictionBar();
|
||||
setupVirtualKeyboard();
|
||||
setupListView();
|
||||
setupPageIndicator();
|
||||
setupPopup();
|
||||
setupProgressBar();
|
||||
setupPushButton();
|
||||
setupScrollView();
|
||||
setupSeparator();
|
||||
setupSlider();
|
||||
setupSubWindow();
|
||||
setupTabButton();
|
||||
setupTabBar();
|
||||
setupTabView();
|
||||
setupTextLabel();
|
||||
setupTextInput();
|
||||
}
|
||||
|
||||
void QskSquiekSkin::resetColors( const QColor& accent )
|
||||
{
|
||||
m_data->palette = ColorPalette( accent );
|
||||
initHints();
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initCommonHints()
|
||||
void Editor::setupControl()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskControl;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setPadding( A::Control, 4 );
|
||||
|
||||
setGradient( A::Control, pal.lighter135 );
|
||||
setColor( A::Control | A::StyleColor, pal.themeForeground );
|
||||
setColor( A::Control | A::StyleColor | Q::Disabled, pal.theme );
|
||||
setGradient( A::Control, m_pal.lighter135 );
|
||||
setColor( A::Control | A::StyleColor, m_pal.themeForeground );
|
||||
setColor( A::Control | A::StyleColor | Q::Disabled, m_pal.theme );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initBoxHints()
|
||||
void Editor::setupBox()
|
||||
{
|
||||
setPanel( QskBox::Panel, Plain );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initPopupHints()
|
||||
void Editor::setupPopup()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskPopup;
|
||||
|
||||
setSkinHint( Q::Overlay | A::Style, true );
|
||||
setFlagHint( Q::Overlay | A::Style, true );
|
||||
setGradient( Q::Overlay, QColor( 220, 220, 220, 150 ) );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initTextLabelHints()
|
||||
void Editor::setupTextLabel()
|
||||
{
|
||||
using Q = QskTextLabel;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setAlignment( Q::Text, Qt::AlignCenter );
|
||||
setColor( Q::Text, pal.themeForeground );
|
||||
setColor( Q::Text, m_pal.themeForeground );
|
||||
|
||||
setPadding( Q::Panel, 5 );
|
||||
setBoxBorderMetrics( Q::Panel, 2 );
|
||||
setBoxShape( Q::Panel, 4 );
|
||||
|
||||
const QColor c = pal.base;
|
||||
const QColor c = m_pal.base;
|
||||
|
||||
const QskBoxBorderColors borderColors(
|
||||
c.darker( 170 ), c.darker( 170 ),
|
||||
|
@ -295,18 +314,16 @@ void QskSquiekSkin::initTextLabelHints()
|
|||
setGradient( Q::Panel, c );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initTextInputHints()
|
||||
void Editor::setupTextInput()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskTextInput;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setAlignment( Q::Text, Qt::AlignLeft | Qt::AlignTop );
|
||||
|
||||
setColor( Q::Text, pal.themeForeground );
|
||||
setColor( Q::PanelSelected, pal.highlighted );
|
||||
setColor( Q::TextSelected, pal.highlightedText );
|
||||
setColor( Q::Text, m_pal.themeForeground );
|
||||
setColor( Q::PanelSelected, m_pal.highlighted );
|
||||
setColor( Q::TextSelected, m_pal.highlightedText );
|
||||
|
||||
setPadding( Q::Panel, 5 );
|
||||
setBoxBorderMetrics( Q::Panel, 2 );
|
||||
|
@ -318,15 +335,15 @@ void QskSquiekSkin::initTextInputHints()
|
|||
|
||||
if ( state == Q::ReadOnly )
|
||||
{
|
||||
c = pal.theme.lighter( 120 );
|
||||
c = m_pal.theme.lighter( 120 );
|
||||
}
|
||||
else if ( state == Q::Editing )
|
||||
{
|
||||
c = pal.baseActive;
|
||||
c = m_pal.baseActive;
|
||||
}
|
||||
else
|
||||
{
|
||||
c = pal.base;
|
||||
c = m_pal.base;
|
||||
}
|
||||
|
||||
const auto aspect = Q::Panel | state;
|
||||
|
@ -342,36 +359,32 @@ void QskSquiekSkin::initTextInputHints()
|
|||
setAnimation( Q::Panel | A::Color, qskDuration );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initProgressBarHints()
|
||||
void Editor::setupProgressBar()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskProgressBar;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setMetric( Q::Groove | A::Size, 8 );
|
||||
setPadding( Q::Groove, 0 );
|
||||
setGradient( Q::Groove, pal.darker200 );
|
||||
setGradient( Q::Groove, m_pal.darker200 );
|
||||
setBoxShape( Q::Groove, 4 );
|
||||
|
||||
setGradient( Q::Bar, pal.highlighted );
|
||||
setGradient( Q::Bar, m_pal.highlighted );
|
||||
setBoxShape( Q::Bar, 4 );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initFocusIndicatorHints()
|
||||
void Editor::setupFocusIndicator()
|
||||
{
|
||||
using Q = QskFocusIndicator;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setPadding( Q::Panel, 5 );
|
||||
setBoxBorderMetrics( Q::Panel, 2 );
|
||||
setBoxShape( Q::Panel, 4 );
|
||||
setGradient( Q::Panel, Qt::transparent );
|
||||
setBoxBorderColors( Q::Panel, pal.highlighted );
|
||||
setBoxBorderColors( Q::Panel, m_pal.highlighted );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initSeparatorHints()
|
||||
void Editor::setupSeparator()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskSeparator;
|
||||
|
@ -382,13 +395,11 @@ void QskSquiekSkin::initSeparatorHints()
|
|||
setSeparator( Q::Panel | A::Vertical );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initPageIndicatorHints()
|
||||
void Editor::setupPageIndicator()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskPageIndicator;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
for ( auto subControl : { Q::Bullet, Q::Highlighted } )
|
||||
{
|
||||
const auto extent = qskDpiScaled( 12 );
|
||||
|
@ -398,8 +409,8 @@ void QskSquiekSkin::initPageIndicatorHints()
|
|||
setBoxShape( subControl, 100, Qt::RelativeSize );
|
||||
}
|
||||
|
||||
setGradient( Q::Bullet, pal.darker150 );
|
||||
setGradient( Q::Highlighted, pal.lighter150 );
|
||||
setGradient( Q::Bullet, m_pal.darker150 );
|
||||
setGradient( Q::Highlighted, m_pal.lighter150 );
|
||||
|
||||
// no visible background panel
|
||||
setBoxBorderMetrics( Q::Panel, 0 );
|
||||
|
@ -409,13 +420,11 @@ void QskSquiekSkin::initPageIndicatorHints()
|
|||
setMetric( Q::Panel | A::Spacing, 3 );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initPushButtonHints()
|
||||
void Editor::setupPushButton()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskPushButton;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
// Panel
|
||||
|
||||
setStrutSize( Q::Panel, qskDpiScaled( 75.0 ), qskDpiScaled( 23.0 ) );
|
||||
|
@ -443,20 +452,18 @@ void QskSquiekSkin::initPushButtonHints()
|
|||
setAnimation( Q::Panel | A::Metric, qskDuration );
|
||||
|
||||
// Text
|
||||
setSkinHint( Q::Text | Q::Disabled | A::Style, Qsk::Sunken );
|
||||
setFlagHint( Q::Text | Q::Disabled | A::Style, Qsk::Sunken );
|
||||
setAlignment( Q::Text, Qt::AlignCenter );
|
||||
|
||||
setColor( Q::Text, pal.themeForeground );
|
||||
setColor( Q::Text | Q::Disabled, pal.darker200 );
|
||||
setColor( Q::Text, m_pal.themeForeground );
|
||||
setColor( Q::Text | Q::Disabled, m_pal.darker200 );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initDialogButtonHints()
|
||||
void Editor::setupDialogButton()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskDialogButton;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
// panel
|
||||
setStrutSize( Q::Panel, qskDpiScaled( 75.0 ), qskDpiScaled( 23.0 ) );
|
||||
|
||||
|
@ -470,58 +477,54 @@ void QskSquiekSkin::initDialogButtonHints()
|
|||
setAnimation( Q::Panel | A::Metric, qskDuration );
|
||||
|
||||
// text
|
||||
setSkinHint( Q::Text | Q::Disabled | A::Style, Qsk::Sunken );
|
||||
setFlagHint( Q::Text | Q::Disabled | A::Style, Qsk::Sunken );
|
||||
setAlignment( Q::Text, Qt::AlignCenter );
|
||||
|
||||
setColor( Q::Text, pal.themeForeground );
|
||||
setColor( Q::Text | Q::Disabled, pal.darker200 );
|
||||
setColor( Q::Text, m_pal.themeForeground );
|
||||
setColor( Q::Text | Q::Disabled, m_pal.darker200 );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initDialogButtonBoxHints()
|
||||
void Editor::setupDialogButtonBox()
|
||||
{
|
||||
using Q = QskDialogButtonBox;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setBoxBorderColors( Q::Panel, pal.theme );
|
||||
setGradient( Q::Panel, pal.lighter135 );
|
||||
setBoxBorderColors( Q::Panel, m_pal.theme );
|
||||
setGradient( Q::Panel, m_pal.lighter135 );
|
||||
setBoxBorderMetrics( Q::Panel, 0 );
|
||||
setBoxShape( Q::Panel, 2 );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initTabButtonHints()
|
||||
void Editor::setupTabButton()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskTabButton;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setStrutSize( Q::Panel, 30, 16 );
|
||||
|
||||
for ( auto placement : { A::Top, A::Bottom } )
|
||||
{
|
||||
setGradient( Q::Panel | placement,
|
||||
QskGradient( Qt::Vertical, pal.lighter125, pal.lighter110 ) );
|
||||
QskGradient( Qt::Vertical, m_pal.lighter125, m_pal.lighter110 ) );
|
||||
|
||||
for ( const auto state : { Q::Checked, Q::Checked | Q::Pressed } )
|
||||
{
|
||||
setGradient( Q::Panel | placement | state, pal.lighter125 );
|
||||
setColor( Q::Text | placement | state, pal.themeForeground );
|
||||
setGradient( Q::Panel | placement | state, m_pal.lighter125 );
|
||||
setColor( Q::Text | placement | state, m_pal.themeForeground );
|
||||
}
|
||||
}
|
||||
|
||||
for ( auto placement : { A::Left, A::Right } )
|
||||
{
|
||||
setGradient( Q::Panel | placement, pal.lighter125 );
|
||||
setGradient( Q::Panel | placement, m_pal.lighter125 );
|
||||
|
||||
for ( const auto state : { Q::Checked, Q::Checked | Q::Pressed } )
|
||||
{
|
||||
setGradient( Q::Panel | placement | state, pal.highlighted );
|
||||
setColor( Q::Text | placement | state, pal.highlightedText );
|
||||
setGradient( Q::Panel | placement | state, m_pal.highlighted );
|
||||
setColor( Q::Text | placement | state, m_pal.highlightedText );
|
||||
}
|
||||
}
|
||||
|
||||
setBoxBorderColors( Q::Panel, pal.darker200 );
|
||||
setBoxBorderColors( Q::Panel, m_pal.darker200 );
|
||||
|
||||
for ( auto placement : { A::Left, A::Right, A::Top, A::Bottom } )
|
||||
{
|
||||
|
@ -593,17 +596,15 @@ void QskSquiekSkin::initTabButtonHints()
|
|||
|
||||
// text
|
||||
setAlignment( Q::Text, Qt::AlignCenter );
|
||||
setColor( Q::Text, pal.themeForeground );
|
||||
setColor( Q::Text | Q::Checkable | Q::Disabled, pal.darker200 );
|
||||
setColor( Q::Text, m_pal.themeForeground );
|
||||
setColor( Q::Text | Q::Checkable | Q::Disabled, m_pal.darker200 );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initSliderHints()
|
||||
void Editor::setupSlider()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskSlider;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
const qreal extent = 40;
|
||||
|
||||
// Panel
|
||||
|
@ -636,7 +637,7 @@ void QskSquiekSkin::initSliderHints()
|
|||
setBoxShape( aspect, 0.1 * extent );
|
||||
}
|
||||
|
||||
setGradient( Q::Groove | placement, pal.darker200 );
|
||||
setGradient( Q::Groove | placement, m_pal.darker200 );
|
||||
setGradient( Q::Fill | placement, QskGradient() ); // no filling
|
||||
}
|
||||
|
||||
|
@ -657,7 +658,7 @@ void QskSquiekSkin::initSliderHints()
|
|||
setAnimation( Q::Handle | A::Color, qskDuration );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initTabBarHints()
|
||||
void Editor::setupTabBar()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskTabBar;
|
||||
|
@ -678,7 +679,7 @@ void QskSquiekSkin::initTabBarHints()
|
|||
setAnimation( Q::Panel | A::Metric, QskAnimationHint( 200, QEasingCurve::OutCubic ) );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initTabViewHints()
|
||||
void Editor::setupTabView()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskTabView;
|
||||
|
@ -696,7 +697,7 @@ void QskSquiekSkin::initTabViewHints()
|
|||
setAnimation( Q::Page, qskDuration );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initInputPanelHints()
|
||||
void Editor::setupInputPanel()
|
||||
{
|
||||
using Q = QskInputPanelBox;
|
||||
|
||||
|
@ -704,31 +705,27 @@ void QskSquiekSkin::initInputPanelHints()
|
|||
setPanel( Q::Panel, Raised );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initInputPredictionBar()
|
||||
void Editor::setupInputPredictionBar()
|
||||
{
|
||||
using Q = QskInputPredictionBar;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setPadding( Q::Panel, 5 );
|
||||
setPanel( Q::Panel, Flat );
|
||||
|
||||
setButton( Q::ButtonPanel, Flat );
|
||||
setButton( Q::ButtonPanel | QskPushButton::Pressed, Sunken );
|
||||
|
||||
setStrutSize( Q::ButtonPanel, qskDpiScaled( 30.0 ), qskDpiScaled( 10.0 ) );
|
||||
setStrutSize( Q::ButtonPanel, qskDpiScaled( 30.0 ), qskDpiScaled( 23.0 ) );
|
||||
|
||||
setColor( Q::ButtonText, pal.themeForeground );
|
||||
setColor( Q::ButtonText | QskPushButton::Disabled, pal.darker200 );
|
||||
setColor( Q::ButtonText, m_pal.themeForeground );
|
||||
setColor( Q::ButtonText | QskPushButton::Disabled, m_pal.darker200 );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initVirtualKeyboardHints()
|
||||
void Editor::setupVirtualKeyboard()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskVirtualKeyboard;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setPadding( Q::Panel, 5 );
|
||||
setMetric( Q::Panel | A::Spacing, 5 );
|
||||
setPanel( Q::Panel, Raised );
|
||||
|
@ -738,11 +735,11 @@ void QskSquiekSkin::initVirtualKeyboardHints()
|
|||
|
||||
setAnimation( Q::ButtonPanel | A::Color, qskDuration );
|
||||
|
||||
setColor( Q::ButtonText, pal.themeForeground );
|
||||
setColor( Q::ButtonText | QskPushButton::Disabled, pal.darker200 );
|
||||
setColor( Q::ButtonText, m_pal.themeForeground );
|
||||
setColor( Q::ButtonText | QskPushButton::Disabled, m_pal.darker200 );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initScrollViewHints()
|
||||
void Editor::setupScrollView()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskScrollView;
|
||||
|
@ -796,57 +793,53 @@ void QskSquiekSkin::initScrollViewHints()
|
|||
setAnimation( Q::Viewport | A::Metric, QskAnimationHint( 200, QEasingCurve::OutCubic ) );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initListViewHints()
|
||||
void Editor::setupListView()
|
||||
{
|
||||
using Q = QskListView;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
// padding for each cell
|
||||
setPadding( Q::Cell, QskMargins( 4, 8 ) );
|
||||
|
||||
setColor( Q::Text, pal.themeForeground );
|
||||
setColor( Q::Cell, pal.contrasted );
|
||||
setColor( Q::Text, m_pal.themeForeground );
|
||||
setColor( Q::Cell, m_pal.contrasted );
|
||||
|
||||
setColor( Q::CellSelected, pal.highlighted );
|
||||
setColor( Q::TextSelected, pal.highlightedText );
|
||||
setColor( Q::CellSelected, m_pal.highlighted );
|
||||
setColor( Q::TextSelected, m_pal.highlightedText );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initSubWindowHints()
|
||||
void Editor::setupSubWindow()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskSubWindow;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
const qreal radius = 5.0;
|
||||
|
||||
// Panel
|
||||
|
||||
setSkinHint( Q::Panel | A::Decoration, true );
|
||||
setFlagHint( Q::Panel | A::Decoration, true );
|
||||
setPadding( Q::Panel, 10 );
|
||||
setBoxBorderMetrics( Q::Panel, 2 );
|
||||
setBoxShape( Q::Panel, radius, radius, 0, 0, Qt::AbsoluteSize );
|
||||
|
||||
QskBoxBorderColors borderColors;
|
||||
borderColors.setColorsAt( Qt::TopEdge | Qt::LeftEdge, pal.lighter125 );
|
||||
borderColors.setColorsAt( Qt::RightEdge | Qt::BottomEdge, pal.darker200 );
|
||||
borderColors.setColorsAt( Qt::TopEdge | Qt::LeftEdge, m_pal.lighter125 );
|
||||
borderColors.setColorsAt( Qt::RightEdge | Qt::BottomEdge, m_pal.darker200 );
|
||||
|
||||
setBoxBorderColors( Q::Panel, borderColors );
|
||||
setGradient( Q::Panel, pal.lighter135 );
|
||||
setGradient( Q::Panel, m_pal.lighter135 );
|
||||
|
||||
// TitleBar
|
||||
|
||||
setGradient( Q::TitleBar | Q::Focused, pal.highlighted );
|
||||
setGradient( Q::TitleBar, pal.contrasted );
|
||||
setGradient( Q::TitleBar | Q::Focused, m_pal.highlighted );
|
||||
setGradient( Q::TitleBar, m_pal.contrasted );
|
||||
setSpacing( Q::TitleBar, 5 );
|
||||
setStrutSize( Q::TitleBar, 0, 20 );
|
||||
setBoxShape( Q::TitleBar, radius, radius, 0, 0, Qt::AbsoluteSize );
|
||||
|
||||
// TitleBarText
|
||||
setFontRole( Q::TitleBarText, QskSkin::SmallFont );
|
||||
setColor( Q::TitleBarText | Q::Focused, pal.highlightedText );
|
||||
setColor( Q::TitleBarText, pal.themeForeground );
|
||||
setColor( Q::TitleBarText | Q::Focused, m_pal.highlightedText );
|
||||
setColor( Q::TitleBarText, m_pal.themeForeground );
|
||||
|
||||
setAlignment( Q::TitleBarText, Qt::AlignLeft | Qt::AlignVCenter );
|
||||
|
||||
|
@ -854,4 +847,33 @@ void QskSquiekSkin::initSubWindowHints()
|
|||
setAnimation( subControl | A::Color, qskDuration );
|
||||
}
|
||||
|
||||
class QskSquiekSkin::PrivateData
|
||||
{
|
||||
public:
|
||||
ColorPalette palette;
|
||||
};
|
||||
|
||||
QskSquiekSkin::QskSquiekSkin( QObject* parent )
|
||||
: Inherited( parent )
|
||||
, m_data( new PrivateData() )
|
||||
{
|
||||
setupFonts( "DejaVuSans" );
|
||||
|
||||
Editor editor( &hintTable(), m_data->palette );
|
||||
editor.setup();
|
||||
}
|
||||
|
||||
QskSquiekSkin::~QskSquiekSkin()
|
||||
{
|
||||
}
|
||||
|
||||
void QskSquiekSkin::resetColors( const QColor& accent )
|
||||
{
|
||||
m_data->palette = ColorPalette( accent );
|
||||
|
||||
Editor editor( &hintTable(), m_data->palette );
|
||||
editor.setup();
|
||||
}
|
||||
|
||||
|
||||
#include "moc_QskSquiekSkin.cpp"
|
||||
|
|
|
@ -23,45 +23,6 @@ class QSK_SQUIEK_EXPORT QskSquiekSkin : public QskSkin
|
|||
private:
|
||||
void resetColors( const QColor& accent ) override;
|
||||
|
||||
void initHints();
|
||||
|
||||
void initCommonHints();
|
||||
|
||||
void initBoxHints();
|
||||
void initDialogButtonHints();
|
||||
void initDialogButtonBoxHints();
|
||||
void initFocusIndicatorHints();
|
||||
void initInputPanelHints();
|
||||
void initInputPredictionBar();
|
||||
void initVirtualKeyboardHints();
|
||||
void initListViewHints();
|
||||
void initPageIndicatorHints();
|
||||
void initPopupHints();
|
||||
void initProgressBarHints();
|
||||
void initPushButtonHints();
|
||||
void initScrollViewHints();
|
||||
void initSeparatorHints();
|
||||
void initSliderHints();
|
||||
void initSubWindowHints();
|
||||
void initTabButtonHints();
|
||||
void initTabBarHints();
|
||||
void initTabViewHints();
|
||||
void initTextLabelHints();
|
||||
void initTextInputHints();
|
||||
|
||||
enum PanelStyle
|
||||
{
|
||||
NoPanel,
|
||||
Raised,
|
||||
Sunken,
|
||||
Plain,
|
||||
Flat
|
||||
};
|
||||
|
||||
void setSeparator( QskAspect );
|
||||
void setButton( QskAspect, PanelStyle, qreal border = 2.0 );
|
||||
void setPanel( QskAspect, PanelStyle );
|
||||
|
||||
class PrivateData;
|
||||
std::unique_ptr< PrivateData > m_data;
|
||||
};
|
||||
|
|
|
@ -131,6 +131,9 @@ class QSK_EXPORT QskAspect
|
|||
constexpr QskAspect operator|( Placement ) const noexcept;
|
||||
constexpr QskAspect operator|( State ) const noexcept;
|
||||
|
||||
constexpr QskAspect stateless() const noexcept;
|
||||
constexpr QskAspect trunk() const noexcept;
|
||||
|
||||
constexpr quint64 value() const noexcept;
|
||||
|
||||
constexpr bool isAnimator() const noexcept;
|
||||
|
@ -295,6 +298,18 @@ inline constexpr QskAspect QskAspect::operator|( State state ) const noexcept
|
|||
m_bits.primitive, m_bits.placement, m_bits.states | state );
|
||||
}
|
||||
|
||||
inline constexpr QskAspect QskAspect::stateless() const noexcept
|
||||
{
|
||||
return QskAspect( m_bits.subControl, m_bits.type, m_bits.isAnimator,
|
||||
m_bits.primitive, m_bits.placement, 0 );
|
||||
}
|
||||
|
||||
inline constexpr QskAspect QskAspect::trunk() const noexcept
|
||||
{
|
||||
return QskAspect( m_bits.subControl, m_bits.type, m_bits.isAnimator,
|
||||
m_bits.primitive, 0, 0 );
|
||||
}
|
||||
|
||||
inline constexpr quint64 QskAspect::value() const noexcept
|
||||
{
|
||||
return m_value;
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include "QskSkinHintTable.h"
|
||||
#include "QskStandardSymbol.h"
|
||||
|
||||
#include "QskMargins.h"
|
||||
|
||||
QSK_QT_PRIVATE_BEGIN
|
||||
#include <private/qguiapplication_p.h>
|
||||
QSK_QT_PRIVATE_END
|
||||
|
@ -156,203 +158,21 @@ QskSkin::QskSkin( QObject* parent )
|
|||
const QFont font = QGuiApplication::font();
|
||||
setupFonts( font.family(), font.weight(), font.italic() );
|
||||
|
||||
setMargin( QskAspect::Control, 0 );
|
||||
setPadding( QskAspect::Control, 0 );
|
||||
setSpacing( QskAspect::Control, 0 );
|
||||
{
|
||||
// some defaults
|
||||
const auto noMargins = QVariant::fromValue( QskMargins( 0 ) );
|
||||
const auto aspect = QskAspect::Control | QskAspect::Metric;
|
||||
|
||||
setSkinHint( aspect | QskAspect::Margin, noMargins );
|
||||
setSkinHint( aspect | QskAspect::Padding, noMargins );
|
||||
setSkinHint( aspect | QskAspect::Spacing, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
QskSkin::~QskSkin()
|
||||
{
|
||||
}
|
||||
|
||||
void QskSkin::setColor( QskAspect aspect, QRgb rgb )
|
||||
{
|
||||
setSkinHint( aspect | QskAspect::Color, QColor::fromRgba( rgb ) );
|
||||
}
|
||||
|
||||
void QskSkin::setColor( QskAspect aspect, Qt::GlobalColor color )
|
||||
{
|
||||
setSkinHint( aspect | QskAspect::Color, QColor( color ) );
|
||||
}
|
||||
|
||||
void QskSkin::setColor( QskAspect aspect, const QColor& color )
|
||||
{
|
||||
setSkinHint( aspect | QskAspect::Color, color );
|
||||
}
|
||||
|
||||
QColor QskSkin::color( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.color( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setMetric( QskAspect aspect, qreal metric )
|
||||
{
|
||||
m_data->hintTable.setMetric( aspect, metric );
|
||||
}
|
||||
|
||||
qreal QskSkin::metric( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.metric( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setStrutSize( QskAspect aspect, qreal width, qreal height )
|
||||
{
|
||||
setStrutSize( aspect, QSizeF( width, height ) );
|
||||
}
|
||||
|
||||
void QskSkin::setStrutSize( QskAspect aspect, const QSizeF& strut )
|
||||
{
|
||||
m_data->hintTable.setStrutSize( aspect, strut );
|
||||
}
|
||||
|
||||
QSizeF QskSkin::strutSize( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.strutSize( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setMargin( QskAspect aspect, const QskMargins& margins )
|
||||
{
|
||||
m_data->hintTable.setMargin( aspect, margins );
|
||||
}
|
||||
|
||||
void QskSkin::setMargin( QskAspect aspect,
|
||||
qreal left, qreal top, qreal right, qreal bottom )
|
||||
{
|
||||
const QskMargins margins( left, top, right, bottom );
|
||||
m_data->hintTable.setMargin( aspect, margins );
|
||||
}
|
||||
|
||||
QskMargins QskSkin::margin( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.margin( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setPadding( QskAspect aspect, const QskMargins& padding )
|
||||
{
|
||||
m_data->hintTable.setPadding( aspect, padding );
|
||||
}
|
||||
|
||||
void QskSkin::setPadding( QskAspect aspect,
|
||||
qreal left, qreal top, qreal right, qreal bottom )
|
||||
{
|
||||
const QskMargins padding( left, top, right, bottom );
|
||||
m_data->hintTable.setPadding( aspect, padding );
|
||||
}
|
||||
|
||||
QskMargins QskSkin::padding( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.padding( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setSpacing( QskAspect aspect, qreal spacing )
|
||||
{
|
||||
m_data->hintTable.setSpacing( aspect, spacing );
|
||||
}
|
||||
|
||||
qreal QskSkin::spacing( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.spacing( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setGradient( QskAspect aspect, const QskGradient& gradient )
|
||||
{
|
||||
m_data->hintTable.setGradient( aspect, gradient );
|
||||
}
|
||||
|
||||
QskGradient QskSkin::gradient( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.gradient( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setBoxShape( QskAspect aspect,
|
||||
qreal radius, Qt::SizeMode sizeMode )
|
||||
{
|
||||
m_data->hintTable.setBoxShape( aspect,
|
||||
QskBoxShapeMetrics( radius, radius, radius, radius, sizeMode ) );
|
||||
}
|
||||
|
||||
void QskSkin::setBoxShape( QskAspect aspect, qreal topLeft, qreal topRight,
|
||||
qreal bottomLeft, qreal bottomRight, Qt::SizeMode sizeMode )
|
||||
{
|
||||
m_data->hintTable.setBoxShape( aspect,
|
||||
QskBoxShapeMetrics( topLeft, topRight, bottomLeft, bottomRight, sizeMode ) );
|
||||
}
|
||||
|
||||
void QskSkin::setBoxShape( QskAspect aspect, const QskBoxShapeMetrics& shape )
|
||||
{
|
||||
m_data->hintTable.setBoxShape( aspect, shape );
|
||||
}
|
||||
|
||||
QskBoxShapeMetrics QskSkin::boxShape( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.boxShape( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setBoxBorderMetrics( QskAspect aspect,
|
||||
qreal left, qreal top, qreal right, qreal bottom, Qt::SizeMode sizeMode )
|
||||
{
|
||||
m_data->hintTable.setBoxBorder( aspect,
|
||||
QskBoxBorderMetrics( left, top, right, bottom, sizeMode ) );
|
||||
}
|
||||
|
||||
void QskSkin::setBoxBorderMetrics( QskAspect aspect,
|
||||
qreal borderWidth, Qt::SizeMode sizeMode )
|
||||
{
|
||||
m_data->hintTable.setBoxBorder(
|
||||
aspect, QskBoxBorderMetrics( borderWidth, sizeMode ) );
|
||||
}
|
||||
|
||||
void QskSkin::setBoxBorderMetrics(
|
||||
QskAspect aspect, const QskBoxBorderMetrics& border )
|
||||
{
|
||||
m_data->hintTable.setBoxBorder( aspect, border );
|
||||
}
|
||||
|
||||
QskBoxBorderMetrics QskSkin::boxBorderMetrics( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.boxBorder( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setBoxBorderColors( QskAspect aspect, const QskBoxBorderColors& colors )
|
||||
{
|
||||
m_data->hintTable.setBoxBorderColors( aspect, colors );
|
||||
}
|
||||
|
||||
QskBoxBorderColors QskSkin::boxBorderColors( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.boxBorderColors( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setFontRole( QskAspect aspect, int fontRole )
|
||||
{
|
||||
m_data->hintTable.setFontRole( aspect, fontRole );
|
||||
}
|
||||
|
||||
void QskSkin::setGraphicRole( QskAspect aspect, int graphicRole )
|
||||
{
|
||||
m_data->hintTable.setGraphicRole( aspect, graphicRole );
|
||||
}
|
||||
|
||||
void QskSkin::setAnimation( QskAspect aspect, QskAnimationHint animation )
|
||||
{
|
||||
m_data->hintTable.setAnimation( aspect, animation );
|
||||
}
|
||||
|
||||
QskAnimationHint QskSkin::animation( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.animation( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setAlignment( QskAspect aspect, Qt::Alignment alignment )
|
||||
{
|
||||
m_data->hintTable.setAlignment( aspect, alignment );
|
||||
}
|
||||
|
||||
Qt::Alignment QskSkin::alignment( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.alignment( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setSkinHint( QskAspect aspect, const QVariant& skinHint )
|
||||
{
|
||||
m_data->hintTable.setHint( aspect, skinHint );
|
||||
|
@ -457,7 +277,7 @@ const QskSkinHintTable& QskSkin::hintTable() const
|
|||
return m_data->hintTable;
|
||||
}
|
||||
|
||||
QskSkinHintTable& QskSkin::skinHintTable()
|
||||
QskSkinHintTable& QskSkin::hintTable()
|
||||
{
|
||||
return m_data->hintTable;
|
||||
}
|
||||
|
|
|
@ -22,15 +22,9 @@ class QskColorFilter;
|
|||
class QskGraphic;
|
||||
class QskGraphicProvider;
|
||||
|
||||
class QskAnimationHint;
|
||||
class QskSkinHintTable;
|
||||
|
||||
class QVariant;
|
||||
class QskMargins;
|
||||
class QskGradient;
|
||||
class QskBoxShapeMetrics;
|
||||
class QskBoxBorderMetrics;
|
||||
class QskBoxBorderColors;
|
||||
|
||||
class QSK_EXPORT QskSkin : public QObject
|
||||
{
|
||||
|
@ -60,60 +54,6 @@ class QSK_EXPORT QskSkin : public QObject
|
|||
|
||||
virtual void resetColors( const QColor& accent );
|
||||
|
||||
void setColor( QskAspect, Qt::GlobalColor );
|
||||
void setColor( QskAspect, QRgb );
|
||||
void setColor( QskAspect, const QColor& );
|
||||
|
||||
QColor color( QskAspect ) const;
|
||||
|
||||
void setMetric( QskAspect, qreal metric );
|
||||
qreal metric( QskAspect ) const;
|
||||
|
||||
void setStrutSize( QskAspect, const QSizeF& );
|
||||
void setStrutSize( QskAspect, qreal width, qreal height );
|
||||
QSizeF strutSize( QskAspect ) const;
|
||||
|
||||
void setMargin( QskAspect, const QskMargins& );
|
||||
void setMargin( QskAspect,
|
||||
qreal left, qreal top, qreal right, qreal bottom );
|
||||
QskMargins margin( QskAspect ) const;
|
||||
|
||||
void setPadding( QskAspect, const QskMargins& );
|
||||
void setPadding( QskAspect,
|
||||
qreal left, qreal top, qreal right, qreal bottom );
|
||||
QskMargins padding( QskAspect ) const;
|
||||
|
||||
void setSpacing( QskAspect, qreal );
|
||||
qreal spacing( QskAspect ) const;
|
||||
|
||||
void setGradient( QskAspect, const QskGradient& );
|
||||
QskGradient gradient( QskAspect ) const;
|
||||
|
||||
void setBoxShape( QskAspect, qreal radius, Qt::SizeMode = Qt::AbsoluteSize );
|
||||
void setBoxShape( QskAspect, qreal topLeft, qreal topRight,
|
||||
qreal bottomLeft, qreal bottomRight, Qt::SizeMode = Qt::AbsoluteSize );
|
||||
|
||||
void setBoxShape( QskAspect, const QskBoxShapeMetrics& );
|
||||
QskBoxShapeMetrics boxShape( QskAspect ) const;
|
||||
|
||||
void setBoxBorderMetrics( QskAspect,
|
||||
qreal borderWidth, Qt::SizeMode = Qt::AbsoluteSize );
|
||||
|
||||
void setBoxBorderMetrics( QskAspect, qreal left, qreal top,
|
||||
qreal right, qreal bottom, Qt::SizeMode = Qt::AbsoluteSize );
|
||||
|
||||
void setBoxBorderMetrics( QskAspect, const QskBoxBorderMetrics& );
|
||||
QskBoxBorderMetrics boxBorderMetrics( QskAspect ) const;
|
||||
|
||||
void setBoxBorderColors( QskAspect, const QskBoxBorderColors& );
|
||||
QskBoxBorderColors boxBorderColors( QskAspect ) const;
|
||||
|
||||
void setAnimation( QskAspect, QskAnimationHint );
|
||||
QskAnimationHint animation( QskAspect ) const;
|
||||
|
||||
void setAlignment( QskAspect, Qt::Alignment );
|
||||
Qt::Alignment alignment( QskAspect ) const;
|
||||
|
||||
void setSkinHint( QskAspect, const QVariant& hint );
|
||||
const QVariant& skinHint( QskAspect ) const;
|
||||
|
||||
|
@ -121,9 +61,6 @@ class QSK_EXPORT QskSkin : public QObject
|
|||
void resetGraphicFilter( int graphicRole );
|
||||
QskColorFilter graphicFilter( int graphicRole ) const;
|
||||
|
||||
void setFontRole( QskAspect, int fontRole );
|
||||
void setGraphicRole( QskAspect, int graphicRole );
|
||||
|
||||
void setFont( int fontRole, const QFont& );
|
||||
void resetFont( int fontRole );
|
||||
QFont font( int fontRole ) const;
|
||||
|
@ -145,12 +82,12 @@ class QSK_EXPORT QskSkin : public QObject
|
|||
QskSkinlet* skinlet( const QMetaObject* );
|
||||
|
||||
const QskSkinHintTable& hintTable() const;
|
||||
QskSkinHintTable& hintTable();
|
||||
|
||||
const std::unordered_map< int, QFont >& fonts() const;
|
||||
const std::unordered_map< int, QskColorFilter >& graphicFilters() const;
|
||||
|
||||
protected:
|
||||
QskSkinHintTable& skinHintTable();
|
||||
|
||||
private:
|
||||
void declareSkinlet( const QMetaObject* controlMetaObject,
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "QskSkinHintTable.h"
|
||||
#include "QskAnimationHint.h"
|
||||
|
||||
QVariant QskSkinHintTable::invalidHint;
|
||||
const QVariant QskSkinHintTable::invalidHint;
|
||||
|
||||
inline const QVariant* qskResolvedHint( QskAspect aspect,
|
||||
const std::unordered_map< QskAspect, QVariant >& hints,
|
||||
|
@ -111,7 +112,7 @@ void QskSkinHintTable::setHint( QskAspect aspect, const QVariant& skinHint )
|
|||
it->second = skinHint;
|
||||
}
|
||||
|
||||
if ( aspect.state() )
|
||||
if ( aspect.hasState() )
|
||||
m_hasStates = true;
|
||||
}
|
||||
|
||||
|
@ -213,3 +214,16 @@ QskAspect QskSkinHintTable::resolvedAnimator(
|
|||
|
||||
return QskAspect();
|
||||
}
|
||||
|
||||
QskAnimationHint QskSkinHintTable::animation( QskAspect aspect ) const
|
||||
{
|
||||
aspect.setAnimator( true );
|
||||
return hint< QskAnimationHint >( aspect );
|
||||
}
|
||||
|
||||
void QskSkinHintTable::setAnimation(
|
||||
QskAspect aspect, QskAnimationHint animation )
|
||||
{
|
||||
aspect.setAnimator( true );
|
||||
setHint( aspect, animation );
|
||||
}
|
||||
|
|
|
@ -6,19 +6,13 @@
|
|||
#ifndef QSK_SKIN_HINT_TABLE_H
|
||||
#define QSK_SKIN_HINT_TABLE_H
|
||||
|
||||
#include "QskAnimationHint.h"
|
||||
#include "QskAspect.h"
|
||||
#include "QskBoxBorderColors.h"
|
||||
#include "QskBoxBorderMetrics.h"
|
||||
#include "QskBoxShapeMetrics.h"
|
||||
#include "QskGradient.h"
|
||||
#include "QskMargins.h"
|
||||
|
||||
#include <qcolor.h>
|
||||
#include <qvariant.h>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
class QskAnimationHint;
|
||||
|
||||
class QSK_EXPORT QskSkinHintTable
|
||||
{
|
||||
public:
|
||||
|
@ -29,52 +23,15 @@ class QSK_EXPORT QskSkinHintTable
|
|||
|
||||
QskSkinHintTable& operator=( const QskSkinHintTable& );
|
||||
|
||||
void setColor( QskAspect, Qt::GlobalColor );
|
||||
void setColor( QskAspect, QRgb );
|
||||
|
||||
void setColor( QskAspect, const QColor& );
|
||||
QColor color( QskAspect ) const;
|
||||
|
||||
void setMetric( QskAspect, qreal );
|
||||
qreal metric( QskAspect ) const;
|
||||
|
||||
void setStrutSize( QskAspect, const QSizeF& );
|
||||
QSizeF strutSize( QskAspect ) const;
|
||||
|
||||
void setMargin( QskAspect, const QskMargins& );
|
||||
QskMargins margin( QskAspect ) const;
|
||||
|
||||
void setPadding( QskAspect, const QskMargins& );
|
||||
QskMargins padding( QskAspect ) const;
|
||||
|
||||
void setGradient( QskAspect, const QskGradient& );
|
||||
QskGradient gradient( QskAspect ) const;
|
||||
|
||||
void setBoxShape( QskAspect, const QskBoxShapeMetrics& );
|
||||
QskBoxShapeMetrics boxShape( QskAspect ) const;
|
||||
|
||||
void setBoxBorder( QskAspect, const QskBoxBorderMetrics& );
|
||||
QskBoxBorderMetrics boxBorder( QskAspect ) const;
|
||||
|
||||
void setBoxBorderColors( QskAspect, const QskBoxBorderColors& );
|
||||
QskBoxBorderColors boxBorderColors( QskAspect ) const;
|
||||
|
||||
void setSpacing( QskAspect, qreal );
|
||||
qreal spacing( QskAspect ) const;
|
||||
|
||||
void setAlignment( QskAspect, Qt::Alignment );
|
||||
Qt::Alignment alignment( QskAspect ) const;
|
||||
|
||||
void setAnimation( QskAspect, QskAnimationHint );
|
||||
QskAnimationHint animation( QskAspect ) const;
|
||||
|
||||
void setGraphicRole( QskAspect, int role );
|
||||
void setFontRole( QskAspect, int role );
|
||||
void setFlagHint( QskAspect, int flag );
|
||||
|
||||
void setHint( QskAspect, const QVariant& );
|
||||
const QVariant& hint( QskAspect ) const;
|
||||
|
||||
template< typename T > void setHint( QskAspect, const T& );
|
||||
template< typename T > T hint( QskAspect ) const;
|
||||
|
||||
bool removeHint( QskAspect );
|
||||
QVariant takeHint( QskAspect );
|
||||
|
||||
|
@ -97,7 +54,7 @@ class QSK_EXPORT QskSkinHintTable
|
|||
QskAspect, QskAnimationHint& ) const;
|
||||
|
||||
private:
|
||||
static QVariant invalidHint;
|
||||
static const QVariant invalidHint;
|
||||
|
||||
typedef std::unordered_map< QskAspect, QVariant > HintMap;
|
||||
HintMap* m_hints;
|
||||
|
@ -141,171 +98,16 @@ inline const QVariant& QskSkinHintTable::hint( QskAspect aspect ) const
|
|||
return invalidHint;
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setColor( QskAspect aspect, const QColor& color )
|
||||
template< typename T >
|
||||
inline void QskSkinHintTable::setHint( QskAspect aspect, const T& hint )
|
||||
{
|
||||
setHint( aspect | QskAspect::Color, color );
|
||||
setHint( aspect, QVariant::fromValue( hint ) );
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setColor( QskAspect aspect, Qt::GlobalColor color )
|
||||
template< typename T >
|
||||
inline T QskSkinHintTable::hint( QskAspect aspect ) const
|
||||
{
|
||||
setHint( aspect | QskAspect::Color, QColor( color ) );
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setColor( QskAspect aspect, QRgb rgb )
|
||||
{
|
||||
setHint( aspect | QskAspect::Color, QColor::fromRgba( rgb ) );
|
||||
}
|
||||
|
||||
inline QColor QskSkinHintTable::color( QskAspect aspect ) const
|
||||
{
|
||||
return hint( aspect | QskAspect::Color ).value< QColor >();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setMetric( QskAspect aspect, qreal metric )
|
||||
{
|
||||
setHint( aspect | QskAspect::Metric, metric );
|
||||
}
|
||||
|
||||
inline qreal QskSkinHintTable::metric( QskAspect aspect ) const
|
||||
{
|
||||
return hint( aspect | QskAspect::Metric ).toReal();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setStrutSize( QskAspect aspect, const QSizeF& size )
|
||||
{
|
||||
const auto aspectStrut = aspect | QskAspect::Metric | QskAspect::StrutSize;
|
||||
setHint( aspectStrut, QVariant::fromValue( size ) );
|
||||
}
|
||||
|
||||
inline QSizeF QskSkinHintTable::strutSize( QskAspect aspect ) const
|
||||
{
|
||||
const auto aspectStrut = aspect | QskAspect::Metric | QskAspect::StrutSize;
|
||||
return hint( aspectStrut ).value< QSizeF >();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setMargin(
|
||||
QskAspect aspect, const QskMargins& margins )
|
||||
{
|
||||
const auto aspectMargin = aspect | QskAspect::Metric | QskAspect::Margin;
|
||||
setHint( aspectMargin, QVariant::fromValue( margins ) );
|
||||
}
|
||||
|
||||
inline QskMargins QskSkinHintTable::margin( QskAspect aspect ) const
|
||||
{
|
||||
const auto aspectMargin = aspect | QskAspect::Metric | QskAspect::Margin;
|
||||
return hint( aspectMargin ).value< QskMargins >();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setPadding(
|
||||
QskAspect aspect, const QskMargins& padding )
|
||||
{
|
||||
const auto aspectPadding = aspect | QskAspect::Metric | QskAspect::Padding;
|
||||
setHint( aspectPadding, QVariant::fromValue( padding ) );
|
||||
}
|
||||
|
||||
inline QskMargins QskSkinHintTable::padding( QskAspect aspect ) const
|
||||
{
|
||||
const auto aspectPadding = aspect | QskAspect::Metric | QskAspect::Padding;
|
||||
return hint( aspectPadding ).value< QskMargins >();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setGradient(
|
||||
QskAspect aspect, const QskGradient& gradient )
|
||||
{
|
||||
setHint( aspect | QskAspect::Color, QVariant::fromValue( gradient ) );
|
||||
}
|
||||
|
||||
inline QskGradient QskSkinHintTable::gradient( QskAspect aspect ) const
|
||||
{
|
||||
return hint( aspect | QskAspect::Color ).value< QskGradient >();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setBoxShape(
|
||||
QskAspect aspect, const QskBoxShapeMetrics& shape )
|
||||
{
|
||||
using A = QskAspect;
|
||||
setHint( aspect | A::Shape | A::Metric, QVariant::fromValue( shape ) );
|
||||
}
|
||||
|
||||
inline QskBoxShapeMetrics QskSkinHintTable::boxShape( QskAspect aspect ) const
|
||||
{
|
||||
using A = QskAspect;
|
||||
return hint( aspect | A::Shape | A::Metric ).value< QskBoxShapeMetrics >();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setBoxBorder(
|
||||
QskAspect aspect, const QskBoxBorderMetrics& border )
|
||||
{
|
||||
using A = QskAspect;
|
||||
setHint( aspect | A::Border | A::Metric, QVariant::fromValue( border ) );
|
||||
}
|
||||
|
||||
inline QskBoxBorderMetrics QskSkinHintTable::boxBorder( QskAspect aspect ) const
|
||||
{
|
||||
using A = QskAspect;
|
||||
return hint( aspect | A::Border | A::Metric ).value< QskBoxBorderMetrics >();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setBoxBorderColors(
|
||||
QskAspect aspect, const QskBoxBorderColors& colors )
|
||||
{
|
||||
using A = QskAspect;
|
||||
setHint( aspect | A::Border | A::Color, QVariant::fromValue( colors ) );
|
||||
}
|
||||
|
||||
inline QskBoxBorderColors QskSkinHintTable::boxBorderColors( QskAspect aspect ) const
|
||||
{
|
||||
using A = QskAspect;
|
||||
return hint( aspect | A::Border | A::Color ).value< QskBoxBorderColors >();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setSpacing( QskAspect aspect, qreal spacing )
|
||||
{
|
||||
setMetric( aspect | QskAspect::Spacing, spacing );
|
||||
}
|
||||
|
||||
inline qreal QskSkinHintTable::spacing( QskAspect aspect ) const
|
||||
{
|
||||
return metric( aspect | QskAspect::Spacing );
|
||||
}
|
||||
|
||||
inline QskAnimationHint QskSkinHintTable::animation( QskAspect aspect ) const
|
||||
{
|
||||
aspect.setAnimator( true );
|
||||
return hint( aspect ).value< QskAnimationHint >();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setGraphicRole( QskAspect aspect, int role )
|
||||
{
|
||||
setHint( aspect | QskAspect::GraphicRole, role );
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setFontRole( QskAspect aspect, int role )
|
||||
{
|
||||
setHint( aspect | QskAspect::FontRole, role );
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setAlignment(
|
||||
QskAspect aspect, Qt::Alignment alignment )
|
||||
{
|
||||
setFlagHint( aspect | QskAspect::Alignment, alignment );
|
||||
}
|
||||
|
||||
inline Qt::Alignment QskSkinHintTable::alignment( QskAspect aspect ) const
|
||||
{
|
||||
return hint( aspect | QskAspect::Alignment ).value< Qt::Alignment >();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setFlagHint( QskAspect aspect, int flag )
|
||||
{
|
||||
setHint( aspect, QVariant( flag ) );
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setAnimation(
|
||||
QskAspect aspect, QskAnimationHint animation )
|
||||
{
|
||||
aspect.setAnimator( true );
|
||||
setHint( aspect, QVariant::fromValue( animation ) );
|
||||
return hint( aspect ).value< T >();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,324 @@
|
|||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#include "QskSkinHintTableEditor.h"
|
||||
#include "QskSkinHintTable.h"
|
||||
|
||||
#include "QskMargins.h"
|
||||
#include "QskBoxShapeMetrics.h"
|
||||
#include "QskBoxBorderMetrics.h"
|
||||
#include "QskBoxBorderColors.h"
|
||||
#include "QskGradient.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
inline QskAspect aspectStrutSize( QskAspect aspect )
|
||||
{
|
||||
return aspect | QskAspect::StrutSize;
|
||||
}
|
||||
|
||||
inline QskAspect aspectMargin( QskAspect aspect )
|
||||
{
|
||||
return aspect | QskAspect::Margin;
|
||||
}
|
||||
|
||||
inline QskAspect aspectPadding( QskAspect aspect )
|
||||
{
|
||||
return aspect | QskAspect::Padding;
|
||||
}
|
||||
|
||||
inline QskAspect aspectSpacing( QskAspect aspect )
|
||||
{
|
||||
return aspect | QskAspect::Spacing;
|
||||
}
|
||||
|
||||
inline QskAspect aspectAlignment( QskAspect aspect )
|
||||
{
|
||||
return aspect | QskAspect::Alignment;
|
||||
}
|
||||
|
||||
inline QskAspect aspectFontRole( QskAspect aspect )
|
||||
{
|
||||
return aspect | QskAspect::FontRole;
|
||||
}
|
||||
|
||||
inline QskAspect aspectGraphicRole( QskAspect aspect )
|
||||
{
|
||||
return aspect | QskAspect::GraphicRole;
|
||||
}
|
||||
|
||||
inline QskAspect aspectShape( QskAspect aspect )
|
||||
{
|
||||
return aspect | QskAspect::Shape;
|
||||
}
|
||||
|
||||
inline QskAspect aspectBorder( QskAspect aspect )
|
||||
{
|
||||
return aspect | QskAspect::Border;
|
||||
}
|
||||
}
|
||||
|
||||
QskSkinHintTableEditor::QskSkinHintTableEditor( QskSkinHintTable* table )
|
||||
: m_table( table )
|
||||
{
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setTable( QskSkinHintTable* table )
|
||||
{
|
||||
m_table = table;
|
||||
}
|
||||
|
||||
QskSkinHintTable* QskSkinHintTableEditor::table() const
|
||||
{
|
||||
return m_table;
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setFlag( QskAspect aspect, int flag )
|
||||
{
|
||||
setFlagHint( aspect, flag );
|
||||
}
|
||||
|
||||
int QskSkinHintTableEditor::flag( QskAspect aspect ) const
|
||||
{
|
||||
return flagHint<int>( aspect );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setMetric( QskAspect aspect, qreal metric )
|
||||
{
|
||||
setMetricHint( aspect, metric );
|
||||
}
|
||||
|
||||
qreal QskSkinHintTableEditor::metric( QskAspect aspect ) const
|
||||
{
|
||||
return metricHint<qreal>( aspect );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setColor( QskAspect aspect, Qt::GlobalColor color )
|
||||
{
|
||||
setColorHint( aspect, QColor( color ) );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setColor( QskAspect aspect, QRgb rgb )
|
||||
{
|
||||
setColorHint( aspect, QColor::fromRgba( rgb ) );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setColor( QskAspect aspect, const QColor& color )
|
||||
{
|
||||
setColorHint( aspect, color );
|
||||
}
|
||||
|
||||
QColor QskSkinHintTableEditor::color( QskAspect aspect ) const
|
||||
{
|
||||
return colorHint<QColor>( aspect );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setGradient( QskAspect aspect, const QskGradient& gradient )
|
||||
{
|
||||
setColorHint( aspect, gradient );
|
||||
}
|
||||
|
||||
QskGradient QskSkinHintTableEditor::gradient( QskAspect aspect ) const
|
||||
{
|
||||
return colorHint<QskGradient>( aspect );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setStrutSize( QskAspect aspect, const QSizeF& size )
|
||||
{
|
||||
setMetricHint( aspect | QskAspect::StrutSize, size );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setStrutSize( QskAspect aspect, qreal width, qreal height )
|
||||
{
|
||||
setMetricHint( aspectStrutSize( aspect ), QSizeF( width, height ) );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removeStrutSize( QskAspect aspect )
|
||||
{
|
||||
removeMetricHint( aspectStrutSize( aspect ) );
|
||||
}
|
||||
|
||||
QSizeF QskSkinHintTableEditor::strutSize( QskAspect aspect ) const
|
||||
{
|
||||
return metricHint< QSizeF >( aspectStrutSize( aspect ) );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setMargin( QskAspect aspect, const QskMargins& margins )
|
||||
{
|
||||
setMetricHint( aspectMargin( aspect ), margins );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setMargin( QskAspect aspect,
|
||||
qreal left, qreal top, qreal right, qreal bottom )
|
||||
{
|
||||
setMetricHint( aspectMargin( aspect ), QskMargins( left, top, right, bottom ) );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removeMargin( QskAspect aspect )
|
||||
{
|
||||
removeMetricHint( aspectMargin( aspect ) );
|
||||
}
|
||||
|
||||
QskMargins QskSkinHintTableEditor::margin( QskAspect aspect ) const
|
||||
{
|
||||
return metricHint< QskMargins >( aspectMargin( aspect ) );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setPadding( QskAspect aspect, const QskMargins& padding )
|
||||
{
|
||||
setMetricHint( aspectPadding( aspect ), padding );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setPadding( QskAspect aspect,
|
||||
qreal left, qreal top, qreal right, qreal bottom )
|
||||
{
|
||||
setMetricHint( aspectPadding( aspect ), QskMargins( left, top, right, bottom ) );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removePadding( QskAspect aspect )
|
||||
{
|
||||
removeMetricHint( aspectPadding( aspect ) );
|
||||
}
|
||||
|
||||
QskMargins QskSkinHintTableEditor::padding( QskAspect aspect ) const
|
||||
{
|
||||
return metricHint< QskMargins >( aspectPadding( aspect ) );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setSpacing( QskAspect aspect, qreal spacing )
|
||||
{
|
||||
setMetricHint( aspectSpacing( aspect ), spacing );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removeSpacing( QskAspect aspect )
|
||||
{
|
||||
removeMetricHint( aspectSpacing( aspect ) );
|
||||
}
|
||||
|
||||
qreal QskSkinHintTableEditor::spacing( QskAspect aspect ) const
|
||||
{
|
||||
return metricHint< qreal >( aspectSpacing( aspect ) );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setAlignment( QskAspect aspect, Qt::Alignment alignment )
|
||||
{
|
||||
setFlagHint( aspectAlignment( aspect ), static_cast< int >( alignment ) );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removeAlignment( QskAspect aspect )
|
||||
{
|
||||
return removeFlagHint( aspectAlignment( aspect ) );
|
||||
}
|
||||
|
||||
Qt::Alignment QskSkinHintTableEditor::alignment( QskAspect aspect ) const
|
||||
{
|
||||
return flagHint< Qt::Alignment >( aspectAlignment( aspect ) );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setFontRole( QskAspect aspect, int fontRole )
|
||||
{
|
||||
setFlagHint( aspectFontRole( aspect ), fontRole );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removeFontRole( QskAspect aspect )
|
||||
{
|
||||
return removeFlagHint( aspectFontRole( aspect ) );
|
||||
}
|
||||
|
||||
int QskSkinHintTableEditor::fontRole( QskAspect aspect ) const
|
||||
{
|
||||
return flagHint< int >( aspectFontRole( aspect ) );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setGraphicRole( QskAspect aspect, int graphicRole )
|
||||
{
|
||||
setFlagHint( aspectGraphicRole( aspect ), graphicRole );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removeGraphicRole( QskAspect aspect )
|
||||
{
|
||||
return removeFlagHint( aspectGraphicRole( aspect ) );
|
||||
}
|
||||
|
||||
int QskSkinHintTableEditor::graphicRole( QskAspect aspect ) const
|
||||
{
|
||||
return flagHint< int >( aspectGraphicRole( aspect ) );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setBoxShape(
|
||||
QskAspect aspect, qreal radius, Qt::SizeMode sizeMode )
|
||||
{
|
||||
setMetricHint( aspectShape( aspect ),
|
||||
QskBoxShapeMetrics( radius, sizeMode ) );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setBoxShape( QskAspect aspect, qreal topLeft, qreal topRight,
|
||||
qreal bottomLeft, qreal bottomRight, Qt::SizeMode sizeMode )
|
||||
{
|
||||
setMetricHint( aspectShape( aspect ),
|
||||
QskBoxShapeMetrics( topLeft, topRight, bottomLeft, bottomRight, sizeMode ) );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setBoxShape(
|
||||
QskAspect aspect, const QskBoxShapeMetrics& shape )
|
||||
{
|
||||
setMetricHint( aspectShape( aspect ), shape );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removeBoxShape( QskAspect aspect )
|
||||
{
|
||||
return removeMetricHint( aspectShape( aspect ) );
|
||||
}
|
||||
|
||||
QskBoxShapeMetrics QskSkinHintTableEditor::boxShape( QskAspect aspect ) const
|
||||
{
|
||||
return metricHint< QskBoxShapeMetrics >( aspectShape( aspect ) );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setBoxBorderMetrics( QskAspect aspect,
|
||||
qreal borderWidth, Qt::SizeMode sizeMode )
|
||||
{
|
||||
setMetricHint( aspectBorder( aspect ),
|
||||
QskBoxBorderMetrics( borderWidth, sizeMode ) );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setBoxBorderMetrics( QskAspect aspect,
|
||||
qreal left, qreal top, qreal right, qreal bottom, Qt::SizeMode sizeMode )
|
||||
{
|
||||
setMetricHint( aspectBorder( aspect ),
|
||||
QskBoxBorderMetrics( left, top, right, bottom, sizeMode ) );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setBoxBorderMetrics(
|
||||
QskAspect aspect, const QskBoxBorderMetrics& borderMetrics )
|
||||
{
|
||||
setMetricHint( aspectBorder( aspect ), borderMetrics );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removeBoxBorderMetric( QskAspect aspect )
|
||||
{
|
||||
return removeMetricHint( aspectBorder( aspect ) );
|
||||
}
|
||||
|
||||
QskBoxBorderMetrics QskSkinHintTableEditor::boxBorderMetrics( QskAspect aspect ) const
|
||||
{
|
||||
return metricHint< QskBoxBorderMetrics >( aspectBorder( aspect ) );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setBoxBorderColors(
|
||||
QskAspect aspect, const QskBoxBorderColors& borderColors )
|
||||
{
|
||||
setColorHint( aspectBorder( aspect ), borderColors );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removeBoxBorderColors( QskAspect aspect )
|
||||
{
|
||||
return removeColorHint( aspectBorder( aspect ) );
|
||||
}
|
||||
|
||||
QskBoxBorderColors QskSkinHintTableEditor::boxBorderColors( QskAspect aspect ) const
|
||||
{
|
||||
return colorHint< QskBoxBorderColors >( aspectBorder( aspect ) );
|
||||
}
|
|
@ -0,0 +1,281 @@
|
|||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef QSK_SKIN_HINT_TABLE_EDITOR_H
|
||||
#define QSK_SKIN_HINT_TABLE_EDITOR_H
|
||||
|
||||
#include "QskAspect.h"
|
||||
#include "QskSkinHintTable.h"
|
||||
#include "QskAnimationHint.h"
|
||||
|
||||
#include <qcolor.h>
|
||||
#include <qvariant.h>
|
||||
|
||||
class QskMargins;
|
||||
class QskGradient;
|
||||
class QskBoxShapeMetrics;
|
||||
class QskBoxBorderMetrics;
|
||||
class QskBoxBorderColors;
|
||||
|
||||
class QSK_EXPORT QskSkinHintTableEditor
|
||||
{
|
||||
public:
|
||||
QskSkinHintTableEditor( QskSkinHintTable* = nullptr );
|
||||
|
||||
void setTable( QskSkinHintTable* );
|
||||
QskSkinHintTable* table() const;
|
||||
|
||||
// generic access
|
||||
|
||||
void setHint( QskAspect, const QVariant& );
|
||||
const QVariant& hint( QskAspect ) const;
|
||||
|
||||
bool removeHint( QskAspect );
|
||||
QVariant takeHint( QskAspect );
|
||||
|
||||
bool hasHint( QskAspect ) const;
|
||||
|
||||
template< typename T > void setHint( QskAspect, const T& );
|
||||
template< typename T > T hint( QskAspect ) const;
|
||||
|
||||
// animation hints
|
||||
|
||||
void setAnimation( QskAspect, QskAnimationHint );
|
||||
QskAnimationHint animation( QskAspect ) const;
|
||||
|
||||
// flag/metric/color
|
||||
|
||||
void setFlagHint( QskAspect, const QVariant& );
|
||||
void removeFlagHint( QskAspect );
|
||||
QVariant flagHint( QskAspect ) const;
|
||||
|
||||
template< typename T > void setFlagHint( QskAspect, const T& );
|
||||
template< typename T > T flagHint( QskAspect ) const;
|
||||
|
||||
void setMetricHint( QskAspect, const QVariant& );
|
||||
void removeMetricHint( QskAspect );
|
||||
QVariant metricHint( QskAspect ) const;
|
||||
|
||||
template< typename T > void setMetricHint( QskAspect, const T& );
|
||||
template< typename T > T metricHint( QskAspect ) const;
|
||||
|
||||
void setColorHint( QskAspect, const QVariant& );
|
||||
void removeColorHint( QskAspect );
|
||||
QVariant colorHint( QskAspect ) const;
|
||||
|
||||
template< typename T > void setColorHint( QskAspect, const T& );
|
||||
template< typename T > T colorHint( QskAspect ) const;
|
||||
|
||||
// type specific
|
||||
|
||||
void setFlag( QskAspect, int );
|
||||
int flag( QskAspect ) const;
|
||||
|
||||
void setMetric( QskAspect, qreal metric );
|
||||
qreal metric( QskAspect ) const;
|
||||
|
||||
void setColor( QskAspect, Qt::GlobalColor );
|
||||
void setColor( QskAspect, QRgb );
|
||||
void setColor( QskAspect, const QColor& );
|
||||
QColor color( QskAspect ) const;
|
||||
|
||||
void setGradient( QskAspect, const QskGradient& );
|
||||
QskGradient gradient( QskAspect ) const;
|
||||
|
||||
void setStrutSize( QskAspect, const QSizeF& );
|
||||
void setStrutSize( QskAspect, qreal width, qreal height );
|
||||
void removeStrutSize( QskAspect );
|
||||
QSizeF strutSize( QskAspect ) const;
|
||||
|
||||
void setMargin( QskAspect, const QskMargins& );
|
||||
void setMargin( QskAspect,
|
||||
qreal left, qreal top, qreal right, qreal bottom );
|
||||
void removeMargin( QskAspect );
|
||||
QskMargins margin( QskAspect ) const;
|
||||
|
||||
void setPadding( QskAspect, const QskMargins& );
|
||||
void setPadding( QskAspect,
|
||||
qreal left, qreal top, qreal right, qreal bottom );
|
||||
void removePadding( QskAspect );
|
||||
QskMargins padding( QskAspect ) const;
|
||||
|
||||
void setSpacing( QskAspect, qreal );
|
||||
void removeSpacing( QskAspect );
|
||||
qreal spacing( QskAspect ) const;
|
||||
|
||||
void setAlignment( QskAspect, Qt::Alignment );
|
||||
void removeAlignment( QskAspect );
|
||||
Qt::Alignment alignment( QskAspect ) const;
|
||||
|
||||
void setFontRole( QskAspect, int );
|
||||
void removeFontRole( QskAspect );
|
||||
int fontRole( QskAspect ) const;
|
||||
|
||||
void setGraphicRole( QskAspect, int );
|
||||
void removeGraphicRole( QskAspect );
|
||||
int graphicRole( QskAspect ) const;
|
||||
|
||||
void setBoxShape( QskAspect, qreal radius, Qt::SizeMode = Qt::AbsoluteSize );
|
||||
void setBoxShape( QskAspect, qreal topLeft, qreal topRight,
|
||||
qreal bottomLeft, qreal bottomRight, Qt::SizeMode = Qt::AbsoluteSize );
|
||||
void setBoxShape( QskAspect, const QskBoxShapeMetrics& );
|
||||
void removeBoxShape( QskAspect );
|
||||
QskBoxShapeMetrics boxShape( QskAspect ) const;
|
||||
|
||||
void setBoxBorderMetrics( QskAspect,
|
||||
qreal borderWidth, Qt::SizeMode = Qt::AbsoluteSize );
|
||||
void setBoxBorderMetrics( QskAspect, qreal left, qreal top,
|
||||
qreal right, qreal bottom, Qt::SizeMode = Qt::AbsoluteSize );
|
||||
void setBoxBorderMetrics( QskAspect, const QskBoxBorderMetrics& );
|
||||
void removeBoxBorderMetric( QskAspect );
|
||||
QskBoxBorderMetrics boxBorderMetrics( QskAspect ) const;
|
||||
|
||||
void setBoxBorderColors( QskAspect, const QskBoxBorderColors& );
|
||||
void removeBoxBorderColors( QskAspect );
|
||||
QskBoxBorderColors boxBorderColors( QskAspect ) const;
|
||||
|
||||
private:
|
||||
QskSkinHintTable* m_table = nullptr;
|
||||
};
|
||||
|
||||
// --- generic access ---
|
||||
|
||||
inline void QskSkinHintTableEditor::setHint( QskAspect aspect, const QVariant& hint )
|
||||
{
|
||||
return m_table->setHint( aspect, hint );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
inline void QskSkinHintTableEditor::setHint( QskAspect aspect, const T& hint )
|
||||
{
|
||||
setHint( aspect, QVariant::fromValue( hint ) );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
inline T QskSkinHintTableEditor::hint( QskAspect aspect ) const
|
||||
{
|
||||
return hint( aspect ).value< T >();
|
||||
}
|
||||
|
||||
inline const QVariant& QskSkinHintTableEditor::hint( QskAspect aspect ) const
|
||||
{
|
||||
return m_table->hint( aspect );
|
||||
}
|
||||
|
||||
inline bool QskSkinHintTableEditor::removeHint( QskAspect aspect )
|
||||
{
|
||||
return m_table->removeHint( aspect );
|
||||
}
|
||||
|
||||
inline QVariant QskSkinHintTableEditor::takeHint( QskAspect aspect )
|
||||
{
|
||||
return m_table->takeHint( aspect );
|
||||
}
|
||||
|
||||
inline bool QskSkinHintTableEditor::hasHint( QskAspect aspect ) const
|
||||
{
|
||||
return m_table->hasHint( aspect );
|
||||
}
|
||||
|
||||
// --- flag ---
|
||||
|
||||
inline void QskSkinHintTableEditor::setFlagHint( QskAspect aspect, const QVariant& hint )
|
||||
{
|
||||
setHint( aspect | QskAspect::Flag, hint );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
inline void QskSkinHintTableEditor::setFlagHint( QskAspect aspect, const T& hint )
|
||||
{
|
||||
setHint( aspect | QskAspect::Flag, hint );
|
||||
}
|
||||
|
||||
inline void QskSkinHintTableEditor::removeFlagHint( QskAspect aspect )
|
||||
{
|
||||
removeHint( aspect | QskAspect::Flag );
|
||||
}
|
||||
|
||||
inline QVariant QskSkinHintTableEditor::flagHint( QskAspect aspect ) const
|
||||
{
|
||||
return hint( aspect | QskAspect::Flag );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
inline T QskSkinHintTableEditor::flagHint( QskAspect aspect ) const
|
||||
{
|
||||
return hint< T >( aspect | QskAspect::Flag );
|
||||
}
|
||||
|
||||
// --- metric ---
|
||||
|
||||
inline void QskSkinHintTableEditor::setMetricHint( QskAspect aspect, const QVariant& hint )
|
||||
{
|
||||
setHint( aspect | QskAspect::Metric, hint );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
inline void QskSkinHintTableEditor::setMetricHint( QskAspect aspect, const T& hint )
|
||||
{
|
||||
setHint( aspect | QskAspect::Metric, hint );
|
||||
}
|
||||
|
||||
inline void QskSkinHintTableEditor::removeMetricHint( QskAspect aspect )
|
||||
{
|
||||
removeHint( aspect | QskAspect::Metric );
|
||||
}
|
||||
|
||||
inline QVariant QskSkinHintTableEditor::metricHint( QskAspect aspect ) const
|
||||
{
|
||||
return hint( aspect | QskAspect::Metric );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
inline T QskSkinHintTableEditor::metricHint( QskAspect aspect ) const
|
||||
{
|
||||
return hint< T >( aspect | QskAspect::Metric );
|
||||
}
|
||||
|
||||
// --- color ---
|
||||
|
||||
inline void QskSkinHintTableEditor::setColorHint( QskAspect aspect, const QVariant& hint )
|
||||
{
|
||||
setHint( aspect | QskAspect::Metric, hint );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
inline void QskSkinHintTableEditor::setColorHint( QskAspect aspect, const T& hint )
|
||||
{
|
||||
setHint( aspect | QskAspect::Color, hint );
|
||||
}
|
||||
|
||||
inline void QskSkinHintTableEditor::removeColorHint( QskAspect aspect )
|
||||
{
|
||||
removeHint( aspect | QskAspect::Color );
|
||||
}
|
||||
|
||||
inline QVariant QskSkinHintTableEditor::colorHint( QskAspect aspect ) const
|
||||
{
|
||||
return hint( aspect | QskAspect::Color );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
inline T QskSkinHintTableEditor::colorHint( QskAspect aspect ) const
|
||||
{
|
||||
return hint< T >( aspect | QskAspect::Color );
|
||||
}
|
||||
|
||||
// --- animation ---
|
||||
|
||||
inline QskAnimationHint QskSkinHintTableEditor::animation( QskAspect aspect ) const
|
||||
{
|
||||
return m_table->animation( aspect );
|
||||
}
|
||||
|
||||
inline void QskSkinHintTableEditor::setAnimation( QskAspect aspect, QskAnimationHint hint )
|
||||
{
|
||||
m_table->setAnimation( aspect, hint );
|
||||
}
|
||||
|
||||
#endif
|
|
@ -170,6 +170,7 @@ HEADERS += \
|
|||
controls/QskSkin.h \
|
||||
controls/QskSkinFactory.h \
|
||||
controls/QskSkinHintTable.h \
|
||||
controls/QskSkinHintTableEditor.h \
|
||||
controls/QskSkinManager.h \
|
||||
controls/QskSkinTransition.h \
|
||||
controls/QskSkinlet.h \
|
||||
|
@ -242,6 +243,7 @@ SOURCES += \
|
|||
controls/QskSimpleListBox.cpp \
|
||||
controls/QskSkin.cpp \
|
||||
controls/QskSkinHintTable.cpp \
|
||||
controls/QskSkinHintTableEditor.cpp \
|
||||
controls/QskSkinFactory.cpp \
|
||||
controls/QskSkinManager.cpp \
|
||||
controls/QskSkinTransition.cpp \
|
||||
|
|
Loading…
Reference in New Issue