File indexing completed on 2024-04-21 03:50:59
0001 /* 0002 SPDX-FileCopyrightText: 2007-2008 Frederik Gladhorn <frederik.gladhorn@kdemail.net> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef VOCABULARYFILTER_H 0007 #define VOCABULARYFILTER_H 0008 0009 #include <QSortFilterProxyModel> 0010 0011 class KEduVocLesson; 0012 class KEduVocExpression; 0013 0014 class VocabularyModel; 0015 0016 class VocabularyFilter : public QSortFilterProxyModel 0017 { 0018 Q_OBJECT 0019 public: 0020 explicit VocabularyFilter(QObject *parent = nullptr); 0021 0022 void setSourceModel(VocabularyModel *model); 0023 0024 QModelIndex appendEntry(KEduVocExpression *expression = nullptr); 0025 KEduVocLesson *lesson(); 0026 0027 public Q_SLOTS: 0028 void setSearchString(const QString &expression); 0029 0030 protected: 0031 bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; 0032 0033 private: 0034 void setSourceModel(QAbstractItemModel *model) override 0035 { 0036 Q_UNUSED(model) 0037 } 0038 0039 VocabularyModel *m_model; 0040 QString m_filterString; 0041 }; 0042 0043 #endif