cleanup og the the skinHint retrieving
This commit is contained in:
parent
1adcce7347
commit
3c40903ea9
|
@ -43,19 +43,18 @@ public:
|
|||
using namespace QskAspect;
|
||||
|
||||
const QskAspect::Aspect aspectRole = QskGraphicLabel::Graphic | GraphicRole;
|
||||
const int oldRole = graphicRole( aspectRole );
|
||||
|
||||
const QVariant oldRole = storedSkinHint( aspectRole );
|
||||
|
||||
QRgb rgb;
|
||||
QColor color;
|
||||
if ( on )
|
||||
{
|
||||
rgb = qRgb( 40, 40, 40 );
|
||||
setFlagHint( aspectRole, Inverted );
|
||||
color.setRgb( 40, 40, 40 );
|
||||
setGraphicRole( aspectRole, Inverted );
|
||||
}
|
||||
else
|
||||
{
|
||||
rgb = qRgb( 255, 228, 181 );
|
||||
setFlagHint( aspectRole, Normal );
|
||||
color.setRgb( 255, 228, 181 );
|
||||
setGraphicRole( aspectRole, Normal );
|
||||
}
|
||||
|
||||
const int duration = 500;
|
||||
|
@ -64,12 +63,12 @@ public:
|
|||
{
|
||||
const Aspect aspectColor = Control | Color | Background | edge;
|
||||
|
||||
const auto oldColor = storedSkinHint( aspectColor );
|
||||
setColor( aspectColor, rgb );
|
||||
startTransition( aspectColor, duration, oldColor, storedSkinHint( aspectColor ) );
|
||||
const auto oldColor = effectiveHint( aspectColor );
|
||||
setColor( aspectColor, color );
|
||||
startTransition( aspectColor, duration, oldColor, color );
|
||||
}
|
||||
|
||||
startTransition( aspectRole, duration, oldRole, storedSkinHint( aspectRole ) );
|
||||
startTransition( aspectRole, duration, oldRole, graphicRole( aspectRole ) );
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -299,7 +299,7 @@ QskColorFilter QskSkinnable::effectiveGraphicFilter(
|
|||
#if 1
|
||||
QskSkinHintStatus status;
|
||||
|
||||
const QVariant hint = storedSkinHint( aspect | skinState(), &status );
|
||||
const QVariant hint = storedHint( aspect | skinState(), &status );
|
||||
if ( status.isValid() )
|
||||
{
|
||||
// we need to know about how the aspect gets resolved
|
||||
|
@ -393,7 +393,7 @@ QVariant QskSkinnable::effectiveHint(
|
|||
aspect.setSubControl( effectiveSubcontrol( aspect.subControl() ) );
|
||||
|
||||
if ( aspect.isAnimator() )
|
||||
return storedSkinHint( aspect, status );
|
||||
return storedHint( aspect, status );
|
||||
|
||||
const QVariant v = animatedValue( aspect, status );
|
||||
if ( v.isValid() )
|
||||
|
@ -402,7 +402,7 @@ QVariant QskSkinnable::effectiveHint(
|
|||
if ( aspect.state() == QskAspect::NoState )
|
||||
aspect = aspect | skinState();
|
||||
|
||||
return storedSkinHint( aspect, status );
|
||||
return storedHint( aspect, status );
|
||||
}
|
||||
|
||||
QskSkinHintStatus QskSkinnable::hintStatus( QskAspect::Aspect aspect ) const
|
||||
|
@ -469,7 +469,7 @@ void QskSkinnable::removeSkinHint( QskAspect::Aspect aspect )
|
|||
m_data->skinHints->erase( aspect );
|
||||
}
|
||||
|
||||
const QVariant& QskSkinnable::storedSkinHint(
|
||||
const QVariant& QskSkinnable::storedHint(
|
||||
QskAspect::Aspect aspect, QskSkinHintStatus* status ) const
|
||||
{
|
||||
const auto skin = effectiveSkin();
|
||||
|
@ -722,15 +722,15 @@ void QskSkinnable::startTransition( QskAspect::Aspect aspect,
|
|||
void QskSkinnable::startTransition( QskAspect::Aspect aspect,
|
||||
QskAspect::State oldState, QskAspect::State newState )
|
||||
{
|
||||
const auto animationHint = storedSkinHint( aspect ).value< QskAnimationHint >();
|
||||
const auto animationHint = storedHint( aspect ).value< QskAnimationHint >();
|
||||
if ( animationHint.duration <= 0 )
|
||||
return;
|
||||
|
||||
aspect.clearStates();
|
||||
aspect.setAnimator( false );
|
||||
|
||||
const auto from = storedSkinHint( aspect | oldState, nullptr );
|
||||
const auto to = storedSkinHint( aspect | newState, nullptr );
|
||||
const auto from = storedHint( aspect | oldState, nullptr );
|
||||
const auto to = storedHint( aspect | newState, nullptr );
|
||||
|
||||
startTransition( aspect, animationHint, from, to );
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
|
||||
void removeSkinHint( QskAspect::Aspect );
|
||||
|
||||
const QVariant& storedSkinHint( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
QVariant effectiveHint( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
|
||||
QskSkinHintStatus hintStatus( QskAspect::Aspect ) const;
|
||||
|
||||
|
@ -136,10 +136,10 @@ protected:
|
|||
|
||||
private:
|
||||
void setSkinHint( QskAspect::Aspect, const QVariant& );
|
||||
QVariant effectiveHint( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
|
||||
void startTransition( QskAspect::Aspect, QskAspect::State, QskAspect::State );
|
||||
QVariant animatedValue( QskAspect::Aspect, QskSkinHintStatus* ) const;
|
||||
const QVariant& storedHint( QskAspect::Aspect, QskSkinHintStatus* = nullptr ) const;
|
||||
|
||||
class PrivateData;
|
||||
std::unique_ptr< PrivateData > m_data;
|
||||
|
|
|
@ -228,9 +228,10 @@ void QskSlider::updatePosition()
|
|||
|
||||
if ( animation.duration > 0 )
|
||||
{
|
||||
const QVariant hint = storedSkinHint( aspect );
|
||||
const qreal oldPos = metric( aspect );
|
||||
setMetric( aspect, pos );
|
||||
startTransition( aspect, animation, hint, QVariant( pos ) );
|
||||
|
||||
startTransition( aspect, animation, oldPos, pos );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue