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

View File

@ -1063,10 +1063,13 @@ void QskControl::resetImplicitSize()
Q_D( QskControl ); Q_D( QskControl );
if ( d->controlFlags & QskControl::DeferredLayout ) if ( d->controlFlags & QskControl::DeferredLayout )
{
if ( !d->blockedImplicitSize )
{ {
d->blockedImplicitSize = true; d->blockedImplicitSize = true;
layoutConstraintChanged(); layoutConstraintChanged();
} }
}
else else
{ {
const QSizeF sz = implicitSize(); const QSizeF sz = implicitSize();
@ -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: