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 /src/corelib/global | |
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 'src/corelib/global')
-rw-r--r-- | src/corelib/global/qnamespace.h | 3 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index fccb0d5421..4a3c9c546e 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1475,7 +1475,8 @@ public: ItemIsUserCheckable = 16, ItemIsEnabled = 32, ItemIsTristate = 64, - ItemNeverHasChildren = 128 + ItemNeverHasChildren = 128, + ItemIsUserTristate = 256 }; Q_DECLARE_FLAGS(ItemFlags, ItemFlag) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index c8aa53aced..e49bc1565f 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2574,8 +2574,13 @@ \value ItemIsDropEnabled It can be used as a drop target. \value ItemIsUserCheckable It can be checked or unchecked by the user. \value ItemIsEnabled The user can interact with the item. - \value ItemIsTristate The item is checkable with three separate states. + \value ItemIsTristate The item can show three separate states. + This enables automatic management of the state of parent items in QTreeWidget + (checked if all children are checked, unchecked if all children are unchecked, + or partially checked if only some children are checked). \value ItemNeverHasChildren The item never has child items. + \value ItemIsUserTristate The user can cycle through three separate states. + This value has been added in Qt 5.5. Note that checkable items need to be given both a suitable set of flags and an initial state, indicating whether the item is checked or not. |