diff options
Diffstat (limited to 'src/positioning/doc/src/cpp-qml-positioning.qdoc')
-rw-r--r-- | src/positioning/doc/src/cpp-qml-positioning.qdoc | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/src/positioning/doc/src/cpp-qml-positioning.qdoc b/src/positioning/doc/src/cpp-qml-positioning.qdoc deleted file mode 100644 index f1044306..00000000 --- a/src/positioning/doc/src/cpp-qml-positioning.qdoc +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! -\page positioning-cpp-qml.html -\title Interfaces between C++ and QML Code in Qt Positioning - -\brief Describes the methods used to exchange position data between C++ and QML -code. - -\section1 Overview - -Qt Positioning utilizes two methods to simplify exchange of position data -between C++ and QML code. - -\target Cpp_value_integration_positioning -\section1 Direct C++ Value Integration in QtPositioning - -Starting with Qt 5.5, it has become much easier to integrate non-QObject based -data types into QML. This is achieved by adding \l Q_GADGET support to \l QtQml. -The macro converts classes into a light-weight version of a \l QObject without -the required \l QObject inheritance. At the same time, it retains the reflection -capabilities of \l QMetaObject. As a result, they can be directly exposed to -QML. - -A significant number of Position related data types were converted to -\l {Q_GADGET}s. They retain their API and value type character but have become -introspectable via \l QMetaObject. - -The \l QML_ANONYMOUS macro is used to expose these types to the QML environment. -See the \l QQmlEngine documentation for more details and the full list of -available macros. - -The classes, however, are not directly extended with this macro, because we do -not want Qt Positioning to depend on \l QtQml. So a helper class is created for -each of them, and the \l QML_FOREIGN macro is used: - -\code -struct QGeoCoordinateForeign -{ - Q_GADGET - QML_FOREIGN(QGeoCoordinate) - QML_ANONYMOUS - QML_ADDED_IN_VERSION(5, 0) -}; -\endcode - -The above registration of Positioning types is automatically done once by the -QtPositioning QML plugin. - -\section1 QVariant Based integration - -This section provides information on how to integrate QGeoAddress and -QGeoLocation. - -\section2 Address - QGeoAddress - -The \l {QtPositioning::Address::address} {Address.address} property is used to -provide an interface between C++ and QML code. First a pointer to an -\l {QtPositioning::}{Address} object must be obtained from C++, then the -\l {QObject::}{property()} and \l {QObject::}{setProperty()} functions must be -used to get and set the \c address property. - -The following piece of code gets the \l QGeoAddress object from C++: - -\snippet cpp/cppqml.cpp Address get - -The following piece of code sets the address property of the QML object based -on a \l QGeoAddress object from C++: - -\snippet cpp/cppqml.cpp Address set - - -\section2 Location - QGeoLocation -The \l {Location::location} {Location.location} property is used to provide an -interface between C++ and QML code. First a pointer to a \l Location object -must be obtained from C++, then the \l {QObject::}{property()} and -\l {QObject::}{setProperty()} functions must be used to get and set the -\c location property. - -The following piece of code gets the \l QGeoLocation object from C++: - -\snippet cpp/cppqml.cpp Location get - -The following piece of code sets the location property of the QML object based -on a \l QGeoLocation object from C++: - -\snippet cpp/cppqml.cpp Location set - -*/ |