* reworked fullscreen mode as transforming shell * controlcenter configuring of toasts & notifs * fix animation on fs switch * border rounding & shadow animation * change controlcenter notifications layout * stay on WlrLayer.Overlay, use Anim * ci: update action versions * qmlformat * format take two * third time's the charm * fix: special workspace fullscreen * fix: bar width border.thickness on non-persistent behaviour * merge fix * stop layout shift on close * last few conventions sorted * linting * maximized state to fullscreen --------- Co-authored-by: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
115 lines
3.8 KiB
QML
115 lines
3.8 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import ".."
|
|
import "../effects"
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import qs.services
|
|
import qs.config
|
|
|
|
Elevation {
|
|
id: root
|
|
|
|
property list<MenuItem> items
|
|
property MenuItem active: items[0] ?? null
|
|
property bool expanded
|
|
|
|
signal itemSelected(item: MenuItem)
|
|
|
|
radius: Appearance.rounding.small / 2
|
|
level: 2
|
|
|
|
implicitWidth: Math.max(200, column.implicitWidth)
|
|
implicitHeight: root.expanded ? column.implicitHeight : 0
|
|
opacity: root.expanded ? 1 : 0
|
|
|
|
StyledClippingRect {
|
|
anchors.fill: parent
|
|
radius: parent.radius
|
|
color: Colours.palette.m3surfaceContainer
|
|
|
|
ColumnLayout {
|
|
id: column
|
|
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
spacing: 0
|
|
|
|
Repeater {
|
|
model: root.items
|
|
|
|
StyledRect {
|
|
id: item
|
|
|
|
required property int index
|
|
required property MenuItem modelData
|
|
readonly property bool active: modelData === root.active
|
|
|
|
Layout.fillWidth: true
|
|
implicitWidth: menuOptionRow.implicitWidth + Appearance.padding.normal * 2
|
|
implicitHeight: menuOptionRow.implicitHeight + Appearance.padding.normal * 2
|
|
|
|
color: Qt.alpha(Colours.palette.m3secondaryContainer, active ? 1 : 0)
|
|
|
|
StateLayer {
|
|
function onClicked(): void {
|
|
root.itemSelected(item.modelData);
|
|
root.active = item.modelData;
|
|
item.modelData.clicked();
|
|
root.expanded = false;
|
|
}
|
|
|
|
color: item.active ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface
|
|
disabled: !root.expanded
|
|
}
|
|
|
|
RowLayout {
|
|
id: menuOptionRow
|
|
|
|
anchors.fill: parent
|
|
anchors.margins: Appearance.padding.normal
|
|
spacing: Appearance.spacing.small
|
|
|
|
MaterialIcon {
|
|
Layout.alignment: Qt.AlignVCenter
|
|
text: item.modelData.icon
|
|
color: item.active ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurfaceVariant
|
|
}
|
|
|
|
StyledText {
|
|
Layout.alignment: Qt.AlignVCenter
|
|
Layout.fillWidth: true
|
|
text: item.modelData.text
|
|
color: item.active ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface
|
|
}
|
|
|
|
Loader {
|
|
asynchronous: true
|
|
Layout.alignment: Qt.AlignVCenter
|
|
active: item.modelData.trailingIcon.length > 0
|
|
visible: active
|
|
|
|
sourceComponent: MaterialIcon {
|
|
text: item.modelData.trailingIcon
|
|
color: item.active ? Colours.palette.m3onSecondaryContainer : Colours.palette.m3onSurface
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Behavior on opacity {
|
|
Anim {
|
|
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
|
}
|
|
}
|
|
|
|
Behavior on implicitHeight {
|
|
Anim {
|
|
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
|
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
|
}
|
|
}
|
|
}
|