// A toggle that is NOT schema-bound. // // ToggleRow reads and writes a preference key. Some switches govern system // state instead -- an account flag, a systemd unit -- which lives outside // Panama's settings file and is read back from the system that owns it. import QtQuick import qs.config SettingRow { id: root property bool checked: false property bool enabled: true signal toggled(value: bool) controlWidth: 54 Rectangle { anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter width: 44 height: 26 radius: height / 2 color: root.checked ? Theme.accent : Theme.alpha(Theme.fg, 0.14) opacity: root.enabled ? 1 : 0.45 Rectangle { x: root.checked ? parent.width - width - 3 : 3 anchors.verticalCenter: parent.verticalCenter width: 20 height: 20 radius: height / 2 color: root.checked ? Theme.bgDark : Theme.fg // Short and non-repeating: this animates only when someone acts. Behavior on x { NumberAnimation { duration: 120; easing.type: Easing.OutCubic } } } MouseArea { anchors.fill: parent enabled: root.enabled cursorShape: Qt.PointingHandCursor onClicked: root.toggled(!root.checked) } } }