moment/src/qml/Base/HMenu.qml

32 lines
837 B
QML
Raw Normal View History

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)
if (! item.visible) continue
2019-08-22 06:23:22 +10:00
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
}
}