Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qdeclarativesatellitesource_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QDECLARATIVESATELLITESOURCE_H
5#define QDECLARATIVESATELLITESOURCE_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/private/qproperty_p.h>
19#include <QtCore/QObject>
20
21#include <QtPositioning/qgeosatelliteinfosource.h>
22
23#include <QtPositioningQuick/private/qdeclarativepluginparameter_p.h>
24#include <QtPositioningQuick/private/qpositioningquickglobal_p.h>
25
26#include <QtQml/QQmlParserStatus>
27
29
30class Q_POSITIONINGQUICK_EXPORT QDeclarativeSatelliteSource : public QObject, public QQmlParserStatus
31{
33 QML_NAMED_ELEMENT(SatelliteSource)
35
36 Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged)
37 Q_PROPERTY(bool valid READ isValid NOTIFY validityChanged)
38 Q_PROPERTY(int updateInterval READ updateInterval WRITE setUpdateInterval
39 NOTIFY updateIntervalChanged)
40 Q_PROPERTY(SourceError sourceError READ sourceError NOTIFY sourceErrorChanged)
41 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
43 Q_PROPERTY(QList<QGeoSatelliteInfo> satellitesInUse READ satellitesInUse
44 NOTIFY satellitesInUseChanged)
45 Q_PROPERTY(QList<QGeoSatelliteInfo> satellitesInView READ satellitesInView
46 NOTIFY satellitesInViewChanged)
47
48 Q_CLASSINFO("DefaultProperty", "parameters")
50
51public:
59 Q_ENUM(SourceError)
60
63
64 bool isActive() const;
65 bool isValid() const;
66 int updateInterval() const;
67 SourceError sourceError() const;
68 QString name() const;
69 QQmlListProperty<QDeclarativePluginParameter> parameters();
70 QList<QGeoSatelliteInfo> satellitesInUse() const;
71 QList<QGeoSatelliteInfo> satellitesInView() const;
72
73 void setUpdateInterval(int updateInterval);
74 void setActive(bool active);
75 void setName(const QString &name);
76
77 // virtuals from QQmlParserStatus
78 void classBegin() override { }
79 void componentComplete() override;
80
81 Q_INVOKABLE bool setBackendProperty(const QString &name, const QVariant &value);
82 Q_INVOKABLE QVariant backendProperty(const QString &name) const;
83
84public Q_SLOTS:
85 void update(int timeout = 0);
86 void start();
87 void stop();
88
97
98private Q_SLOTS:
99 void sourceErrorReceived(const QGeoSatelliteInfoSource::Error error);
100 void onParameterInitialized();
101 void satellitesInViewUpdateReceived(const QList<QGeoSatelliteInfo> &satellites);
102 void satellitesInUseUpdateReceived(const QList<QGeoSatelliteInfo> &satellites);
103
104private:
105 QVariantMap parameterMap() const;
106 void createSource(const QString &newName);
107 void handleSingleUpdateReceived();
108 void executeStart();
109 void executeSingleUpdate(int timeout);
110
111 using PluginParameterProperty = QQmlListProperty<QDeclarativePluginParameter>;
112 static void parameter_append(PluginParameterProperty *prop,
113 QDeclarativePluginParameter *parameter);
114 static qsizetype parameter_count(PluginParameterProperty *prop);
115 static QDeclarativePluginParameter *parameter_at(PluginParameterProperty *prop,
117 static void parameter_clear(PluginParameterProperty *prop);
118
119 std::unique_ptr<QGeoSatelliteInfoSource> m_source;
120 QList<QDeclarativePluginParameter *> m_parameters;
121
122 int m_updateInterval = 0;
123 SourceError m_error = SourceError::NoError;
124 QString m_name;
125 QList<QGeoSatelliteInfo> m_satellitesInView;
126 QList<QGeoSatelliteInfo> m_satellitesInUse;
127
128 int m_singleUpdateDesiredTimeout = 0;
129
130 quint8 m_active : 1;
131 quint8 m_componentComplete : 1;
132 quint8 m_parametersInitialized : 1;
133 quint8 m_startRequested : 1;
134 quint8 m_defaultSourceUsed : 1;
135 quint8 m_regularUpdates : 1;
136 quint8 m_singleUpdate : 1;
137 quint8 m_singleUpdateRequested : 1;
138};
139
141
142#endif // QDECLARATIVESATELLITESOURCE_H
bool m_active
bool isActive
QQmlListProperty< QDeclarativePluginParameter > parameters()
void classBegin() override
Invoked after class creation, but before any properties have been set.
Error
The Error enumeration represents the errors which can occur.
\inmodule QtPositioning
Definition qlist.h:75
\inmodule QtCore
Definition qobject.h:103
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
Definition qqmllist.h:24
The QQmlParserStatus class provides updates on the QML parser state.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
employee setName("Richard Schmit")
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint index
[2]
GLbitfield GLuint64 timeout
[4]
GLuint start
GLuint name
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
@ NoError
Definition main.cpp:34
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_CLASSINFO(name, value)
#define Q_INVOKABLE
#define Q_INTERFACES(x)
#define Q_SLOTS
#define Q_SIGNALS
ptrdiff_t qsizetype
Definition qtypes.h:165
unsigned char quint8
Definition qtypes.h:46