File indexing completed on 2024-12-15 03:45:01

0001 /*
0002     SPDX-FileCopyrightText: 2017 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: MIT
0005 */
0006 
0007 #ifndef KUSERFEEDBACK_CONSOLE_SINGLEROWFILTERPROXYMODEL_H
0008 #define KUSERFEEDBACK_CONSOLE_SINGLEROWFILTERPROXYMODEL_H
0009 
0010 #include <QSortFilterProxyModel>
0011 
0012 namespace KUserFeedback {
0013 namespace Console {
0014 
0015 /** Keep a single row from the source model. */
0016 class SingleRowFilterProxyModel : public QSortFilterProxyModel
0017 {
0018     Q_OBJECT
0019 public:
0020     explicit SingleRowFilterProxyModel(QObject *parent = nullptr);
0021     ~SingleRowFilterProxyModel() override;
0022 
0023     void setRow(int row);
0024     bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const override;
0025 
0026 private:
0027     int m_row = 0;
0028 };
0029 
0030 }}
0031 
0032 #endif // KUSERFEEDBACK_CONSOLE_SINGLEROWFILTERPROXYMODEL_H