HMenu: Fix width calculation (padding)
This commit is contained in:
parent
d7fc0ad0b8
commit
035ab1add6
|
@ -7,20 +7,14 @@ Menu {
|
||||||
|
|
||||||
implicitWidth: {
|
implicitWidth: {
|
||||||
let result = 0
|
let result = 0
|
||||||
let leftPadding = 0
|
|
||||||
let rightPadding = 0
|
|
||||||
|
|
||||||
for (let i = 0; i < count; ++i) {
|
for (let i = 0; i < count; ++i) {
|
||||||
let item = itemAt(i)
|
let item = itemAt(i)
|
||||||
if (! item.visible) continue
|
if (! item.visible) continue
|
||||||
|
|
||||||
result = Math.max(item.contentItem.implicitWidth, result)
|
result = Math.max(item.implicitWidth, result)
|
||||||
leftPadding = Math.max(item.leftPadding, leftPadding)
|
|
||||||
rightPadding = Math.max(item.rightPadding, rightPadding)
|
|
||||||
}
|
}
|
||||||
return Math.min(
|
return Math.min(result + menu.padding * 2, window.width)
|
||||||
result + leftPadding + rightPadding, window.width
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user