Skip to content

FlexBoxLayout: fix min-width/min-height axis confusion for column direction#11041

Merged
dfaure-kdab merged 1 commit intoslint-ui:masterfrom
dfaure-kdab:wip/dfaure/fix-axis-confusion
Mar 19, 2026
Merged

FlexBoxLayout: fix min-width/min-height axis confusion for column direction#11041
dfaure-kdab merged 1 commit intoslint-ui:masterfrom
dfaure-kdab:wip/dfaure/fix-axis-confusion

Conversation

@dfaure-kdab
Copy link
Collaborator

flexbox_layout_info() selected cells/padding/spacing using a
(direction, orientation) match. The intention was to pick the
main-axis cells for a main-axis query and cross-axis cells for a
cross-axis query. But the match was wrong:

(Column, Vertical) → main axis → should use cells_v (heights)
but selected cells_h (widths)
(Column, Horizontal) → cross axis → should use cells_h (widths)
but selected cells_v (heights)

For a column layout with items wider than tall (e.g. width=80px,
height=40px), this caused:

  • min-height reported as 80px (max item width) instead of 40px
  • min-width reported as 40px (max item height) instead of 80px

Fix: select cells/padding/spacing by orientation alone — height
queries always use cells_v, width queries always use cells_h,
regardless of flex direction.

The bug was visible in flexbox-interactive.slint when selecting
Flex Direction: Column, and trying to shrink the window height
as much as possible - it didn't shrink all the way to the height
of the one row of items.

…ection

flexbox_layout_info() selected cells/padding/spacing using a
(direction, orientation) match. The intention was to pick the
main-axis cells for a main-axis query and cross-axis cells for a
cross-axis query. But the match was wrong:

  (Column, Vertical)   → main axis → should use cells_v (heights)
                          but selected cells_h (widths)
  (Column, Horizontal) → cross axis → should use cells_h (widths)
                          but selected cells_v (heights)

For a column layout with items wider than tall (e.g. width=80px,
height=40px), this caused:
  - min-height reported as 80px (max item width) instead of 40px
  - min-width  reported as 40px (max item height) instead of 80px

Fix: select cells/padding/spacing by orientation alone — height
queries always use cells_v, width queries always use cells_h,
regardless of flex direction.

The bug was visible in flexbox-interactive.slint when selecting
Flex Direction: Column, and trying to shrink the window height
as much as possible - it didn't shrink all the way to the height
of the one row of items.
@dfaure-kdab dfaure-kdab merged commit de52c6f into slint-ui:master Mar 19, 2026
44 checks passed
@dfaure-kdab dfaure-kdab deleted the wip/dfaure/fix-axis-confusion branch March 19, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants