On Tue, Sep 6, 2016 at 12:20 PM, Thompson, Adam B. <thompso...@ornl.gov> wrote:
> > My question: can anyone provide some tips on how to properly subclass > QAbstractProxyModel so I can provide some custom depth-first filtering > capabilities? (Sorting isn’t really necessary at the moment, really just > filtering.) > > > Our application does something similar to what you describe. We have several item types: folders (which may have children), and waves, variables, and strings, which may not contain children. Our custom QSortFilterProxyModel class allows sorting and filtering by item type and/or name. In order to get around the issue you describe, our filterAcceptsRow method essentially always returns true for items of type folder. For other item types, we actually test whether the type is appropriate for the filter settings and whether the name matches the specified pattern. This isn't optimal, because it can be difficult to wade through all of the empty folders displayed in the view, but in most cases the number of non-folder items greatly outnumbers the number of folder items so the filtering is still quite useful. It's also very fast since we're not inspecting all descendants of each item when determining if it should be filtered out or not. Adam
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest