code moved to QskSkinHintTable
This commit is contained in:
parent
5ecec7892e
commit
1a3058fad8
@ -227,3 +227,69 @@ void QskSkinHintTable::setAnimation(
|
||||
aspect.setAnimator( true );
|
||||
setHint( aspect, animation );
|
||||
}
|
||||
|
||||
bool QskSkinHintTable::isResolutionMatching(
|
||||
QskAspect aspect1, QskAspect aspect2 ) const
|
||||
{
|
||||
if ( aspect1 == aspect2 )
|
||||
return true;
|
||||
|
||||
if ( aspect1.trunk() != aspect2.trunk() )
|
||||
return false;
|
||||
|
||||
if ( !hasStates() )
|
||||
return false;
|
||||
|
||||
const auto a1 = aspect1;
|
||||
const auto a2 = aspect2;
|
||||
|
||||
Q_FOREVER
|
||||
{
|
||||
const auto s1 = aspect1.topState();
|
||||
const auto s2 = aspect2.topState();
|
||||
|
||||
if ( s1 > s2 )
|
||||
{
|
||||
if ( hasHint( aspect1 ) )
|
||||
return false;
|
||||
|
||||
aspect1.clearState( s1 );
|
||||
}
|
||||
else if ( s2 > s1 )
|
||||
{
|
||||
if ( hasHint( aspect2 ) )
|
||||
return false;
|
||||
|
||||
aspect2.clearState( s2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( aspect1 == aspect2 )
|
||||
{
|
||||
if ( hasHint( aspect1 ) )
|
||||
return true;
|
||||
|
||||
if ( s1 == 0 )
|
||||
{
|
||||
if ( aspect1.placement() == QskAspect::NoPlacement )
|
||||
return true;
|
||||
|
||||
// clear the placement bits and restart with the initial state
|
||||
aspect1 = a1;
|
||||
aspect1.setPlacement( QskAspect::NoPlacement );
|
||||
|
||||
aspect2 = a2;
|
||||
aspect2.setPlacement( QskAspect::NoPlacement );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( hasHint( aspect1 ) || hasHint( aspect2 ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
aspect1.clearState( s1 );
|
||||
aspect2.clearState( s2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,6 +53,8 @@ class QSK_EXPORT QskSkinHintTable
|
||||
QskAspect resolvedAnimator(
|
||||
QskAspect, QskAnimationHint& ) const;
|
||||
|
||||
bool isResolutionMatching( QskAspect, QskAspect ) const;
|
||||
|
||||
private:
|
||||
static const QVariant invalidHint;
|
||||
|
||||
|
@ -44,66 +44,6 @@ static inline bool qskIsControl( const QskSkinnable* skinnable )
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool qskCompareResolvedStates(
|
||||
QskAspect& aspect1, QskAspect& aspect2, const QskSkinHintTable& table )
|
||||
{
|
||||
if ( !table.hasStates() )
|
||||
return false;
|
||||
|
||||
const auto a1 = aspect1;
|
||||
const auto a2 = aspect2;
|
||||
|
||||
Q_FOREVER
|
||||
{
|
||||
const auto s1 = aspect1.topState();
|
||||
const auto s2 = aspect2.topState();
|
||||
|
||||
if ( s1 > s2 )
|
||||
{
|
||||
if ( table.hasHint( aspect1 ) )
|
||||
return false;
|
||||
|
||||
aspect1.clearState( s1 );
|
||||
}
|
||||
else if ( s2 > s1 )
|
||||
{
|
||||
if ( table.hasHint( aspect2 ) )
|
||||
return false;
|
||||
|
||||
aspect2.clearState( s2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( aspect1 == aspect2 )
|
||||
{
|
||||
if ( table.hasHint( aspect1 ) )
|
||||
return true;
|
||||
|
||||
if ( s1 == 0 )
|
||||
{
|
||||
if ( aspect1.placement() == QskAspect::NoPlacement )
|
||||
return true;
|
||||
|
||||
// clear the placement bits and restart with the initial state
|
||||
aspect1 = a1;
|
||||
aspect1.setPlacement( QskAspect::NoPlacement );
|
||||
|
||||
aspect2 = a2;
|
||||
aspect2.setPlacement( QskAspect::NoPlacement );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( table.hasHint( aspect1 ) || table.hasHint( aspect2 ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
aspect1.clearState( s1 );
|
||||
aspect2.clearState( s2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline QVariant qskTypedNullValue( const QVariant& value )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
|
||||
@ -1062,7 +1002,7 @@ void QskSkinnable::setSkinState( QskAspect::State newState, bool animated )
|
||||
for skinnables with many state bits.
|
||||
|
||||
*/
|
||||
doTransition = !qskCompareResolvedStates( a1, a2, skinTable );
|
||||
doTransition = !skinTable.isResolutionMatching( a1, a2 );
|
||||
}
|
||||
|
||||
if ( doTransition )
|
||||
|
Loading…
x
Reference in New Issue
Block a user