Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-106351

Add height-for-width support to Qt Quick Layout system

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5
    • Quick: Layouts
    • None

    Description

      This includes integrating it with elements that mimic height-for-width by updating their implicitHeight when their explicit width is changed, such as QQuickText with wordWrap enabled. This could also be applicable to other QML elements: Image comes to my mind. Layout themselves can also have height-for-width constraints.

      Research how height-for-width constraints should be specified (today, setting an explicit width on a Text element (with word wrapping) will update its implicitHeight to reflect which height it needs.

      Possibly, also add width-for-height support (the engine can already deal with it)

       

      Today, HFW kind of works, but in a hackish way (it needs two rearrange passes):

      A layout with a word-wrapping Text element gets resized:

      • It will call QQuickLayout::rearrange().
        • This will ultimately resize the Text element by setting its width first.
          • As a response to that, the Text element will update its implicitHeight.
            • Consequence of that is that the layout gets invalidated during the rearrange, and it will schedule a second rearrange.
        • Next, the height of the Text element is set (this height was calculated without the knowledge of the implicitHeight of the Text element, so this calculated height is most likely wrong. However, the scheduled second rearrange will take care of that)
      • The scheduled second rearrange starts
        • Now, the implicitHeight of the Text element is known in advance, and it is able to adjust the height of the row where the Text element is correctly.

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            smd Jan Arve
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes