parley
kvtsortfiltermodel.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 00003 kvtsortfiltermodel 00004 00005 ----------------------------------------------------------------------- 00006 00007 copyright : (C) 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net> 00008 (C) 2007 Peter Hedlund <peter.hedlund@kdemail.net> 00009 00010 ----------------------------------------------------------------------- 00011 00012 ***************************************************************************/ 00013 00014 /*************************************************************************** 00015 * * 00016 * This program is free software; you can redistribute it and/or modify * 00017 * it under the terms of the GNU General Public License as published by * 00018 * the Free Software Foundation; either version 2 of the License, or * 00019 * (at your option) any later version. * 00020 * * 00021 ***************************************************************************/ 00022 00023 #ifndef KVTSORTFILTERMODEL_H 00024 #define KVTSORTFILTERMODEL_H 00025 00026 #include <QSortFilterProxyModel> 00027 00028 00033 class KVTTableModel; 00034 00035 class KVTSortFilterModel : public QSortFilterProxyModel 00036 { 00037 Q_OBJECT 00038 public: 00039 00040 KVTSortFilterModel(QObject *parent = 0); 00041 00042 void setSourceModel(KVTTableModel * sourceModel); 00043 KVTTableModel * sourceModel() const; 00044 00046 bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; 00047 00048 void setSearchRegExp(const QRegExp& filter); 00049 void setWordType(const QRegExp& wordType); 00050 00051 public slots: 00056 void slotSearch(const QString& s); 00057 00061 void restoreNativeOrder(); 00062 00063 void setLessonSelection(int lessonSelection); 00064 void slotCurrentLessonChanged(int); 00065 void slotLessonsInQueryChanged(); 00066 00067 protected: 00068 bool lessThan(const QModelIndex & left, const QModelIndex & right) const; 00069 00070 private: 00072 bool checkLesson(int sourceRow) const; 00073 bool checkSearch(int sourceRow) const; 00074 bool checkWordType(int sourceRow) const; 00075 00076 KVTTableModel * m_sourceModel; 00077 int m_lessonSelection; 00078 QRegExp m_searchFilter; 00079 QRegExp m_wordType; 00080 00081 bool m_restoreNativeOrder; 00082 }; 00083 00084 #endif
KDE 4.0 API Reference