summaryrefslogtreecommitdiff
path: root/examples/positioning/satelliteinfo/satellitemodel.h
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2021-03-16 13:08:34 +0100
committerIvan Solovev <ivan.solovev@qt.io>2021-03-23 10:44:43 +0100
commit2c962c3251a0e8c3375e8de628622cf8f0154f83 (patch)
tree644c50b5f84d097a76611654d5448c54b0b8a164 /examples/positioning/satelliteinfo/satellitemodel.h
parentebe3a8c054ff82f255a5414d51d13b2aa01bafaa (diff)
downloadqtlocation-2c962c3251a0e8c3375e8de628622cf8f0154f83.tar.gz
QtPositioning: improve satelliteinfo example
Register model for QML using QML_ELEMENT. Improve the example documentation. Task-number: QTBUG-89855 Change-Id: I88abccecbba446332501ddb787cf4bbb8d0d8058 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'examples/positioning/satelliteinfo/satellitemodel.h')
-rw-r--r--examples/positioning/satelliteinfo/satellitemodel.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/examples/positioning/satelliteinfo/satellitemodel.h b/examples/positioning/satelliteinfo/satellitemodel.h
index 0b6cf6b1..18d94a59 100644
--- a/examples/positioning/satelliteinfo/satellitemodel.h
+++ b/examples/positioning/satelliteinfo/satellitemodel.h
@@ -60,6 +60,7 @@
QT_FORWARD_DECLARE_CLASS(QTimer)
QT_FORWARD_DECLARE_CLASS(QGeoSatelliteInfoSource)
+//! [0]
class SatelliteModel : public QAbstractListModel, public QQmlParserStatus
{
Q_OBJECT
@@ -68,6 +69,7 @@ class SatelliteModel : public QAbstractListModel, public QQmlParserStatus
Q_PROPERTY(int entryCount READ entryCount NOTIFY entryCountChanged)
Q_PROPERTY(bool singleRequestMode READ isSingleRequest WRITE setSingleRequest NOTIFY singleRequestChanged)
Q_INTERFACES(QQmlParserStatus)
+ QML_ELEMENT
public:
explicit SatelliteModel(QObject *parent = 0);
@@ -87,6 +89,7 @@ public:
//From QQmlParserStatus
void classBegin() override {}
void componentComplete() override;
+//! [0]
bool running() const;
void setRunning(bool isActive);
@@ -98,6 +101,7 @@ public:
bool canProvideSatelliteInfo() const;
+//! [1]
signals:
void runningChanged();
void entryCountChanged();
@@ -108,6 +112,7 @@ signals:
public slots:
void clearModel();
void updateDemoData();
+//! [1]
private slots:
void error(QGeoSatelliteInfoSource::Error);
@@ -126,8 +131,9 @@ private:
QTimer *timer;
bool isSingle;
bool singleRequestServed;
-
+//! [2]
};
+//! [2]
QML_DECLARE_TYPE(SatelliteModel)