aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexander Akulich <akulichalexander@gmail.com>2021-05-14 16:04:51 +0300
committerAlexander Akulich <akulichalexander@gmail.com>2021-05-26 14:51:23 +0300
commit4f73c07b529d2437e72bfdf4c1a75f83e2bdbe76 (patch)
tree99dd8d4d0d4ccdaf799597fd6cf41fc2bf56fa7d /src
parent6b687ad7ec46fed10766f5d26809c4fe430db608 (diff)
Revert "AbstractButton: set automatically as checkable when being checked"
This reverts commit 8ba12ed7f25d8cfb7619b6eb0a26fe4ae3e823b1. The referenced commit was introduced to simplify buttons setup: Button { checked: true } Button { checkable: true } With the commit the first button becomes 'checkable' automatically. However, the implemented behavior violates the principle of least surprise, listed in "API Design Principles". The following checkbox will be checkable despite of the explicitly set properties: CheckBox { checked: true checkable: false } This is a "surprising" behavior which makes some rare and already complex use-cases unnecessarily complicated. The save of explicit "checkable: true" does not justify the surprice and the ugliness of the code needed to overcome the forced checkable property if needed. [ChangeLog][Important Behavior Changes] Setting the AbstractButton's 'checked' property to 'true' does not automatically set its 'checkable' to true anymore. Fixes: QTBUG-93807 Change-Id: Ia35138ee6a09bb9f361f52a84e53578b0b6e57e3 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/quicktemplates2/qquickabstractbutton.cpp9
1 files changed, 4 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