startHintTransitions added to be able to start transitions withot
changing the state
This commit is contained in:
parent
47df732f4a
commit
996e849fc5
|
@ -1302,28 +1302,52 @@ void QskSkinnable::setSkinStates( QskAspect::States newStates )
|
||||||
auto control = owningControl();
|
auto control = owningControl();
|
||||||
|
|
||||||
#if DEBUG_STATE
|
#if DEBUG_STATE
|
||||||
qDebug() << control->className() << ":"
|
const auto className = control ? control->className() : "QskSkinnable";
|
||||||
|
qDebug() << className << ":"
|
||||||
<< skinStateAsPrintable( m_data->skinState ) << "->"
|
<< skinStateAsPrintable( m_data->skinState ) << "->"
|
||||||
<< skinStateAsPrintable( newState );
|
<< skinStateAsPrintable( newState );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const auto skin = effectiveSkin();
|
if ( control && control->window() )
|
||||||
|
|
||||||
if ( skin )
|
|
||||||
{
|
{
|
||||||
const auto mask = skin->hintTable().states() | m_data->hintTable.states();
|
const bool needUpdate = startHintTransitions( m_data->skinStates, newStates );
|
||||||
|
if ( needUpdate )
|
||||||
if ( ( newStates & mask ) == ( m_data->skinStates & mask ) )
|
|
||||||
{
|
{
|
||||||
// the modified bits are not handled by the skin
|
if ( control->flags() & QQuickItem::ItemHasContents )
|
||||||
|
control->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_data->skinStates = newStates;
|
m_data->skinStates = newStates;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
bool QskSkinnable::startHintTransitions(
|
||||||
|
QskAspect::States oldStates, QskAspect::States newStates )
|
||||||
|
{
|
||||||
|
const auto skin = effectiveSkin();
|
||||||
|
auto control = owningControl();
|
||||||
|
|
||||||
|
if ( skin == nullptr || control == nullptr || control->window() == nullptr )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const auto mask = m_data->hintTable.states() | skin->hintTable().states();
|
||||||
|
if ( ( newStates & mask ) == ( oldStates & mask ) )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
When there are no aspects for the changed state bits we know
|
||||||
|
that there won't be any animated transitions
|
||||||
|
*/
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( control->window() && isTransitionAccepted( QskAspect() ) )
|
if ( !isTransitionAccepted( QskAspect() ) )
|
||||||
{
|
{
|
||||||
|
// the control does not like any animated transition at the moment
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool started = false; // at least one transition has been started
|
||||||
|
|
||||||
QskAspect aspect;
|
QskAspect aspect;
|
||||||
aspect.setPlacement( effectivePlacement() );
|
aspect.setPlacement( effectivePlacement() );
|
||||||
aspect.setSection( section() );
|
aspect.setSection( section() );
|
||||||
|
@ -1376,17 +1400,15 @@ void QskSkinnable::setSkinStates( QskAspect::States newStates )
|
||||||
{
|
{
|
||||||
startHintTransition( aspect, hint,
|
startHintTransition( aspect, hint,
|
||||||
storedHint( a1 ), storedHint( a2 ) );
|
storedHint( a1 ), storedHint( a2 ) );
|
||||||
}
|
|
||||||
|
started = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_data->skinStates = newStates;
|
return started;
|
||||||
|
|
||||||
if ( control->flags() & QQuickItem::ItemHasContents )
|
|
||||||
control->update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSkin* QskSkinnable::effectiveSkin() const
|
QskSkin* QskSkinnable::effectiveSkin() const
|
||||||
|
|
|
@ -258,6 +258,7 @@ class QSK_EXPORT QskSkinnable
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY( QskSkinnable )
|
Q_DISABLE_COPY( QskSkinnable )
|
||||||
|
|
||||||
|
bool startHintTransitions( QskAspect::States, QskAspect::States );
|
||||||
void startHintTransition( QskAspect,
|
void startHintTransition( QskAspect,
|
||||||
QskAnimationHint, const QVariant& from, const QVariant& to );
|
QskAnimationHint, const QVariant& from, const QVariant& to );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue