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