// A row whose trailing control is a button rather than a setting. // // ActionRow { // label: "Keyboard" // detail: "Use Fedora's hardware-backed input panels" // action: "Open keyboard" // onTriggered: SystemSettings.openGnomePanel("keyboard") // } // // Not schema-bound: these hand off to GNOME, launch an application, or run a // one-shot like restoring defaults. There is no key to name. import QtQuick import qs.config SettingRow { id: root property string action: "" property bool enabled: true signal triggered controlWidth: Math.max(110, button.implicitWidth + 8) function press(): void { if (root.enabled) root.triggered(); } SettingsButton { id: button anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter text: root.action enabled: root.enabled onClicked: root.triggered() activeFocusOnTab: root.enabled // The row's label is what the button is FOR; the button's own caption // is what pressing it does. Both are said, in that order. Accessible.role: Accessible.Button Accessible.name: root.label Accessible.description: root.detail === "" ? root.action : `${root.detail} — ${root.action}` Accessible.focusable: root.enabled Accessible.focused: button.activeFocus Accessible.onPressAction: root.press() Keys.onReturnPressed: root.press() Keys.onEnterPressed: root.press() Keys.onSpacePressed: root.press() // Focus ring only -- the button keeps its own border at rest. Rectangle { anchors.fill: parent anchors.margins: -3 radius: 11 color: "transparent" visible: button.activeFocus border.width: 2 border.color: Theme.accentSecondary } } }