QtPdCom  1.2.0
BroadcastModel.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * Copyright (C) 2009-2023 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 BROADCASTMODEL_H
23 #define BROADCASTMODEL_H
24 
25 #include <QAbstractTableModel>
26 #include <QList>
27 #include <QString>
28 
29 #include "Export.h"
30 #include "Process.h"
31 
32 namespace QtPdCom {
33 class Process;
34 
36 
43 class QTPDCOM_PUBLIC BroadcastModel: public QAbstractTableModel
44 {
45  Q_OBJECT
46  Q_PROPERTY(QtPdCom::Process *process READ getProcess WRITE connectProcess)
47 
48  public:
49  explicit BroadcastModel(QObject *parent = nullptr);
50  ~BroadcastModel();
51 
52  int rowCount(const QModelIndex & = {}) const override;
53  int columnCount(const QModelIndex & = {}) const override;
54  QVariant
55  data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
56  QVariant headerData(
57  int section,
58  Qt::Orientation orientation,
59  int role = Qt::DisplayRole) const override;
60 
66  void connectProcess(QtPdCom::Process *process);
67  QtPdCom::Process *getProcess() const;
71  Q_INVOKABLE void clear();
72 
73  enum Roles {
74  DateStringRole = Qt::UserRole + 1,
77  };
78  Q_ENUM(Roles);
79  QHash<int, QByteArray> roleNames() const override;
80 
81  private:
82  Q_DECLARE_PRIVATE(BroadcastModel);
83 
84  QScopedPointer<BroadcastModelPrivate> const d_ptr;
85 };
86 
87 } // namespace QtPdCom
88 
89 
90 #endif // BROADCASTMODEL_H
Definition: BroadcastModel.h:76
Definition: BroadcastModel.h:75
PdCom::Process implementation for Qt.
Definition: Process.h:60
Model for capturing broadcast messages.
Definition: BroadcastModel.h:43
Definition: BroadcastModel.h:32
#define QTPDCOM_PUBLIC
Definition: Export.h:30
Roles
Definition: BroadcastModel.h:73
QScopedPointer< BroadcastModelPrivate > const d_ptr
Definition: BroadcastModel.h:84
Definition: BroadcastModel.cpp:28