mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-03-15 08:29:41 +08:00
60 lines
2.0 KiB
QML
60 lines
2.0 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Controls.impl
|
|
import QtQuick.Templates as T
|
|
import FluentUI
|
|
|
|
T.Menu {
|
|
property bool animationEnabled: true
|
|
id: control
|
|
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
|
contentWidth + leftPadding + rightPadding)
|
|
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
|
contentHeight + topPadding + bottomPadding)
|
|
margins: 0
|
|
overlap: 1
|
|
spacing: 0
|
|
delegate: FluMenuItem { }
|
|
enter: Transition {
|
|
NumberAnimation {
|
|
property: "opacity"
|
|
from:0
|
|
to:1
|
|
duration: FluTheme.animationEnabled && control.animationEnabled ? 83 : 0
|
|
}
|
|
}
|
|
exit:Transition {
|
|
NumberAnimation {
|
|
property: "opacity"
|
|
from:1
|
|
to:0
|
|
duration: FluTheme.animationEnabled && control.animationEnabled ? 83 : 0
|
|
}
|
|
}
|
|
contentItem: ListView {
|
|
implicitHeight: contentHeight
|
|
model: control.contentModel
|
|
interactive: Window.window
|
|
? contentHeight + control.topPadding + control.bottomPadding > Window.window.height
|
|
: false
|
|
clip: true
|
|
currentIndex: control.currentIndex
|
|
ScrollIndicator.vertical: ScrollIndicator {}
|
|
}
|
|
background: Rectangle {
|
|
implicitWidth: 150
|
|
implicitHeight: 36
|
|
color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(240/255,240/255,240/255,1)
|
|
border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
|
|
border.width: 1
|
|
radius: 5
|
|
FluShadow{}
|
|
}
|
|
T.Overlay.modal: Rectangle {
|
|
color: Color.transparent(control.palette.shadow, 0.5)
|
|
}
|
|
T.Overlay.modeless: Rectangle {
|
|
color: Color.transparent(control.palette.shadow, 0.12)
|
|
}
|
|
}
|