2019-08-22 04:58:57 +10:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
|
|
|
|
Menu {
|
2019-08-22 06:23:22 +10:00
|
|
|
id: menu
|
|
|
|
padding: theme.controls.menu.borderWidth
|
|
|
|
|
|
|
|
implicitWidth: {
|
|
|
|
let result = 0
|
|
|
|
let leftPadding = 0
|
|
|
|
let rightPadding = 0
|
|
|
|
|
|
|
|
for (let i = 0; i < count; ++i) {
|
|
|
|
let item = itemAt(i)
|
|
|
|
result = Math.max(item.contentItem.implicitWidth, result)
|
|
|
|
leftPadding = Math.max(item.leftPadding, leftPadding)
|
|
|
|
rightPadding = Math.max(item.rightPadding, rightPadding)
|
|
|
|
}
|
|
|
|
return Math.min(
|
2019-08-22 06:38:34 +10:00
|
|
|
result + leftPadding + rightPadding, window.width
|
2019-08-22 06:23:22 +10:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
background: HRectangle {
|
|
|
|
color: "transparent"
|
|
|
|
border.color: theme.controls.menu.border
|
|
|
|
border.width: theme.controls.menu.borderWidth
|
|
|
|
}
|
2019-08-22 04:58:57 +10:00
|
|
|
}
|