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
cpp-qml-positioning.qdoc
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5\page positioning-cpp-qml.html
6\title Interfaces between C++ and QML Code in Qt Positioning
7
8\brief Describes the methods used to exchange position data between C++ and QML
9code.
10
11\section1 Overview
12
13Qt Positioning utilizes two methods to simplify exchange of position data
14between C++ and QML code.
15
16
17\target Cpp_value_integration_positioning
18
19\section1 Direct mapping
20
21Qt Positioning allow you to pass the following value types from QML to C++, and
22vice versa:
23
24 \table
25 \header
26 \li C++ Class
27 \li QML Value Type
28 \row
29 \li \l[C++]QGeoCircle
30 \li \l[QML]geoCircle
31 \row
32 \li \l[C++]QGeoCoordinate
33 \li \l[QML]geoCoordinate
34 \row
35 \li \l[C++]QGeoPath
36 \li \l[QML]geoPath
37 \row
38 \li \l[C++]QGeoPolygon
39 \li \l[QML]geoPolygon
40 \row
41 \li \l[C++]QGeoRectangle
42 \li \l[QML]geoRectangle
43 \row
44 \li \l[C++]QGeoSatelliteInfo
45 \li \l[QML]geoSatelliteInfo
46 \row
47 \li \l[C++]QGeoShape
48 \li \l[QML]geoShape
49\endtable
50
51\section1 QVariant Based integration
52
53This section provides information on how to integrate QGeoAddress and
54QGeoLocation.
55
56\section2 Address - QGeoAddress
57
58The \l {QtPositioning::Address::address} {Address.address} property is used to
59provide an interface between C++ and QML code. First a pointer to an
60\l {QtPositioning::}{Address} object must be obtained from C++, then the
61\l {QObject::}{property()} and \l {QObject::}{setProperty()} functions must be
62used to get and set the \c address property.
63
64The following piece of code gets the \l QGeoAddress object from C++:
65
66\snippet cpp/cppqml.cpp Address get
67
68The following piece of code sets the address property of the QML object based
69on a \l QGeoAddress object from C++:
70
71\snippet cpp/cppqml.cpp Address set
72
73
74\section2 Location - QGeoLocation
75The \l {Location::location} {Location.location} property is used to provide an
76interface between C++ and QML code. First a pointer to a \l Location object
77must be obtained from C++, then the \l {QObject::}{property()} and
78\l {QObject::}{setProperty()} functions must be used to get and set the
79\c location property.
80
81The following piece of code gets the \l QGeoLocation object from C++:
82
83\snippet cpp/cppqml.cpp Location get
84
85The following piece of code sets the location property of the QML object based
86on a \l QGeoLocation object from C++:
87
88\snippet cpp/cppqml.cpp Location set
89
90*/