QtPdCom  1.3.3
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 
35 
42 class QTPDCOM_PUBLIC BroadcastModel: public QAbstractTableModel
43 {
44  Q_OBJECT
45  Q_PROPERTY(QtPdCom::Process *process READ getProcess WRITE connectProcess)
46 
47  public:
48  explicit BroadcastModel(QObject *parent = nullptr);
49  ~BroadcastModel();
50 
51  int rowCount(const QModelIndex & = {}) const override;
52  int columnCount(const QModelIndex & = {}) const override;
53  QVariant
54  data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
55  QVariant headerData(
56  int section,
57  Qt::Orientation orientation,
58  int role = Qt::DisplayRole) const override;
59 
65  void connectProcess(QtPdCom::Process *process);
66  QtPdCom::Process *getProcess() const;
70  Q_INVOKABLE void clear();
71 
72  enum Roles {
73  DateStringRole = Qt::UserRole + 1,
76  };
77  Q_ENUM(Roles);
78  QHash<int, QByteArray> roleNames() const override;
79 
80  private:
81  Q_DECLARE_PRIVATE(BroadcastModel);
82 
83  QScopedPointer<BroadcastModelPrivate> const d_ptr;
84 };
85 
86 } // namespace QtPdCom
87 
88 
89 #endif // BROADCASTMODEL_H
Definition: BroadcastModel.h:75
Definition: BroadcastModel.h:74
PdCom::Process implementation for Qt.
Definition: Process.h:70
Model for capturing broadcast messages.
Definition: BroadcastModel.h:42
Definition: BroadcastModel.h:32
#define QTPDCOM_PUBLIC
Definition: Export.h:30
Roles
Definition: BroadcastModel.h:72
QScopedPointer< BroadcastModelPrivate > const d_ptr
Definition: BroadcastModel.h:83
Definition: BroadcastModel.cpp:28