Commit 809f3787 authored by David Edmundson's avatar David Edmundson

Don't use visible property in procedural code to determine state

It can be invisible not just because something is disabled but because
it's not shown yet. But load() is only run once. Instead replace with a
binding.

Rather than toggling the checked state when invisible, the evaluation is
moved into the sync method.

BUG: 408116


(cherry picked from commit a53b30f3)
parent bf7d64b3
......@@ -738,16 +738,9 @@ Kirigami.ScrollablePage {
enabled: touchpad.supportsClickMethodAreas && touchpad.supportsClickMethodClickfinger
spacing: Kirigami.Units.smallSpacing
visible: touchpad.supportedButtons & Qt.LeftButton
function load() {
visible = (touchpad.supportedButtons & Qt.LeftButton)
if (!visible) {
rightClickMethodAreas.checked = false
rightClickMethodClickfinger.checked = false
return;
}
rightClickMethodAreas.enabled = touchpad.supportsClickMethodAreas
rightClickMethodClickfinger.enabled = touchpad.supportsClickMethodClickfinger
......@@ -760,8 +753,8 @@ Kirigami.ScrollablePage {
function syncCurrent() {
if (enabled && !root.loading) {
touchpad.clickMethodAreas = rightClickMethodAreas.checked
touchpad.clickMethodClickfinger = rightClickMethodClickfinger.checked
touchpad.clickMethodAreas = rightClickMethodAreas.checked && rightClickMethodAreas.visible
touchpad.clickMethodClickfinger = rightClickMethodClickfinger.checked && rightClickMethodClickfinger.visible
root.changeSignal()
}
loading = true
......@@ -805,15 +798,9 @@ Kirigami.ScrollablePage {
id: middleClickMethod
spacing: Kirigami.Units.smallSpacing
visible: rightClickMethod.visible
function load() {
visible = rightClickMethod.visible
if (!visible) {
enabled = false
return;
}
enabled = touchpad.supportsMiddleEmulation
if (enabled && touchpad.middleEmulation) {
middleSoftwareEmulation.checked = true
......@@ -824,7 +811,7 @@ Kirigami.ScrollablePage {
function syncCurrent() {
if (enabled && !root.loading) {
touchpad.middleEmulation = middleSoftwareEmulation.checked
touchpad.middleEmulation = middleSoftwareEmulation.checked && middleSoftwareEmulation.visible
root.changeSignal()
}
loading = true
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment