GCC Code Coverage Report


Directory: ./
File: QtPdCom1/MessageModelUnion.h
Date: 2025-07-04 12:28:41
Exec Total Coverage
Lines: 0 1 0.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /*****************************************************************************
2 *
3 * Copyright (C) 2009 - 2025 Florian Pose <fp@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 #pragma once
23
24 #include "Export.h"
25
26 #include <QAbstractTableModel>
27
28 #include <memory>
29
30 namespace QtPdCom {
31
32 class MessageModel;
33 class MessageModelFilter;
34 class Message;
35
36 /****************************************************************************/
37
38 /** Table model that combines the rows of multiple MessageModels or
39 * MessageModelFilters.
40 */
41 class QTPDCOM_PUBLIC MessageModelUnion: public QAbstractTableModel
42 {
43 Q_OBJECT
44
45 public:
46 enum Columns {
47 TextColumn = 0,
48 TimeOccurredColumn,
49 TimeResetColumn,
50 SourceColumn
51 };
52 Q_ENUM(Columns)
53
54 explicit MessageModelUnion(QObject *parent = nullptr);
55 virtual ~MessageModelUnion();
56
57 void addSourceModel(QAbstractItemModel *, QString = QString());
58 void removeSourceModel(QAbstractItemModel *);
59
60 void clearSourceModels();
61
62 // from QAbstractItemModel
63 virtual int rowCount(const QModelIndex &) const override;
64 virtual int columnCount(const QModelIndex &) const override;
65 virtual QVariant data(const QModelIndex &, int) const override;
66 virtual QVariant headerData(int, Qt::Orientation, int) const override;
67 virtual Qt::ItemFlags flags(const QModelIndex &) const override;
68 virtual bool canFetchMore(const QModelIndex &) const override;
69 virtual void fetchMore(const QModelIndex &) override;
70
71 signals:
72 /** Emitted, when a new message gets active.
73 *
74 * This signal announces the most recent message. It is only emitted
75 * for the first message getting active, or for a subsequent message
76 * with a higher type.
77 *
78 * In QML, a currentMessage property is available.
79 *
80 * \param message The message that got active. The signal is emitted
81 * with \a message being \a NULL, if no messages are
82 * active any more.
83 */
84 void currentMessage(const QtPdCom::Message *message);
85
86 private:
87 struct Q_DECL_HIDDEN Impl;
88 std::unique_ptr<Impl> impl;
89 };
90
91 /****************************************************************************/
92
93 } // namespace QtPdCom
94