QtPdCom  1.5.2
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
32namespace QtPdCom {
33
35
42class QTPDCOM_PUBLIC BroadcastModel: public QAbstractTableModel
43{
44 Q_OBJECT
46
47 public:
48 explicit BroadcastModel(QObject *parent = nullptr);
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 };
78 QHash<int, QByteArray> roleNames() const override;
79
80 private:
82
83 QScopedPointer<BroadcastModelPrivate> const d_ptr;
84};
85
86} // namespace QtPdCom
87
88
89#endif // BROADCASTMODEL_H
#define QTPDCOM_PUBLIC
Definition Export.h:30
BroadcastModel(QObject *parent=nullptr)
Definition BroadcastModel.cpp:46
Definition BroadcastModel.cpp:29
void connectProcess(QtPdCom::Process *process)
Connect to a Process.
Definition BroadcastModel.cpp:131
QtPdCom::Process * process
Definition BroadcastModel.h:45
QScopedPointer< BroadcastModelPrivate > const d_ptr
Definition BroadcastModel.h:83
int rowCount(const QModelIndex &={}) const override
Definition BroadcastModel.cpp:52
BroadcastModel(QObject *parent=nullptr)
Definition BroadcastModel.cpp:46
Roles
Definition BroadcastModel.h:72
@ MessageStringRole
Definition BroadcastModel.h:74
@ UsernameRole
Definition BroadcastModel.h:75
@ DateStringRole
Definition BroadcastModel.h:73
QHash< int, QByteArray > roleNames() const override
Definition BroadcastModel.cpp:175
Q_DECLARE_PRIVATE(BroadcastModel)
QtPdCom::Process * getProcess() const
Definition BroadcastModel.cpp:160
PdCom::Process implementation for Qt.
Definition Process.h:72
Definition BroadcastModel.h:32