broken state changes fixed

This commit is contained in:
Uwe Rathmann 2022-09-09 12:01:30 +02:00
parent 996e849fc5
commit 4ca5e798c8

View File

@ -1303,6 +1303,7 @@ void QskSkinnable::setSkinStates( QskAspect::States newStates )
#if DEBUG_STATE
const auto className = control ? control->className() : "QskSkinnable";
qDebug() << className << ":"
<< skinStateAsPrintable( m_data->skinState ) << "->"
<< skinStateAsPrintable( newState );
@ -1310,13 +1311,23 @@ void QskSkinnable::setSkinStates( QskAspect::States newStates )
if ( control && control->window() )
{
const bool needUpdate = startHintTransitions( m_data->skinStates, newStates );
if ( needUpdate )
if ( const auto skin = effectiveSkin() )
{
const auto mask = m_data->hintTable.states() | skin->hintTable().states();
if ( ( newStates & mask ) != ( m_data->skinStates & mask ) )
{
/*
When there are no aspects for the changed state bits we know
that there won't be any animated transitions
*/
startHintTransitions( m_data->skinStates, newStates );
}
}
if ( control->flags() & QQuickItem::ItemHasContents )
control->update();
}
}
m_data->skinStates = newStates;
}
@ -1324,22 +1335,6 @@ void QskSkinnable::setSkinStates( QskAspect::States newStates )
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 ( !isTransitionAccepted( QskAspect() ) )
{
// the control does not like any animated transition at the moment
@ -1352,6 +1347,9 @@ bool QskSkinnable::startHintTransitions(
aspect.setPlacement( effectivePlacement() );
aspect.setSection( section() );
const auto skin = effectiveSkin();
const auto control = owningControl();
const auto primitiveCount = QskAspect::primitiveCount();
const auto subControls = control->subControls();
@ -1379,7 +1377,7 @@ bool QskSkinnable::startHintTransitions(
const auto primitive = static_cast< QskAspect::Primitive >( i );
aspect.setPrimitive( type, primitive );
const auto a1 = aspect | m_data->skinStates;
const auto a1 = aspect | oldStates;
const auto a2 = aspect | newStates;
bool doTransition = true;