Warning, file /system/kjournald/lib/fieldfilterproxymodel.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-License-Identifier: LGPL-2.1-or-later OR MIT
0003     SPDX-FileCopyrightText: 2021 Andreas Cord-Landwehr <cordlandwehr@kde.org>
0004 */
0005 
0006 #ifndef FIELDFILTERPROXYMODEL_H
0007 #define FIELDFILTERPROXYMODEL_H
0008 
0009 #include "journaldviewmodel.h"
0010 #include "kjournald_export.h"
0011 #include <qjsvalue.h>
0012 #include <qqmlparserstatus.h>
0013 #include <qsortfilterproxymodel.h>
0014 
0015 class KJOURNALD_EXPORT FieldFilterProxyModel : public QSortFilterProxyModel, public QQmlParserStatus
0016 {
0017     Q_OBJECT
0018     Q_INTERFACES(QQmlParserStatus)
0019 
0020     Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
0021     Q_PROPERTY(QString field WRITE setField)
0022 
0023 public:
0024     explicit FieldFilterProxyModel(QObject *parent = 0);
0025 
0026     void setField(const QString &field);
0027 
0028     QString filterString() const;
0029     void setFilterString(const QString &filter);
0030 
0031     Q_INVOKABLE QJSValue get(int index) const;
0032 
0033     void classBegin() override;
0034     void componentComplete() override;
0035 
0036 Q_SIGNALS:
0037     void countChanged();
0038 
0039 protected:
0040     int roleKey(const QByteArray &role) const;
0041     QHash<int, QByteArray> roleNames() const override;
0042 
0043 private:
0044     bool mComplete;
0045     JournaldViewModel::Roles mFilterRole;
0046     QString mFilter;
0047 };
0048 
0049 #endif // FIELDFILTERPROXYMODEL_H