feat: make right bar side dependant on devices

This commit is contained in:
johannes committed 2026-08-28 19:58:21 +02:00
1 parent c7fb3f9c02
commit 832d2544da
13 files changed
+630 -17

No files matched your search

@@ -0,0 +1,87 @@
import QtQuick
import "."
// Reusable right-click menu. `model` is a plain JS array of
// { label, icon, destructive, separator, action } entries.
Rectangle {
id: menu
property var model: []
visible: false
z: 1000
width: 180
radius: 10
color: Theme.colors.background
border.color: Theme.colors.border
border.width: 1
height: column.implicitHeight + Theme.geometry.spacing
function openAt(px, py) {
x = px;
y = py;
visible = true;
}
function close() {
visible = false;
}
// Absorb clicks inside the menu so they don't fall through to the backdrop.
MouseArea {
anchors.fill: parent
}
Column {
id: column
anchors.fill: parent
anchors.margins: Theme.geometry.spacing / 2
Repeater {
model: menu.model
delegate: Rectangle {
width: column.width
height: modelData.separator ? 1 : 28
radius: modelData.separator ? 0 : 6
color: modelData.separator
? Theme.colors.border
: (itemMouse.containsMouse ? Theme.colors.surfaceHover : "transparent")
Row {
visible: !modelData.separator
anchors.left: parent.left
anchors.leftMargin: Theme.geometry.spacing
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.geometry.spacing
Text {
text: modelData.icon || ""
width: 14
font.pixelSize: 12
color: modelData.destructive ? Theme.colors.alert : Theme.colors.text
}
Text {
text: modelData.label || ""
font.family: Theme.font.family
font.pixelSize: 12
color: modelData.destructive ? Theme.colors.alert : Theme.colors.text
}
}
MouseArea {
id: itemMouse
anchors.fill: parent
enabled: !modelData.separator
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
menu.close();
if (modelData.action) modelData.action();
}
}
}
}
}
}