summaryrefslogtreecommitdiffstats
path: root/src/sensors/doc/snippets/sensors/tutorial.cpp
blob: e87149617c126d7f3c365d2d02ed67fb12b737a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

//! [MySensor]
class MyReadingPrivate;

class MyReading : public QSensorReading
  {
    Q_OBJECT
    Q_PROPERTY(qreal myprop READ myprop)
    DECLARE_READING(MyReading)
public:
    qreal myprop() const;
    void setMyprop(qreal myprop);
  };

class MySensor : public QSensor
{
    Q_OBJECT
public:
    explicit MySensor(QObject *parent = 0);
    MyReading *reading() const;
    static char const * const sensorType;
  };
//! [MySensor]