Files
sloposk/qml/BarToggle.qml
T
ericek111andClaude Opus 5.5 ac5f43ca5f Add quick toggles to the grab bar
Beside the gear: full keyboard, hold keys, and the numeric keypad,
navigation and function key sections, each behind a drawn icon and lit
while on. Section toggles hide when the layout lacks the section. The
grab pill narrows when a small window leaves it less room.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 00:29:48 +01:00

41 lines
929 B
QML

import QtQuick
// A small on/off button in the grab bar; lit while on. The icon goes inside
// and should draw in `foreground`.
Item {
id: toggle
required property string label
property bool checked: false
readonly property color foreground: checked ? Theme.accentText : (tap.pressed ? Theme.text : Theme.handle)
default property alias icon: iconArea.data
signal toggled(bool checked)
implicitWidth: 34
implicitHeight: 22
Accessible.role: Accessible.CheckBox
Accessible.name: label
Accessible.checked: checked
Rectangle {
anchors.centerIn: parent
width: 30
height: 20
radius: 5
color: Theme.accent
visible: toggle.checked
}
Item {
id: iconArea
anchors.centerIn: parent
width: 20
height: 14
}
TapHandler {
id: tap
onTapped: toggle.toggled(!toggle.checked)
}
}