Skip to content

Commit

Permalink
Merge pull request #1462 from ghutchis/filter-out-png-files
Browse files Browse the repository at this point in the history
Don't show PNG files in the filter dialog
  • Loading branch information
ghutchis authored Nov 21, 2023
2 parents 4f1b939 + a68636a commit 02e2d5a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion avogadro/qtgui/sortfiltertreeproxymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;

Expand Down

0 comments on commit 02e2d5a

Please sign in to comment.