moment/src/qml/Base/HMenu.qml

32 lines
853 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
)
}
2019-08-28 12:46:31 +10:00
background: Rectangle {
color: theme.controls.menu.background
2019-08-22 06:23:22 +10:00
border.color: theme.controls.menu.border
border.width: theme.controls.menu.borderWidth
}
}