From 6cbcef3ee59000510ef489966604cc3ad3dd0720 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Sat, 8 Jan 2022 17:35:41 +0100 Subject: [PATCH] test filtering behavior --- src/librssguard/gui/feedsview.cpp | 35 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/librssguard/gui/feedsview.cpp b/src/librssguard/gui/feedsview.cpp index f43c5ca80..971204006 100644 --- a/src/librssguard/gui/feedsview.cpp +++ b/src/librssguard/gui/feedsview.cpp @@ -495,6 +495,12 @@ void FeedsView::focusInEvent(QFocusEvent* event) { } void FeedsView::filterItems(const QString& pattern) { + if (!pattern.isEmpty()) { + m_dontSaveExpandState = true; + expandAll(); + m_dontSaveExpandState = false; + } + #if QT_VERSION < 0x050C00 // Qt < 5.12.0 m_proxyModel->setFilterRegExp(pattern.toLower()); #else @@ -504,14 +510,6 @@ void FeedsView::filterItems(const QString& pattern) { if (pattern.isEmpty()) { loadAllExpandStates(); } - - /* - else { - m_isDontSaveExpandState = true; - expandAll(); - m_isDontSaveExpandState = false; - } - */ } void FeedsView::onIndexExpanded(const QModelIndex& idx) { @@ -603,17 +601,18 @@ void FeedsView::loadAllExpandStates() { } void FeedsView::expandItemDelayed(const QModelIndex& source_idx) { - QTimer::singleShot(100, this, [=] { - // Model requests to expand some items as they are visible and there is - // a filter active, so they maybe were not visible before. - QModelIndex pidx = m_proxyModel->mapFromSource(source_idx); + //QTimer::singleShot(100, this, [=] { + // Model requests to expand some items as they are visible and there is + // a filter active, so they maybe were not visible before. + QModelIndex pidx = m_proxyModel->mapFromSource(source_idx); - // NOTE: These changes are caused by filtering mechanisms - // and we don't want to store the values. - m_dontSaveExpandState = true; - expandRecursively(pidx); - m_dontSaveExpandState = false; - }); + // NOTE: These changes are caused by filtering mechanisms + // and we don't want to store the values. + m_dontSaveExpandState = true; + expandRecursively(pidx); + m_dontSaveExpandState = false; + + //}); } QMenu* FeedsView::initializeContextMenuCategories(RootItem* clicked_item) {