1// Copyright (C) 2016 Canonical, Ltd
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3#ifndef QMLLIDSENSOR_P_H
4#define QMLLIDSENSOR_P_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
17#include "qmlsensor_p.h"
18
19QT_BEGIN_NAMESPACE
20
21class QLidSensor;
22
23class Q_SENSORSQUICK_PRIVATE_EXPORT QmlLidSensor : public QmlSensor
24{
25 Q_OBJECT
26 QML_NAMED_ELEMENT(LidSensor)
27 QML_ADDED_IN_VERSION(5,9)
28public:
29 explicit QmlLidSensor(QObject *parent = 0);
30 ~QmlLidSensor();
31
32 QSensor *sensor() const override;
33
34private:
35 QmlSensorReading *createReading() const override;
36
37 QLidSensor *m_sensor;
38};
39
40class Q_SENSORSQUICK_PRIVATE_EXPORT QmlLidReading : public QmlSensorReading
41{
42 Q_OBJECT
43 Q_PROPERTY(bool backLidClosed READ backLidClosed
44 NOTIFY backLidChanged BINDABLE bindableBackLidClosed)
45 Q_PROPERTY(bool frontLidClosed READ frontLidClosed
46 NOTIFY frontLidChanged BINDABLE bindableFrontLidClosed)
47 QML_NAMED_ELEMENT(LidReading)
48 QML_UNCREATABLE("Cannot create LidReading")
49 QML_ADDED_IN_VERSION(5,9)
50public:
51 explicit QmlLidReading(QLidSensor *sensor);
52 ~QmlLidReading();
53
54 bool backLidClosed() const;
55 QBindable<bool> bindableBackLidClosed() const;
56 bool frontLidClosed() const;
57 QBindable<bool> bindableFrontLidClosed() const;
58
59Q_SIGNALS:
60 void backLidChanged(bool closed);
61 bool frontLidChanged(bool closed);
62
63private:
64 QSensorReading *reading() const override;
65 void readingUpdate() override;
66
67 QLidSensor *m_sensor;
68 Q_OBJECT_BINDABLE_PROPERTY(QmlLidReading, bool,
69 m_backClosed, &QmlLidReading::backLidChanged)
70 Q_OBJECT_BINDABLE_PROPERTY(QmlLidReading, bool,
71 m_frontClosed, &QmlLidReading::frontLidChanged)
72};
73
74QT_END_NAMESPACE
75#endif
76

source code of qtsensors/src/sensorsquick/qmllidsensor_p.h