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 <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2024-08-28 14:15:14 +02:00
parent cfdb2695f8
commit 2355c09056

View File

@@ -222,10 +222,11 @@ void TestResultsPane::createToolButtons()
connect(m_showDurationButton, &QToolButton::toggled, this, [this](bool checked) {
if (auto trd = qobject_cast<TestResultDelegate *>(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});
});
}
}
});