Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.5
-
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.
- As a response to that, the Text element will update its implicitHeight.
- 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)
- This will ultimately resize the Text element by setting its width first.
- 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.