alloffilter.cpp
1 #include "alloffilter.h" 2 3 namespace qqsfpm { 4 5 /*! 6 \qmltype AllOf 7 \inherits Filter 8 \inqmlmodule SortFilterProxyModel 9 \ingroup Filters 10 \ingroup FilterContainer 11 \brief Filter container accepting rows accepted by all its child filters. 12 13 The AllOf type is a \l Filter container that accepts rows if all of its contained (and enabled) filters accept them, or if it has no filter. 14 15 Using it as a top level filter has the same effect as putting all its child filters as top level filters. It can however be usefull to use an AllOf filter when nested in an AnyOf filter. 16 \sa FilterContainer 17 */ 18 bool AllOfFilter::filterRow(const QModelIndex& sourceIndex, const QQmlSortFilterProxyModel& proxyModel) const 19 { 20 //return true if all filters return false, or if there is no filter. 21 return std::all_of(m_filters.begin(), m_filters.end(), 22 [&sourceIndex, &proxyModel] (Filter* filter) { 23 return filter->filterAcceptsRow(sourceIndex, proxyModel); 24 } 25 ); 26 } 27 28 }