limit the flood of LayoutRequest events

This commit is contained in:
Uwe Rathmann 2018-03-23 09:55:48 +01:00
parent 6005336cf8
commit 5447aa30fa
1 changed files with 26 additions and 11 deletions

View File

@ -1064,8 +1064,11 @@ void QskControl::resetImplicitSize()
if ( d->controlFlags & QskControl::DeferredLayout ) if ( d->controlFlags & QskControl::DeferredLayout )
{ {
d->blockedImplicitSize = true; if ( !d->blockedImplicitSize )
layoutConstraintChanged(); {
d->blockedImplicitSize = true;
layoutConstraintChanged();
}
} }
else else
{ {
@ -1294,6 +1297,14 @@ void QskControl::itemChange( QQuickItem::ItemChange change,
} }
case QQuickItem::ItemVisibleHasChanged: case QQuickItem::ItemVisibleHasChanged:
{ {
#if 1
/*
~QQuickItem sends QQuickItem::ItemVisibleHasChanged recursively
to all childItems. When being a child ( not only a childItem() )
we are short before being destructed too and any updates
done here are totally pointless. TODO ...
*/
#endif
if ( value.boolValue ) if ( value.boolValue )
{ {
if ( d->blockedPolish ) if ( d->blockedPolish )
@ -1313,16 +1324,20 @@ void QskControl::itemChange( QQuickItem::ItemChange change,
d->isInitiallyPainted = false; d->isInitiallyPainted = false;
} }
#if 1 if ( parentItem() && parentItem()->isVisible() )
// Layout code might consider the visiblility of the children {
// and therefore needs to be updated. Posting a statement about /*
// changed layout constraints has this effect, but is not correct. Layout code might consider the visiblility of the children
// The right way to go would be to create show/hide events and to and therefore needs to be updated. Posting a statement about
// handle them, where visibility of the children matters. changed layout constraints has this effect, but is not correct.
// TODO ... The right way to go would be to create show/hide events and to
handle them, where visibility of the children matters.
TODO ...
*/
layoutConstraintChanged();
}
layoutConstraintChanged();
#endif
break; break;
} }
case QQuickItem::ItemSceneChange: case QQuickItem::ItemSceneChange: