3
* In the name of the Father, and of the Son, and of the Holy Spirit.
5
* This file is part of BibleTime's source code, http://www.bibletime.info/.
7
* Copyright 1999-2009 by the BibleTime developers.
8
* The BibleTime source code is licensed under the GNU General Public License
13
#include "backend/bookshelfmodel/btmodulenamefilterproxymodel.h"
15
BtModuleNameFilterProxyModel::BtModuleNameFilterProxyModel(QObject *parent)
16
: QSortFilterProxyModel(parent), m_enabled(true)
18
setFilterCaseSensitivity(Qt::CaseInsensitive);
21
BtModuleNameFilterProxyModel::~BtModuleNameFilterProxyModel() {
22
// Intentionally empty
25
bool BtModuleNameFilterProxyModel::filterAcceptsRow(int row,
26
const QModelIndex &p) const
28
if (!m_enabled) return true;
30
const QAbstractItemModel *m(sourceModel());
33
QModelIndex itemIndex(m->index(row, 0, p));
34
int numChildren(m->rowCount(itemIndex));
35
if (numChildren == 0) {
36
return QSortFilterProxyModel::filterAcceptsRow(row, p);
38
for (int i(0); i < numChildren; i++) {
39
if (filterAcceptsRow(i, itemIndex)) return true;