00001 #include "exercisefiltermodel.h"
00002
00003 ExerciseFilterModel::ExerciseFilterModel(QSortFilterProxyModel *parent) : QSortFilterProxyModel(parent)
00004 {
00005 }
00006
00007 bool ExerciseFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
00008 {
00009 QModelIndex parent = sourceModel()->index(sourceRow, 0, sourceParent).parent();
00010 if(parent.data(Qt::DisplayRole).toString().toUpper() != "")
00011 {
00012 if(!sourceModel()->index(sourceRow, 0, sourceParent).data(Qt::DisplayRole).toString().toUpper().contains(filterRegExp().pattern().toUpper()))
00013 {
00014 return false;
00015 }
00016 }
00017 return true;
00018 }
00019
00020 bool ExerciseFilterModel::filterAcceptsColumn(int source_column, const QModelIndex & source_parent) const
00021 {
00022 return true;
00023 }
00024