From a68636acd89f3e283ec49c644761e8a51d6e89c7 Mon Sep 17 00:00:00 2001 From: Geoff Hutchison Date: Tue, 21 Nov 2023 13:43:18 -0500 Subject: [PATCH] Don't show PNG files in the filter dialog Signed-off-by: Geoff Hutchison --- avogadro/qtgui/sortfiltertreeproxymodel.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/avogadro/qtgui/sortfiltertreeproxymodel.cpp b/avogadro/qtgui/sortfiltertreeproxymodel.cpp index 7eb1a07572..54786153f5 100644 --- a/avogadro/qtgui/sortfiltertreeproxymodel.cpp +++ b/avogadro/qtgui/sortfiltertreeproxymodel.cpp @@ -23,6 +23,11 @@ bool SortFilterTreeProxyModel::filterAcceptsRow( return true; // true root, always accept } + QString data = sourceModel()->data(sourceIndex).toString(); + // ignore any image files + if (data.endsWith(".png")) + return false; + // Now we see if we're a child of the root // If not, we accept -- only filter under *our* tree // Along the way, we'll see if a parent matches the filter @@ -48,7 +53,6 @@ bool SortFilterTreeProxyModel::filterAcceptsRow( // else, sourceParent is a root, so we're good to filter // Check if the data for this row matches. If so, the default is to accept - QString data = sourceModel()->data(sourceIndex).toString(); if (data.contains(filterRegExp())) return true;