| Line |
Branch |
Exec |
Source |
| 1 |
|
|
/***************************************************************************** |
| 2 |
|
|
* |
| 3 |
|
|
* Copyright (C) 2009 - 2024 Bjarne von Horn <vh@igh.de> |
| 4 |
|
|
* |
| 5 |
|
|
* This file is part of the QtPdCom library. |
| 6 |
|
|
* |
| 7 |
|
|
* The QtPdCom library is free software: you can redistribute it and/or modify |
| 8 |
|
|
* it under the terms of the GNU Lesser General Public License as published by |
| 9 |
|
|
* the Free Software Foundation, either version 3 of the License, or (at your |
| 10 |
|
|
* option) any later version. |
| 11 |
|
|
* |
| 12 |
|
|
* The QtPdCom library is distributed in the hope that it will be useful, but |
| 13 |
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 14 |
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
| 15 |
|
|
* License for more details. |
| 16 |
|
|
* |
| 17 |
|
|
* You should have received a copy of the GNU Lesser General Public License |
| 18 |
|
|
* along with the QtPdCom Library. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
|
|
* |
| 20 |
|
|
****************************************************************************/ |
| 21 |
|
|
|
| 22 |
|
|
#ifndef QTPDCOM_MESSAGEMODELFILTER_H |
| 23 |
|
|
#define QTPDCOM_MESSAGEMODELFILTER_H |
| 24 |
|
|
|
| 25 |
|
|
#include "Export.h" |
| 26 |
|
|
#include <QScopedPointer> |
| 27 |
|
|
#include <QSortFilterProxyModel> |
| 28 |
|
|
|
| 29 |
|
|
namespace QtPdCom { |
| 30 |
|
|
|
| 31 |
|
|
class MessageModelFilterPrivate; |
| 32 |
|
|
|
| 33 |
|
|
/** Proxy model to filter Messages based on their reset time. |
| 34 |
|
|
* |
| 35 |
|
|
* This Proxy model allows to filter out acknowledged messages. |
| 36 |
|
|
* Messages with a non-empty reset timestamp are acknowledged. |
| 37 |
|
|
* |
| 38 |
|
|
* This class is also available in QML. |
| 39 |
|
|
* |
| 40 |
|
|
* Supply a MessageModel instance as \c sourceModel property of |
| 41 |
|
|
* QSortFilterProxyModel. |
| 42 |
|
|
*/ |
| 43 |
|
✗ |
class QTPDCOM_PUBLIC MessageModelFilter: public QSortFilterProxyModel |
| 44 |
|
|
{ |
| 45 |
|
|
Q_OBJECT |
| 46 |
|
|
Q_PROPERTY(bool showOnlyActiveMessages READ getShowOnlyActiveMessages |
| 47 |
|
|
WRITE setShowOnlyActiveMessages) |
| 48 |
|
|
|
| 49 |
|
|
public: |
| 50 |
|
|
explicit MessageModelFilter(QObject *parent = nullptr); |
| 51 |
|
|
~MessageModelFilter(); |
| 52 |
|
|
|
| 53 |
|
|
bool getShowOnlyActiveMessages() const; |
| 54 |
|
|
void setShowOnlyActiveMessages(bool value); |
| 55 |
|
|
|
| 56 |
|
|
protected: |
| 57 |
|
|
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) |
| 58 |
|
|
const override; |
| 59 |
|
|
|
| 60 |
|
|
private: |
| 61 |
|
✗ |
Q_DECLARE_PRIVATE(MessageModelFilter); |
| 62 |
|
|
QScopedPointer<MessageModelFilterPrivate> const d_ptr; |
| 63 |
|
|
}; |
| 64 |
|
|
|
| 65 |
|
|
} // namespace QtPdCom |
| 66 |
|
|
|
| 67 |
|
|
#endif // QTPDCOM_MESSAGEMODELFILTER_H |
| 68 |
|
|
|