Skip to content
  • Jan Arve Saether's avatar
    Refactor propagation of size hints · 5dec3ed5
    Jan Arve Saether authored
    
    
    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>
    5dec3ed5