Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
5.15.5
-
None
Description
Why is this a problem? Because it breaks manual bindings for the checked property: Button's code alters the checked state when seemingly no one asked it to. Consider the following code (adapted from plasma-pa applet):
SmallToolButton { id: muteButton icon.name: Icon.name(item.model.Volume, item.model.Muted, isPlayback) text: item.model.Muted ? "Unmute" : "Mute" onClicked: item.model.Muted = !item.model.Muted; checked: item.model.Muted }
This component is supposed to manage its checked state externally, since audio sources/sinks may switch their muted state by other means (e.g. Mute key on a keyboard, or via other software). But what happens if a user double clicks it?
Starting with qtquickcontrols2@09476c590ab13623130d5ac79045fa68e504be96 the clicked() is no more emitted after doubleClicked(), but the nextCheckState() is still called regardless!
There are two problems at once:
- There's no way to disable internal management of the checked property. Setting checkable to false does not help, because it would be immediately reset to true the next time setChecked is called.
- Double click triggers checked state change.
- Double click is emitted even when there are no listeners. But his is not a problem anymore, since the fix was merged for Qt 6 as qtdeclarative@778e08a4061a87b5b2d6c4cee082ded74e1bcc64
Attachments
Issue Links
- duplicates
-
QTBUG-93807 Forced 'checkable' property of ItemDelegate interferes with editable models
- Closed