usig QskSkinHintTableEditor
This commit is contained in:
parent
c48fcbffd3
commit
b8bbd3a135
|
@ -12,6 +12,9 @@
|
|||
#include <QskGradient.h>
|
||||
#include <QskRgbValue.h>
|
||||
|
||||
#include <QskSkinHintTable.h>
|
||||
#include <QskSkinHintTableEditor.h>
|
||||
|
||||
QSK_SUBCONTROL( CustomSlider, Scale )
|
||||
QSK_SUBCONTROL( CustomSlider, Decoration )
|
||||
|
||||
|
@ -20,19 +23,21 @@ CustomSlider::CustomSlider( QQuickItem* parentItem )
|
|||
{
|
||||
using namespace QskRgb;
|
||||
|
||||
setBoxShapeHint( Fill, 0 );
|
||||
setGradientHint( Fill, Grey700 );
|
||||
setColor( Scale, qRgb( 178, 178, 178 ) ); // for the ticks
|
||||
QskSkinHintTableEditor ed( &hintTable() );
|
||||
|
||||
setStrutSizeHint( Handle, 80, 80 );
|
||||
setColor( Handle, Grey800 );
|
||||
ed.setBoxShape( Fill, 0 );
|
||||
ed.setGradient( Fill, Grey700 );
|
||||
ed.setColor( Scale, qRgb( 178, 178, 178 ) ); // for the ticks
|
||||
|
||||
ed.setStrutSize( Handle, 80, 80 );
|
||||
ed.setColor( Handle, Grey800 );
|
||||
|
||||
for ( auto state : { Pressed, Focused | Hovered, Hovered, Focused } )
|
||||
setColor( Handle | state, Orange600 );
|
||||
ed.setColor( Handle | state, Orange600 );
|
||||
|
||||
setAnimationHint( Handle | QskAspect::Color, 1000 );
|
||||
ed.setAnimation( Handle | QskAspect::Color, 1000 );
|
||||
for ( auto state : { Focused | Hovered, Hovered, Focused } )
|
||||
setAnimationHint( Handle | QskAspect::Color | state, 300 );
|
||||
ed.setAnimation( Handle | QskAspect::Color | state, 300 );
|
||||
|
||||
// using an individual skinlet, not known by the skin
|
||||
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskBoxBorderColors.h>
|
||||
|
||||
#include <QskSkinHintTable.h>
|
||||
#include <QskSkinHintTableEditor.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
OtherSlider::OtherSlider( QQuickItem* parentItem )
|
||||
|
@ -23,22 +26,24 @@ OtherSlider::OtherSlider( QQuickItem* parentItem )
|
|||
const qreal w = 2.0 * h;
|
||||
const qreal paddingW = 0.5 * w + 1;
|
||||
|
||||
QskSkinHintTableEditor ed( &hintTable() );
|
||||
|
||||
// Panel
|
||||
|
||||
for ( auto placement : { A::Horizontal, A::Vertical } )
|
||||
{
|
||||
const auto aspect = Panel | placement;
|
||||
|
||||
setMetric( aspect | A::Size, h );
|
||||
setBoxShapeHint( aspect, 4 );
|
||||
setBoxBorderMetricsHint( aspect, 1 );
|
||||
setBoxBorderColorsHint( aspect, Grey900 );
|
||||
setGradientHint( aspect, Grey400 );
|
||||
ed.setMetric( aspect | A::Size, h );
|
||||
ed.setBoxShape( aspect, 4 );
|
||||
ed.setBoxBorderMetrics( aspect, 1 );
|
||||
ed.setBoxBorderColors( aspect, Grey900 );
|
||||
ed.setGradient( aspect, Grey400 );
|
||||
|
||||
if ( placement == A::Horizontal )
|
||||
setPaddingHint( aspect, QskMargins( paddingW, 0 ) );
|
||||
ed.setPadding( aspect, QskMargins( paddingW, 0 ) );
|
||||
else
|
||||
setPaddingHint( aspect, QskMargins( 0, paddingW ) );
|
||||
ed.setPadding( aspect, QskMargins( 0, paddingW ) );
|
||||
}
|
||||
|
||||
// Groove
|
||||
|
@ -47,18 +52,18 @@ OtherSlider::OtherSlider( QQuickItem* parentItem )
|
|||
{
|
||||
const auto aspect = Groove | placement;
|
||||
|
||||
setMetric( aspect | A::Size, 4 );
|
||||
setBoxBorderMetricsHint( aspect, 0 );
|
||||
setBoxShapeHint( aspect, 1 );
|
||||
ed.setMetric( aspect | A::Size, 4 );
|
||||
ed.setBoxBorderMetrics( aspect, 0 );
|
||||
ed.setBoxShape( aspect, 1 );
|
||||
|
||||
setGradientHint( aspect, Qt::black );
|
||||
ed.setGradient( aspect, Qt::black );
|
||||
}
|
||||
|
||||
// no Fill
|
||||
for ( auto placement : { A::Horizontal, A::Vertical } )
|
||||
{
|
||||
const auto aspect = Fill | placement;
|
||||
setMetric( aspect | A::Size, 0 );
|
||||
ed.setMetric( aspect | A::Size, 0 );
|
||||
}
|
||||
|
||||
// Handle
|
||||
|
@ -67,20 +72,20 @@ OtherSlider::OtherSlider( QQuickItem* parentItem )
|
|||
{
|
||||
const auto aspect = Handle | placement;
|
||||
|
||||
setBoxBorderMetricsHint( aspect, 1 );
|
||||
setBoxShapeHint( aspect, 4 );
|
||||
ed.setBoxBorderMetrics( aspect, 1 );
|
||||
ed.setBoxShape( aspect, 4 );
|
||||
|
||||
const qreal m = 0.5 * std::ceil( 0.5 * ( w - h ) ) + 1;
|
||||
|
||||
if ( placement == A::Horizontal )
|
||||
setMarginHint( aspect, QskMargins( -m, 0 ) );
|
||||
ed.setMargin( aspect, QskMargins( -m, 0 ) );
|
||||
else
|
||||
setMarginHint( aspect, QskMargins( 0, -m ) );
|
||||
ed.setMargin( aspect, QskMargins( 0, -m ) );
|
||||
|
||||
for ( auto state : { A::NoState, Pressed } )
|
||||
{
|
||||
setBoxBorderColorsHint( aspect | state, Grey600 );
|
||||
setGradientHint( aspect | state, Blue400 );
|
||||
ed.setBoxBorderColors( aspect | state, Grey600 );
|
||||
ed.setGradient( aspect | state, Blue400 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue