making QskAspect a class
This commit is contained in:
parent
0df922cba8
commit
95d8d2a6da
|
@ -16,7 +16,7 @@
|
|||
OtherSlider::OtherSlider( QQuickItem* parentItem )
|
||||
: QskSlider( parentItem )
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using namespace QskRgb;
|
||||
|
||||
const qreal h = 30;
|
||||
|
@ -25,17 +25,17 @@ OtherSlider::OtherSlider( QQuickItem* parentItem )
|
|||
|
||||
// Panel
|
||||
|
||||
for ( auto placement : { Horizontal, Vertical } )
|
||||
for ( auto placement : { A::Horizontal, A::Vertical } )
|
||||
{
|
||||
const auto aspect = Panel | placement;
|
||||
|
||||
setMetric( aspect | Size, h );
|
||||
setMetric( aspect | A::Size, h );
|
||||
setBoxShapeHint( aspect, 4 );
|
||||
setBoxBorderMetricsHint( aspect, 1 );
|
||||
setBoxBorderColorsHint( aspect, Grey900 );
|
||||
setGradientHint( aspect, Grey400 );
|
||||
|
||||
if ( placement == Horizontal )
|
||||
if ( placement == A::Horizontal )
|
||||
setPaddingHint( aspect, QskMargins( paddingW, 0 ) );
|
||||
else
|
||||
setPaddingHint( aspect, QskMargins( 0, paddingW ) );
|
||||
|
@ -43,11 +43,11 @@ OtherSlider::OtherSlider( QQuickItem* parentItem )
|
|||
|
||||
// Groove
|
||||
|
||||
for ( auto placement : { Horizontal, Vertical } )
|
||||
for ( auto placement : { A::Horizontal, A::Vertical } )
|
||||
{
|
||||
const auto aspect = Groove | placement;
|
||||
|
||||
setMetric( aspect | Size, 4 );
|
||||
setMetric( aspect | A::Size, 4 );
|
||||
setBoxBorderMetricsHint( aspect, 0 );
|
||||
setBoxShapeHint( aspect, 1 );
|
||||
|
||||
|
@ -55,15 +55,15 @@ OtherSlider::OtherSlider( QQuickItem* parentItem )
|
|||
}
|
||||
|
||||
// no Fill
|
||||
for ( auto placement : { Horizontal, Vertical } )
|
||||
for ( auto placement : { A::Horizontal, A::Vertical } )
|
||||
{
|
||||
const auto aspect = Fill | placement;
|
||||
setMetric( aspect | Size, 0 );
|
||||
setMetric( aspect | A::Size, 0 );
|
||||
}
|
||||
|
||||
// Handle
|
||||
|
||||
for ( auto placement : { Horizontal, Vertical } )
|
||||
for ( auto placement : { A::Horizontal, A::Vertical } )
|
||||
{
|
||||
const auto aspect = Handle | placement;
|
||||
|
||||
|
@ -72,12 +72,12 @@ OtherSlider::OtherSlider( QQuickItem* parentItem )
|
|||
|
||||
const qreal m = 0.5 * std::ceil( 0.5 * ( w - h ) ) + 1;
|
||||
|
||||
if ( placement == Horizontal )
|
||||
if ( placement == A::Horizontal )
|
||||
setMarginHint( aspect, QskMargins( -m, 0 ) );
|
||||
else
|
||||
setMarginHint( aspect, QskMargins( 0, -m ) );
|
||||
|
||||
for ( auto state : { NoState, Pressed } )
|
||||
for ( auto state : { A::NoState, Pressed } )
|
||||
{
|
||||
setBoxBorderColorsHint( aspect | state, Grey600 );
|
||||
setGradientHint( aspect | state, Blue400 );
|
||||
|
|
|
@ -78,7 +78,7 @@ class MySkin : public QskSkin
|
|||
QRgb baseColor, QRgb baseTextColor,
|
||||
QRgb foregroundColor, QRgb foregroundTextColor )
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = MyToggleButton;
|
||||
|
||||
for( auto subControl : { Q::UncheckedLabel, Q::CheckedLabel } )
|
||||
|
@ -95,7 +95,7 @@ class MySkin : public QskSkin
|
|||
setColor( subControl, color2 );
|
||||
|
||||
setAlignment( subControl, Qt::AlignCenter );
|
||||
setAnimation( subControl | Color, animator() );
|
||||
setAnimation( subControl | A::Color, animator() );
|
||||
}
|
||||
|
||||
for( auto subControl : { Q::UncheckedIcon, Q::CheckedIcon } )
|
||||
|
@ -111,7 +111,7 @@ class MySkin : public QskSkin
|
|||
setGraphicRole( subControl, role1 );
|
||||
setGraphicRole( subControl | Q::Checked, role2 );
|
||||
|
||||
setAnimation( subControl | Flag, animator() );
|
||||
setAnimation( subControl | A::Flag, animator() );
|
||||
}
|
||||
|
||||
setGradient( Q::Panel, baseColor );
|
||||
|
@ -143,15 +143,15 @@ class MySkin : public QskSkin
|
|||
setPadding( Q::CheckedPanel, 10 );
|
||||
setPadding( Q::UncheckedPanel, 10 );
|
||||
|
||||
for( auto state : { NoState, Q::Disabled } )
|
||||
for( auto state : { A::NoState, Q::Disabled } )
|
||||
{
|
||||
const auto aspect = Q::Cursor | state | Position;
|
||||
const auto aspect = Q::Cursor | state | A::Position;
|
||||
|
||||
setMetric( aspect | Q::Checked, 0 );
|
||||
setMetric( aspect, 1 );
|
||||
}
|
||||
|
||||
setAnimation( Q::Cursor | Metric, animator() );
|
||||
setAnimation( Q::Cursor | A::Metric, animator() );
|
||||
}
|
||||
|
||||
void setGraphicFilter( int role, QRgb rgb )
|
||||
|
|
|
@ -158,16 +158,16 @@ void QskMaterialSkin::resetColors( const QColor& accent )
|
|||
|
||||
void QskMaterialSkin::initCommonHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskControl;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setPadding( Control, 4 );
|
||||
setPadding( A::Control, 4 );
|
||||
|
||||
setGradient( Control, pal.baseColor );
|
||||
setColor( Control | StyleColor, pal.textColor );
|
||||
setColor( Control | StyleColor | Q::Disabled,
|
||||
setGradient( A::Control, pal.baseColor );
|
||||
setColor( A::Control | A::StyleColor, pal.textColor );
|
||||
setColor( A::Control | A::StyleColor | Q::Disabled,
|
||||
qskShadedColor( m_data->palette.textColor, 0.6 ) );
|
||||
}
|
||||
|
||||
|
@ -184,11 +184,12 @@ void QskMaterialSkin::initBoxHints()
|
|||
|
||||
void QskMaterialSkin::initPopupHints()
|
||||
{
|
||||
using A = QskAspect;
|
||||
using Q = QskPopup;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setSkinHint( Q::Overlay | QskAspect::Style, true );
|
||||
setSkinHint( Q::Overlay | A::Style, true );
|
||||
|
||||
const QskGradient gradient( QskGradient::Vertical,
|
||||
qskShadedColor( pal.accentColor, 0.45 ), qskShadedColor( pal.accentColor, 0.7 ) );
|
||||
|
@ -233,7 +234,7 @@ void QskMaterialSkin::initTextInputHints()
|
|||
|
||||
void QskMaterialSkin::initProgressBarHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using namespace QskRgb;
|
||||
using Q = QskProgressBar;
|
||||
|
||||
|
@ -241,7 +242,7 @@ void QskMaterialSkin::initProgressBarHints()
|
|||
|
||||
for ( auto subControl : { Q::Groove, Q::Bar } )
|
||||
{
|
||||
setMetric( subControl | Size, 5 );
|
||||
setMetric( subControl | A::Size, 5 );
|
||||
setPadding( subControl, 0 );
|
||||
|
||||
setBoxShape( subControl, 0 );
|
||||
|
@ -249,7 +250,7 @@ void QskMaterialSkin::initProgressBarHints()
|
|||
}
|
||||
|
||||
setGradient( Q::Groove, Grey );
|
||||
setMetric( Q::Groove | Size, 5 );
|
||||
setMetric( Q::Groove | A::Size, 5 );
|
||||
setGradient( Q::Bar, pal.accentColor );
|
||||
}
|
||||
|
||||
|
@ -268,16 +269,16 @@ void QskMaterialSkin::initFocusIndicatorHints()
|
|||
|
||||
void QskMaterialSkin::initSeparatorHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskSeparator;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
for ( auto placement : { Horizontal, Vertical } )
|
||||
for ( auto placement : { A::Horizontal, A::Vertical } )
|
||||
{
|
||||
const auto aspect = Q::Panel | placement;
|
||||
|
||||
setMetric( aspect | Size, 4 );
|
||||
setMetric( aspect | A::Size, 4 );
|
||||
setBoxShape( Q::Panel, 0 );
|
||||
setBoxBorderMetrics( Q::Panel, 0 );
|
||||
setGradient( aspect, pal.baseColor );
|
||||
|
@ -286,7 +287,6 @@ void QskMaterialSkin::initSeparatorHints()
|
|||
|
||||
void QskMaterialSkin::initPageIndicatorHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using Q = QskPageIndicator;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
@ -316,7 +316,7 @@ void QskMaterialSkin::initPageIndicatorHints()
|
|||
|
||||
void QskMaterialSkin::initPushButtonHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using namespace QskRgb;
|
||||
using Q = QskPushButton;
|
||||
|
||||
|
@ -348,12 +348,12 @@ void QskMaterialSkin::initPushButtonHints()
|
|||
setFontRole( Q::Text, ButtonFontRole );
|
||||
setAlignment( Q::Text, Qt::AlignCenter );
|
||||
|
||||
for ( auto state1 : { NoState, Q::Checkable, Q::Focused, Q::Focused | Q::Checkable } )
|
||||
for ( auto state1 : { A::NoState, Q::Checkable, Q::Focused, Q::Focused | Q::Checkable } )
|
||||
{
|
||||
setBoxBorderColors( Q::Panel | Q::Hovered | state1, borderColors );
|
||||
setBoxBorderColors( Q::Panel | Q::Hovered | Q::Flat | state1, borderColors );
|
||||
|
||||
for ( auto state2 : { NoState, Q::Hovered } )
|
||||
for ( auto state2 : { A::NoState, Q::Hovered } )
|
||||
{
|
||||
for ( auto state3 : { Q::Pressed, Q::Checked, Q::Checked | Q::Pressed } )
|
||||
{
|
||||
|
@ -368,14 +368,14 @@ void QskMaterialSkin::initPushButtonHints()
|
|||
}
|
||||
}
|
||||
|
||||
setAnimation( Q::Panel | Color, qskDuration );
|
||||
setAnimation( Q::Panel | Metric, qskDuration );
|
||||
setAnimation( Q::Text | Color, qskDuration );
|
||||
setAnimation( Q::Panel | A::Color, qskDuration );
|
||||
setAnimation( Q::Panel | A::Metric, qskDuration );
|
||||
setAnimation( Q::Text | A::Color, qskDuration );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initDialogButtonHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using namespace QskRgb;
|
||||
using Q = QskDialogButton;
|
||||
|
||||
|
@ -402,11 +402,11 @@ void QskMaterialSkin::initDialogButtonHints()
|
|||
setFontRole( Q::Text, ButtonFontRole );
|
||||
setAlignment( Q::Text, Qt::AlignCenter );
|
||||
|
||||
for ( auto state1 : { NoState, Q::Checkable, Q::Focused, Q::Focused | Q::Checkable } )
|
||||
for ( auto state1 : { A::NoState, Q::Checkable, Q::Focused, Q::Focused | Q::Checkable } )
|
||||
{
|
||||
setBoxBorderColors( Q::Panel | Q::Hovered | state1, borderColors );
|
||||
|
||||
for ( auto state2 : { NoState, Q::Hovered } )
|
||||
for ( auto state2 : { A::NoState, Q::Hovered } )
|
||||
{
|
||||
for ( auto state3 : { Q::Pressed, Q::Checked, Q::Checked | Q::Pressed } )
|
||||
{
|
||||
|
@ -418,9 +418,9 @@ void QskMaterialSkin::initDialogButtonHints()
|
|||
}
|
||||
}
|
||||
|
||||
setAnimation( Q::Panel | Color, qskDuration );
|
||||
setAnimation( Q::Panel | Metric, qskDuration );
|
||||
setAnimation( Q::Text | Color, qskDuration );
|
||||
setAnimation( Q::Panel | A::Color, qskDuration );
|
||||
setAnimation( Q::Panel | A::Metric, qskDuration );
|
||||
setAnimation( Q::Text | A::Color, qskDuration );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initDialogButtonBoxHints()
|
||||
|
@ -436,7 +436,7 @@ void QskMaterialSkin::initDialogButtonBoxHints()
|
|||
|
||||
void QskMaterialSkin::initSliderHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using namespace QskRgb;
|
||||
using Q = QskSlider;
|
||||
|
||||
|
@ -446,19 +446,19 @@ void QskMaterialSkin::initSliderHints()
|
|||
|
||||
// Panel
|
||||
|
||||
setMetric( Q::Panel | Size, extent );
|
||||
setMetric( Q::Panel | A::Size, extent );
|
||||
setBoxShape( Q::Panel, 0 );
|
||||
setBoxBorderMetrics( Q::Panel, 0 );
|
||||
setGradient( Q::Panel, QskGradient() );
|
||||
|
||||
setPadding( Q::Panel | Horizontal, QskMargins( 0.5 * extent, 0 ) );
|
||||
setPadding( Q::Panel | Vertical, QskMargins( 0, 0.5 * extent ) );
|
||||
setPadding( Q::Panel | A::Horizontal, QskMargins( 0.5 * extent, 0 ) );
|
||||
setPadding( Q::Panel | A::Vertical, QskMargins( 0, 0.5 * extent ) );
|
||||
|
||||
// Groove, Fill
|
||||
|
||||
for ( auto subControl : { Q::Groove, Q::Fill } )
|
||||
{
|
||||
setMetric( subControl | Size, 5 );
|
||||
setMetric( subControl | A::Size, 5 );
|
||||
setPadding( subControl, 0 );
|
||||
|
||||
setBoxShape( subControl, 0 );
|
||||
|
@ -486,36 +486,36 @@ void QskMaterialSkin::initSliderHints()
|
|||
setGradient( Q::Handle, pal.accentColor );
|
||||
setGradient( Q::Handle | Q::Pressed, pal.accentColor );
|
||||
|
||||
for ( auto state : { NoState, Q::Pressed, Q::Pressed | Q::Hovered } )
|
||||
for ( auto state : { A::NoState, Q::Pressed, Q::Pressed | Q::Hovered } )
|
||||
{
|
||||
setBoxBorderColors( Q::Handle | state, pal.accentColor );
|
||||
}
|
||||
|
||||
for ( auto state : { NoState, Q::Pressed, Q::Pressed | Q::Hovered } )
|
||||
for ( auto state : { A::NoState, Q::Pressed, Q::Pressed | Q::Hovered } )
|
||||
{
|
||||
const auto aspect = Q::Handle | Q::Minimum | state;
|
||||
setGradient( aspect, Grey300 );
|
||||
setBoxBorderColors( aspect, Grey );
|
||||
}
|
||||
|
||||
setAnimation( Q::Handle | Metric, qskDuration );
|
||||
setAnimation( Q::Handle | Color, qskDuration );
|
||||
setAnimation( Q::Handle | A::Metric, qskDuration );
|
||||
setAnimation( Q::Handle | A::Color, qskDuration );
|
||||
|
||||
// move the handle smoothly, when using keys
|
||||
setAnimation( Q::Handle | Metric | Position, 2 * qskDuration );
|
||||
setAnimation( Q::Handle | Metric | Position | Q::Pressed, 0 );
|
||||
setAnimation( Q::Handle | A::Metric | A::Position, 2 * qskDuration );
|
||||
setAnimation( Q::Handle | A::Metric | A::Position | Q::Pressed, 0 );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initTabButtonHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskTabButton;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setStrutSize( Q::Panel, 30, 16 );
|
||||
|
||||
for ( const auto placement : { Left, Right, Top, Bottom } )
|
||||
for ( const auto placement : { A::Left, A::Right, A::Top, A::Bottom } )
|
||||
{
|
||||
const auto aspect = Q::Panel | placement;
|
||||
|
||||
|
@ -523,19 +523,19 @@ void QskMaterialSkin::initTabButtonHints()
|
|||
|
||||
switch( placement )
|
||||
{
|
||||
case Left:
|
||||
case A::Left:
|
||||
edge = Qt::RightEdge;
|
||||
break;
|
||||
|
||||
case Right:
|
||||
case A::Right:
|
||||
edge = Qt::LeftEdge;
|
||||
break;
|
||||
|
||||
case Top:
|
||||
case A::Top:
|
||||
edge = Qt::BottomEdge;
|
||||
break;
|
||||
|
||||
case Bottom:
|
||||
case A::Bottom:
|
||||
edge = Qt::TopEdge;
|
||||
break;
|
||||
|
||||
|
@ -560,7 +560,7 @@ void QskMaterialSkin::initTabButtonHints()
|
|||
setBoxBorderColors( aspect | state, borderColors );
|
||||
}
|
||||
|
||||
setAnimation( Q::Panel | Color, qskDuration );
|
||||
setAnimation( Q::Panel | A::Color, qskDuration );
|
||||
|
||||
// text
|
||||
setFontRole( Q::Text, ButtonFontRole );
|
||||
|
@ -573,7 +573,7 @@ void QskMaterialSkin::initTabButtonHints()
|
|||
|
||||
void QskMaterialSkin::initTabBarHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskTabBar;
|
||||
|
||||
setBoxShape( Q::Panel, 0 );
|
||||
|
@ -581,7 +581,7 @@ void QskMaterialSkin::initTabBarHints()
|
|||
setGradient( Q::Panel, QskGradient() );
|
||||
|
||||
// when flicking
|
||||
setAnimation( Q::Panel | Metric, QskAnimationHint( 200, QEasingCurve::InCubic ) );
|
||||
setAnimation( Q::Panel | A::Metric, QskAnimationHint( 200, QEasingCurve::InCubic ) );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initTabViewHints()
|
||||
|
@ -612,7 +612,7 @@ void QskMaterialSkin::initInputPanelHints()
|
|||
|
||||
void QskMaterialSkin::initVirtualKeyboardHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskVirtualKeyboard;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
@ -626,11 +626,11 @@ void QskMaterialSkin::initVirtualKeyboardHints()
|
|||
setGradient( Q::ButtonPanel, pal.darker125 );
|
||||
setBoxBorderColors( Q::ButtonPanel, pal.baseColor );
|
||||
|
||||
for ( auto state : { NoState, Q::Focused } )
|
||||
for ( auto state : { A::NoState, Q::Focused } )
|
||||
setBoxBorderColors( Q::ButtonPanel | QskPushButton::Pressed | state, pal.accentColor );
|
||||
|
||||
setAnimation( Q::ButtonPanel | Color, qskDuration );
|
||||
setAnimation( Q::ButtonPanel | Metric, qskDuration );
|
||||
setAnimation( Q::ButtonPanel | A::Color, qskDuration );
|
||||
setAnimation( Q::ButtonPanel | A::Metric, qskDuration );
|
||||
|
||||
// panel
|
||||
setBoxShape( Q::Panel, 0 );
|
||||
|
@ -641,7 +641,7 @@ void QskMaterialSkin::initVirtualKeyboardHints()
|
|||
|
||||
void QskMaterialSkin::initScrollViewHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskScrollView;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
@ -655,7 +655,7 @@ void QskMaterialSkin::initScrollViewHints()
|
|||
|
||||
for ( auto subControl : { Q::HorizontalScrollBar, Q::VerticalScrollBar } )
|
||||
{
|
||||
setMetric( subControl | Size, 12 );
|
||||
setMetric( subControl | A::Size, 12 );
|
||||
setPadding( subControl, 0 );
|
||||
}
|
||||
|
||||
|
@ -670,7 +670,7 @@ void QskMaterialSkin::initScrollViewHints()
|
|||
setGradient( subControl, pal.accentColor );
|
||||
setBoxBorderColors( subControl, QskRgb::White );
|
||||
|
||||
setAnimation( subControl | Color, qskDuration );
|
||||
setAnimation( subControl | A::Color, qskDuration );
|
||||
}
|
||||
|
||||
for ( auto subControl : {
|
||||
|
@ -682,7 +682,7 @@ void QskMaterialSkin::initScrollViewHints()
|
|||
}
|
||||
|
||||
// when changing the position by QskScrollView::scrollTo
|
||||
setAnimation( Q::Viewport | Metric, QskAnimationHint( 200, QEasingCurve::InCubic ) );
|
||||
setAnimation( Q::Viewport | A::Metric, QskAnimationHint( 200, QEasingCurve::InCubic ) );
|
||||
}
|
||||
|
||||
void QskMaterialSkin::initListViewHints()
|
||||
|
@ -703,14 +703,14 @@ void QskMaterialSkin::initListViewHints()
|
|||
|
||||
void QskMaterialSkin::initSubWindowHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskSubWindow;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
// Panel
|
||||
|
||||
setSkinHint( Q::Panel | Decoration, true );
|
||||
setSkinHint( Q::Panel | A::Decoration, true );
|
||||
setPadding( Q::Panel, 10 );
|
||||
setBoxShape( Q::Panel, 0 );
|
||||
setBoxBorderMetrics( Q::Panel, 2 );
|
||||
|
@ -731,7 +731,7 @@ void QskMaterialSkin::initSubWindowHints()
|
|||
setAlignment( Q::TitleBarText, Qt::AlignLeft | Qt::AlignVCenter );
|
||||
|
||||
for ( auto subControl : { Q::Panel, Q::TitleBar, Q::TitleBarText } )
|
||||
setAnimation( subControl | Color, qskDuration );
|
||||
setAnimation( subControl | A::Color, qskDuration );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ QskSquiekSkin::~QskSquiekSkin()
|
|||
{
|
||||
}
|
||||
|
||||
void QskSquiekSkin::setSeparator( QskAspect::Aspect aspect )
|
||||
void QskSquiekSkin::setSeparator( QskAspect aspect )
|
||||
{
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
|
@ -147,7 +147,7 @@ void QskSquiekSkin::setSeparator( QskAspect::Aspect aspect )
|
|||
}
|
||||
|
||||
void QskSquiekSkin::setButton(
|
||||
QskAspect::Aspect aspect, PanelStyle style, qreal border )
|
||||
QskAspect aspect, PanelStyle style, qreal border )
|
||||
{
|
||||
#if 1
|
||||
// Buttons shift ???
|
||||
|
@ -206,7 +206,7 @@ void QskSquiekSkin::setButton(
|
|||
setBoxBorderMetrics( aspect, border );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::setPanel( QskAspect::Aspect aspect, PanelStyle style )
|
||||
void QskSquiekSkin::setPanel( QskAspect aspect, PanelStyle style )
|
||||
{
|
||||
setButton( aspect, style, 1 );
|
||||
}
|
||||
|
@ -246,16 +246,16 @@ void QskSquiekSkin::resetColors( const QColor& accent )
|
|||
|
||||
void QskSquiekSkin::initCommonHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskControl;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setPadding( Control, 4 );
|
||||
setPadding( A::Control, 4 );
|
||||
|
||||
setGradient( Control, pal.lighter135 );
|
||||
setColor( Control | StyleColor, pal.themeForeground );
|
||||
setColor( Control | StyleColor | Q::Disabled, pal.theme );
|
||||
setGradient( A::Control, pal.lighter135 );
|
||||
setColor( A::Control | A::StyleColor, pal.themeForeground );
|
||||
setColor( A::Control | A::StyleColor | Q::Disabled, pal.theme );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initBoxHints()
|
||||
|
@ -265,10 +265,10 @@ void QskSquiekSkin::initBoxHints()
|
|||
|
||||
void QskSquiekSkin::initPopupHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskPopup;
|
||||
|
||||
setSkinHint( Q::Overlay | Style, true );
|
||||
setSkinHint( Q::Overlay | A::Style, true );
|
||||
setGradient( Q::Overlay, QColor( 220, 220, 220, 150 ) );
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,7 @@ void QskSquiekSkin::initTextLabelHints()
|
|||
|
||||
void QskSquiekSkin::initTextInputHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskTextInput;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
@ -312,7 +312,7 @@ void QskSquiekSkin::initTextInputHints()
|
|||
setBoxBorderMetrics( Q::Panel, 2 );
|
||||
setBoxShape( Q::Panel, 4 );
|
||||
|
||||
for ( auto state : { NoState, Q::ReadOnly, Q::Editing } )
|
||||
for ( auto state : { A::NoState, Q::ReadOnly, Q::Editing } )
|
||||
{
|
||||
QColor c;
|
||||
|
||||
|
@ -339,17 +339,17 @@ void QskSquiekSkin::initTextInputHints()
|
|||
setGradient( aspect, c );
|
||||
}
|
||||
|
||||
setAnimation( Q::Panel | Color, qskDuration );
|
||||
setAnimation( Q::Panel | A::Color, qskDuration );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initProgressBarHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskProgressBar;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setMetric( Q::Groove | Size, 8 );
|
||||
setMetric( Q::Groove | A::Size, 8 );
|
||||
setPadding( Q::Groove, 0 );
|
||||
setGradient( Q::Groove, pal.darker200 );
|
||||
setBoxShape( Q::Groove, 4 );
|
||||
|
@ -373,18 +373,18 @@ void QskSquiekSkin::initFocusIndicatorHints()
|
|||
|
||||
void QskSquiekSkin::initSeparatorHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskSeparator;
|
||||
|
||||
setMetric( Q::Panel | Size, 4 );
|
||||
setMetric( Q::Panel | A::Size, 4 );
|
||||
|
||||
setSeparator( Q::Panel | Horizontal );
|
||||
setSeparator( Q::Panel | Vertical );
|
||||
setSeparator( Q::Panel | A::Horizontal );
|
||||
setSeparator( Q::Panel | A::Vertical );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initPageIndicatorHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskPageIndicator;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
@ -406,12 +406,12 @@ void QskSquiekSkin::initPageIndicatorHints()
|
|||
setBoxShape( Q::Panel, 2 );
|
||||
setGradient( Q::Panel, QskGradient() );
|
||||
|
||||
setMetric( Q::Panel | Spacing, 3 );
|
||||
setMetric( Q::Panel | A::Spacing, 3 );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initPushButtonHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskPushButton;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
@ -422,9 +422,9 @@ void QskSquiekSkin::initPushButtonHints()
|
|||
|
||||
setMargin( Q::Panel, 0 );
|
||||
setPadding( Q::Panel, 10 );
|
||||
setMetric( Q::Panel | Spacing, 4 );
|
||||
setMetric( Q::Panel | A::Spacing, 4 );
|
||||
|
||||
for ( auto state : { NoState, Q::Checkable } )
|
||||
for ( auto state : { A::NoState, Q::Checkable } )
|
||||
{
|
||||
setButton( Q::Panel | state, Raised );
|
||||
setButton( Q::Panel | Q::Flat | Q::Hovered | state, Raised );
|
||||
|
@ -439,11 +439,11 @@ void QskSquiekSkin::initPushButtonHints()
|
|||
setButton( Q::Panel | Q::Flat | state, Sunken );
|
||||
}
|
||||
|
||||
setAnimation( Q::Panel | Color, qskDuration );
|
||||
setAnimation( Q::Panel | Metric, qskDuration );
|
||||
setAnimation( Q::Panel | A::Color, qskDuration );
|
||||
setAnimation( Q::Panel | A::Metric, qskDuration );
|
||||
|
||||
// Text
|
||||
setSkinHint( Q::Text | Q::Disabled | Style, Qsk::Sunken );
|
||||
setSkinHint( Q::Text | Q::Disabled | A::Style, Qsk::Sunken );
|
||||
setAlignment( Q::Text, Qt::AlignCenter );
|
||||
|
||||
setColor( Q::Text, pal.themeForeground );
|
||||
|
@ -452,7 +452,7 @@ void QskSquiekSkin::initPushButtonHints()
|
|||
|
||||
void QskSquiekSkin::initDialogButtonHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskDialogButton;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
@ -461,16 +461,16 @@ void QskSquiekSkin::initDialogButtonHints()
|
|||
setStrutSize( Q::Panel, qskDpiScaled( 75.0 ), qskDpiScaled( 23.0 ) );
|
||||
|
||||
setPadding( Q::Panel, 10 );
|
||||
setMetric( Q::Panel | Spacing, 4 );
|
||||
setMetric( Q::Panel | A::Spacing, 4 );
|
||||
|
||||
setButton( Q::Panel, Raised );
|
||||
setButton( Q::Panel | Q::Pressed, Sunken );
|
||||
|
||||
setAnimation( Q::Panel | Color, qskDuration );
|
||||
setAnimation( Q::Panel | Metric, qskDuration );
|
||||
setAnimation( Q::Panel | A::Color, qskDuration );
|
||||
setAnimation( Q::Panel | A::Metric, qskDuration );
|
||||
|
||||
// text
|
||||
setSkinHint( Q::Text | Q::Disabled | Style, Qsk::Sunken );
|
||||
setSkinHint( Q::Text | Q::Disabled | A::Style, Qsk::Sunken );
|
||||
setAlignment( Q::Text, Qt::AlignCenter );
|
||||
|
||||
setColor( Q::Text, pal.themeForeground );
|
||||
|
@ -491,14 +491,14 @@ void QskSquiekSkin::initDialogButtonBoxHints()
|
|||
|
||||
void QskSquiekSkin::initTabButtonHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskTabButton;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setStrutSize( Q::Panel, 30, 16 );
|
||||
|
||||
for ( auto placement : { Top, Bottom } )
|
||||
for ( auto placement : { A::Top, A::Bottom } )
|
||||
{
|
||||
setGradient( Q::Panel | placement,
|
||||
QskGradient( Qt::Vertical, pal.lighter125, pal.lighter110 ) );
|
||||
|
@ -510,7 +510,7 @@ void QskSquiekSkin::initTabButtonHints()
|
|||
}
|
||||
}
|
||||
|
||||
for ( auto placement : { Left, Right } )
|
||||
for ( auto placement : { A::Left, A::Right } )
|
||||
{
|
||||
setGradient( Q::Panel | placement, pal.lighter125 );
|
||||
|
||||
|
@ -523,7 +523,7 @@ void QskSquiekSkin::initTabButtonHints()
|
|||
|
||||
setBoxBorderColors( Q::Panel, pal.darker200 );
|
||||
|
||||
for ( auto placement : { Left, Right, Top, Bottom } )
|
||||
for ( auto placement : { A::Left, A::Right, A::Top, A::Bottom } )
|
||||
{
|
||||
const auto aspect = Q::Panel | placement;
|
||||
|
||||
|
@ -533,7 +533,7 @@ void QskSquiekSkin::initTabButtonHints()
|
|||
|
||||
const int indent = 4;
|
||||
|
||||
if ( placement == Top )
|
||||
if ( placement == A::Top )
|
||||
{
|
||||
margins0 = QskMargins( -1, indent, -1, -1 );
|
||||
margins1 = QskMargins( -1, 0, -1, -2 );
|
||||
|
@ -543,7 +543,7 @@ void QskSquiekSkin::initTabButtonHints()
|
|||
shape.setRadius( Qt::BottomLeftCorner, 0 );
|
||||
shape.setRadius( Qt::BottomRightCorner, 0 );
|
||||
}
|
||||
else if ( placement == Bottom )
|
||||
else if ( placement == A::Bottom )
|
||||
{
|
||||
margins0 = QskMargins( -1, -1, -1, indent );
|
||||
margins1 = QskMargins( -1, -2, -1, 0 );
|
||||
|
@ -553,7 +553,7 @@ void QskSquiekSkin::initTabButtonHints()
|
|||
shape.setRadius( Qt::TopLeftCorner, 0 );
|
||||
shape.setRadius( Qt::TopRightCorner, 0 );
|
||||
}
|
||||
else if ( placement == Left )
|
||||
else if ( placement == A::Left )
|
||||
{
|
||||
margins0 = QskMargins( indent, -1, -1, -1 );
|
||||
margins1 = QskMargins( 0, -1, -2, 0 );
|
||||
|
@ -563,7 +563,7 @@ void QskSquiekSkin::initTabButtonHints()
|
|||
shape.setRadius( Qt::TopRightCorner, 0 );
|
||||
shape.setRadius( Qt::BottomRightCorner, 0 );
|
||||
}
|
||||
else if ( placement == Right )
|
||||
else if ( placement == A::Right )
|
||||
{
|
||||
margins0 = QskMargins( -1, -1, indent, -1 );
|
||||
margins1 = QskMargins( -2, -1, 0, 0 );
|
||||
|
@ -588,8 +588,8 @@ void QskSquiekSkin::initTabButtonHints()
|
|||
QskAnimationHint animationHint( qskDuration );
|
||||
animationHint.updateFlags = QskAnimationHint::UpdateNode;
|
||||
|
||||
setAnimation( Q::Panel | Color, animationHint );
|
||||
setAnimation( Q::Panel | Metric, animationHint );
|
||||
setAnimation( Q::Panel | A::Color, animationHint );
|
||||
setAnimation( Q::Panel | A::Metric, animationHint );
|
||||
|
||||
// text
|
||||
setAlignment( Q::Text, Qt::AlignCenter );
|
||||
|
@ -599,7 +599,7 @@ void QskSquiekSkin::initTabButtonHints()
|
|||
|
||||
void QskSquiekSkin::initSliderHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskSlider;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
@ -608,28 +608,28 @@ void QskSquiekSkin::initSliderHints()
|
|||
|
||||
// Panel
|
||||
|
||||
for ( auto placement : { Horizontal, Vertical } )
|
||||
for ( auto placement : { A::Horizontal, A::Vertical } )
|
||||
{
|
||||
const auto aspect = Q::Panel | placement;
|
||||
|
||||
setMetric( aspect | Size, extent );
|
||||
setMetric( aspect | A::Size, extent );
|
||||
setBoxBorderMetrics( aspect, 0 );
|
||||
setBoxShape( aspect, 0 );
|
||||
setGradient( aspect, QskGradient() );
|
||||
}
|
||||
|
||||
setPadding( Q::Panel | Horizontal, QskMargins( 0.5 * extent, 0 ) );
|
||||
setPadding( Q::Panel | Vertical, QskMargins( 0, 0.5 * extent ) );
|
||||
setPadding( Q::Panel | A::Horizontal, QskMargins( 0.5 * extent, 0 ) );
|
||||
setPadding( Q::Panel | A::Vertical, QskMargins( 0, 0.5 * extent ) );
|
||||
|
||||
// Groove, Fill
|
||||
|
||||
for ( auto placement : { Horizontal, Vertical } )
|
||||
for ( auto placement : { A::Horizontal, A::Vertical } )
|
||||
{
|
||||
for ( auto subControl : { Q::Groove, Q::Fill } )
|
||||
{
|
||||
const auto aspect = subControl | placement;
|
||||
|
||||
setMetric( aspect | Size, 0.3 * extent );
|
||||
setMetric( aspect | A::Size, 0.3 * extent );
|
||||
setPadding( aspect, 0 );
|
||||
|
||||
setBoxBorderMetrics( aspect, 0 );
|
||||
|
@ -642,7 +642,7 @@ void QskSquiekSkin::initSliderHints()
|
|||
|
||||
// Handle
|
||||
|
||||
for ( auto placement : { Horizontal, Vertical } )
|
||||
for ( auto placement : { A::Horizontal, A::Vertical } )
|
||||
{
|
||||
const auto aspect = Q::Handle | placement;
|
||||
|
||||
|
@ -654,12 +654,12 @@ void QskSquiekSkin::initSliderHints()
|
|||
setStrutSize( aspect, sz, sz );
|
||||
}
|
||||
|
||||
setAnimation( Q::Handle | Color, qskDuration );
|
||||
setAnimation( Q::Handle | A::Color, qskDuration );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initTabBarHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskTabBar;
|
||||
|
||||
setBoxBorderMetrics( Q::Panel, 0 );
|
||||
|
@ -669,18 +669,18 @@ void QskSquiekSkin::initTabBarHints()
|
|||
const qreal vb = 1.0; // borderWidth of the view
|
||||
const qreal pw = 1.0; // extra space for the negative padding of the buttons
|
||||
|
||||
setPadding( Q::Panel | Top, pw, 0.0, pw, vb );
|
||||
setPadding( Q::Panel | Bottom, pw, vb, pw, 0.0 );
|
||||
setPadding( Q::Panel | Left, 0.0, pw, vb, pw );
|
||||
setPadding( Q::Panel | Right, vb, pw, 0.0, pw );
|
||||
setPadding( Q::Panel | A::Top, pw, 0.0, pw, vb );
|
||||
setPadding( Q::Panel | A::Bottom, pw, vb, pw, 0.0 );
|
||||
setPadding( Q::Panel | A::Left, 0.0, pw, vb, pw );
|
||||
setPadding( Q::Panel | A::Right, vb, pw, 0.0, pw );
|
||||
|
||||
// when flicking
|
||||
setAnimation( Q::Panel | Metric, QskAnimationHint( 200, QEasingCurve::OutCubic ) );
|
||||
setAnimation( Q::Panel | A::Metric, QskAnimationHint( 200, QEasingCurve::OutCubic ) );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initTabViewHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskTabView;
|
||||
|
||||
setPadding( Q::Page, 0 );
|
||||
|
@ -688,10 +688,10 @@ void QskSquiekSkin::initTabViewHints()
|
|||
setPanel( Q::Page, Plain );
|
||||
|
||||
const qreal radius = 8.0;
|
||||
setBoxShape( Q::Page | Top, 0, 0, radius, radius );
|
||||
setBoxShape( Q::Page | Bottom, radius, radius, 0, 0 );
|
||||
setBoxShape( Q::Page | Left, 0, radius, 0, radius );
|
||||
setBoxShape( Q::Page | Right, radius, 0, radius, 0 );
|
||||
setBoxShape( Q::Page | A::Top, 0, 0, radius, radius );
|
||||
setBoxShape( Q::Page | A::Bottom, radius, radius, 0, 0 );
|
||||
setBoxShape( Q::Page | A::Left, 0, radius, 0, radius );
|
||||
setBoxShape( Q::Page | A::Right, radius, 0, radius, 0 );
|
||||
|
||||
setAnimation( Q::Page, qskDuration );
|
||||
}
|
||||
|
@ -724,19 +724,19 @@ void QskSquiekSkin::initInputPredictionBar()
|
|||
|
||||
void QskSquiekSkin::initVirtualKeyboardHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskVirtualKeyboard;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
||||
setPadding( Q::Panel, 5 );
|
||||
setMetric( Q::Panel | Spacing, 5 );
|
||||
setMetric( Q::Panel | A::Spacing, 5 );
|
||||
setPanel( Q::Panel, Raised );
|
||||
|
||||
setButton( Q::ButtonPanel, Raised );
|
||||
setButton( Q::ButtonPanel | QskPushButton::Pressed, Sunken );
|
||||
|
||||
setAnimation( Q::ButtonPanel | Color, qskDuration );
|
||||
setAnimation( Q::ButtonPanel | A::Color, qskDuration );
|
||||
|
||||
setColor( Q::ButtonText, pal.themeForeground );
|
||||
setColor( Q::ButtonText | QskPushButton::Disabled, pal.darker200 );
|
||||
|
@ -744,10 +744,10 @@ void QskSquiekSkin::initVirtualKeyboardHints()
|
|||
|
||||
void QskSquiekSkin::initScrollViewHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskScrollView;
|
||||
|
||||
setMetric( Q::Panel | Spacing, 4 );
|
||||
setMetric( Q::Panel | A::Spacing, 4 );
|
||||
|
||||
setBoxBorderMetrics( Q::Viewport, 2 );
|
||||
setBoxShape( Q::Viewport, 8 );
|
||||
|
@ -764,7 +764,7 @@ void QskSquiekSkin::initScrollViewHints()
|
|||
// scroll bars
|
||||
for ( auto subControl : { Q::HorizontalScrollBar, Q::VerticalScrollBar } )
|
||||
{
|
||||
setMetric( subControl | Size, qskDpiScaled( 12 ) );
|
||||
setMetric( subControl | A::Size, qskDpiScaled( 12 ) );
|
||||
setPadding( subControl, 0 );
|
||||
setMargin( subControl, 0 );
|
||||
}
|
||||
|
@ -789,11 +789,11 @@ void QskSquiekSkin::initScrollViewHints()
|
|||
setButton( subControl | Q::VerticalHandlePressed, Sunken, bw );
|
||||
}
|
||||
|
||||
setAnimation( subControl | Color, qskDuration );
|
||||
setAnimation( subControl | A::Color, qskDuration );
|
||||
}
|
||||
|
||||
// when changing the position by QskScrollView::scrollTo
|
||||
setAnimation( Q::Viewport | Metric, QskAnimationHint( 200, QEasingCurve::OutCubic ) );
|
||||
setAnimation( Q::Viewport | A::Metric, QskAnimationHint( 200, QEasingCurve::OutCubic ) );
|
||||
}
|
||||
|
||||
void QskSquiekSkin::initListViewHints()
|
||||
|
@ -814,7 +814,7 @@ void QskSquiekSkin::initListViewHints()
|
|||
|
||||
void QskSquiekSkin::initSubWindowHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskSubWindow;
|
||||
|
||||
const auto& pal = m_data->palette;
|
||||
|
@ -823,7 +823,7 @@ void QskSquiekSkin::initSubWindowHints()
|
|||
|
||||
// Panel
|
||||
|
||||
setSkinHint( Q::Panel | Decoration, true );
|
||||
setSkinHint( Q::Panel | A::Decoration, true );
|
||||
setPadding( Q::Panel, 10 );
|
||||
setBoxBorderMetrics( Q::Panel, 2 );
|
||||
setBoxShape( Q::Panel, radius, radius, 0, 0, Qt::AbsoluteSize );
|
||||
|
@ -851,7 +851,7 @@ void QskSquiekSkin::initSubWindowHints()
|
|||
setAlignment( Q::TitleBarText, Qt::AlignLeft | Qt::AlignVCenter );
|
||||
|
||||
for ( auto subControl : { Q::Panel, Q::TitleBar, Q::TitleBarText } )
|
||||
setAnimation( subControl | Color, qskDuration );
|
||||
setAnimation( subControl | A::Color, qskDuration );
|
||||
}
|
||||
|
||||
#include "moc_QskSquiekSkin.cpp"
|
||||
|
|
|
@ -58,9 +58,9 @@ class QSK_SQUIEK_EXPORT QskSquiekSkin : public QskSkin
|
|||
Flat
|
||||
};
|
||||
|
||||
void setSeparator( QskAspect::Aspect );
|
||||
void setButton( QskAspect::Aspect, PanelStyle, qreal border = 2.0 );
|
||||
void setPanel( QskAspect::Aspect, PanelStyle );
|
||||
void setSeparator( QskAspect );
|
||||
void setButton( QskAspect, PanelStyle, qreal border = 2.0 );
|
||||
void setPanel( QskAspect, PanelStyle );
|
||||
|
||||
class PrivateData;
|
||||
std::unique_ptr< PrivateData > m_data;
|
||||
|
|
|
@ -14,24 +14,23 @@
|
|||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
static_assert( sizeof( QskAspect::Aspect ) == sizeof( quint64 ),
|
||||
static_assert( sizeof( QskAspect ) == sizeof( quint64 ),
|
||||
"QskAspect::Aspect has to match quint64" );
|
||||
|
||||
namespace
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using namespace std;
|
||||
|
||||
struct StateInfo
|
||||
{
|
||||
State state;
|
||||
QskAspect::State state;
|
||||
QByteArray name;
|
||||
};
|
||||
|
||||
struct AspectRegistry
|
||||
{
|
||||
QVector< QByteArray > subControlNames;
|
||||
unordered_map< const QMetaObject*, QVector< Subcontrol > > subControlTable;
|
||||
unordered_map< const QMetaObject*, QVector< QskAspect::Subcontrol > > subControlTable;
|
||||
unordered_map< const QMetaObject*, QVector< StateInfo > > stateTable;
|
||||
};
|
||||
}
|
||||
|
@ -253,7 +252,7 @@ QDebug operator<<( QDebug debug, QskAspect::Subcontrol subControl )
|
|||
|
||||
debug.nospace();
|
||||
debug << "QskAspect::Subcontrol" << '(';
|
||||
debug << subControlName( subControl );
|
||||
debug << QskAspect::subControlName( subControl );
|
||||
debug << ')';
|
||||
|
||||
return debug;
|
||||
|
@ -271,7 +270,7 @@ QDebug operator<<( QDebug debug, QskAspect::State state )
|
|||
return debug;
|
||||
}
|
||||
|
||||
QDebug operator<<( QDebug debug, QskAspect::Aspect aspect )
|
||||
QDebug operator<<( QDebug debug, QskAspect aspect )
|
||||
{
|
||||
qskDebugAspect( debug, nullptr, aspect );
|
||||
return debug;
|
||||
|
@ -288,7 +287,7 @@ void qskDebugState( QDebug debug, const QMetaObject* metaObject, QskAspect::Stat
|
|||
debug << "QskAspect::State( " << qskStateString( metaObject, state ) << " )";
|
||||
}
|
||||
|
||||
void qskDebugAspect( QDebug debug, const QMetaObject* metaObject, QskAspect::Aspect aspect )
|
||||
void qskDebugAspect( QDebug debug, const QMetaObject* metaObject, QskAspect aspect )
|
||||
{
|
||||
QDebugStateSaver saver( debug );
|
||||
|
||||
|
@ -340,7 +339,7 @@ void qskDebugAspect( QDebug debug, const QMetaObject* metaObject, QskAspect::Asp
|
|||
|
||||
#endif
|
||||
|
||||
const char* QskAspect::Aspect::toPrintable() const
|
||||
const char* QskAspect::toPrintable() const
|
||||
{
|
||||
QString tmp;
|
||||
|
||||
|
@ -357,7 +356,7 @@ const char* QskAspect::Aspect::toPrintable() const
|
|||
return bytes[ counter ].constData();
|
||||
}
|
||||
|
||||
QskAspect::State QskAspect::Aspect::topState() const noexcept
|
||||
QskAspect::State QskAspect::topState() const noexcept
|
||||
{
|
||||
if ( m_bits.states == NoState )
|
||||
return NoState;
|
||||
|
|
|
@ -11,37 +11,12 @@
|
|||
|
||||
#include <qmetaobject.h>
|
||||
#include <qnamespace.h>
|
||||
#include <functional>
|
||||
|
||||
/*
|
||||
hack to run moc over a namespace, what is not
|
||||
yet supported with Qt 5.6
|
||||
*/
|
||||
|
||||
#ifdef Q_MOC_RUN
|
||||
|
||||
#define QSK_NAMESPACE( name ) struct name
|
||||
#define QSK_ENUM( name ) Q_GADGET Q_ENUM( name )
|
||||
|
||||
#else
|
||||
|
||||
#define QSK_NAMESPACE( name ) namespace name
|
||||
#define QSK_ENUM( name ) \
|
||||
inline constexpr const QMetaObject* qt_getEnumMetaObject(name) noexcept { return &staticMetaObject; } \
|
||||
inline constexpr const char* qt_getEnumName(name) noexcept { return #name; }
|
||||
|
||||
#endif
|
||||
|
||||
QSK_NAMESPACE( QskAspect )
|
||||
class QSK_EXPORT QskAspect
|
||||
{
|
||||
extern QSK_EXPORT const QMetaObject staticMetaObject;
|
||||
Q_GADGET
|
||||
|
||||
enum Subcontrol : quint16
|
||||
{
|
||||
Control = 0,
|
||||
LastSubcontrol = ( 1 << 12 ) - 1
|
||||
};
|
||||
QSK_ENUM( Subcontrol )
|
||||
public:
|
||||
|
||||
enum Type : quint8
|
||||
{
|
||||
|
@ -49,9 +24,9 @@ QSK_NAMESPACE( QskAspect )
|
|||
Metric = 1,
|
||||
Color = 2,
|
||||
};
|
||||
QSK_ENUM( Type )
|
||||
Q_ENUM( Type )
|
||||
|
||||
constexpr uint typeCount = 3;
|
||||
static constexpr uint typeCount = 3;
|
||||
|
||||
enum FlagPrimitive : quint8
|
||||
{
|
||||
|
@ -65,7 +40,7 @@ QSK_NAMESPACE( QskAspect )
|
|||
GraphicRole,
|
||||
FontRole
|
||||
};
|
||||
QSK_ENUM( FlagPrimitive )
|
||||
Q_ENUM( FlagPrimitive )
|
||||
|
||||
enum MetricPrimitive : quint8
|
||||
{
|
||||
|
@ -85,7 +60,7 @@ QSK_NAMESPACE( QskAspect )
|
|||
Shape,
|
||||
Border
|
||||
};
|
||||
QSK_ENUM( MetricPrimitive )
|
||||
Q_ENUM( MetricPrimitive )
|
||||
|
||||
enum ColorPrimitive : quint8
|
||||
{
|
||||
|
@ -95,7 +70,7 @@ QSK_NAMESPACE( QskAspect )
|
|||
StyleColor,
|
||||
LinkColor
|
||||
};
|
||||
QSK_ENUM( ColorPrimitive )
|
||||
Q_ENUM( ColorPrimitive )
|
||||
|
||||
enum Placement : quint8
|
||||
{
|
||||
|
@ -109,7 +84,15 @@ QSK_NAMESPACE( QskAspect )
|
|||
Right = 3,
|
||||
Bottom = 4
|
||||
};
|
||||
QSK_ENUM( Placement )
|
||||
Q_ENUM( Placement )
|
||||
|
||||
enum Subcontrol : quint16
|
||||
{
|
||||
Control = 0,
|
||||
LastSubcontrol = ( 1 << 12 ) - 1
|
||||
};
|
||||
|
||||
Q_ENUM( Subcontrol )
|
||||
|
||||
enum State : quint16
|
||||
{
|
||||
|
@ -123,448 +106,439 @@ QSK_NAMESPACE( QskAspect )
|
|||
AllUserStates = 0x0FF0,
|
||||
AllStates = 0xFFFF
|
||||
};
|
||||
QSK_ENUM( State )
|
||||
}
|
||||
Q_ENUM( State )
|
||||
|
||||
constexpr QskAspect() noexcept;
|
||||
constexpr QskAspect( Subcontrol ) noexcept;
|
||||
constexpr QskAspect( Type ) noexcept;
|
||||
constexpr QskAspect( Placement ) noexcept;
|
||||
|
||||
constexpr QskAspect( const QskAspect& ) noexcept = default;
|
||||
constexpr QskAspect( QskAspect&& ) noexcept = default;
|
||||
|
||||
QskAspect& operator=( const QskAspect& ) noexcept = default;
|
||||
|
||||
bool operator==( const QskAspect& ) const noexcept;
|
||||
bool operator!=( const QskAspect& ) const noexcept;
|
||||
|
||||
bool operator<( const QskAspect& ) const noexcept;
|
||||
|
||||
constexpr QskAspect operator|( Subcontrol ) const noexcept;
|
||||
constexpr QskAspect operator|( Type ) const noexcept;
|
||||
constexpr QskAspect operator|( FlagPrimitive ) const noexcept;
|
||||
constexpr QskAspect operator|( MetricPrimitive ) const noexcept;
|
||||
constexpr QskAspect operator|( ColorPrimitive ) const noexcept;
|
||||
constexpr QskAspect operator|( Placement ) const noexcept;
|
||||
constexpr QskAspect operator|( State ) const noexcept;
|
||||
|
||||
constexpr quint64 value() const noexcept;
|
||||
|
||||
constexpr bool isAnimator() const noexcept;
|
||||
void setAnimator( bool on ) noexcept;
|
||||
|
||||
constexpr Subcontrol subControl() const noexcept;
|
||||
void setSubControl( Subcontrol ) noexcept;
|
||||
|
||||
constexpr Type type() const noexcept;
|
||||
void setType( Type ) noexcept;
|
||||
|
||||
constexpr bool isMetric() const noexcept;
|
||||
constexpr bool isColor() const noexcept;
|
||||
constexpr bool isFlag() const noexcept;
|
||||
|
||||
constexpr Placement placement() const noexcept;
|
||||
void setPlacement( Placement ) noexcept;
|
||||
|
||||
constexpr State state() const noexcept;
|
||||
State topState() const noexcept;
|
||||
|
||||
void setState( State ) noexcept;
|
||||
void addState( State ) noexcept;
|
||||
void clearState( State ) noexcept;
|
||||
void clearStates() noexcept;
|
||||
|
||||
constexpr FlagPrimitive flagPrimitive() const noexcept;
|
||||
constexpr ColorPrimitive colorPrimitive() const noexcept;
|
||||
constexpr MetricPrimitive metricPrimitive() const noexcept;
|
||||
|
||||
void setPrimitive( Type, uint primitive ) noexcept;
|
||||
constexpr uint primitive() const noexcept;
|
||||
void clearPrimitive() noexcept;
|
||||
|
||||
const char* toPrintable() const;
|
||||
|
||||
static State registerState( const QMetaObject*, State, const char* );
|
||||
static Subcontrol nextSubcontrol( const QMetaObject*, const char* );
|
||||
|
||||
static QByteArray subControlName( Subcontrol );
|
||||
static QVector< QByteArray > subControlNames( const QMetaObject* = nullptr );
|
||||
static QVector< Subcontrol > subControls( const QMetaObject* );
|
||||
|
||||
static quint8 primitiveCount( Type );
|
||||
static void reservePrimitives( Type, quint8 count );
|
||||
|
||||
private:
|
||||
constexpr QskAspect( Subcontrol, Type, Placement ) noexcept;
|
||||
|
||||
constexpr QskAspect( uint subControl, uint type, bool isAnimator,
|
||||
uint primitive, uint placement, uint states ) noexcept;
|
||||
|
||||
struct Bits
|
||||
{
|
||||
uint subControl : 12;
|
||||
|
||||
uint type : 3;
|
||||
uint isAnimator : 1;
|
||||
|
||||
uint primitive : 5;
|
||||
uint placement : 3;
|
||||
uint reserved1 : 8;
|
||||
|
||||
uint states : 16;
|
||||
uint reserved2 : 16;
|
||||
};
|
||||
|
||||
union
|
||||
{
|
||||
Bits m_bits;
|
||||
quint64 m_value;
|
||||
};
|
||||
};
|
||||
|
||||
QSK_DECLARE_OPERATORS_FOR_FLAGS( QskAspect::State )
|
||||
|
||||
#undef QSK_NAMESPACE
|
||||
#undef QSK_ENUM
|
||||
|
||||
namespace QskAspect
|
||||
inline constexpr QskAspect::QskAspect() noexcept
|
||||
: QskAspect( Control, Flag, NoPlacement )
|
||||
{
|
||||
class QSK_EXPORT Aspect
|
||||
{
|
||||
public:
|
||||
constexpr Aspect() noexcept;
|
||||
constexpr Aspect( Subcontrol ) noexcept;
|
||||
constexpr Aspect( Type ) noexcept;
|
||||
constexpr Aspect( Placement ) noexcept;
|
||||
|
||||
constexpr Aspect( const Aspect& ) noexcept = default;
|
||||
constexpr Aspect( Aspect&& ) noexcept = default;
|
||||
|
||||
Aspect& operator=( const QskAspect::Aspect& ) noexcept = default;
|
||||
|
||||
bool operator==( const Aspect& ) const noexcept;
|
||||
bool operator!=( const Aspect& ) const noexcept;
|
||||
|
||||
bool operator<( const Aspect& ) const noexcept;
|
||||
|
||||
constexpr Aspect operator|( Subcontrol ) const noexcept;
|
||||
constexpr Aspect operator|( Type ) const noexcept;
|
||||
constexpr Aspect operator|( FlagPrimitive ) const noexcept;
|
||||
constexpr Aspect operator|( MetricPrimitive ) const noexcept;
|
||||
constexpr Aspect operator|( ColorPrimitive ) const noexcept;
|
||||
constexpr Aspect operator|( Placement ) const noexcept;
|
||||
constexpr Aspect operator|( State ) const noexcept;
|
||||
|
||||
constexpr quint64 value() const noexcept;
|
||||
|
||||
constexpr bool isAnimator() const noexcept;
|
||||
void setAnimator( bool on ) noexcept;
|
||||
|
||||
constexpr bool isMetric() const noexcept;
|
||||
constexpr bool isColor() const noexcept;
|
||||
constexpr bool isFlag() const noexcept;
|
||||
|
||||
constexpr Subcontrol subControl() const noexcept;
|
||||
void setSubControl( Subcontrol ) noexcept;
|
||||
|
||||
constexpr Type type() const noexcept;
|
||||
void setType( Type ) noexcept;
|
||||
|
||||
constexpr Placement placement() const noexcept;
|
||||
void setPlacement( Placement ) noexcept;
|
||||
|
||||
constexpr State state() const noexcept;
|
||||
State topState() const noexcept;
|
||||
|
||||
void setState( State ) noexcept;
|
||||
void addState( State ) noexcept;
|
||||
void clearState( State ) noexcept;
|
||||
void clearStates() noexcept;
|
||||
|
||||
constexpr FlagPrimitive flagPrimitive() const noexcept;
|
||||
constexpr ColorPrimitive colorPrimitive() const noexcept;
|
||||
constexpr MetricPrimitive metricPrimitive() const noexcept;
|
||||
|
||||
void setPrimitive( Type, uint primitive ) noexcept;
|
||||
constexpr uint primitive() const noexcept;
|
||||
void clearPrimitive() noexcept;
|
||||
|
||||
const char* toPrintable() const;
|
||||
|
||||
private:
|
||||
constexpr Aspect( Subcontrol, Type, Placement ) noexcept;
|
||||
|
||||
constexpr Aspect( uint subControl, uint type, bool isAnimator,
|
||||
uint primitive, uint placement, uint states ) noexcept;
|
||||
|
||||
struct Bits
|
||||
{
|
||||
uint subControl : 12;
|
||||
|
||||
uint type : 3;
|
||||
uint isAnimator : 1;
|
||||
|
||||
uint primitive : 5;
|
||||
uint placement : 3;
|
||||
uint reserved1 : 8;
|
||||
|
||||
uint states : 16;
|
||||
uint reserved2 : 16;
|
||||
};
|
||||
|
||||
union
|
||||
{
|
||||
Bits m_bits;
|
||||
quint64 m_value;
|
||||
};
|
||||
};
|
||||
|
||||
inline constexpr Aspect::Aspect() noexcept
|
||||
: Aspect( Control, Flag, NoPlacement )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr Aspect::Aspect( Subcontrol subControl ) noexcept
|
||||
: Aspect( subControl, Flag, NoPlacement )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr Aspect::Aspect( Type type ) noexcept
|
||||
: Aspect( Control, type, NoPlacement )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr Aspect::Aspect( Placement placement ) noexcept
|
||||
: Aspect( Control, Flag, placement )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr Aspect::Aspect(
|
||||
Subcontrol subControl, Type type, Placement placement ) noexcept
|
||||
: Aspect( subControl, type, false, 0, placement, NoState )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr Aspect::Aspect( uint subControl, uint type, bool isAnimator,
|
||||
uint primitive, uint placement, uint states ) noexcept
|
||||
: m_bits { subControl, type, isAnimator, primitive, placement, 0, states, 0 }
|
||||
{
|
||||
}
|
||||
|
||||
inline bool Aspect::operator==( const Aspect& other ) const noexcept
|
||||
{
|
||||
return m_value == other.m_value;
|
||||
}
|
||||
|
||||
inline bool Aspect::operator!=( const Aspect& other ) const noexcept
|
||||
{
|
||||
return m_value != other.m_value;
|
||||
}
|
||||
|
||||
inline bool Aspect::operator<( const Aspect& other ) const noexcept
|
||||
{
|
||||
return m_value < other.m_value;
|
||||
}
|
||||
|
||||
inline constexpr Aspect Aspect::operator|( Subcontrol subControl ) const noexcept
|
||||
{
|
||||
return Aspect( subControl, m_bits.type, m_bits.isAnimator,
|
||||
m_bits.primitive, m_bits.placement, m_bits.states );
|
||||
}
|
||||
|
||||
inline constexpr Aspect Aspect::operator|( Type type ) const noexcept
|
||||
{
|
||||
return Aspect( m_bits.subControl, type, m_bits.isAnimator,
|
||||
m_bits.primitive, m_bits.placement, m_bits.states );
|
||||
}
|
||||
|
||||
inline constexpr Aspect Aspect::operator|( FlagPrimitive primitive ) const noexcept
|
||||
{
|
||||
return Aspect( m_bits.subControl, m_bits.type, m_bits.isAnimator,
|
||||
primitive, m_bits.placement, m_bits.states );
|
||||
}
|
||||
|
||||
inline constexpr Aspect Aspect::operator|( MetricPrimitive primitive ) const noexcept
|
||||
{
|
||||
return operator|( static_cast< FlagPrimitive >( primitive ) );
|
||||
}
|
||||
|
||||
inline constexpr Aspect Aspect::operator|( ColorPrimitive primitive ) const noexcept
|
||||
{
|
||||
return operator|( static_cast< FlagPrimitive >( primitive ) );
|
||||
}
|
||||
|
||||
inline constexpr Aspect Aspect::operator|( Placement placement ) const noexcept
|
||||
{
|
||||
return Aspect( m_bits.subControl, m_bits.type, m_bits.isAnimator,
|
||||
m_bits.primitive, placement, m_bits.states );
|
||||
}
|
||||
|
||||
inline constexpr Aspect Aspect::operator|( State state ) const noexcept
|
||||
{
|
||||
return Aspect( m_bits.subControl, m_bits.type, m_bits.isAnimator,
|
||||
m_bits.primitive, m_bits.placement, m_bits.states | state );
|
||||
}
|
||||
|
||||
inline constexpr quint64 Aspect::value() const noexcept
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
|
||||
inline constexpr bool Aspect::isAnimator() const noexcept
|
||||
{
|
||||
return m_bits.isAnimator;
|
||||
}
|
||||
|
||||
inline void Aspect::setAnimator( bool on ) noexcept
|
||||
{
|
||||
m_bits.isAnimator = on;
|
||||
}
|
||||
|
||||
inline constexpr Subcontrol Aspect::subControl() const noexcept
|
||||
{
|
||||
return static_cast< Subcontrol >( m_bits.subControl );
|
||||
}
|
||||
|
||||
inline void Aspect::setSubControl( Subcontrol subControl ) noexcept
|
||||
{
|
||||
m_bits.subControl = subControl;
|
||||
}
|
||||
|
||||
inline constexpr Type Aspect::type() const noexcept
|
||||
{
|
||||
return static_cast< Type >( m_bits.type );
|
||||
}
|
||||
|
||||
inline void Aspect::setType( Type type ) noexcept
|
||||
{
|
||||
m_bits.type = type;
|
||||
}
|
||||
|
||||
inline constexpr bool Aspect::isMetric() const noexcept
|
||||
{
|
||||
return type() == Metric;
|
||||
}
|
||||
|
||||
inline constexpr bool Aspect::isColor() const noexcept
|
||||
{
|
||||
return type() == Color;
|
||||
}
|
||||
|
||||
inline constexpr bool Aspect::isFlag() const noexcept
|
||||
{
|
||||
return type() == Flag;
|
||||
}
|
||||
|
||||
inline constexpr State Aspect::state() const noexcept
|
||||
{
|
||||
return static_cast< State >( m_bits.states );
|
||||
}
|
||||
|
||||
inline void Aspect::setState( State state ) noexcept
|
||||
{
|
||||
m_bits.states = state;
|
||||
}
|
||||
|
||||
inline void Aspect::addState( State state ) noexcept
|
||||
{
|
||||
m_bits.states |= state;
|
||||
}
|
||||
|
||||
inline void Aspect::clearState( State state ) noexcept
|
||||
{
|
||||
m_bits.states &= ~state;
|
||||
}
|
||||
|
||||
inline void Aspect::clearStates() noexcept
|
||||
{
|
||||
m_bits.states = 0;
|
||||
}
|
||||
|
||||
inline constexpr FlagPrimitive Aspect::flagPrimitive() const noexcept
|
||||
{
|
||||
return ( m_bits.type == Flag )
|
||||
? static_cast< FlagPrimitive >( m_bits.primitive )
|
||||
: NoFlagPrimitive;
|
||||
}
|
||||
|
||||
inline constexpr ColorPrimitive Aspect::colorPrimitive() const noexcept
|
||||
{
|
||||
return ( m_bits.type == Color )
|
||||
? static_cast< ColorPrimitive >( m_bits.primitive )
|
||||
: NoColorPrimitive;
|
||||
}
|
||||
|
||||
inline constexpr MetricPrimitive Aspect::metricPrimitive() const noexcept
|
||||
{
|
||||
return ( m_bits.type == Metric )
|
||||
? static_cast< MetricPrimitive >( m_bits.primitive )
|
||||
: NoMetricPrimitive;
|
||||
}
|
||||
|
||||
inline constexpr uint Aspect::primitive() const noexcept
|
||||
{
|
||||
return m_bits.primitive;
|
||||
}
|
||||
|
||||
inline void Aspect::setPrimitive( Type type, uint primitive ) noexcept
|
||||
{
|
||||
m_bits.type = type;
|
||||
m_bits.primitive = primitive;
|
||||
}
|
||||
|
||||
inline void Aspect::clearPrimitive() noexcept
|
||||
{
|
||||
m_bits.primitive = 0;
|
||||
}
|
||||
|
||||
inline constexpr Placement Aspect::placement() const noexcept
|
||||
{
|
||||
return static_cast< Placement >( m_bits.placement );
|
||||
}
|
||||
|
||||
inline void Aspect::setPlacement( Placement placement ) noexcept
|
||||
{
|
||||
m_bits.placement = placement;
|
||||
}
|
||||
|
||||
inline constexpr Aspect operator|(
|
||||
State state, const Aspect& aspect ) noexcept
|
||||
{
|
||||
return aspect | state;
|
||||
}
|
||||
|
||||
inline constexpr Aspect operator|(
|
||||
Subcontrol subControl, const Aspect& aspect ) noexcept
|
||||
{
|
||||
return aspect | subControl;
|
||||
}
|
||||
|
||||
inline constexpr Aspect operator|(
|
||||
Type type, const Aspect& aspect ) noexcept
|
||||
{
|
||||
return aspect | type;
|
||||
}
|
||||
|
||||
inline constexpr Aspect operator|(
|
||||
Placement placement, const Aspect& aspect ) noexcept
|
||||
{
|
||||
return aspect | placement;
|
||||
}
|
||||
|
||||
inline constexpr Aspect operator|(
|
||||
Subcontrol subControl, Type type ) noexcept
|
||||
{
|
||||
return Aspect( subControl ) | type;
|
||||
}
|
||||
|
||||
inline constexpr Aspect operator|( Type type, Subcontrol subControl ) noexcept
|
||||
{
|
||||
return subControl | type;
|
||||
}
|
||||
|
||||
inline constexpr Aspect operator|( Subcontrol subControl, State state ) noexcept
|
||||
{
|
||||
return Aspect( subControl ) | state;
|
||||
}
|
||||
|
||||
inline constexpr Aspect operator|( Type type, Placement placement ) noexcept
|
||||
{
|
||||
return Aspect( type ) | placement;
|
||||
}
|
||||
|
||||
inline constexpr Aspect operator|( Placement placement, Type type ) noexcept
|
||||
{
|
||||
return type | placement;
|
||||
}
|
||||
|
||||
inline constexpr Aspect operator|( State state, Subcontrol subControl ) noexcept
|
||||
{
|
||||
return subControl | state;
|
||||
}
|
||||
|
||||
inline constexpr Aspect operator|(
|
||||
Subcontrol subControl, FlagPrimitive primitive ) noexcept
|
||||
{
|
||||
return Aspect( subControl ) | primitive;
|
||||
}
|
||||
|
||||
inline constexpr Aspect operator|(
|
||||
FlagPrimitive primitive, Subcontrol subControl ) noexcept
|
||||
{
|
||||
return subControl | primitive;
|
||||
}
|
||||
|
||||
inline constexpr Aspect operator|(
|
||||
Subcontrol subControl, ColorPrimitive primitive ) noexcept
|
||||
{
|
||||
return Aspect( subControl ) | primitive;
|
||||
}
|
||||
|
||||
inline constexpr Aspect operator|(
|
||||
ColorPrimitive primitive, Subcontrol subControl ) noexcept
|
||||
{
|
||||
return subControl | primitive;
|
||||
}
|
||||
|
||||
inline constexpr Aspect operator|(
|
||||
Subcontrol subControl, MetricPrimitive primitive ) noexcept
|
||||
{
|
||||
return Aspect( subControl ) | primitive;
|
||||
}
|
||||
|
||||
inline constexpr Aspect operator|(
|
||||
MetricPrimitive primitive, Subcontrol subControl ) noexcept
|
||||
{
|
||||
return subControl | primitive;
|
||||
}
|
||||
|
||||
inline constexpr Aspect operator|(
|
||||
Subcontrol subControl, Placement placement ) noexcept
|
||||
{
|
||||
return Aspect( subControl ) | placement;
|
||||
}
|
||||
|
||||
inline constexpr Aspect operator|(
|
||||
Placement placement, Subcontrol subControl ) noexcept
|
||||
{
|
||||
return subControl | placement;
|
||||
}
|
||||
|
||||
QSK_EXPORT State registerState( const QMetaObject*, State, const char* );
|
||||
QSK_EXPORT Subcontrol nextSubcontrol( const QMetaObject*, const char* );
|
||||
|
||||
QSK_EXPORT QByteArray subControlName( Subcontrol );
|
||||
QSK_EXPORT QVector< QByteArray > subControlNames( const QMetaObject* = nullptr );
|
||||
QSK_EXPORT QVector< Subcontrol > subControls( const QMetaObject* );
|
||||
|
||||
QSK_EXPORT quint8 primitiveCount( Type );
|
||||
QSK_EXPORT void reservePrimitives( Type, quint8 count );
|
||||
|
||||
}
|
||||
|
||||
inline constexpr QskAspect::QskAspect( Subcontrol subControl ) noexcept
|
||||
: QskAspect( subControl, Flag, NoPlacement )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr QskAspect::QskAspect( Type type ) noexcept
|
||||
: QskAspect( Control, type, NoPlacement )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr QskAspect::QskAspect( Placement placement ) noexcept
|
||||
: QskAspect( Control, Flag, placement )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr QskAspect::QskAspect(
|
||||
Subcontrol subControl, Type type, Placement placement ) noexcept
|
||||
: QskAspect( subControl, type, false, 0, placement, NoState )
|
||||
{
|
||||
}
|
||||
|
||||
inline constexpr QskAspect::QskAspect( uint subControl, uint type, bool isAnimator,
|
||||
uint primitive, uint placement, uint states ) noexcept
|
||||
: m_bits { subControl, type, isAnimator, primitive, placement, 0, states, 0 }
|
||||
{
|
||||
}
|
||||
|
||||
inline bool QskAspect::operator==( const QskAspect& other ) const noexcept
|
||||
{
|
||||
return m_value == other.m_value;
|
||||
}
|
||||
|
||||
inline bool QskAspect::operator!=( const QskAspect& other ) const noexcept
|
||||
{
|
||||
return m_value != other.m_value;
|
||||
}
|
||||
|
||||
inline bool QskAspect::operator<( const QskAspect& other ) const noexcept
|
||||
{
|
||||
return m_value < other.m_value;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect QskAspect::operator|( Subcontrol subControl ) const noexcept
|
||||
{
|
||||
return QskAspect( subControl, m_bits.type, m_bits.isAnimator,
|
||||
m_bits.primitive, m_bits.placement, m_bits.states );
|
||||
}
|
||||
|
||||
inline constexpr QskAspect QskAspect::operator|( Type type ) const noexcept
|
||||
{
|
||||
return QskAspect( m_bits.subControl, type, m_bits.isAnimator,
|
||||
m_bits.primitive, m_bits.placement, m_bits.states );
|
||||
}
|
||||
|
||||
inline constexpr QskAspect QskAspect::operator|( FlagPrimitive primitive ) const noexcept
|
||||
{
|
||||
return QskAspect( m_bits.subControl, m_bits.type, m_bits.isAnimator,
|
||||
primitive, m_bits.placement, m_bits.states );
|
||||
}
|
||||
|
||||
inline constexpr QskAspect QskAspect::operator|( MetricPrimitive primitive ) const noexcept
|
||||
{
|
||||
return operator|( static_cast< FlagPrimitive >( primitive ) );
|
||||
}
|
||||
|
||||
inline constexpr QskAspect QskAspect::operator|( ColorPrimitive primitive ) const noexcept
|
||||
{
|
||||
return operator|( static_cast< FlagPrimitive >( primitive ) );
|
||||
}
|
||||
|
||||
inline constexpr QskAspect QskAspect::operator|( Placement placement ) const noexcept
|
||||
{
|
||||
return QskAspect( m_bits.subControl, m_bits.type, m_bits.isAnimator,
|
||||
m_bits.primitive, placement, m_bits.states );
|
||||
}
|
||||
|
||||
inline constexpr QskAspect QskAspect::operator|( State state ) const noexcept
|
||||
{
|
||||
return QskAspect( m_bits.subControl, m_bits.type, m_bits.isAnimator,
|
||||
m_bits.primitive, m_bits.placement, m_bits.states | state );
|
||||
}
|
||||
|
||||
inline constexpr quint64 QskAspect::value() const noexcept
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
|
||||
inline constexpr bool QskAspect::isAnimator() const noexcept
|
||||
{
|
||||
return m_bits.isAnimator;
|
||||
}
|
||||
|
||||
inline void QskAspect::setAnimator( bool on ) noexcept
|
||||
{
|
||||
m_bits.isAnimator = on;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect::Subcontrol QskAspect::subControl() const noexcept
|
||||
{
|
||||
return static_cast< Subcontrol >( m_bits.subControl );
|
||||
}
|
||||
|
||||
inline void QskAspect::setSubControl( Subcontrol subControl ) noexcept
|
||||
{
|
||||
m_bits.subControl = subControl;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect::Type QskAspect::type() const noexcept
|
||||
{
|
||||
return static_cast< Type >( m_bits.type );
|
||||
}
|
||||
|
||||
inline void QskAspect::setType( Type type ) noexcept
|
||||
{
|
||||
m_bits.type = type;
|
||||
}
|
||||
|
||||
inline constexpr bool QskAspect::isMetric() const noexcept
|
||||
{
|
||||
return type() == Metric;
|
||||
}
|
||||
|
||||
inline constexpr bool QskAspect::isColor() const noexcept
|
||||
{
|
||||
return type() == Color;
|
||||
}
|
||||
|
||||
inline constexpr bool QskAspect::isFlag() const noexcept
|
||||
{
|
||||
return type() == Flag;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect::State QskAspect::state() const noexcept
|
||||
{
|
||||
return static_cast< State >( m_bits.states );
|
||||
}
|
||||
|
||||
inline void QskAspect::setState( State state ) noexcept
|
||||
{
|
||||
m_bits.states = state;
|
||||
}
|
||||
|
||||
inline void QskAspect::addState( State state ) noexcept
|
||||
{
|
||||
m_bits.states |= state;
|
||||
}
|
||||
|
||||
inline void QskAspect::clearState( State state ) noexcept
|
||||
{
|
||||
m_bits.states &= ~state;
|
||||
}
|
||||
|
||||
inline void QskAspect::clearStates() noexcept
|
||||
{
|
||||
m_bits.states = 0;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect::FlagPrimitive QskAspect::flagPrimitive() const noexcept
|
||||
{
|
||||
return ( m_bits.type == Flag )
|
||||
? static_cast< FlagPrimitive >( m_bits.primitive ) : NoFlagPrimitive;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect::ColorPrimitive QskAspect::colorPrimitive() const noexcept
|
||||
{
|
||||
return ( m_bits.type == Color )
|
||||
? static_cast< ColorPrimitive >( m_bits.primitive ) : NoColorPrimitive;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect::MetricPrimitive QskAspect::metricPrimitive() const noexcept
|
||||
{
|
||||
return ( m_bits.type == Metric )
|
||||
? static_cast< MetricPrimitive >( m_bits.primitive ) : NoMetricPrimitive;
|
||||
}
|
||||
|
||||
inline constexpr uint QskAspect::primitive() const noexcept
|
||||
{
|
||||
return m_bits.primitive;
|
||||
}
|
||||
|
||||
inline void QskAspect::setPrimitive( Type type, uint primitive ) noexcept
|
||||
{
|
||||
m_bits.type = type;
|
||||
m_bits.primitive = primitive;
|
||||
}
|
||||
|
||||
inline void QskAspect::clearPrimitive() noexcept
|
||||
{
|
||||
m_bits.primitive = 0;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect::Placement QskAspect::placement() const noexcept
|
||||
{
|
||||
return static_cast< Placement >( m_bits.placement );
|
||||
}
|
||||
|
||||
inline void QskAspect::setPlacement( Placement placement ) noexcept
|
||||
{
|
||||
m_bits.placement = placement;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::State state, const QskAspect& aspect ) noexcept
|
||||
{
|
||||
return aspect | state;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::Subcontrol subControl, const QskAspect& aspect ) noexcept
|
||||
{
|
||||
return aspect | subControl;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::Type type, const QskAspect& aspect ) noexcept
|
||||
{
|
||||
return aspect | type;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::Placement placement, const QskAspect& aspect ) noexcept
|
||||
{
|
||||
return aspect | placement;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::Subcontrol subControl, QskAspect::Type type ) noexcept
|
||||
{
|
||||
return QskAspect( subControl ) | type;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::Type type, QskAspect::Subcontrol subControl ) noexcept
|
||||
{
|
||||
return subControl | type;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::Subcontrol subControl, QskAspect::State state ) noexcept
|
||||
{
|
||||
return QskAspect( subControl ) | state;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::Type type, QskAspect::Placement placement ) noexcept
|
||||
{
|
||||
return QskAspect( type ) | placement;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::Placement placement, QskAspect::Type type ) noexcept
|
||||
{
|
||||
return type | placement;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::State state, QskAspect::Subcontrol subControl ) noexcept
|
||||
{
|
||||
return subControl | state;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::Subcontrol subControl, QskAspect::FlagPrimitive primitive ) noexcept
|
||||
{
|
||||
return QskAspect( subControl ) | primitive;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::FlagPrimitive primitive, QskAspect::Subcontrol subControl ) noexcept
|
||||
{
|
||||
return subControl | primitive;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::Subcontrol subControl, QskAspect::ColorPrimitive primitive ) noexcept
|
||||
{
|
||||
return QskAspect( subControl ) | primitive;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::ColorPrimitive primitive, QskAspect::Subcontrol subControl ) noexcept
|
||||
{
|
||||
return subControl | primitive;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::Subcontrol subControl, QskAspect::MetricPrimitive primitive ) noexcept
|
||||
{
|
||||
return QskAspect( subControl ) | primitive;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::MetricPrimitive primitive, QskAspect::Subcontrol subControl ) noexcept
|
||||
{
|
||||
return subControl | primitive;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::Subcontrol subControl, QskAspect::Placement placement ) noexcept
|
||||
{
|
||||
return QskAspect( subControl ) | placement;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::Placement placement, QskAspect::Subcontrol subControl ) noexcept
|
||||
{
|
||||
return subControl | placement;
|
||||
}
|
||||
|
||||
namespace std
|
||||
{
|
||||
template< > struct hash< QskAspect::Aspect >
|
||||
template< > struct hash< QskAspect >
|
||||
{
|
||||
constexpr size_t operator()( const QskAspect::Aspect& aspect ) const noexcept
|
||||
constexpr size_t operator()( const QskAspect& aspect ) const noexcept
|
||||
{
|
||||
return aspect.value();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Q_DECLARE_TYPEINFO( QskAspect::Aspect, Q_MOVABLE_TYPE );
|
||||
Q_DECLARE_TYPEINFO( QskAspect, Q_MOVABLE_TYPE );
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
|
||||
class QDebug;
|
||||
|
||||
QSK_EXPORT QDebug operator<<( QDebug, QskAspect::Aspect );
|
||||
QSK_EXPORT QDebug operator<<( QDebug, QskAspect );
|
||||
QSK_EXPORT QDebug operator<<( QDebug, QskAspect::Type );
|
||||
QSK_EXPORT QDebug operator<<( QDebug, QskAspect::Subcontrol );
|
||||
|
||||
|
@ -576,7 +550,7 @@ QSK_EXPORT QDebug operator<<( QDebug, QskAspect::Placement );
|
|||
QSK_EXPORT QDebug operator<<( QDebug, QskAspect::State );
|
||||
|
||||
QSK_EXPORT void qskDebugState( QDebug, const QMetaObject*, QskAspect::State );
|
||||
QSK_EXPORT void qskDebugAspect( QDebug, const QMetaObject*, QskAspect::Aspect );
|
||||
QSK_EXPORT void qskDebugAspect( QDebug, const QMetaObject*, QskAspect );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ QskGestureEvent* QskGestureEvent::clone() const
|
|||
|
||||
// -- QskAnimatorEvent
|
||||
|
||||
QskAnimatorEvent::QskAnimatorEvent( QskAspect::Aspect aspect, State state )
|
||||
QskAnimatorEvent::QskAnimatorEvent( QskAspect aspect, State state )
|
||||
: QskEvent( QskEvent::Animator )
|
||||
, m_aspect( aspect )
|
||||
, m_state( state )
|
||||
|
|
|
@ -121,15 +121,15 @@ class QSK_EXPORT QskAnimatorEvent : public QskEvent
|
|||
Terminated
|
||||
};
|
||||
|
||||
QskAnimatorEvent( QskAspect::Aspect aspect, State state );
|
||||
QskAnimatorEvent( QskAspect aspect, State state );
|
||||
|
||||
inline QskAspect::Aspect aspect() const { return m_aspect; }
|
||||
inline QskAspect aspect() const { return m_aspect; }
|
||||
inline State state() const { return m_state; }
|
||||
|
||||
QskAnimatorEvent* clone() const override;
|
||||
|
||||
private:
|
||||
const QskAspect::Aspect m_aspect;
|
||||
const QskAspect m_aspect;
|
||||
const State m_state;
|
||||
};
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ QskHintAnimator::~QskHintAnimator()
|
|||
{
|
||||
}
|
||||
|
||||
void QskHintAnimator::setAspect( QskAspect::Aspect aspect )
|
||||
void QskHintAnimator::setAspect( QskAspect aspect )
|
||||
{
|
||||
m_aspect = aspect;
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ class QskHintAnimatorTable::PrivateData
|
|||
public:
|
||||
// we won't have many entries, so we prefer less memory over
|
||||
// using a hash table
|
||||
std::map< QskAspect::Aspect, QskHintAnimator > map;
|
||||
std::map< QskAspect, QskHintAnimator > map;
|
||||
};
|
||||
|
||||
QskHintAnimatorTable::QskHintAnimatorTable()
|
||||
|
@ -223,7 +223,7 @@ QskHintAnimatorTable::~QskHintAnimatorTable()
|
|||
}
|
||||
|
||||
void QskHintAnimatorTable::start( QskControl* control,
|
||||
QskAspect::Aspect aspect, QskAnimationHint animationHint,
|
||||
QskAspect aspect, QskAnimationHint animationHint,
|
||||
const QVariant& from, const QVariant& to )
|
||||
{
|
||||
if ( m_data == nullptr )
|
||||
|
@ -254,7 +254,7 @@ void QskHintAnimatorTable::start( QskControl* control,
|
|||
}
|
||||
}
|
||||
|
||||
const QskHintAnimator* QskHintAnimatorTable::animator( QskAspect::Aspect aspect ) const
|
||||
const QskHintAnimator* QskHintAnimatorTable::animator( QskAspect aspect ) const
|
||||
{
|
||||
if ( m_data == nullptr )
|
||||
return nullptr;
|
||||
|
@ -266,7 +266,7 @@ const QskHintAnimator* QskHintAnimatorTable::animator( QskAspect::Aspect aspect
|
|||
return &( it->second );
|
||||
}
|
||||
|
||||
QVariant QskHintAnimatorTable::currentValue( QskAspect::Aspect aspect ) const
|
||||
QVariant QskHintAnimatorTable::currentValue( QskAspect aspect ) const
|
||||
{
|
||||
if ( m_data )
|
||||
{
|
||||
|
|
|
@ -22,8 +22,8 @@ class QSK_EXPORT QskHintAnimator : public QskVariantAnimator
|
|||
QskHintAnimator();
|
||||
~QskHintAnimator() override;
|
||||
|
||||
void setAspect( QskAspect::Aspect );
|
||||
QskAspect::Aspect aspect() const;
|
||||
void setAspect( QskAspect );
|
||||
QskAspect aspect() const;
|
||||
|
||||
void setControl( QskControl* );
|
||||
QskControl* control() const;
|
||||
|
@ -34,7 +34,7 @@ class QSK_EXPORT QskHintAnimator : public QskVariantAnimator
|
|||
void advance( qreal value ) override;
|
||||
|
||||
private:
|
||||
QskAspect::Aspect m_aspect;
|
||||
QskAspect m_aspect;
|
||||
QskAnimationHint::UpdateFlags m_updateFlags;
|
||||
QPointer< QskControl > m_control;
|
||||
};
|
||||
|
@ -45,11 +45,11 @@ class QSK_EXPORT QskHintAnimatorTable
|
|||
QskHintAnimatorTable();
|
||||
~QskHintAnimatorTable();
|
||||
|
||||
void start( QskControl*, QskAspect::Aspect,
|
||||
void start( QskControl*, QskAspect,
|
||||
QskAnimationHint, const QVariant& from, const QVariant& to );
|
||||
|
||||
const QskHintAnimator* animator( QskAspect::Aspect aspect ) const;
|
||||
QVariant currentValue( QskAspect::Aspect ) const;
|
||||
const QskHintAnimator* animator( QskAspect aspect ) const;
|
||||
QVariant currentValue( QskAspect ) const;
|
||||
|
||||
bool cleanup();
|
||||
|
||||
|
@ -60,7 +60,7 @@ class QSK_EXPORT QskHintAnimatorTable
|
|||
PrivateData* m_data;
|
||||
};
|
||||
|
||||
inline QskAspect::Aspect QskHintAnimator::aspect() const
|
||||
inline QskAspect QskHintAnimator::aspect() const
|
||||
{
|
||||
return m_aspect;
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ class QskPopup::PrivateData
|
|||
InputGrabber* inputGrabber = nullptr;
|
||||
|
||||
uint priority = 0;
|
||||
QskAspect::Aspect faderAspect;
|
||||
QskAspect faderAspect;
|
||||
|
||||
int flags : 4;
|
||||
bool isModal : 1;
|
||||
|
@ -266,12 +266,12 @@ void QskPopup::updateInputGrabber()
|
|||
}
|
||||
}
|
||||
|
||||
QskAspect::Aspect QskPopup::faderAspect() const
|
||||
QskAspect QskPopup::faderAspect() const
|
||||
{
|
||||
return m_data->faderAspect;
|
||||
}
|
||||
|
||||
void QskPopup::setFaderAspect( QskAspect::Aspect aspect )
|
||||
void QskPopup::setFaderAspect( QskAspect aspect )
|
||||
{
|
||||
auto faderAspect = aspect;
|
||||
faderAspect.clearStates(); // animated values are always stateless
|
||||
|
@ -287,7 +287,7 @@ void QskPopup::setFaderAspect( QskAspect::Aspect aspect )
|
|||
m_data->faderAspect = faderAspect;
|
||||
}
|
||||
|
||||
bool QskPopup::isTransitionAccepted( QskAspect::Aspect aspect ) const
|
||||
bool QskPopup::isTransitionAccepted( QskAspect aspect ) const
|
||||
{
|
||||
if ( isVisible() && m_data->hasFaderEffect )
|
||||
{
|
||||
|
|
|
@ -58,8 +58,8 @@ class QSK_EXPORT QskPopup : public QskControl
|
|||
void setFaderEffect( bool );
|
||||
bool hasFaderEffect() const;
|
||||
|
||||
QskAspect::Aspect faderAspect() const;
|
||||
void setFaderAspect( QskAspect::Aspect );
|
||||
QskAspect faderAspect() const;
|
||||
void setFaderAspect( QskAspect );
|
||||
|
||||
virtual QRectF overlayRect() const;
|
||||
|
||||
|
@ -94,7 +94,7 @@ class QSK_EXPORT QskPopup : public QskControl
|
|||
const QQuickItem::ItemChangeData& ) override;
|
||||
|
||||
virtual QQuickItem* focusSuccessor() const;
|
||||
bool isTransitionAccepted( QskAspect::Aspect ) const override;
|
||||
bool isTransitionAccepted( QskAspect ) const override;
|
||||
|
||||
void grabFocus( bool );
|
||||
|
||||
|
|
|
@ -177,9 +177,9 @@ void QskProgressBar::setBarGradient( const QskGradient& gradient )
|
|||
|
||||
void QskProgressBar::resetBarGradient()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
|
||||
if ( resetColor( Bar | Vertical ) || resetColor( Bar | Horizontal ) )
|
||||
if ( resetColor( Bar | A::Vertical ) || resetColor( Bar | A::Horizontal ) )
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ QRectF QskScrollViewSkinlet::scrollHandleRect( const QskScrollView* scrollView,
|
|||
QRectF QskScrollViewSkinlet::scrollBarRect( const QskScrollView* scrollView,
|
||||
const QRectF& contentsRect, Qt::Orientation orientation ) const
|
||||
{
|
||||
using namespace QskAspect;
|
||||
using A = QskAspect;
|
||||
using Q = QskScrollView;
|
||||
|
||||
const auto scrollOrientations = scrollView->scrollableOrientations();
|
||||
|
@ -297,23 +297,23 @@ QRectF QskScrollViewSkinlet::scrollBarRect( const QskScrollView* scrollView,
|
|||
|
||||
if ( orientation == Qt::Horizontal )
|
||||
{
|
||||
const qreal h = scrollView->metric( Q::HorizontalScrollBar | Size );
|
||||
const qreal h = scrollView->metric( Q::HorizontalScrollBar | A::Size );
|
||||
r.setTop( r.bottom() - h );
|
||||
|
||||
if ( scrollOrientations & Qt::Vertical )
|
||||
{
|
||||
const qreal w = scrollView->metric( Q::VerticalScrollBar | Size );
|
||||
const qreal w = scrollView->metric( Q::VerticalScrollBar | A::Size );
|
||||
r.setRight( r.right() - w );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const qreal w = scrollView->metric( Q::VerticalScrollBar | Size );
|
||||
const qreal w = scrollView->metric( Q::VerticalScrollBar | A::Size );
|
||||
r.setLeft( r.right() - w );
|
||||
|
||||
if ( scrollOrientations & Qt::Horizontal )
|
||||
{
|
||||
const qreal h = scrollView->metric( Q::HorizontalScrollBar | Size );
|
||||
const qreal h = scrollView->metric( Q::HorizontalScrollBar | A::Size );
|
||||
r.setBottom( r.bottom() - h );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,137 +165,137 @@ QskSkin::~QskSkin()
|
|||
{
|
||||
}
|
||||
|
||||
void QskSkin::setColor( QskAspect::Aspect aspect, QRgb rgb )
|
||||
void QskSkin::setColor( QskAspect aspect, QRgb rgb )
|
||||
{
|
||||
setSkinHint( aspect | QskAspect::Color, QColor::fromRgba( rgb ) );
|
||||
}
|
||||
|
||||
void QskSkin::setColor( QskAspect::Aspect aspect, Qt::GlobalColor color )
|
||||
void QskSkin::setColor( QskAspect aspect, Qt::GlobalColor color )
|
||||
{
|
||||
setSkinHint( aspect | QskAspect::Color, QColor( color ) );
|
||||
}
|
||||
|
||||
void QskSkin::setColor( QskAspect::Aspect aspect, const QColor& color )
|
||||
void QskSkin::setColor( QskAspect aspect, const QColor& color )
|
||||
{
|
||||
setSkinHint( aspect | QskAspect::Color, color );
|
||||
}
|
||||
|
||||
QColor QskSkin::color( QskAspect::Aspect aspect ) const
|
||||
QColor QskSkin::color( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.color( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setMetric( QskAspect::Aspect aspect, qreal metric )
|
||||
void QskSkin::setMetric( QskAspect aspect, qreal metric )
|
||||
{
|
||||
m_data->hintTable.setMetric( aspect, metric );
|
||||
}
|
||||
|
||||
qreal QskSkin::metric( QskAspect::Aspect aspect ) const
|
||||
qreal QskSkin::metric( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.metric( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setStrutSize( QskAspect::Aspect aspect, qreal width, qreal height )
|
||||
void QskSkin::setStrutSize( QskAspect aspect, qreal width, qreal height )
|
||||
{
|
||||
setStrutSize( aspect, QSizeF( width, height ) );
|
||||
}
|
||||
|
||||
void QskSkin::setStrutSize( QskAspect::Aspect aspect, const QSizeF& strut )
|
||||
void QskSkin::setStrutSize( QskAspect aspect, const QSizeF& strut )
|
||||
{
|
||||
m_data->hintTable.setStrutSize( aspect, strut );
|
||||
}
|
||||
|
||||
QSizeF QskSkin::strutSize( QskAspect::Aspect aspect ) const
|
||||
QSizeF QskSkin::strutSize( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.strutSize( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setMargin( QskAspect::Aspect aspect, const QskMargins& margins )
|
||||
void QskSkin::setMargin( QskAspect aspect, const QskMargins& margins )
|
||||
{
|
||||
m_data->hintTable.setMargin( aspect, margins );
|
||||
}
|
||||
|
||||
void QskSkin::setMargin( QskAspect::Aspect aspect,
|
||||
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 aspect ) const
|
||||
QskMargins QskSkin::margin( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.margin( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setPadding( QskAspect::Aspect aspect, const QskMargins& padding )
|
||||
void QskSkin::setPadding( QskAspect aspect, const QskMargins& padding )
|
||||
{
|
||||
m_data->hintTable.setPadding( aspect, padding );
|
||||
}
|
||||
|
||||
void QskSkin::setPadding( QskAspect::Aspect aspect,
|
||||
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 aspect ) const
|
||||
QskMargins QskSkin::padding( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.padding( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setSpacing( QskAspect::Aspect aspect, qreal spacing )
|
||||
void QskSkin::setSpacing( QskAspect aspect, qreal spacing )
|
||||
{
|
||||
m_data->hintTable.setSpacing( aspect, spacing );
|
||||
}
|
||||
|
||||
qreal QskSkin::spacing( QskAspect::Aspect aspect ) const
|
||||
qreal QskSkin::spacing( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.spacing( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setGradient( QskAspect::Aspect aspect, const QskGradient& gradient )
|
||||
void QskSkin::setGradient( QskAspect aspect, const QskGradient& gradient )
|
||||
{
|
||||
m_data->hintTable.setGradient( aspect, gradient );
|
||||
}
|
||||
|
||||
QskGradient QskSkin::gradient( QskAspect::Aspect aspect ) const
|
||||
QskGradient QskSkin::gradient( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.gradient( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setBoxShape( QskAspect::Aspect 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 aspect, qreal topLeft, qreal topRight,
|
||||
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 aspect, const QskBoxShapeMetrics& shape )
|
||||
void QskSkin::setBoxShape( QskAspect aspect, const QskBoxShapeMetrics& shape )
|
||||
{
|
||||
m_data->hintTable.setBoxShape( aspect, shape );
|
||||
}
|
||||
|
||||
QskBoxShapeMetrics QskSkin::boxShape( QskAspect::Aspect aspect ) const
|
||||
QskBoxShapeMetrics QskSkin::boxShape( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.boxShape( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setBoxBorderMetrics( QskAspect::Aspect 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 aspect,
|
||||
void QskSkin::setBoxBorderMetrics( QskAspect aspect,
|
||||
qreal borderWidth, Qt::SizeMode sizeMode )
|
||||
{
|
||||
m_data->hintTable.setBoxBorder(
|
||||
|
@ -303,63 +303,62 @@ void QskSkin::setBoxBorderMetrics( QskAspect::Aspect aspect,
|
|||
}
|
||||
|
||||
void QskSkin::setBoxBorderMetrics(
|
||||
QskAspect::Aspect aspect, const QskBoxBorderMetrics& border )
|
||||
QskAspect aspect, const QskBoxBorderMetrics& border )
|
||||
{
|
||||
m_data->hintTable.setBoxBorder( aspect, border );
|
||||
}
|
||||
|
||||
QskBoxBorderMetrics QskSkin::boxBorderMetrics( QskAspect::Aspect aspect ) const
|
||||
QskBoxBorderMetrics QskSkin::boxBorderMetrics( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.boxBorder( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setBoxBorderColors( QskAspect::Aspect aspect, const QskBoxBorderColors& colors )
|
||||
void QskSkin::setBoxBorderColors( QskAspect aspect, const QskBoxBorderColors& colors )
|
||||
{
|
||||
m_data->hintTable.setBoxBorderColors( aspect, colors );
|
||||
}
|
||||
|
||||
QskBoxBorderColors QskSkin::boxBorderColors( QskAspect::Aspect aspect ) const
|
||||
QskBoxBorderColors QskSkin::boxBorderColors( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.boxBorderColors( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setFontRole( QskAspect::Aspect aspect, int fontRole )
|
||||
void QskSkin::setFontRole( QskAspect aspect, int fontRole )
|
||||
{
|
||||
m_data->hintTable.setFontRole( aspect, fontRole );
|
||||
}
|
||||
|
||||
void QskSkin::setGraphicRole( QskAspect::Aspect aspect, int graphicRole )
|
||||
void QskSkin::setGraphicRole( QskAspect aspect, int graphicRole )
|
||||
{
|
||||
m_data->hintTable.setGraphicRole( aspect, graphicRole );
|
||||
}
|
||||
|
||||
void QskSkin::setAnimation(
|
||||
QskAspect::Aspect aspect, QskAnimationHint animation )
|
||||
void QskSkin::setAnimation( QskAspect aspect, QskAnimationHint animation )
|
||||
{
|
||||
m_data->hintTable.setAnimation( aspect, animation );
|
||||
}
|
||||
|
||||
QskAnimationHint QskSkin::animation( QskAspect::Aspect aspect ) const
|
||||
QskAnimationHint QskSkin::animation( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.animation( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setAlignment( QskAspect::Aspect aspect, Qt::Alignment alignment )
|
||||
void QskSkin::setAlignment( QskAspect aspect, Qt::Alignment alignment )
|
||||
{
|
||||
m_data->hintTable.setAlignment( aspect, alignment );
|
||||
}
|
||||
|
||||
Qt::Alignment QskSkin::alignment( QskAspect::Aspect aspect ) const
|
||||
Qt::Alignment QskSkin::alignment( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.alignment( aspect );
|
||||
}
|
||||
|
||||
void QskSkin::setSkinHint( QskAspect::Aspect aspect, const QVariant& skinHint )
|
||||
void QskSkin::setSkinHint( QskAspect aspect, const QVariant& skinHint )
|
||||
{
|
||||
m_data->hintTable.setHint( aspect, skinHint );
|
||||
}
|
||||
|
||||
const QVariant& QskSkin::skinHint( QskAspect::Aspect aspect ) const
|
||||
const QVariant& QskSkin::skinHint( QskAspect aspect ) const
|
||||
{
|
||||
return m_data->hintTable.hint( aspect );
|
||||
}
|
||||
|
|
|
@ -61,69 +61,69 @@ class QSK_EXPORT QskSkin : public QObject
|
|||
|
||||
virtual void resetColors( const QColor& accent );
|
||||
|
||||
void setColor( QskAspect::Aspect, Qt::GlobalColor );
|
||||
void setColor( QskAspect::Aspect, QRgb );
|
||||
void setColor( QskAspect::Aspect, const QColor& );
|
||||
void setColor( QskAspect, Qt::GlobalColor );
|
||||
void setColor( QskAspect, QRgb );
|
||||
void setColor( QskAspect, const QColor& );
|
||||
|
||||
QColor color( QskAspect::Aspect ) const;
|
||||
QColor color( QskAspect ) const;
|
||||
|
||||
void setMetric( QskAspect::Aspect, qreal metric );
|
||||
qreal metric( QskAspect::Aspect ) const;
|
||||
void setMetric( QskAspect, qreal metric );
|
||||
qreal metric( QskAspect ) const;
|
||||
|
||||
void setStrutSize( QskAspect::Aspect, const QSizeF& );
|
||||
void setStrutSize( QskAspect::Aspect, qreal width, qreal height );
|
||||
QSizeF strutSize( QskAspect::Aspect ) const;
|
||||
void setStrutSize( QskAspect, const QSizeF& );
|
||||
void setStrutSize( QskAspect, qreal width, qreal height );
|
||||
QSizeF strutSize( QskAspect ) const;
|
||||
|
||||
void setMargin( QskAspect::Aspect, const QskMargins& );
|
||||
void setMargin( QskAspect::Aspect,
|
||||
void setMargin( QskAspect, const QskMargins& );
|
||||
void setMargin( QskAspect,
|
||||
qreal left, qreal top, qreal right, qreal bottom );
|
||||
QskMargins margin( QskAspect::Aspect ) const;
|
||||
QskMargins margin( QskAspect ) const;
|
||||
|
||||
void setPadding( QskAspect::Aspect, const QskMargins& );
|
||||
void setPadding( QskAspect::Aspect,
|
||||
void setPadding( QskAspect, const QskMargins& );
|
||||
void setPadding( QskAspect,
|
||||
qreal left, qreal top, qreal right, qreal bottom );
|
||||
QskMargins padding( QskAspect::Aspect ) const;
|
||||
QskMargins padding( QskAspect ) const;
|
||||
|
||||
void setSpacing( QskAspect::Aspect, qreal );
|
||||
qreal spacing( QskAspect::Aspect ) const;
|
||||
void setSpacing( QskAspect, qreal );
|
||||
qreal spacing( QskAspect ) const;
|
||||
|
||||
void setGradient( QskAspect::Aspect, const QskGradient& );
|
||||
QskGradient gradient( QskAspect::Aspect ) const;
|
||||
void setGradient( QskAspect, const QskGradient& );
|
||||
QskGradient gradient( QskAspect ) const;
|
||||
|
||||
void setBoxShape( QskAspect::Aspect, qreal radius, Qt::SizeMode = Qt::AbsoluteSize );
|
||||
void setBoxShape( QskAspect::Aspect, qreal topLeft, qreal topRight,
|
||||
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::Aspect, const QskBoxShapeMetrics& );
|
||||
QskBoxShapeMetrics boxShape( QskAspect::Aspect ) const;
|
||||
void setBoxShape( QskAspect, const QskBoxShapeMetrics& );
|
||||
QskBoxShapeMetrics boxShape( QskAspect ) const;
|
||||
|
||||
void setBoxBorderMetrics( QskAspect::Aspect,
|
||||
void setBoxBorderMetrics( QskAspect,
|
||||
qreal borderWidth, Qt::SizeMode = Qt::AbsoluteSize );
|
||||
|
||||
void setBoxBorderMetrics( QskAspect::Aspect, qreal left, qreal top,
|
||||
void setBoxBorderMetrics( QskAspect, qreal left, qreal top,
|
||||
qreal right, qreal bottom, Qt::SizeMode = Qt::AbsoluteSize );
|
||||
|
||||
void setBoxBorderMetrics( QskAspect::Aspect, const QskBoxBorderMetrics& );
|
||||
QskBoxBorderMetrics boxBorderMetrics( QskAspect::Aspect ) const;
|
||||
void setBoxBorderMetrics( QskAspect, const QskBoxBorderMetrics& );
|
||||
QskBoxBorderMetrics boxBorderMetrics( QskAspect ) const;
|
||||
|
||||
void setBoxBorderColors( QskAspect::Aspect, const QskBoxBorderColors& );
|
||||
QskBoxBorderColors boxBorderColors( QskAspect::Aspect ) const;
|
||||
void setBoxBorderColors( QskAspect, const QskBoxBorderColors& );
|
||||
QskBoxBorderColors boxBorderColors( QskAspect ) const;
|
||||
|
||||
void setAnimation( QskAspect::Aspect, QskAnimationHint );
|
||||
QskAnimationHint animation( QskAspect::Aspect ) const;
|
||||
void setAnimation( QskAspect, QskAnimationHint );
|
||||
QskAnimationHint animation( QskAspect ) const;
|
||||
|
||||
void setAlignment( QskAspect::Aspect, Qt::Alignment );
|
||||
Qt::Alignment alignment( QskAspect::Aspect ) const;
|
||||
void setAlignment( QskAspect, Qt::Alignment );
|
||||
Qt::Alignment alignment( QskAspect ) const;
|
||||
|
||||
void setSkinHint( QskAspect::Aspect, const QVariant& hint );
|
||||
const QVariant& skinHint( QskAspect::Aspect ) const;
|
||||
void setSkinHint( QskAspect, const QVariant& hint );
|
||||
const QVariant& skinHint( QskAspect ) const;
|
||||
|
||||
void setGraphicFilter( int graphicRole, const QskColorFilter& );
|
||||
void resetGraphicFilter( int graphicRole );
|
||||
QskColorFilter graphicFilter( int graphicRole ) const;
|
||||
|
||||
void setFontRole( QskAspect::Aspect, int fontRole );
|
||||
void setGraphicRole( QskAspect::Aspect, int graphicRole );
|
||||
void setFontRole( QskAspect, int fontRole );
|
||||
void setGraphicRole( QskAspect, int graphicRole );
|
||||
|
||||
void setFont( int fontRole, const QFont& );
|
||||
void resetFont( int fontRole );
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
QVariant QskSkinHintTable::invalidHint;
|
||||
|
||||
inline const QVariant* qskResolvedHint( QskAspect::Aspect aspect,
|
||||
const std::unordered_map< QskAspect::Aspect, QVariant >& hints,
|
||||
QskAspect::Aspect* resolvedAspect )
|
||||
inline const QVariant* qskResolvedHint( QskAspect aspect,
|
||||
const std::unordered_map< QskAspect, QVariant >& hints,
|
||||
QskAspect* resolvedAspect )
|
||||
{
|
||||
const auto a = aspect;
|
||||
|
||||
|
@ -85,16 +85,16 @@ QskSkinHintTable& QskSkinHintTable::operator=( const QskSkinHintTable& other )
|
|||
return *this;
|
||||
}
|
||||
|
||||
const std::unordered_map< QskAspect::Aspect, QVariant >& QskSkinHintTable::hints() const
|
||||
const std::unordered_map< QskAspect, QVariant >& QskSkinHintTable::hints() const
|
||||
{
|
||||
if ( m_hints )
|
||||
return *m_hints;
|
||||
|
||||
static std::unordered_map< QskAspect::Aspect, QVariant > dummyHints;
|
||||
static std::unordered_map< QskAspect, QVariant > dummyHints;
|
||||
return dummyHints;
|
||||
}
|
||||
|
||||
void QskSkinHintTable::setHint( QskAspect::Aspect aspect, const QVariant& skinHint )
|
||||
void QskSkinHintTable::setHint( QskAspect aspect, const QVariant& skinHint )
|
||||
{
|
||||
if ( m_hints == nullptr )
|
||||
m_hints = new HintMap();
|
||||
|
@ -115,7 +115,7 @@ void QskSkinHintTable::setHint( QskAspect::Aspect aspect, const QVariant& skinHi
|
|||
m_hasStates = true;
|
||||
}
|
||||
|
||||
bool QskSkinHintTable::removeHint( QskAspect::Aspect aspect )
|
||||
bool QskSkinHintTable::removeHint( QskAspect aspect )
|
||||
{
|
||||
if ( m_hints == nullptr )
|
||||
return false;
|
||||
|
@ -137,7 +137,7 @@ bool QskSkinHintTable::removeHint( QskAspect::Aspect aspect )
|
|||
return erased;
|
||||
}
|
||||
|
||||
QVariant QskSkinHintTable::takeHint( QskAspect::Aspect aspect )
|
||||
QVariant QskSkinHintTable::takeHint( QskAspect aspect )
|
||||
{
|
||||
if ( m_hints )
|
||||
{
|
||||
|
@ -172,7 +172,7 @@ void QskSkinHintTable::clear()
|
|||
}
|
||||
|
||||
const QVariant* QskSkinHintTable::resolvedHint(
|
||||
QskAspect::Aspect aspect, QskAspect::Aspect* resolvedAspect ) const
|
||||
QskAspect aspect, QskAspect* resolvedAspect ) const
|
||||
{
|
||||
if ( m_hints != nullptr )
|
||||
return qskResolvedHint( aspect, *m_hints, resolvedAspect );
|
||||
|
@ -180,9 +180,9 @@ const QVariant* QskSkinHintTable::resolvedHint(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
QskAspect::Aspect QskSkinHintTable::resolvedAspect( QskAspect::Aspect aspect ) const
|
||||
QskAspect QskSkinHintTable::resolvedAspect( QskAspect aspect ) const
|
||||
{
|
||||
QskAspect::Aspect a;
|
||||
QskAspect a;
|
||||
|
||||
if ( m_hints != nullptr )
|
||||
qskResolvedHint( aspect, *m_hints, &a );
|
||||
|
@ -190,8 +190,8 @@ QskAspect::Aspect QskSkinHintTable::resolvedAspect( QskAspect::Aspect aspect ) c
|
|||
return a;
|
||||
}
|
||||
|
||||
QskAspect::Aspect QskSkinHintTable::resolvedAnimator(
|
||||
QskAspect::Aspect aspect, QskAnimationHint& hint ) const
|
||||
QskAspect QskSkinHintTable::resolvedAnimator(
|
||||
QskAspect aspect, QskAnimationHint& hint ) const
|
||||
{
|
||||
if ( m_hints && m_animatorCount > 0 )
|
||||
{
|
||||
|
@ -211,5 +211,5 @@ QskAspect::Aspect QskSkinHintTable::resolvedAnimator(
|
|||
}
|
||||
}
|
||||
|
||||
return QskAspect::Aspect();
|
||||
return QskAspect();
|
||||
}
|
||||
|
|
|
@ -30,61 +30,61 @@ class QSK_EXPORT QskSkinHintTable
|
|||
|
||||
QskSkinHintTable& operator=( const QskSkinHintTable& );
|
||||
|
||||
void setColor( QskAspect::Aspect, Qt::GlobalColor );
|
||||
void setColor( QskAspect::Aspect, QRgb );
|
||||
void setColor( QskAspect, Qt::GlobalColor );
|
||||
void setColor( QskAspect, QRgb );
|
||||
|
||||
void setColor( QskAspect::Aspect, const QColor& );
|
||||
QColor color( QskAspect::Aspect ) const;
|
||||
void setColor( QskAspect, const QColor& );
|
||||
QColor color( QskAspect ) const;
|
||||
|
||||
void setMetric( QskAspect::Aspect, qreal metric );
|
||||
qreal metric( QskAspect::Aspect ) const;
|
||||
void setMetric( QskAspect, qreal );
|
||||
qreal metric( QskAspect ) const;
|
||||
|
||||
void setStrutSize( QskAspect::Aspect, const QSizeF& );
|
||||
QSizeF strutSize( QskAspect::Aspect ) const;
|
||||
void setStrutSize( QskAspect, const QSizeF& );
|
||||
QSizeF strutSize( QskAspect ) const;
|
||||
|
||||
void setMargin( QskAspect::Aspect, const QskMargins& );
|
||||
QskMargins margin( QskAspect::Aspect ) const;
|
||||
void setMargin( QskAspect, const QskMargins& );
|
||||
QskMargins margin( QskAspect ) const;
|
||||
|
||||
void setPadding( QskAspect::Aspect, const QskMargins& );
|
||||
QskMargins padding( QskAspect::Aspect ) const;
|
||||
void setPadding( QskAspect, const QskMargins& );
|
||||
QskMargins padding( QskAspect ) const;
|
||||
|
||||
void setGradient( QskAspect::Aspect, const QskGradient& );
|
||||
QskGradient gradient( QskAspect::Aspect ) const;
|
||||
void setGradient( QskAspect, const QskGradient& );
|
||||
QskGradient gradient( QskAspect ) const;
|
||||
|
||||
void setBoxShape( QskAspect::Aspect, const QskBoxShapeMetrics& );
|
||||
QskBoxShapeMetrics boxShape( QskAspect::Aspect ) const;
|
||||
void setBoxShape( QskAspect, const QskBoxShapeMetrics& );
|
||||
QskBoxShapeMetrics boxShape( QskAspect ) const;
|
||||
|
||||
void setBoxBorder( QskAspect::Aspect, const QskBoxBorderMetrics& );
|
||||
QskBoxBorderMetrics boxBorder( QskAspect::Aspect ) const;
|
||||
void setBoxBorder( QskAspect, const QskBoxBorderMetrics& );
|
||||
QskBoxBorderMetrics boxBorder( QskAspect ) const;
|
||||
|
||||
void setBoxBorderColors( QskAspect::Aspect, const QskBoxBorderColors& );
|
||||
QskBoxBorderColors boxBorderColors( QskAspect::Aspect ) const;
|
||||
void setBoxBorderColors( QskAspect, const QskBoxBorderColors& );
|
||||
QskBoxBorderColors boxBorderColors( QskAspect ) const;
|
||||
|
||||
void setInterval( QskAspect::Aspect, const QskIntervalF& );
|
||||
QskIntervalF interval( QskAspect::Aspect ) const;
|
||||
void setInterval( QskAspect, const QskIntervalF& );
|
||||
QskIntervalF interval( QskAspect ) const;
|
||||
|
||||
void setSpacing( QskAspect::Aspect, qreal );
|
||||
qreal spacing( QskAspect::Aspect ) const;
|
||||
void setSpacing( QskAspect, qreal );
|
||||
qreal spacing( QskAspect ) const;
|
||||
|
||||
void setAlignment( QskAspect::Aspect, Qt::Alignment );
|
||||
Qt::Alignment alignment( QskAspect::Aspect ) const;
|
||||
void setAlignment( QskAspect, Qt::Alignment );
|
||||
Qt::Alignment alignment( QskAspect ) const;
|
||||
|
||||
void setAnimation( QskAspect::Aspect, QskAnimationHint animation );
|
||||
QskAnimationHint animation( QskAspect::Aspect ) const;
|
||||
void setAnimation( QskAspect, QskAnimationHint );
|
||||
QskAnimationHint animation( QskAspect ) const;
|
||||
|
||||
void setGraphicRole( QskAspect::Aspect, int role );
|
||||
void setFontRole( QskAspect::Aspect, int role );
|
||||
void setFlagHint( QskAspect::Aspect, int flag );
|
||||
void setGraphicRole( QskAspect, int role );
|
||||
void setFontRole( QskAspect, int role );
|
||||
void setFlagHint( QskAspect, int flag );
|
||||
|
||||
void setHint( QskAspect::Aspect, const QVariant& );
|
||||
const QVariant& hint( QskAspect::Aspect ) const;
|
||||
void setHint( QskAspect, const QVariant& );
|
||||
const QVariant& hint( QskAspect ) const;
|
||||
|
||||
bool removeHint( QskAspect::Aspect );
|
||||
QVariant takeHint( QskAspect::Aspect );
|
||||
bool removeHint( QskAspect );
|
||||
QVariant takeHint( QskAspect );
|
||||
|
||||
bool hasHint( QskAspect::Aspect ) const;
|
||||
bool hasHint( QskAspect ) const;
|
||||
|
||||
const std::unordered_map< QskAspect::Aspect, QVariant >& hints() const;
|
||||
const std::unordered_map< QskAspect, QVariant >& hints() const;
|
||||
|
||||
bool hasAnimators() const;
|
||||
bool hasStates() const;
|
||||
|
@ -92,18 +92,18 @@ class QSK_EXPORT QskSkinHintTable
|
|||
|
||||
void clear();
|
||||
|
||||
const QVariant* resolvedHint( QskAspect::Aspect,
|
||||
QskAspect::Aspect* resolvedAspect = nullptr ) const;
|
||||
const QVariant* resolvedHint( QskAspect,
|
||||
QskAspect* resolvedAspect = nullptr ) const;
|
||||
|
||||
QskAspect::Aspect resolvedAspect( QskAspect::Aspect ) const;
|
||||
QskAspect resolvedAspect( QskAspect ) const;
|
||||
|
||||
QskAspect::Aspect resolvedAnimator(
|
||||
QskAspect::Aspect, QskAnimationHint& ) const;
|
||||
QskAspect resolvedAnimator(
|
||||
QskAspect, QskAnimationHint& ) const;
|
||||
|
||||
private:
|
||||
static QVariant invalidHint;
|
||||
|
||||
typedef std::unordered_map< QskAspect::Aspect, QVariant > HintMap;
|
||||
typedef std::unordered_map< QskAspect, QVariant > HintMap;
|
||||
HintMap* m_hints;
|
||||
|
||||
quint16 m_animatorCount;
|
||||
|
@ -125,7 +125,7 @@ inline bool QskSkinHintTable::hasAnimators() const
|
|||
return m_animatorCount;
|
||||
}
|
||||
|
||||
inline bool QskSkinHintTable::hasHint( QskAspect::Aspect aspect ) const
|
||||
inline bool QskSkinHintTable::hasHint( QskAspect aspect ) const
|
||||
{
|
||||
if ( m_hints != nullptr )
|
||||
return m_hints->find( aspect ) != m_hints->cend();
|
||||
|
@ -133,7 +133,7 @@ inline bool QskSkinHintTable::hasHint( QskAspect::Aspect aspect ) const
|
|||
return false;
|
||||
}
|
||||
|
||||
inline const QVariant& QskSkinHintTable::hint( QskAspect::Aspect aspect ) const
|
||||
inline const QVariant& QskSkinHintTable::hint( QskAspect aspect ) const
|
||||
{
|
||||
if ( m_hints != nullptr )
|
||||
{
|
||||
|
@ -145,183 +145,179 @@ inline const QVariant& QskSkinHintTable::hint( QskAspect::Aspect aspect ) const
|
|||
return invalidHint;
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setColor(
|
||||
QskAspect::Aspect aspect, const QColor& color )
|
||||
inline void QskSkinHintTable::setColor( QskAspect aspect, const QColor& color )
|
||||
{
|
||||
setHint( aspect | QskAspect::Color, color );
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setColor(
|
||||
QskAspect::Aspect aspect, Qt::GlobalColor color )
|
||||
inline void QskSkinHintTable::setColor( QskAspect aspect, Qt::GlobalColor color )
|
||||
{
|
||||
setHint( aspect | QskAspect::Color, QColor( color ) );
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setColor(
|
||||
QskAspect::Aspect aspect, QRgb rgb )
|
||||
inline void QskSkinHintTable::setColor( QskAspect aspect, QRgb rgb )
|
||||
{
|
||||
setHint( aspect | QskAspect::Color, QColor::fromRgba( rgb ) );
|
||||
}
|
||||
|
||||
inline QColor QskSkinHintTable::color( QskAspect::Aspect aspect ) const
|
||||
inline QColor QskSkinHintTable::color( QskAspect aspect ) const
|
||||
{
|
||||
return hint( aspect | QskAspect::Color ).value< QColor >();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setMetric( QskAspect::Aspect aspect, qreal metric )
|
||||
inline void QskSkinHintTable::setMetric( QskAspect aspect, qreal metric )
|
||||
{
|
||||
setHint( aspect | QskAspect::Metric, metric );
|
||||
}
|
||||
|
||||
inline qreal QskSkinHintTable::metric( QskAspect::Aspect aspect ) const
|
||||
inline qreal QskSkinHintTable::metric( QskAspect aspect ) const
|
||||
{
|
||||
return hint( aspect | QskAspect::Metric ).toReal();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setStrutSize(
|
||||
QskAspect::Aspect aspect, const QSizeF& size )
|
||||
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 aspect ) const
|
||||
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 aspect, const QskMargins& margins )
|
||||
QskAspect aspect, const QskMargins& margins )
|
||||
{
|
||||
const auto aspectMargin = aspect | QskAspect::Metric | QskAspect::Margin;
|
||||
setHint( aspectMargin, QVariant::fromValue( margins ) );
|
||||
}
|
||||
|
||||
inline QskMargins QskSkinHintTable::margin( QskAspect::Aspect aspect ) const
|
||||
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 aspect, const QskMargins& padding )
|
||||
QskAspect aspect, const QskMargins& padding )
|
||||
{
|
||||
const auto aspectPadding = aspect | QskAspect::Metric | QskAspect::Padding;
|
||||
setHint( aspectPadding, QVariant::fromValue( padding ) );
|
||||
}
|
||||
|
||||
inline QskMargins QskSkinHintTable::padding( QskAspect::Aspect aspect ) const
|
||||
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 aspect, const QskGradient& gradient )
|
||||
QskAspect aspect, const QskGradient& gradient )
|
||||
{
|
||||
setHint( aspect | QskAspect::Color, QVariant::fromValue( gradient ) );
|
||||
}
|
||||
|
||||
inline QskGradient QskSkinHintTable::gradient( QskAspect::Aspect aspect ) const
|
||||
inline QskGradient QskSkinHintTable::gradient( QskAspect aspect ) const
|
||||
{
|
||||
return hint( aspect | QskAspect::Color ).value< QskGradient >();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setBoxShape(
|
||||
QskAspect::Aspect aspect, const QskBoxShapeMetrics& shape )
|
||||
QskAspect aspect, const QskBoxShapeMetrics& shape )
|
||||
{
|
||||
using namespace QskAspect;
|
||||
setHint( aspect | Shape | Metric, QVariant::fromValue( shape ) );
|
||||
using A = QskAspect;
|
||||
setHint( aspect | A::Shape | A::Metric, QVariant::fromValue( shape ) );
|
||||
}
|
||||
|
||||
inline QskBoxShapeMetrics QskSkinHintTable::boxShape( QskAspect::Aspect aspect ) const
|
||||
inline QskBoxShapeMetrics QskSkinHintTable::boxShape( QskAspect aspect ) const
|
||||
{
|
||||
using namespace QskAspect;
|
||||
return hint( aspect | Shape | Metric ).value< QskBoxShapeMetrics >();
|
||||
using A = QskAspect;
|
||||
return hint( aspect | A::Shape | A::Metric ).value< QskBoxShapeMetrics >();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setBoxBorder(
|
||||
QskAspect::Aspect aspect, const QskBoxBorderMetrics& border )
|
||||
QskAspect aspect, const QskBoxBorderMetrics& border )
|
||||
{
|
||||
using namespace QskAspect;
|
||||
setHint( aspect | Border | Metric, QVariant::fromValue( border ) );
|
||||
using A = QskAspect;
|
||||
setHint( aspect | A::Border | A::Metric, QVariant::fromValue( border ) );
|
||||
}
|
||||
|
||||
inline QskBoxBorderMetrics QskSkinHintTable::boxBorder( QskAspect::Aspect aspect ) const
|
||||
inline QskBoxBorderMetrics QskSkinHintTable::boxBorder( QskAspect aspect ) const
|
||||
{
|
||||
using namespace QskAspect;
|
||||
return hint( aspect | Border | Metric ).value< QskBoxBorderMetrics >();
|
||||
using A = QskAspect;
|
||||
return hint( aspect | A::Border | A::Metric ).value< QskBoxBorderMetrics >();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setBoxBorderColors(
|
||||
QskAspect::Aspect aspect, const QskBoxBorderColors& colors )
|
||||
QskAspect aspect, const QskBoxBorderColors& colors )
|
||||
{
|
||||
using namespace QskAspect;
|
||||
setHint( aspect | Border | Color, QVariant::fromValue( colors ) );
|
||||
using A = QskAspect;
|
||||
setHint( aspect | A::Border | A::Color, QVariant::fromValue( colors ) );
|
||||
}
|
||||
|
||||
inline QskBoxBorderColors QskSkinHintTable::boxBorderColors( QskAspect::Aspect aspect ) const
|
||||
inline QskBoxBorderColors QskSkinHintTable::boxBorderColors( QskAspect aspect ) const
|
||||
{
|
||||
using namespace QskAspect;
|
||||
return hint( aspect | Border | Color ).value< QskBoxBorderColors >();
|
||||
using A = QskAspect;
|
||||
return hint( aspect | A::Border | A::Color ).value< QskBoxBorderColors >();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setInterval(
|
||||
QskAspect::Aspect aspect, const QskIntervalF& interval )
|
||||
QskAspect aspect, const QskIntervalF& interval )
|
||||
{
|
||||
setHint( aspect | QskAspect::Metric, QVariant::fromValue( interval ) );
|
||||
}
|
||||
|
||||
inline QskIntervalF QskSkinHintTable::interval( QskAspect::Aspect aspect ) const
|
||||
inline QskIntervalF QskSkinHintTable::interval( QskAspect aspect ) const
|
||||
{
|
||||
return hint( aspect | QskAspect::Metric ).value< QskIntervalF >();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setSpacing( QskAspect::Aspect aspect, qreal spacing )
|
||||
inline void QskSkinHintTable::setSpacing( QskAspect aspect, qreal spacing )
|
||||
{
|
||||
setMetric( aspect | QskAspect::Spacing, spacing );
|
||||
}
|
||||
|
||||
inline qreal QskSkinHintTable::spacing( QskAspect::Aspect aspect ) const
|
||||
inline qreal QskSkinHintTable::spacing( QskAspect aspect ) const
|
||||
{
|
||||
return metric( aspect | QskAspect::Spacing );
|
||||
}
|
||||
|
||||
inline QskAnimationHint QskSkinHintTable::animation( QskAspect::Aspect aspect ) const
|
||||
inline QskAnimationHint QskSkinHintTable::animation( QskAspect aspect ) const
|
||||
{
|
||||
aspect.setAnimator( true );
|
||||
return hint( aspect ).value< QskAnimationHint >();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setGraphicRole( QskAspect::Aspect aspect, int role )
|
||||
inline void QskSkinHintTable::setGraphicRole( QskAspect aspect, int role )
|
||||
{
|
||||
setHint( aspect | QskAspect::GraphicRole, role );
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setFontRole( QskAspect::Aspect aspect, int role )
|
||||
inline void QskSkinHintTable::setFontRole( QskAspect aspect, int role )
|
||||
{
|
||||
setHint( aspect | QskAspect::FontRole, role );
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setAlignment(
|
||||
QskAspect::Aspect aspect, Qt::Alignment alignment )
|
||||
QskAspect aspect, Qt::Alignment alignment )
|
||||
{
|
||||
setFlagHint( aspect | QskAspect::Alignment, alignment );
|
||||
}
|
||||
|
||||
inline Qt::Alignment QskSkinHintTable::alignment( QskAspect::Aspect aspect ) const
|
||||
inline Qt::Alignment QskSkinHintTable::alignment( QskAspect aspect ) const
|
||||
{
|
||||
return hint( aspect | QskAspect::Alignment ).value< Qt::Alignment >();
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setFlagHint( QskAspect::Aspect aspect, int flag )
|
||||
inline void QskSkinHintTable::setFlagHint( QskAspect aspect, int flag )
|
||||
{
|
||||
setHint( aspect, QVariant( flag ) );
|
||||
}
|
||||
|
||||
inline void QskSkinHintTable::setAnimation(
|
||||
QskAspect::Aspect aspect, QskAnimationHint animation )
|
||||
QskAspect aspect, QskAnimationHint animation )
|
||||
{
|
||||
aspect.setAnimator( true );
|
||||
setHint( aspect, QVariant::fromValue( animation ) );
|
||||
|
|
|
@ -39,14 +39,14 @@ namespace
|
|||
public:
|
||||
AnimatorCandidate() = default;
|
||||
|
||||
inline AnimatorCandidate( QskAspect::Aspect aspect, QVariant from, QVariant to )
|
||||
inline AnimatorCandidate( QskAspect aspect, QVariant from, QVariant to )
|
||||
: aspect( aspect )
|
||||
, from( from )
|
||||
, to( to )
|
||||
{
|
||||
}
|
||||
|
||||
QskAspect::Aspect aspect;
|
||||
QskAspect aspect;
|
||||
QVariant from;
|
||||
QVariant to;
|
||||
};
|
||||
|
@ -198,7 +198,7 @@ namespace
|
|||
return false;
|
||||
}
|
||||
|
||||
inline QVariant animatedHint( QskAspect::Aspect aspect ) const
|
||||
inline QVariant animatedHint( QskAspect aspect ) const
|
||||
{
|
||||
auto it = m_hintAnimatorMap.find( aspect );
|
||||
if ( it != m_hintAnimatorMap.cend() )
|
||||
|
@ -388,7 +388,7 @@ namespace
|
|||
animator.setWindow( window );
|
||||
}
|
||||
|
||||
inline void storeUpdateInfo( QskControl* control, QskAspect::Aspect aspect )
|
||||
inline void storeUpdateInfo( QskControl* control, QskAspect aspect )
|
||||
{
|
||||
UpdateInfo info;
|
||||
info.control = control;
|
||||
|
@ -407,7 +407,7 @@ namespace
|
|||
}
|
||||
|
||||
QQuickWindow* m_window;
|
||||
std::unordered_map< QskAspect::Aspect, QskHintAnimator > m_hintAnimatorMap;
|
||||
std::unordered_map< QskAspect, QskHintAnimator > m_hintAnimatorMap;
|
||||
std::unordered_map< int, QskVariantAnimator > m_graphicFilterAnimatorMap;
|
||||
std::vector< UpdateInfo > m_updateInfos; // vector: for fast iteration
|
||||
};
|
||||
|
@ -656,7 +656,7 @@ bool QskSkinTransition::isRunning()
|
|||
}
|
||||
|
||||
QVariant QskSkinTransition::animatedHint(
|
||||
const QQuickWindow* window, QskAspect::Aspect aspect )
|
||||
const QQuickWindow* window, QskAspect aspect )
|
||||
{
|
||||
if ( qskSkinAnimator.exists() )
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ class QSK_EXPORT QskSkinTransition
|
|||
void process();
|
||||
|
||||
static bool isRunning();
|
||||
static QVariant animatedHint( const QQuickWindow*, QskAspect::Aspect );
|
||||
static QVariant animatedHint( const QQuickWindow*, QskAspect );
|
||||
static QVariant animatedGraphicFilter( const QQuickWindow*, int graphicRole );
|
||||
|
||||
protected:
|
||||
|
|
|
@ -40,8 +40,7 @@ static inline bool qskIsControl( const QskSkinnable* skinnable )
|
|||
}
|
||||
|
||||
static inline bool qskCompareResolvedStates(
|
||||
QskAspect::Aspect& aspect1, QskAspect::Aspect& aspect2,
|
||||
const QskSkinHintTable& table )
|
||||
QskAspect& aspect1, QskAspect& aspect2, const QskSkinHintTable& table )
|
||||
{
|
||||
if ( !table.hasStates() )
|
||||
return false;
|
||||
|
@ -112,54 +111,54 @@ static inline QVariant qskTypedNullValue( const QVariant& value )
|
|||
}
|
||||
|
||||
static inline void qskSetFlag( QskSkinnable* skinnable,
|
||||
const QskAspect::Aspect aspect, int flag )
|
||||
const QskAspect aspect, int flag )
|
||||
{
|
||||
skinnable->setSkinHint( aspect | QskAspect::Flag, QVariant( flag ) );
|
||||
}
|
||||
|
||||
static inline int qskFlag( const QskSkinnable* skinnable,
|
||||
const QskAspect::Aspect aspect, QskSkinHintStatus* status = nullptr )
|
||||
const QskAspect aspect, QskSkinHintStatus* status = nullptr )
|
||||
{
|
||||
return skinnable->effectiveSkinHint( aspect | QskAspect::Flag, status ).toInt();
|
||||
}
|
||||
|
||||
static inline void qskSetMetric( QskSkinnable* skinnable,
|
||||
const QskAspect::Aspect aspect, const QVariant& metric )
|
||||
const QskAspect aspect, const QVariant& metric )
|
||||
{
|
||||
skinnable->setSkinHint( aspect | QskAspect::Metric, metric );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
static inline void qskSetMetric( QskSkinnable* skinnable,
|
||||
QskAspect::Aspect aspect, const T& metric )
|
||||
QskAspect aspect, const T& metric )
|
||||
{
|
||||
qskSetMetric( skinnable, aspect, QVariant::fromValue( metric ) );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
static inline T qskMetric( const QskSkinnable* skinnable,
|
||||
QskAspect::Aspect aspect, QskSkinHintStatus* status = nullptr )
|
||||
QskAspect aspect, QskSkinHintStatus* status = nullptr )
|
||||
{
|
||||
return skinnable->effectiveSkinHint(
|
||||
aspect | QskAspect::Metric, status ).value< T >();
|
||||
}
|
||||
|
||||
static inline void qskSetColor( QskSkinnable* skinnable,
|
||||
const QskAspect::Aspect aspect, const QVariant& color )
|
||||
const QskAspect aspect, const QVariant& color )
|
||||
{
|
||||
skinnable->setSkinHint( aspect | QskAspect::Color, color );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
static inline void qskSetColor( QskSkinnable* skinnable,
|
||||
const QskAspect::Aspect aspect, const T& color )
|
||||
const QskAspect aspect, const T& color )
|
||||
{
|
||||
qskSetColor( skinnable, aspect, QVariant::fromValue( color ) );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
static inline T qskColor( const QskSkinnable* skinnable,
|
||||
QskAspect::Aspect aspect, QskSkinHintStatus* status = nullptr )
|
||||
QskAspect aspect, QskSkinHintStatus* status = nullptr )
|
||||
{
|
||||
return skinnable->effectiveSkinHint(
|
||||
aspect | QskAspect::Color, status ).value< T >();
|
||||
|
@ -249,243 +248,242 @@ const QskSkinHintTable& QskSkinnable::hintTable() const
|
|||
return m_data->hintTable;
|
||||
}
|
||||
|
||||
void QskSkinnable::setFlagHint( QskAspect::Aspect aspect, int flag )
|
||||
void QskSkinnable::setFlagHint( const QskAspect aspect, int flag )
|
||||
{
|
||||
qskSetFlag( this, aspect, flag );
|
||||
}
|
||||
|
||||
int QskSkinnable::flagHint( QskAspect::Aspect aspect ) const
|
||||
int QskSkinnable::flagHint( const QskAspect aspect ) const
|
||||
{
|
||||
return effectiveSkinHint( aspect ).toInt();
|
||||
}
|
||||
|
||||
void QskSkinnable::setAlignmentHint( QskAspect::Aspect aspect, Qt::Alignment alignment )
|
||||
void QskSkinnable::setAlignmentHint( const QskAspect aspect, Qt::Alignment alignment )
|
||||
{
|
||||
qskSetFlag( this, aspect | QskAspect::Alignment, alignment );
|
||||
}
|
||||
|
||||
bool QskSkinnable::resetAlignmentHint( QskAspect::Aspect aspect )
|
||||
bool QskSkinnable::resetAlignmentHint( const QskAspect aspect )
|
||||
{
|
||||
return resetFlagHint( aspect | QskAspect::Alignment );
|
||||
}
|
||||
|
||||
void QskSkinnable::setColor( QskAspect::Aspect aspect, const QColor& color )
|
||||
void QskSkinnable::setColor( const QskAspect aspect, const QColor& color )
|
||||
{
|
||||
qskSetColor( this, aspect, color );
|
||||
}
|
||||
|
||||
void QskSkinnable::setColor( QskAspect::Aspect aspect, Qt::GlobalColor color )
|
||||
void QskSkinnable::setColor( const QskAspect aspect, Qt::GlobalColor color )
|
||||
{
|
||||
qskSetColor( this, aspect, QColor( color ) );
|
||||
}
|
||||
|
||||
void QskSkinnable::setColor( QskAspect::Aspect aspect, QRgb rgb )
|
||||
void QskSkinnable::setColor( const QskAspect aspect, QRgb rgb )
|
||||
{
|
||||
qskSetColor( this, aspect, QColor::fromRgba( rgb ) );
|
||||
}
|
||||
|
||||
QColor QskSkinnable::color( QskAspect::Aspect aspect, QskSkinHintStatus* status ) const
|
||||
QColor QskSkinnable::color( const QskAspect aspect, QskSkinHintStatus* status ) const
|
||||
{
|
||||
return qskColor< QColor >( this, aspect, status );
|
||||
}
|
||||
|
||||
void QskSkinnable::setMetric( QskAspect::Aspect aspect, qreal metric )
|
||||
void QskSkinnable::setMetric( const QskAspect aspect, qreal metric )
|
||||
{
|
||||
qskSetMetric( this, aspect, metric );
|
||||
}
|
||||
|
||||
qreal QskSkinnable::metric( QskAspect::Aspect aspect, QskSkinHintStatus* status ) const
|
||||
qreal QskSkinnable::metric( const QskAspect aspect, QskSkinHintStatus* status ) const
|
||||
{
|
||||
return qskMetric< qreal >( this, aspect, status );
|
||||
}
|
||||
|
||||
void QskSkinnable::setStrutSizeHint(
|
||||
QskAspect::Aspect aspect, qreal width, qreal height )
|
||||
const QskAspect aspect, qreal width, qreal height )
|
||||
{
|
||||
qskSetMetric( this, aspect, QSizeF( width, height ) );
|
||||
}
|
||||
|
||||
void QskSkinnable::setStrutSizeHint( const QskAspect::Aspect aspect, const QSizeF& strut )
|
||||
void QskSkinnable::setStrutSizeHint( const QskAspect aspect, const QSizeF& strut )
|
||||
{
|
||||
qskSetMetric( this, aspect, strut );
|
||||
}
|
||||
|
||||
bool QskSkinnable::resetStrutSizeHint( const QskAspect::Aspect aspect )
|
||||
bool QskSkinnable::resetStrutSizeHint( const QskAspect aspect )
|
||||
{
|
||||
return resetMetric( aspect | QskAspect::StrutSize );
|
||||
}
|
||||
|
||||
QSizeF QskSkinnable::strutSizeHint(
|
||||
const QskAspect::Aspect aspect, QskSkinHintStatus* status ) const
|
||||
const QskAspect aspect, QskSkinHintStatus* status ) const
|
||||
{
|
||||
return qskMetric< QSizeF >( this, aspect | QskAspect::StrutSize, status );
|
||||
}
|
||||
|
||||
void QskSkinnable::setMarginHint( QskAspect::Aspect aspect, qreal margins )
|
||||
void QskSkinnable::setMarginHint( const QskAspect aspect, qreal margins )
|
||||
{
|
||||
qskSetMetric( this, aspect | QskAspect::Margin, QskMargins( margins ) );
|
||||
}
|
||||
|
||||
void QskSkinnable::setMarginHint( QskAspect::Aspect aspect, const QMarginsF& margins )
|
||||
void QskSkinnable::setMarginHint( const QskAspect aspect, const QMarginsF& margins )
|
||||
{
|
||||
qskSetMetric( this, aspect | QskAspect::Margin, QskMargins( margins ) );
|
||||
}
|
||||
|
||||
bool QskSkinnable::resetMarginHint( QskAspect::Aspect aspect )
|
||||
bool QskSkinnable::resetMarginHint( const QskAspect aspect )
|
||||
{
|
||||
return resetMetric( aspect | QskAspect::Margin );
|
||||
}
|
||||
|
||||
QMarginsF QskSkinnable::marginHint(
|
||||
QskAspect::Aspect aspect, QskSkinHintStatus* status ) const
|
||||
const QskAspect aspect, QskSkinHintStatus* status ) const
|
||||
{
|
||||
return qskMetric< QskMargins >( this, aspect | QskAspect::Margin, status );
|
||||
}
|
||||
|
||||
void QskSkinnable::setPaddingHint( QskAspect::Aspect aspect, qreal padding )
|
||||
void QskSkinnable::setPaddingHint( const QskAspect aspect, qreal padding )
|
||||
{
|
||||
qskSetMetric( this, aspect | QskAspect::Padding, QskMargins( padding ) );
|
||||
}
|
||||
|
||||
void QskSkinnable::setPaddingHint( QskAspect::Aspect aspect, const QMarginsF& padding )
|
||||
void QskSkinnable::setPaddingHint( const QskAspect aspect, const QMarginsF& padding )
|
||||
{
|
||||
qskSetMetric( this, aspect | QskAspect::Padding, QskMargins( padding ) );
|
||||
}
|
||||
|
||||
bool QskSkinnable::resetPaddingHint( QskAspect::Aspect aspect )
|
||||
bool QskSkinnable::resetPaddingHint( const QskAspect aspect )
|
||||
{
|
||||
return resetMetric( aspect | QskAspect::Padding );
|
||||
}
|
||||
|
||||
QMarginsF QskSkinnable::paddingHint(
|
||||
QskAspect::Aspect aspect, QskSkinHintStatus* status ) const
|
||||
const QskAspect aspect, QskSkinHintStatus* status ) const
|
||||
{
|
||||
return qskMetric< QskMargins >( this, aspect | QskAspect::Padding, status );
|
||||
}
|
||||
|
||||
void QskSkinnable::setGradientHint(
|
||||
QskAspect::Aspect aspect, const QskGradient& gradient )
|
||||
const QskAspect aspect, const QskGradient& gradient )
|
||||
{
|
||||
qskSetColor( this, aspect, gradient );
|
||||
}
|
||||
|
||||
QskGradient QskSkinnable::gradientHint(
|
||||
QskAspect::Aspect aspect, QskSkinHintStatus* status ) const
|
||||
const QskAspect aspect, QskSkinHintStatus* status ) const
|
||||
{
|
||||
return qskColor< QskGradient >( this, aspect, status );
|
||||
}
|
||||
|
||||
void QskSkinnable::setBoxShapeHint(
|
||||
QskAspect::Aspect aspect, const QskBoxShapeMetrics& shape )
|
||||
const QskAspect aspect, const QskBoxShapeMetrics& shape )
|
||||
{
|
||||
qskSetMetric( this, aspect | QskAspect::Shape, shape );
|
||||
}
|
||||
|
||||
bool QskSkinnable::resetBoxShapeHint( QskAspect::Aspect aspect )
|
||||
bool QskSkinnable::resetBoxShapeHint( const QskAspect aspect )
|
||||
{
|
||||
return resetMetric( aspect | QskAspect::Shape );
|
||||
}
|
||||
|
||||
QskBoxShapeMetrics QskSkinnable::boxShapeHint(
|
||||
QskAspect::Aspect aspect, QskSkinHintStatus* status ) const
|
||||
const QskAspect aspect, QskSkinHintStatus* status ) const
|
||||
{
|
||||
return qskMetric< QskBoxShapeMetrics >(
|
||||
this, aspect | QskAspect::Shape, status );
|
||||
}
|
||||
|
||||
void QskSkinnable::setBoxBorderMetricsHint(
|
||||
QskAspect::Aspect aspect, const QskBoxBorderMetrics& border )
|
||||
const QskAspect aspect, const QskBoxBorderMetrics& border )
|
||||
{
|
||||
qskSetMetric( this, aspect | QskAspect::Border, border );
|
||||
}
|
||||
|
||||
bool QskSkinnable::resetBoxBorderMetricsHint( QskAspect::Aspect aspect )
|
||||
bool QskSkinnable::resetBoxBorderMetricsHint( const QskAspect aspect )
|
||||
{
|
||||
return resetMetric( aspect | QskAspect::Border );
|
||||
}
|
||||
|
||||
QskBoxBorderMetrics QskSkinnable::boxBorderMetricsHint(
|
||||
QskAspect::Aspect aspect, QskSkinHintStatus* status ) const
|
||||
const QskAspect aspect, QskSkinHintStatus* status ) const
|
||||
{
|
||||
return qskMetric< QskBoxBorderMetrics >(
|
||||
this, aspect | QskAspect::Border, status );
|
||||
}
|
||||
|
||||
void QskSkinnable::setBoxBorderColorsHint(
|
||||
QskAspect::Aspect aspect, const QskBoxBorderColors& colors )
|
||||
const QskAspect aspect, const QskBoxBorderColors& colors )
|
||||
{
|
||||
qskSetColor( this, aspect | QskAspect::Border, colors );
|
||||
}
|
||||
|
||||
bool QskSkinnable::resetBoxBorderColorsHint( QskAspect::Aspect aspect )
|
||||
bool QskSkinnable::resetBoxBorderColorsHint( const QskAspect aspect )
|
||||
{
|
||||
return resetColor( aspect | QskAspect::Border );
|
||||
}
|
||||
|
||||
QskBoxBorderColors QskSkinnable::boxBorderColorsHint(
|
||||
QskAspect::Aspect aspect, QskSkinHintStatus* status ) const
|
||||
const QskAspect aspect, QskSkinHintStatus* status ) const
|
||||
{
|
||||
return qskColor< QskBoxBorderColors >(
|
||||
this, aspect | QskAspect::Border, status );
|
||||
}
|
||||
|
||||
void QskSkinnable::setIntervalHint(
|
||||
QskAspect::Aspect aspect, const QskIntervalF& interval )
|
||||
const QskAspect aspect, const QskIntervalF& interval )
|
||||
{
|
||||
qskSetMetric( this, aspect, interval );
|
||||
}
|
||||
|
||||
QskIntervalF QskSkinnable::intervalHint(
|
||||
QskAspect::Aspect aspect, QskSkinHintStatus* status ) const
|
||||
const QskAspect aspect, QskSkinHintStatus* status ) const
|
||||
{
|
||||
return qskMetric< QskIntervalF >( this, aspect, status );
|
||||
}
|
||||
|
||||
void QskSkinnable::setSpacingHint( QskAspect::Aspect aspect, qreal spacing )
|
||||
void QskSkinnable::setSpacingHint( const QskAspect aspect, qreal spacing )
|
||||
{
|
||||
qskSetMetric( this, aspect | QskAspect::Spacing, spacing );
|
||||
}
|
||||
|
||||
bool QskSkinnable::resetSpacingHint( QskAspect::Aspect aspect )
|
||||
bool QskSkinnable::resetSpacingHint( const QskAspect aspect )
|
||||
{
|
||||
return resetMetric( aspect | QskAspect::Spacing );
|
||||
}
|
||||
|
||||
qreal QskSkinnable::spacingHint(
|
||||
QskAspect::Aspect aspect, QskSkinHintStatus* status ) const
|
||||
const QskAspect aspect, QskSkinHintStatus* status ) const
|
||||
{
|
||||
return qskMetric< qreal >( this, aspect | QskAspect::Spacing, status );
|
||||
}
|
||||
|
||||
void QskSkinnable::setFontRole( QskAspect::Aspect aspect, int role )
|
||||
void QskSkinnable::setFontRole( const QskAspect aspect, int role )
|
||||
{
|
||||
qskSetFlag( this, aspect | QskAspect::FontRole, role );
|
||||
}
|
||||
|
||||
int QskSkinnable::fontRole(
|
||||
QskAspect::Aspect aspect, QskSkinHintStatus* status ) const
|
||||
const QskAspect aspect, QskSkinHintStatus* status ) const
|
||||
{
|
||||
return qskFlag( this, aspect | QskAspect::FontRole, status );
|
||||
}
|
||||
|
||||
QFont QskSkinnable::effectiveFont( QskAspect::Aspect aspect ) const
|
||||
QFont QskSkinnable::effectiveFont( const QskAspect aspect ) const
|
||||
{
|
||||
return effectiveSkin()->font( fontRole( aspect ) );
|
||||
}
|
||||
|
||||
void QskSkinnable::setGraphicRole( QskAspect::Aspect aspect, int role )
|
||||
void QskSkinnable::setGraphicRole( const QskAspect aspect, int role )
|
||||
{
|
||||
qskSetFlag( this, aspect | QskAspect::GraphicRole, role );
|
||||
}
|
||||
|
||||
int QskSkinnable::graphicRole(
|
||||
QskAspect::Aspect aspect, QskSkinHintStatus* status ) const
|
||||
const QskAspect aspect, QskSkinHintStatus* status ) const
|
||||
{
|
||||
return qskFlag( this, aspect | QskAspect::GraphicRole, status );
|
||||
}
|
||||
|
||||
QskColorFilter QskSkinnable::effectiveGraphicFilter(
|
||||
QskAspect::Aspect aspect ) const
|
||||
QskColorFilter QskSkinnable::effectiveGraphicFilter( QskAspect aspect ) const
|
||||
{
|
||||
aspect.setSubControl( effectiveSubcontrol( aspect.subControl() ) );
|
||||
aspect.setPlacement( effectivePlacement() );
|
||||
|
@ -530,13 +528,13 @@ QskColorFilter QskSkinnable::effectiveGraphicFilter(
|
|||
}
|
||||
|
||||
void QskSkinnable::setAnimationHint(
|
||||
QskAspect::Aspect aspect, QskAnimationHint animation )
|
||||
const QskAspect aspect, QskAnimationHint animation )
|
||||
{
|
||||
m_data->hintTable.setAnimation( aspect, animation );
|
||||
}
|
||||
|
||||
QskAnimationHint QskSkinnable::animationHint(
|
||||
QskAspect::Aspect aspect, QskSkinHintStatus* status ) const
|
||||
QskAspect aspect, QskSkinHintStatus* status ) const
|
||||
{
|
||||
aspect.setAnimator( true );
|
||||
return effectiveSkinHint( aspect, status ).value< QskAnimationHint >();
|
||||
|
@ -581,19 +579,19 @@ QskAnimationHint QskSkinnable::effectiveAnimation(
|
|||
if ( status )
|
||||
{
|
||||
status->source = QskSkinHintStatus::NoSource;
|
||||
status->aspect = QskAspect::Aspect();
|
||||
status->aspect = QskAspect();
|
||||
}
|
||||
|
||||
return hint;
|
||||
}
|
||||
|
||||
void QskSkinnable::setSkinHint( QskAspect::Aspect aspect, const QVariant& skinHint )
|
||||
void QskSkinnable::setSkinHint( QskAspect aspect, const QVariant& skinHint )
|
||||
{
|
||||
aspect.setSubControl( effectiveSubcontrol( aspect.subControl() ) );
|
||||
m_data->hintTable.setHint( aspect, skinHint );
|
||||
}
|
||||
|
||||
bool QskSkinnable::resetSkinHint( QskAspect::Aspect aspect )
|
||||
bool QskSkinnable::resetSkinHint( QskAspect aspect )
|
||||
{
|
||||
aspect.setSubControl( effectiveSubcontrol( aspect.subControl() ) );
|
||||
|
||||
|
@ -622,7 +620,7 @@ bool QskSkinnable::resetSkinHint( QskAspect::Aspect aspect )
|
|||
}
|
||||
|
||||
QVariant QskSkinnable::effectiveSkinHint(
|
||||
QskAspect::Aspect aspect, QskSkinHintStatus* status ) const
|
||||
QskAspect aspect, QskSkinHintStatus* status ) const
|
||||
{
|
||||
aspect.setSubControl( effectiveSubcontrol( aspect.subControl() ) );
|
||||
aspect.setPlacement( effectivePlacement() );
|
||||
|
@ -640,7 +638,7 @@ QVariant QskSkinnable::effectiveSkinHint(
|
|||
return storedHint( aspect, status );
|
||||
}
|
||||
|
||||
QskSkinHintStatus QskSkinnable::hintStatus( QskAspect::Aspect aspect ) const
|
||||
QskSkinHintStatus QskSkinnable::hintStatus( QskAspect aspect ) const
|
||||
{
|
||||
QskSkinHintStatus status;
|
||||
|
||||
|
@ -650,7 +648,7 @@ QskSkinHintStatus QskSkinnable::hintStatus( QskAspect::Aspect aspect ) const
|
|||
|
||||
|
||||
QVariant QskSkinnable::animatedValue(
|
||||
QskAspect::Aspect aspect, QskSkinHintStatus* status ) const
|
||||
QskAspect aspect, QskSkinHintStatus* status ) const
|
||||
{
|
||||
QVariant v;
|
||||
|
||||
|
@ -721,14 +719,14 @@ QVariant QskSkinnable::animatedValue(
|
|||
}
|
||||
|
||||
const QVariant& QskSkinnable::storedHint(
|
||||
QskAspect::Aspect aspect, QskSkinHintStatus* status ) const
|
||||
QskAspect aspect, QskSkinHintStatus* status ) const
|
||||
{
|
||||
const auto skin = effectiveSkin();
|
||||
|
||||
// clearing all state bits not being handled from the skin
|
||||
aspect.clearState( ~skin->stateMask() );
|
||||
|
||||
QskAspect::Aspect resolvedAspect;
|
||||
QskAspect resolvedAspect;
|
||||
|
||||
const auto& localTable = m_data->hintTable;
|
||||
if ( localTable.hasHints() )
|
||||
|
@ -795,7 +793,7 @@ const QVariant& QskSkinnable::storedHint(
|
|||
if ( status )
|
||||
{
|
||||
status->source = QskSkinHintStatus::NoSource;
|
||||
status->aspect = QskAspect::Aspect();
|
||||
status->aspect = QskAspect();
|
||||
}
|
||||
|
||||
static QVariant hintInvalid;
|
||||
|
@ -830,7 +828,7 @@ const char* QskSkinnable::skinStateAsPrintable( QskAspect::State state ) const
|
|||
}
|
||||
|
||||
static inline QskMargins qskEffectivePadding( const QskSkinnable* skinnable,
|
||||
QskAspect::Aspect aspect, const QSizeF& size, bool inner )
|
||||
QskAspect aspect, const QSizeF& size, bool inner )
|
||||
{
|
||||
const auto shape = skinnable->boxShapeHint( aspect ).toAbsolute( size );
|
||||
const auto borderMetrics = skinnable->boxBorderMetricsHint( aspect );
|
||||
|
@ -876,13 +874,13 @@ static inline QskMargins qskEffectivePadding( const QskSkinnable* skinnable,
|
|||
}
|
||||
|
||||
QMarginsF QskSkinnable::innerPadding(
|
||||
QskAspect::Aspect aspect, const QSizeF& outerBoxSize ) const
|
||||
QskAspect aspect, const QSizeF& outerBoxSize ) const
|
||||
{
|
||||
return qskEffectivePadding( this, aspect, outerBoxSize, true );
|
||||
}
|
||||
|
||||
QSizeF QskSkinnable::innerBoxSize(
|
||||
QskAspect::Aspect aspect, const QSizeF& outerBoxSize ) const
|
||||
QskAspect aspect, const QSizeF& outerBoxSize ) const
|
||||
{
|
||||
const auto pd = qskEffectivePadding( this, aspect, outerBoxSize, true );
|
||||
|
||||
|
@ -891,14 +889,14 @@ QSizeF QskSkinnable::innerBoxSize(
|
|||
}
|
||||
|
||||
QRectF QskSkinnable::innerBox(
|
||||
QskAspect::Aspect aspect, const QRectF& outerBox ) const
|
||||
QskAspect aspect, const QRectF& outerBox ) const
|
||||
{
|
||||
const auto pd = qskEffectivePadding( this, aspect, outerBox.size(), true );
|
||||
return outerBox.marginsRemoved( pd );
|
||||
}
|
||||
|
||||
QSizeF QskSkinnable::outerBoxSize(
|
||||
QskAspect::Aspect aspect, const QSizeF& innerBoxSize ) const
|
||||
QskAspect aspect, const QSizeF& innerBoxSize ) const
|
||||
{
|
||||
const auto pd = qskEffectivePadding( this, aspect, innerBoxSize, false );
|
||||
|
||||
|
@ -908,13 +906,13 @@ QSizeF QskSkinnable::outerBoxSize(
|
|||
}
|
||||
|
||||
QRectF QskSkinnable::outerBox(
|
||||
QskAspect::Aspect aspect, const QRectF& innerBox ) const
|
||||
QskAspect aspect, const QRectF& innerBox ) const
|
||||
{
|
||||
const auto m = qskEffectivePadding( this, aspect, innerBox.size(), false );
|
||||
return innerBox.marginsAdded( m );
|
||||
}
|
||||
|
||||
bool QskSkinnable::isTransitionAccepted( QskAspect::Aspect aspect ) const
|
||||
bool QskSkinnable::isTransitionAccepted( QskAspect aspect ) const
|
||||
{
|
||||
Q_UNUSED( aspect )
|
||||
|
||||
|
@ -929,14 +927,14 @@ bool QskSkinnable::isTransitionAccepted( QskAspect::Aspect aspect ) const
|
|||
return false;
|
||||
}
|
||||
|
||||
void QskSkinnable::startTransition( QskAspect::Aspect aspect,
|
||||
void QskSkinnable::startTransition( QskAspect aspect,
|
||||
QskAnimationHint animationHint, QVariant from, QVariant to )
|
||||
{
|
||||
aspect.setSubControl( effectiveSubcontrol( aspect.subControl() ) );
|
||||
startHintTransition( aspect, animationHint, from, to );
|
||||
}
|
||||
|
||||
void QskSkinnable::startHintTransition( QskAspect::Aspect aspect,
|
||||
void QskSkinnable::startHintTransition( QskAspect aspect,
|
||||
QskAnimationHint animationHint, QVariant from, QVariant to )
|
||||
{
|
||||
if ( animationHint.duration <= 0 || ( from == to ) )
|
||||
|
@ -1024,7 +1022,7 @@ void QskSkinnable::setSkinState( QskAspect::State newState, bool animated )
|
|||
}
|
||||
}
|
||||
|
||||
if ( control->window() && animated && isTransitionAccepted( QskAspect::Aspect() ) )
|
||||
if ( control->window() && animated && isTransitionAccepted( QskAspect() ) )
|
||||
{
|
||||
const auto placement = effectivePlacement();
|
||||
|
||||
|
@ -1075,7 +1073,7 @@ void QskSkinnable::setSkinState( QskAspect::State newState, bool animated )
|
|||
|
||||
if ( doTransition )
|
||||
{
|
||||
startTransition( aspect, hint,
|
||||
startHintTransition( aspect, hint,
|
||||
storedHint( a1 ), storedHint( a2 ) );
|
||||
}
|
||||
}
|
||||
|
@ -1129,7 +1127,7 @@ const QskControl* QskSkinnable::controlCast() const
|
|||
? static_cast< const QskControl* >( this ) : nullptr;
|
||||
}
|
||||
|
||||
void QskSkinnable::debug( QDebug debug, QskAspect::Aspect aspect ) const
|
||||
void QskSkinnable::debug( QDebug debug, QskAspect aspect ) const
|
||||
{
|
||||
qskDebugAspect( debug, metaObject(), aspect );
|
||||
}
|
||||
|
@ -1139,7 +1137,7 @@ void QskSkinnable::debug( QDebug debug, QskAspect::State state ) const
|
|||
qskDebugState( debug, metaObject(), state );
|
||||
}
|
||||
|
||||
void QskSkinnable::debug( QskAspect::Aspect aspect ) const
|
||||
void QskSkinnable::debug( QskAspect aspect ) const
|
||||
{
|
||||
qskDebugAspect( qDebug(), metaObject(), aspect );
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ class QSK_EXPORT QskSkinHintStatus
|
|||
}
|
||||
|
||||
Source source;
|
||||
QskAspect::Aspect aspect;
|
||||
QskAspect aspect;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
|
@ -76,103 +76,103 @@ class QSK_EXPORT QskSkinnable
|
|||
void setSkinlet( const QskSkinlet* skinlet );
|
||||
const QskSkinlet* skinlet() const;
|
||||
|
||||
void setColor( QskAspect::Aspect, Qt::GlobalColor );
|
||||
void setColor( QskAspect::Aspect, QRgb );
|
||||
void setColor( QskAspect::Aspect, const QColor& );
|
||||
bool resetColor( QskAspect::Aspect );
|
||||
QColor color( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
void setColor( QskAspect, Qt::GlobalColor );
|
||||
void setColor( QskAspect, QRgb );
|
||||
void setColor( QskAspect, const QColor& );
|
||||
bool resetColor( QskAspect );
|
||||
QColor color( QskAspect, QskSkinHintStatus* = nullptr ) const;
|
||||
|
||||
void setMetric( QskAspect::Aspect, qreal metric );
|
||||
bool resetMetric( QskAspect::Aspect );
|
||||
qreal metric( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
void setMetric( QskAspect, qreal metric );
|
||||
bool resetMetric( QskAspect );
|
||||
qreal metric( QskAspect, QskSkinHintStatus* = nullptr ) const;
|
||||
|
||||
void setFlagHint( QskAspect::Aspect, int flag );
|
||||
bool resetFlagHint( QskAspect::Aspect );
|
||||
int flagHint( QskAspect::Aspect ) const;
|
||||
template< typename T > T flagHint( QskAspect::Aspect, T = T() ) const;
|
||||
void setFlagHint( QskAspect, int flag );
|
||||
bool resetFlagHint( QskAspect );
|
||||
int flagHint( QskAspect ) const;
|
||||
template< typename T > T flagHint( QskAspect, T = T() ) const;
|
||||
|
||||
void setStrutSizeHint( QskAspect::Aspect, const QSizeF& );
|
||||
void setStrutSizeHint( QskAspect::Aspect, qreal width, qreal height );
|
||||
bool resetStrutSizeHint( QskAspect::Aspect );
|
||||
QSizeF strutSizeHint( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
void setStrutSizeHint( QskAspect, const QSizeF& );
|
||||
void setStrutSizeHint( QskAspect, qreal width, qreal height );
|
||||
bool resetStrutSizeHint( QskAspect );
|
||||
QSizeF strutSizeHint( QskAspect, QskSkinHintStatus* = nullptr ) const;
|
||||
|
||||
void setMarginHint( QskAspect::Aspect, qreal );
|
||||
void setMarginHint( QskAspect::Aspect, const QMarginsF& );
|
||||
bool resetMarginHint( QskAspect::Aspect );
|
||||
QMarginsF marginHint( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
void setMarginHint( QskAspect, qreal );
|
||||
void setMarginHint( QskAspect, const QMarginsF& );
|
||||
bool resetMarginHint( QskAspect );
|
||||
QMarginsF marginHint( QskAspect, QskSkinHintStatus* = nullptr ) const;
|
||||
|
||||
void setPaddingHint( QskAspect::Aspect, qreal );
|
||||
void setPaddingHint( QskAspect::Aspect, const QMarginsF& );
|
||||
bool resetPaddingHint( QskAspect::Aspect );
|
||||
QMarginsF paddingHint( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
void setPaddingHint( QskAspect, qreal );
|
||||
void setPaddingHint( QskAspect, const QMarginsF& );
|
||||
bool resetPaddingHint( QskAspect );
|
||||
QMarginsF paddingHint( QskAspect, QskSkinHintStatus* = nullptr ) const;
|
||||
|
||||
void setGradientHint( QskAspect::Aspect, const QskGradient& );
|
||||
QskGradient gradientHint( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
void setGradientHint( QskAspect, const QskGradient& );
|
||||
QskGradient gradientHint( QskAspect, QskSkinHintStatus* = nullptr ) const;
|
||||
|
||||
void setBoxShapeHint( QskAspect::Aspect, const QskBoxShapeMetrics& );
|
||||
bool resetBoxShapeHint( QskAspect::Aspect );
|
||||
QskBoxShapeMetrics boxShapeHint( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
void setBoxShapeHint( QskAspect, const QskBoxShapeMetrics& );
|
||||
bool resetBoxShapeHint( QskAspect );
|
||||
QskBoxShapeMetrics boxShapeHint( QskAspect, QskSkinHintStatus* = nullptr ) const;
|
||||
|
||||
void setBoxBorderMetricsHint( QskAspect::Aspect, const QskBoxBorderMetrics& );
|
||||
bool resetBoxBorderMetricsHint( QskAspect::Aspect );
|
||||
void setBoxBorderMetricsHint( QskAspect, const QskBoxBorderMetrics& );
|
||||
bool resetBoxBorderMetricsHint( QskAspect );
|
||||
QskBoxBorderMetrics boxBorderMetricsHint(
|
||||
QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
QskAspect, QskSkinHintStatus* = nullptr ) const;
|
||||
|
||||
void setBoxBorderColorsHint( QskAspect::Aspect, const QskBoxBorderColors& );
|
||||
bool resetBoxBorderColorsHint( QskAspect::Aspect );
|
||||
QskBoxBorderColors boxBorderColorsHint( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
void setBoxBorderColorsHint( QskAspect, const QskBoxBorderColors& );
|
||||
bool resetBoxBorderColorsHint( QskAspect );
|
||||
QskBoxBorderColors boxBorderColorsHint( QskAspect, QskSkinHintStatus* = nullptr ) const;
|
||||
|
||||
void setIntervalHint( QskAspect::Aspect, const QskIntervalF& );
|
||||
QskIntervalF intervalHint( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
void setIntervalHint( QskAspect, const QskIntervalF& );
|
||||
QskIntervalF intervalHint( QskAspect, QskSkinHintStatus* = nullptr ) const;
|
||||
|
||||
void setSpacingHint( QskAspect::Aspect, qreal );
|
||||
bool resetSpacingHint( QskAspect::Aspect );
|
||||
qreal spacingHint( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
void setSpacingHint( QskAspect, qreal );
|
||||
bool resetSpacingHint( QskAspect );
|
||||
qreal spacingHint( QskAspect, QskSkinHintStatus* = nullptr ) const;
|
||||
|
||||
void setAlignmentHint( QskAspect::Aspect, Qt::Alignment );
|
||||
bool resetAlignmentHint( QskAspect::Aspect );
|
||||
Qt::Alignment alignmentHint( QskAspect::Aspect, Qt::Alignment = Qt::Alignment() ) const;
|
||||
void setAlignmentHint( QskAspect, Qt::Alignment );
|
||||
bool resetAlignmentHint( QskAspect );
|
||||
Qt::Alignment alignmentHint( QskAspect, Qt::Alignment = Qt::Alignment() ) const;
|
||||
|
||||
void setFontRole( QskAspect::Aspect, int role );
|
||||
int fontRole( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
void setFontRole( QskAspect, int role );
|
||||
int fontRole( QskAspect, QskSkinHintStatus* = nullptr ) const;
|
||||
|
||||
QFont effectiveFont( QskAspect::Aspect ) const;
|
||||
QFont effectiveFont( QskAspect ) const;
|
||||
|
||||
void setGraphicRole( QskAspect::Aspect, int role );
|
||||
int graphicRole( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
void setGraphicRole( QskAspect, int role );
|
||||
int graphicRole( QskAspect, QskSkinHintStatus* = nullptr ) const;
|
||||
|
||||
QskColorFilter effectiveGraphicFilter( QskAspect::Aspect ) const;
|
||||
QskColorFilter effectiveGraphicFilter( QskAspect ) const;
|
||||
|
||||
void setAnimationHint( QskAspect::Aspect, QskAnimationHint );
|
||||
QskAnimationHint animationHint( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
void setAnimationHint( QskAspect, QskAnimationHint );
|
||||
QskAnimationHint animationHint( QskAspect, QskSkinHintStatus* = nullptr ) const;
|
||||
|
||||
void setSkinHint( QskAspect::Aspect, const QVariant& );
|
||||
bool resetSkinHint( QskAspect::Aspect );
|
||||
void setSkinHint( QskAspect, const QVariant& );
|
||||
bool resetSkinHint( QskAspect );
|
||||
|
||||
QskAnimationHint effectiveAnimation( QskAspect::Type, QskAspect::Subcontrol,
|
||||
QskAspect::State, QskSkinHintStatus* status = nullptr ) const;
|
||||
|
||||
QVariant effectiveSkinHint( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
QVariant effectiveSkinHint( QskAspect, QskSkinHintStatus* = nullptr ) const;
|
||||
virtual QskAspect::Placement effectivePlacement() const;
|
||||
|
||||
QskSkinHintStatus hintStatus( QskAspect::Aspect ) const;
|
||||
QskSkinHintStatus hintStatus( QskAspect ) const;
|
||||
|
||||
QskAspect::State skinState() const;
|
||||
const char* skinStateAsPrintable() const;
|
||||
const char* skinStateAsPrintable( QskAspect::State ) const;
|
||||
|
||||
QSizeF outerBoxSize( QskAspect::Aspect, const QSizeF& innerBoxSize ) const;
|
||||
QSizeF innerBoxSize( QskAspect::Aspect, const QSizeF& outerBoxSize ) const;
|
||||
QSizeF outerBoxSize( QskAspect, const QSizeF& innerBoxSize ) const;
|
||||
QSizeF innerBoxSize( QskAspect, const QSizeF& outerBoxSize ) const;
|
||||
|
||||
QRectF innerBox( QskAspect::Aspect, const QRectF& outerBox ) const;
|
||||
QRectF outerBox( QskAspect::Aspect, const QRectF& innerBox ) const;
|
||||
QRectF innerBox( QskAspect, const QRectF& outerBox ) const;
|
||||
QRectF outerBox( QskAspect, const QRectF& innerBox ) const;
|
||||
|
||||
QMarginsF innerPadding( QskAspect::Aspect, const QSizeF& ) const;
|
||||
QMarginsF innerPadding( QskAspect, const QSizeF& ) const;
|
||||
|
||||
const QskSkinlet* effectiveSkinlet() const;
|
||||
QskSkin* effectiveSkin() const;
|
||||
|
||||
void startTransition( QskAspect::Aspect,
|
||||
void startTransition( QskAspect,
|
||||
QskAnimationHint, QVariant from, QVariant to );
|
||||
|
||||
virtual QskAspect::Subcontrol effectiveSubcontrol( QskAspect::Subcontrol ) const;
|
||||
|
@ -183,9 +183,9 @@ class QSK_EXPORT QskSkinnable
|
|||
virtual QskControl* owningControl() const = 0;
|
||||
virtual const QMetaObject* metaObject() const = 0;
|
||||
|
||||
void debug( QskAspect::Aspect ) const;
|
||||
void debug( QskAspect ) const;
|
||||
void debug( QskAspect::State ) const;
|
||||
void debug( QDebug, QskAspect::Aspect ) const;
|
||||
void debug( QDebug, QskAspect ) const;
|
||||
void debug( QDebug, QskAspect::State ) const;
|
||||
|
||||
void setSkinState( QskAspect::State, bool animated = true );
|
||||
|
@ -193,24 +193,24 @@ class QSK_EXPORT QskSkinnable
|
|||
|
||||
protected:
|
||||
virtual void updateNode( QSGNode* );
|
||||
virtual bool isTransitionAccepted( QskAspect::Aspect ) const;
|
||||
virtual bool isTransitionAccepted( QskAspect ) const;
|
||||
|
||||
QskSkinHintTable& hintTable();
|
||||
const QskSkinHintTable& hintTable() const;
|
||||
|
||||
private:
|
||||
void startHintTransition( QskAspect::Aspect,
|
||||
void startHintTransition( QskAspect,
|
||||
QskAnimationHint, QVariant from, QVariant to );
|
||||
|
||||
QVariant animatedValue( QskAspect::Aspect, QskSkinHintStatus* ) const;
|
||||
const QVariant& storedHint( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
QVariant animatedValue( QskAspect, QskSkinHintStatus* ) const;
|
||||
const QVariant& storedHint( QskAspect, QskSkinHintStatus* = nullptr ) const;
|
||||
|
||||
class PrivateData;
|
||||
std::unique_ptr< PrivateData > m_data;
|
||||
};
|
||||
|
||||
template< typename T >
|
||||
inline T QskSkinnable::flagHint( QskAspect::Aspect aspect, T defaultValue ) const
|
||||
inline T QskSkinnable::flagHint( QskAspect aspect, T defaultValue ) const
|
||||
{
|
||||
const auto& hint = effectiveSkinHint( aspect );
|
||||
if ( hint.isValid() && hint.canConvert< int >() )
|
||||
|
@ -220,22 +220,22 @@ inline T QskSkinnable::flagHint( QskAspect::Aspect aspect, T defaultValue ) cons
|
|||
}
|
||||
|
||||
inline Qt::Alignment QskSkinnable::alignmentHint(
|
||||
QskAspect::Aspect aspect, Qt::Alignment defaultAlignment ) const
|
||||
QskAspect aspect, Qt::Alignment defaultAlignment ) const
|
||||
{
|
||||
return flagHint< Qt::Alignment >( aspect | QskAspect::Alignment, defaultAlignment );
|
||||
}
|
||||
|
||||
inline bool QskSkinnable::resetColor( QskAspect::Aspect aspect )
|
||||
inline bool QskSkinnable::resetColor( QskAspect aspect )
|
||||
{
|
||||
return resetSkinHint( aspect | QskAspect::Color );
|
||||
}
|
||||
|
||||
inline bool QskSkinnable::resetMetric( QskAspect::Aspect aspect )
|
||||
inline bool QskSkinnable::resetMetric( QskAspect aspect )
|
||||
{
|
||||
return resetSkinHint( aspect | QskAspect::Metric );
|
||||
}
|
||||
|
||||
inline bool QskSkinnable::resetFlagHint( QskAspect::Aspect aspect )
|
||||
inline bool QskSkinnable::resetFlagHint( QskAspect aspect )
|
||||
{
|
||||
return resetSkinHint( aspect | QskAspect::Flag );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue