aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/quicktemplates2/qquickabstractbutton.cpp9
-rw-r--r--tests/auto/controls/data/tst_abstractbutton.qml7
2 files changed, 11 insertions, 5 deletions
diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp
index 40cc6c10..d589e613 100644
--- a/src/quicktemplates2/qquickabstractbutton.cpp
+++ b/src/quicktemplates2/qquickabstractbutton.cpp
@@ -578,6 +578,10 @@ void QQuickAbstractButton::setPressed(bool isPressed)
This property holds whether the button is checked.
+ Since Qt 6.2, setting this property no longer affects the
+ \l {AbstractButton::}{checkable} property. Explicitly set the
+ \c checkable property if needed.
+
\sa checkable
*/
bool QQuickAbstractButton::isChecked() const
@@ -592,9 +596,6 @@ void QQuickAbstractButton::setChecked(bool checked)
if (d->checked == checked)
return;
- if (checked && !d->checkable)
- setCheckable(true);
-
d->checked = checked;
if (d->action)
d->action->setChecked(checked);
@@ -612,8 +613,6 @@ void QQuickAbstractButton::setChecked(bool checked)
the user clicks on it or presses the space bar while the button has active
focus.
- Setting \l checked to \c true forces this property to \c true.
-
The default value is \c false.
\sa checked
diff --git a/tests/auto/controls/data/tst_abstractbutton.qml b/tests/auto/controls/data/tst_abstractbutton.qml
index 74538053..f2242feb 100644
--- a/tests/auto/controls/data/tst_abstractbutton.qml
+++ b/tests/auto/controls/data/tst_abstractbutton.qml
@@ -910,4 +910,11 @@ TestCase {
compare(clickedSpy.count, 1)
compare(doubleClickedSpy.count, 1)
}
+
+ function test_checkedShouldNotSetCheckable() {
+ let control = createTemporaryObject(button, testCase, { checked: true })
+ verify(control)
+
+ verify(!control.checkable)
+ }
}