From bf8eb2d270f62d3796c2004aa777db4a3f9136f9 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 6 Nov 2020 13:24:06 +0100 Subject: [PATCH] AutoTest: Fix using of cache Change-Id: I3f7695c96139c1f1809631ead1b723e3820b240d Reviewed-by: David Schulz --- src/plugins/autotest/testnavigationwidget.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/plugins/autotest/testnavigationwidget.cpp b/src/plugins/autotest/testnavigationwidget.cpp index 31b0c6749bf..4a6aa7c0c06 100644 --- a/src/plugins/autotest/testnavigationwidget.cpp +++ b/src/plugins/autotest/testnavigationwidget.cpp @@ -116,6 +116,8 @@ TestNavigationWidget::TestNavigationWidget(QWidget *parent) : this, &TestNavigationWidget::reapplyCachedExpandedState); connect(m_progressTimer, &QTimer::timeout, m_progressIndicator, &Utils::ProgressIndicator::show); + connect(m_view, &TestTreeView::expanded, this, &TestNavigationWidget::updateExpandedStateCache); + connect(m_view, &TestTreeView::collapsed, this, &TestNavigationWidget::updateExpandedStateCache); } void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event) @@ -226,8 +228,18 @@ QList TestNavigationWidget::createToolButtons() collapse->setIcon(Utils::Icons::COLLAPSE_TOOLBAR.icon()); collapse->setToolTip(tr("Collapse All")); - connect(expand, &QToolButton::clicked, m_view, &TestTreeView::expandAll); - connect(collapse, &QToolButton::clicked, m_view, &TestTreeView::collapseAll); + connect(expand, &QToolButton::clicked, m_view, [this]() { + m_view->blockSignals(true); + m_view->expandAll(); + m_view->blockSignals(false); + updateExpandedStateCache(); + }); + connect(collapse, &QToolButton::clicked, m_view, [this]() { + m_view->blockSignals(true); + m_view->collapseAll(); + m_view->blockSignals(false); + updateExpandedStateCache(); + }); connect(m_sort, &QToolButton::clicked, this, &TestNavigationWidget::onSortClicked); list << m_filterButton << m_sort << expand << collapse;