import QtQuick import QtQuick.Templates as QQCT import Weave.Controls import Weave.Templates as T T.Menu { id: root implicitWidth: Math.min( Theme.component.modal.minWidth + leftInset + rightInset, Math.max( implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + leftPadding + rightPadding)) implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding) leftPadding: Theme.component.menu.menuContainer.paddingLeft rightPadding: Theme.component.menu.menuContainer.paddingRight topPadding: Theme.component.menu.menuContainer.paddingTop bottomPadding: Theme.component.menu.menuContainer.paddingBottom margins: 0 transformOrigin: !cascade ? Item.Top : (mirrored ? Item.TopRight : Item.TopLeft) closePolicy: QQCT.Popup.CloseOnEscape | QQCT.Popup.CloseOnPressOutsideParent icon.color: Theme.component.menu.icon.fill icon.width: Theme.component.button.icon.width // TODO: Theme constant for menu.iconSize ? icon.height: Theme.component.button.icon.height // TODO: Theme constant for menu.iconSize ? currentIndex: -1 onOpened: currentIndex = -1 x: !parent || horizontalAlignment === Menu.AlignLeft ? 0 : horizontalAlignment === Menu.AlignRight ? (parent.width - width) : (parent.width - width)/2 y: parent.height background: Item { implicitWidth: 1 implicitHeight: Theme.component.menu.minHeight Rectangle { id: bgRect anchors.fill: parent color: Theme.component.surface._100.backgroundColor BoxShadow { z: -1 width: bgRect.width height: bgRect.height source: Theme.semantic.shadow.low // TODO: Menu-specific tokens } } } contentItem: Flickable { clip: true flickableDirection: Flickable.VerticalFlick implicitWidth: contentColumn.implicitWidth implicitHeight: contentColumn.implicitHeight contentWidth: contentColumn.width contentHeight: contentColumn.height T.MouseWheelFilter.enabled: true QQCT.ScrollIndicator.vertical: QQCT.ScrollIndicator {} Binding { target: root property: "empty" value: contentColumn.visibleItemCount == 0 } T.MenuLayout { id: contentColumn headerDelegate: Item { } Repeater { model: root.contentModel } } } delegate: MenuItem {} }