From 339ddd4fc70bbb75aec63db0429c6f5900a609f4 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 26 Oct 2017 07:48:54 +0200 Subject: QQuickCheckBox: don't force tristate when partially checked This allows a parent node to present partially checked state of child nodes without being interactively a tri-state box. [ChangeLog][Important Behavior Changes] CheckBox no longer forces tristate to true when setting checkState to Qt.PartiallyChecked. This allows a checkbox to present a partially checked state without being interactively a tri-state checkbox. Task-number: QTBUG-56295 Change-Id: Ie392d1955b922e0e5c3db4ef24b3abb0191ce519 Reviewed-by: Mitch Curtis --- tests/auto/controls/data/tst_checkbox.qml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'tests/auto/controls/data/tst_checkbox.qml') diff --git a/tests/auto/controls/data/tst_checkbox.qml b/tests/auto/controls/data/tst_checkbox.qml index 5f36b00c..55de90dc 100644 --- a/tests/auto/controls/data/tst_checkbox.qml +++ b/tests/auto/controls/data/tst_checkbox.qml @@ -387,12 +387,14 @@ TestCase { compare(container.cb2.checked, true) compare(container.cb2.checkState, Qt.PartiallyChecked) - compare(container.cb1.tristate, true) - compare(container.cb2.tristate, true) + // note: since Qt Quick Controls 2.4 (Qt 5.11), CheckBox does not + // force tristate when checkState is set to Qt.PartiallyChecked + compare(container.cb1.tristate, false) + compare(container.cb2.tristate, false) } function test_tristate() { - var control = createTemporaryObject(checkBox, testCase) + var control = createTemporaryObject(checkBox, testCase, {tristate: true}) var sequenceSpy = signalSequenceSpy.createObject(control, {target: control}) @@ -400,14 +402,13 @@ TestCase { control.forceActiveFocus() verify(control.activeFocus) - compare(control.tristate, false) + compare(control.tristate, true) compare(control.checked, false) compare(control.checkState, Qt.Unchecked) sequenceSpy.expectedSequence = [["checkStateChanged", { "pressed": false, "checked": true, "checkState": Qt.PartiallyChecked }], ["checkedChanged", { "pressed": false, "checked": true, "checkState": Qt.PartiallyChecked }]] control.checkState = Qt.PartiallyChecked - compare(control.tristate, true) compare(control.checked, true) compare(control.checkState, Qt.PartiallyChecked) verify(sequenceSpy.success) -- cgit v1.2.3