Hold power actions to confirm instead of a confirm row

Logout, reboot and shut down now fill with accent liquid while held and
run once full; letting go early drains it. A tap hints to hold. Replaces
the Confirm/Cancel rows in the control center tile and dashboard tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mxandClaude Opus 5.5 committed 2026-11-28 01:05:11 +01:00
1 parent 1e918414d1
commit d37f9b7121
10 files changed
+350 -102

No files matched your search

+25 -2
View File
@@ -2,14 +2,24 @@ import QtQuick
import "../components"
import "../theme"
// Round icon toggle; filled with the accent while on.
// Round icon toggle; filled with the accent while on. With `hold` it is a
// hold-to-confirm button instead: liquid fills it while held and held() fires
// once full; clicked() is not emitted.
Item {
id: root
property string glyph
property string fallback
property bool checked: false
property int size: 34
property bool hold: false
// Callers may withhold filling, e.g. until an action is pending.
property bool armed: true
readonly property bool holding: hold && armed && area.pressed && area.containsMouse
readonly property bool pressed: area.pressed
readonly property bool filled: fill.active
signal clicked
signal held
signal holdCancelled
implicitWidth: size
implicitHeight: size
opacity: enabled ? 1 : 0.45
@@ -32,12 +42,25 @@ Item {
easing.type: Easing.OutCubic
}
}
HoldFill {
id: fill
anchors.fill: parent
visible: root.hold
holding: root.holding
glyph: root.glyph
fallback: root.fallback
glyphSize: Math.round(root.size * 0.5)
glyphWeight: Font.DemiBold
onCompleted: root.held()
onCancelled: root.holdCancelled()
}
}
MouseArea {
id: area
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.clicked()
onClicked: if (!root.hold)
root.clicked()
}
}