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>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user