aboutsummaryrefslogtreecommitdiffstats
path: root/tests
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 /tests
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 'tests')
-rw-r--r--tests/auto/controls/data/tst_abstractbutton.qml7
1 files changed, 7 insertions, 0 deletions
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)
+ }
}