From dd23d9f161deda1e72c1f6c4eccf1c6d598bf752 Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 19 Jan 2015 19:26:22 +0100 Subject: QTreeWidget: forbid forcing PartiallyChecked on parent tristate items. ItemIsTristate means QTreeWidget determines the check state of parent items based on the check state of child items. Checking/unchecking the parent propagates to children; but setting the parent to PartiallyChecked shouldn't do that, especially since it can lead to children without ItemIsTristate having PartiallyChecked check state. Change-Id: Ibc8b7c77d9ec4c1578c07f3c62581edb770f8439 Reviewed-by: Friedemann Kleint Reviewed-by: Jarek Kobus --- src/widgets/itemviews/qtreewidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 704f8975b9..007760ef16 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -1720,7 +1720,7 @@ void QTreeWidgetItem::setData(int column, int role, const QVariant &value) } } break; case Qt::CheckStateRole: - if (itemFlags & Qt::ItemIsTristate) { + if ((itemFlags & Qt::ItemIsTristate) && value != Qt::PartiallyChecked) { for (int i = 0; i < children.count(); ++i) { QTreeWidgetItem *child = children.at(i); if (child->data(column, role).isValid()) {// has a CheckState -- cgit v1.2.3