Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cppqml.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#include <QtCore/QObject>
5#include <QtCore/QDebug>
6#include <QtCore/QVariant>
7#include <QtPositioning/QGeoAddress>
8#include <QtPositioning/QGeoLocation>
9#include <QtPositioning/QGeoCircle>
10#include <QtPositioning/QGeoAreaMonitorSource>
11
12void cppQmlInterface(QObject *qmlObject)
13{
14 //! [Address get]
15 QGeoAddress geoAddress = qmlObject->property("address").value<QGeoAddress>();
16 //! [Address get]
17
18 //! [Address set]
19 qmlObject->setProperty("address", QVariant::fromValue(geoAddress));
20 //! [Address set]
21
22 //! [Location get]
23 QGeoLocation geoLocation = qmlObject->property("location").value<QGeoLocation>();
24 //! [Location get]
25
26 //! [Location set]
27 qmlObject->setProperty("location", QVariant::fromValue(geoLocation));
28 //! [Location set]
29}
30
31class MyClass : public QObject
32{
34//! [BigBen]
35public:
55
56public Q_SLOTS:
58 {
60
61 qDebug() << "Now within 100 meters, current position is" << update.coordinate();
62 }
63
65 {
67
68 qDebug() << "No longer within 100 meters, current position is" << update.coordinate();
69 }
70//! [BigBen]
71};
void cppQmlInterface(QObject *qmlObject)
Definition cppqml.cpp:15