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