QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
sensor
qgssensormodel.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgssensormodel.h
3
---------------
4
begin : March 2023
5
copyright : (C) 2023 by Mathieu pellerin
6
email : mathieu at opengis dot ch
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
16
#ifndef QGSSENSORMODEL_H
17
#define QGSSENSORMODEL_H
18
19
#include "qgis_core.h"
20
#include "
qgis_sip.h
"
21
22
#include <QAbstractItemModel>
23
24
class
QgsSensorManager
;
25
32
class
CORE_EXPORT
QgsSensorModel
:
public
QAbstractItemModel
33
{
34
Q_OBJECT
35
36
public
:
38
enum class
Column
:
int
39
{
40
Name = 0,
41
LastValue = 1,
42
};
43
44
// *INDENT-OFF*
45
52
enum class
CustomRole
SIP_MONKEYPATCH_SCOPEENUM_UNNEST
(
QgsSensorModel
, Role ) : int
53
{
54
SensorType = Qt::UserRole + 1,
55
SensorId,
56
SensorName,
57
SensorStatus,
58
SensorLastValue,
59
SensorLastTimestamp,
60
Sensor,
61
};
62
Q_ENUM( CustomRole )
63
// *INDENT-ON*
64
65
68
explicit
QgsSensorModel
(
QgsSensorManager
*manager, QObject *parent
SIP_TRANSFERTHIS
=
nullptr
);
69
70
QVariant data(
const
QModelIndex &index,
int
role )
const override
;
71
bool
setData(
const
QModelIndex &index,
const
QVariant &value,
int
role = Qt::EditRole )
override
;
72
Qt::ItemFlags flags(
const
QModelIndex &index )
const override
;
73
QVariant headerData(
int
section, Qt::Orientation orientation,
int
role = Qt::DisplayRole )
const override
;
74
QModelIndex index(
int
row,
int
column,
const
QModelIndex &parent = QModelIndex() )
const override
;
75
QModelIndex parent(
const
QModelIndex &index )
const override
;
76
int
rowCount(
const
QModelIndex &parent = QModelIndex() )
const override
;
77
int
columnCount(
const
QModelIndex &parent = QModelIndex() )
const override
;
78
79
private
slots:
80
81
void
sensorAdded(
const
QString &
id
);
82
void
sensorRemoved(
const
QString &
id
);
83
void
sensorNameChanged(
const
QString &
id
);
84
void
sensorStatusChanged(
const
QString &
id
);
85
void
sensorDataCaptured(
const
QString &
id
);
86
87
private
:
88
QgsSensorManager
*mSensorManager =
nullptr
;
89
QStringList mSensorIds;
90
};
91
92
#endif
//QGSSENSORMODEL_H
QgsSensorManager
Manages sensors.
Definition
qgssensormanager.h:42
QgsSensorModel
A QAbstractItemModel subclass for showing sensors within a QgsSensorManager.
Definition
qgssensormodel.h:33
QgsSensorModel::QgsSensorModel
QgsSensorModel(QgsSensorManager *manager, QObject *parent=nullptr)
Constructor for QgsSensorModel, for the specified manager and parent object.
Definition
qgssensormodel.cpp:24
QgsSensorModel::Column
Column
Model columns.
Definition
qgssensormodel.h:39
QgsSensorModel::CustomRole
CustomRole
Custom model roles.
Definition
qgssensormodel.h:53
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
SIP_MONKEYPATCH_SCOPEENUM_UNNEST
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition
qgis_sip.h:270
Generated on
for QGIS API Documentation by
1.17.0