2019-08-21 14:58:57 -04:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
|
|
|
|
Menu {
|
2019-08-21 16:23:22 -04:00
|
|
|
id: menu
|
|
|
|
padding: theme.controls.menu.borderWidth
|
|
|
|
|
|
|
|
implicitWidth: {
|
2019-09-09 11:21:31 -04:00
|
|
|
let result = 0
|
2019-08-21 16:23:22 -04:00
|
|
|
|
|
|
|
for (let i = 0; i < count; ++i) {
|
2019-08-21 16:41:52 -04:00
|
|
|
let item = itemAt(i)
|
|
|
|
if (! item.visible) continue
|
|
|
|
|
2019-09-09 11:21:31 -04:00
|
|
|
result = Math.max(item.implicitWidth, result)
|
2019-08-21 16:23:22 -04:00
|
|
|
}
|
2019-09-09 11:21:31 -04:00
|
|
|
return Math.min(result + menu.padding * 2, window.width)
|
2019-08-21 16:23:22 -04:00
|
|
|
}
|
|
|
|
|
2019-08-27 22:46:31 -04:00
|
|
|
background: Rectangle {
|
2019-09-06 16:11:25 -04:00
|
|
|
color: theme.controls.menu.background
|
2019-08-21 16:23:22 -04:00
|
|
|
border.color: theme.controls.menu.border
|
|
|
|
border.width: theme.controls.menu.borderWidth
|
|
|
|
}
|
2019-08-21 14:58:57 -04:00
|
|
|
}
|