fix menu height
This commit is contained in:
parent
5ad933c03b
commit
73443a78b1
3 changed files with 102 additions and 45 deletions
60
PLAN-traymenu-fix.md
Normal file
60
PLAN-traymenu-fix.md
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
# Plan: fix tray menu grey bar
|
||||
|
||||
## Root cause
|
||||
|
||||
`Column` (a QML positioner) lays out children using their `height` property.
|
||||
`implicitHeight` is advisory — layouts like `ColumnLayout` use it, but plain
|
||||
`Column` does not. The delegate `Item`s in `TrayMenu.qml` set `implicitHeight`
|
||||
but leave `height` at its default of 0, so every row collapses. The only
|
||||
visible pixels are the Column's `topPadding + bottomPadding = 8 px` — the grey
|
||||
bar.
|
||||
|
||||
The same mistake applies to `implicitWidth` on the delegate items and the back
|
||||
button; the width happens to work because the children use `anchors` relative to
|
||||
`parent` which already has `width: 220` from the Column, but it is still wrong
|
||||
and should be fixed for clarity.
|
||||
|
||||
## Fix — TrayMenu.qml only, two places
|
||||
|
||||
### 1. Back button Item (line ~108)
|
||||
|
||||
```qml
|
||||
// before
|
||||
implicitWidth: page.implicitWidth
|
||||
implicitHeight: 28
|
||||
|
||||
// after
|
||||
width: page.width
|
||||
height: 28
|
||||
```
|
||||
|
||||
### 2. Repeater delegate Item (line ~142)
|
||||
|
||||
```qml
|
||||
// before
|
||||
implicitWidth: page.implicitWidth
|
||||
implicitHeight: modelData.isSeparator ? 9 : 28
|
||||
|
||||
// after
|
||||
width: page.width
|
||||
height: modelData.isSeparator ? 9 : 28
|
||||
```
|
||||
|
||||
## Also check: StackView height binding
|
||||
|
||||
The StackView currently binds:
|
||||
|
||||
```qml
|
||||
height: currentItem ? currentItem.implicitHeight : 0
|
||||
```
|
||||
|
||||
`Column.implicitHeight` is computed from children's `implicitHeight` (not
|
||||
`height`), so it should be correct in principle — but once the delegate items
|
||||
have a real `height`, `Column.implicitHeight` will equal `Column.height`
|
||||
anyway. Worth verifying that `currentItem.implicitHeight` and
|
||||
`currentItem.height` agree after the fix; if not, switch to `currentItem.height`.
|
||||
|
||||
## Expected result
|
||||
|
||||
Each menu row is 28 px tall (9 px for separators). The panel Rectangle sizes
|
||||
correctly. The dismiss MouseArea still works. No other files need changing.
|
||||
Loading…
Add table
Add a link
Reference in a new issue