Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.7.0 Alpha
-
None
-
ff9d924d98aac8248ce99aef992920aeb99fda7e
Description
It is impossible to use the QQuickAbstractButton's `clicked` signal and `checked` property in a similar way we did for years with QAbstractButton and/or Quick.Controls Button (same for other checkables).
some parts of a whole issue:
- when the slot connected to the CheckBox' clicked() signal explicitly sets its checked state (i.e. in tristate case), the checkedChanged() signal could be emitted more than once per click, due to nextCheckState() call
- in some cases Switch doesn't emit `clicked` and thus it is not always possible to distinguish "toggle due to the user action" and "toggle due to the 'checked' property binding re-evaluation"; it seems like `clicked` means the mouse click here, not the button click.
(see QAbstractButton::clicked() documentation for more differences)
The following code could be used to see this issue in action:
QtObject { id: action property bool checked: false function toggle() { checked = !checked; } } Button { text: "First" highlighted: checked checked: action.checked onClicked: action.toggle() } CheckBox { id: button text: "Second" checked: action.checked onClicked: action.toggle() } Switch { text: "Third" checked: action.checked onClicked: action.toggle() }
Attachments
Issue Links
- duplicates
-
QTBUG-52448 QQuickAbstractButton: clicked() called before nextCheckState()
- Closed
- is duplicated by
-
QTBUG-53896 Switch components does not provide a way to know if checked changed from a user action
- Closed