krecursivefilterproxymodel.h

00001 /*
00002     Copyright (c) 2009 Stephen Kelly <steveire@gmail.com>
00003 
00004     This library is free software; you can redistribute it and/or modify it
00005     under the terms of the GNU Library General Public License as published by
00006     the Free Software Foundation; either version 2 of the License, or (at your
00007     option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful, but WITHOUT
00010     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012     License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to the
00016     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017     02110-1301, USA.
00018 */
00019 
00020 
00021 #ifndef RECURSIVEFILTERPROXYMODEL_H
00022 #define RECURSIVEFILTERPROXYMODEL_H
00023 
00024 #include <QtGui/QSortFilterProxyModel>
00025 
00026 class KRecursiveFilterProxyModelPrivate;
00027 
00028 class KRecursiveFilterProxyModel : public QSortFilterProxyModel
00029 {
00030   Q_OBJECT
00031 public:
00032   KRecursiveFilterProxyModel(QObject* parent = 0);
00033 
00034   virtual ~KRecursiveFilterProxyModel();
00035 
00036   /* reimp */ void setSourceModel( QAbstractItemModel *model );
00037 
00038   virtual QModelIndexList match(const QModelIndex& start, int role, const QVariant& value, int hits = 1,
00039                                 Qt::MatchFlags flags = Qt::MatchFlags( Qt::MatchStartsWith | Qt::MatchWrap ) ) const;
00040 
00041 protected:
00042   virtual bool acceptRow(int sourceRow, const QModelIndex &sourceParent) const;
00043 
00044 private:
00045   /* reimp */ bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
00046 
00047 protected:
00048   KRecursiveFilterProxyModelPrivate * const d_ptr;
00049 
00050   Q_DECLARE_PRIVATE(KRecursiveFilterProxyModel)
00051 
00052   Q_PRIVATE_SLOT(d_func(), void sourceDataChanged(const QModelIndex &source_top_left, const QModelIndex &source_bottom_right))
00053   Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeInserted(const QModelIndex &source_parent, int start, int end))
00054   Q_PRIVATE_SLOT(d_func(), void sourceRowsInserted(const QModelIndex &source_parent, int start, int end))
00055   Q_PRIVATE_SLOT(d_func(), void sourceRowsAboutToBeRemoved(const QModelIndex &source_parent, int start, int end))
00056   Q_PRIVATE_SLOT(d_func(), void sourceRowsRemoved(const QModelIndex &source_parent, int start, int end))
00057 };
00058 
00059 #endif
00060 
KDE Home | KDE Accessibility Home | Description of Access Keys