Commit 5dec3ed5 authored by Jan Arve Saether's avatar Jan Arve Saether Committed by The Qt Project
Browse files

Refactor propagation of size hints


This issue refactors how size hints are propagated up layout
hierarchies. It fixes several problems:

1. Do not overwrite explicitly set size hints when propagating them
   (Covered by test_sizeHint(propagateNone) )
2. Propagate size hints immediately when they are changed.
   Previously, this was in an inconsistent state, since for some
   operations (such as implicitWidth changes) it would immediately
   propagate through an explicit call to propagateSizeHints. However,
   changes to other properties such as Layout.minimumWidth would simply
   call invalidate(), causing the propagation to be postponed until the
   layout got rearranged.
3. Do not propagate size hints from rearrange. This could potentially
   make rearrange() unnecessary slow.
4. Only use the fallback to width/height the *first* time the size hint
   is queried. This had the unfortunate consequence when a
   Layout.preferredWidth was reset back to -1 it could end up querying
   the width again (due to layout resizing, this could at this point be
   different than what was specified in the QML file). This is still
   not bullet proof, but AFAIK there is no bullet-proof way, since there
   is no way of retrieving the original value that 'width' was bound to
   in the QML file.
   (Covered by test_sizeHintPropagationCount)

The performance characteristics for this change should be that it will
make resizing of layouts faster, but will make dynamic changes to the
layout slower (since it has to propagate the size hints every time a
property is changed).

Change-Id: I3dd818f6f7504908534eb5b22413fbeba1877985
Task-number: QTBUG-30773
Reviewed-by: default avatarJens Bache-Wiig <jens.bache-wiig@digia.com>
parent 391d63ad
Branches
Tags
No related merge requests found
Showing with 204 additions and 39 deletions
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment