diff options
author | David Faure <david.faure@kdab.com> | 2015-01-15 14:12:34 +0100 |
---|---|---|
committer | David Faure <david.faure@kdab.com> | 2015-01-25 12:37:41 +0100 |
commit | 4910f416c2c0d1ec4a11408647bc6c96c719ce18 (patch) | |
tree | ef5532b84c725f4233a450f36180de5f62e97406 /tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp | |
parent | ed56e79b5373a3fb7dbabc5b56eaae2ac898ce05 (diff) |
Itemviews: add ItemIsUserTristate flag
ItemIsTristate is now again purely for enabling the automatic management
of the check state of QTreeWidgetItems, while ItemIsUserTristate is
separate from that and lets the user select the three states manually.
This restores the original behavior of ItemIsTristate for QTreeWidgetItems,
which got broken by letting the user cycle through the states too.
[ChangeLog][QtWidgets][QTreeWidget] Restored Qt 5.1 behavior of
QTreeWidgetItems with ItemIsTristate to enable automatic management
of the check state. User-editable tristate checkboxes are now enabled
by setting the new flag ItemIsUserTristate.
Task-number: QTBUG-40060
Change-Id: I341f5e983804d3b4f27982520bb6647f3014cccc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
Diffstat (limited to 'tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp')
-rw-r--r-- | tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp index 0ecb1d1af4..0d1f11c1b5 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp @@ -1159,7 +1159,7 @@ void tst_QItemDelegate::editorEvent_data() << (int)(QEvent::MouseButtonRelease) << (int)(Qt::LeftButton) << true - << (int)(Qt::PartiallyChecked); + << (int)(Qt::Checked); QTest::newRow("partially checked, tristate, release") << (int)(Qt::PartiallyChecked) @@ -1178,6 +1178,33 @@ void tst_QItemDelegate::editorEvent_data() << (int)(Qt::LeftButton) << true << (int)(Qt::Unchecked); + + QTest::newRow("unchecked, user-tristate, release") + << (int)(Qt::Unchecked) + << (int)(defaultFlags | Qt::ItemIsUserTristate) + << true + << (int)(QEvent::MouseButtonRelease) + << (int)(Qt::LeftButton) + << true + << (int)(Qt::PartiallyChecked); + + QTest::newRow("partially checked, user-tristate, release") + << (int)(Qt::PartiallyChecked) + << (int)(defaultFlags | Qt::ItemIsUserTristate) + << true + << (int)(QEvent::MouseButtonRelease) + << (int)(Qt::LeftButton) + << true + << (int)(Qt::Checked); + + QTest::newRow("checked, user-tristate, release") + << (int)(Qt::Checked) + << (int)(defaultFlags | Qt::ItemIsUserTristate) + << true + << (int)(QEvent::MouseButtonRelease) + << (int)(Qt::LeftButton) + << true + << (int)(Qt::Unchecked); } void tst_QItemDelegate::editorEvent() |