From c1abbf0802a8ee6fa6fe90f30d176609b6f525a4 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 10 May 2021 07:00:16 +0200 Subject: [PATCH] AutoTest: Fix checkstate evaluation When the last item of a test got modified and gets a different state than the rest of its siblings we failed to set the resulting state of its parent to partially checked. Fixes: QTCREATORBUG-25702 Change-Id: I122b77b907dfa7fd14c31d8363b025254e0c115e Reviewed-by: David Schulz --- src/plugins/autotest/testtreemodel.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/autotest/testtreemodel.cpp b/src/plugins/autotest/testtreemodel.cpp index 3a5908e16f9..4719818d5d8 100644 --- a/src/plugins/autotest/testtreemodel.cpp +++ b/src/plugins/autotest/testtreemodel.cpp @@ -623,10 +623,6 @@ static Qt::CheckState computeCheckStateByChildren(ITestTreeItem *item) bool foundPartiallyChecked = false; item->forFirstLevelChildren([&](ITestTreeItem *child) { - if (foundPartiallyChecked || (foundChecked && foundUnchecked)) { - newState = Qt::PartiallyChecked; - return; - } switch (child->type()) { case TestTreeItem::TestDataFunction: case TestTreeItem::TestSpecialFunction: @@ -638,6 +634,11 @@ static Qt::CheckState computeCheckStateByChildren(ITestTreeItem *item) foundChecked |= (child->checked() == Qt::Checked); foundUnchecked |= (child->checked() == Qt::Unchecked); foundPartiallyChecked |= (child->checked() == Qt::PartiallyChecked); + + if (foundPartiallyChecked || (foundChecked && foundUnchecked)) { + newState = Qt::PartiallyChecked; + return; + } }); if (newState != Qt::PartiallyChecked)