simplify menu
This commit is contained in:
parent
6027d0bbff
commit
d4ebfbd767
2 changed files with 3 additions and 52 deletions
|
|
@ -10,33 +10,25 @@ StyledPopupWindow {
|
||||||
id: window
|
id: window
|
||||||
|
|
||||||
backgroundColor: Theme.palette.base300
|
backgroundColor: Theme.palette.base300
|
||||||
|
margins: 8
|
||||||
radius: 8
|
radius: 8
|
||||||
|
|
||||||
property QsMenuOpener menuOpener
|
property QsMenuOpener menuOpener
|
||||||
|
|
||||||
content: ColumnLayout {
|
content: ColumnLayout {
|
||||||
id: menu
|
spacing: 8
|
||||||
|
|
||||||
anchors.margins: 30
|
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: repeater
|
|
||||||
model: window.menuOpener.children
|
model: window.menuOpener.children
|
||||||
delegate: Loader {
|
delegate: Loader {
|
||||||
id: loader
|
|
||||||
|
|
||||||
required property QsMenuEntry modelData
|
required property QsMenuEntry modelData
|
||||||
required property int index
|
|
||||||
|
|
||||||
active: true
|
active: true
|
||||||
|
|
||||||
opacity: 0
|
Layout.fillWidth: true
|
||||||
|
|
||||||
Layout.minimumWidth: 120
|
Layout.minimumWidth: 120
|
||||||
|
|
||||||
sourceComponent: modelData.isSeparator ? menuSeperator : menuItem
|
sourceComponent: modelData.isSeparator ? menuSeperator : menuItem
|
||||||
property Component menuSeperator: Rectangle {
|
property Component menuSeperator: Rectangle {
|
||||||
implicitWidth: menu.width
|
|
||||||
implicitHeight: 2
|
implicitHeight: 2
|
||||||
|
|
||||||
color: Theme.palette.base100
|
color: Theme.palette.base100
|
||||||
|
|
@ -44,45 +36,6 @@ StyledPopupWindow {
|
||||||
property Component menuItem: MenuItem {
|
property Component menuItem: MenuItem {
|
||||||
menuEntry: modelData
|
menuEntry: modelData
|
||||||
}
|
}
|
||||||
|
|
||||||
states: State {
|
|
||||||
name: "opened"
|
|
||||||
when: window.opened
|
|
||||||
PropertyChanges {
|
|
||||||
loader {
|
|
||||||
opacity: 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
transitions: [
|
|
||||||
Transition {
|
|
||||||
from: ""
|
|
||||||
to: "opened"
|
|
||||||
SequentialAnimation {
|
|
||||||
PauseAnimation {
|
|
||||||
duration: (repeater.count / root.animationDuration) * loader.index
|
|
||||||
}
|
|
||||||
NumberAnimation {
|
|
||||||
property: "opacity"
|
|
||||||
duration: 100
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Transition {
|
|
||||||
from: "opened"
|
|
||||||
to: ""
|
|
||||||
SequentialAnimation {
|
|
||||||
PauseAnimation {
|
|
||||||
duration: 15 * (repeater.count - loader.index)
|
|
||||||
}
|
|
||||||
NumberAnimation {
|
|
||||||
property: "opacity"
|
|
||||||
duration: 200
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import "../../../../../config/"
|
import "../../../../../config/"
|
||||||
import "../../../../../styled/"
|
import "../../../../../styled/"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue