From 2355c090567c9d015d60a42a9320b16e2e5806e0 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 28 Aug 2024 14:15:14 +0200 Subject: [PATCH] AutoTest: Fix update when toggling duration Explicitly mark respective indices having its data changed if the durations get toggled. Former approach did not cover all results correctly. Change-Id: Ibedbfcb426a9e3e9423f2c9b7a394062775c8fbc Reviewed-by: David Schulz --- src/plugins/autotest/testresultspane.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/autotest/testresultspane.cpp b/src/plugins/autotest/testresultspane.cpp index 1ccbd986f0a..96e6fd61185 100644 --- a/src/plugins/autotest/testresultspane.cpp +++ b/src/plugins/autotest/testresultspane.cpp @@ -222,10 +222,11 @@ void TestResultsPane::createToolButtons() connect(m_showDurationButton, &QToolButton::toggled, this, [this](bool checked) { if (auto trd = qobject_cast(m_treeView->itemDelegate())) { trd->setShowDuration(checked); - if (auto rowCount = m_model->rowCount()) { - QModelIndex tl = m_model->index(0, 0); - QModelIndex br = m_model->index(rowCount - 1, 0); - emit m_model->dataChanged(tl, br, {Qt::DisplayRole}); + if (m_model->rowCount()) { + m_model->rootItem()->forAllChildren([this](TestResultItem *it) { + const QModelIndex idx = m_model->indexForItem(it); + emit m_model->dataChanged(idx, idx, {Qt::DisplayRole}); + }); } } });