From 65b1088a17c04393a100132ae881211d533c0c18 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 22 Jun 2023 15:22:35 +0200 Subject: [PATCH] AutoTest: Delay expansion request Do not directly expand an item directly after it had been added to the model as its internal mappings need to get updated. Fixes: QTCREATORBUG-29302 Change-Id: If70d209074d97e0598bcbce061e176148751705a Reviewed-by: Qt CI Bot Reviewed-by: David Schulz --- src/plugins/autotest/testresultmodel.cpp | 5 ++--- src/plugins/autotest/testresultspane.cpp | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plugins/autotest/testresultmodel.cpp b/src/plugins/autotest/testresultmodel.cpp index f686692faad..812303e47af 100644 --- a/src/plugins/autotest/testresultmodel.cpp +++ b/src/plugins/autotest/testresultmodel.cpp @@ -298,9 +298,8 @@ void TestResultModel::addTestResult(const TestResult &testResult, bool autoExpan if (parentItem) { parentItem->appendChild(newItem); if (autoExpand) { - parentItem->expand(); - newItem->expand(); - newItem->forAllChildren([](TreeItem *it) { it->expand(); }); + QMetaObject::invokeMethod(this, [parentItem]{ parentItem->expand(); }, + Qt::QueuedConnection); } updateParent(newItem); } else { diff --git a/src/plugins/autotest/testresultspane.cpp b/src/plugins/autotest/testresultspane.cpp index 3dbad31ea99..457b273a4a1 100644 --- a/src/plugins/autotest/testresultspane.cpp +++ b/src/plugins/autotest/testresultspane.cpp @@ -142,7 +142,7 @@ TestResultsPane::TestResultsPane(QObject *parent) : onCopyItemTriggered(getTestResult(m_treeView->currentIndex())); }); connect(m_model, &TestResultModel::requestExpansion, this, [this](const QModelIndex &idx) { - m_treeView->expand(m_filterModel->mapFromSource(idx)); + m_treeView->expandRecursively(m_filterModel->mapFromSource(idx)); }); connect(TestRunner::instance(), &TestRunner::testRunStarted, this, &TestResultsPane::onTestRunStarted);