1/****************************************************************************
2**
3** Copyright (C) 2017 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtLocation module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:BSD$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** BSD License Usage
18** Alternatively, you may use this file under the terms of the BSD license
19** as follows:
20**
21** "Redistribution and use in source and binary forms, with or without
22** modification, are permitted provided that the following conditions are
23** met:
24** * Redistributions of source code must retain the above copyright
25** notice, this list of conditions and the following disclaimer.
26** * Redistributions in binary form must reproduce the above copyright
27** notice, this list of conditions and the following disclaimer in
28** the documentation and/or other materials provided with the
29** distribution.
30** * Neither the name of The Qt Company Ltd nor the names of its
31** contributors may be used to endorse or promote products derived
32** from this software without specific prior written permission.
33**
34**
35** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
46**
47** $QT_END_LICENSE$
48**
49****************************************************************************/
50
51#include <QtCore/QObject>
52#include <QtCore/QVariant>
53#include <QtLocation/QPlaceCategory>
54#include <QtLocation/QPlaceContactDetail>
55#include <QtLocation/QPlace>
56#include <QtLocation/QPlaceAttribute>
57#include <QtLocation/QPlaceIcon>
58#include <QtLocation/QPlaceUser>
59#include <QtLocation/QPlaceRatings>
60#include <QtLocation/QPlaceSupplier>
61
62void cppQmlInterface(QObject *qmlObject)
63{
64 //! [Category get]
65 QPlaceCategory category = qmlObject->property(name: "category").value<QPlaceCategory>();
66 //! [Category get]
67
68 //! [Category set]
69 qmlObject->setProperty(name: "category", value: QVariant::fromValue(value: category));
70 //! [Category set]
71
72 //! [ContactDetail get]
73 QPlaceContactDetail contactDetail = qmlObject->property(name: "contactDetail").value<QPlaceContactDetail>();
74 //! [ContactDetail get]
75
76 //! [ContactDetail set]
77 qmlObject->setProperty(name: "contactDetail", value: QVariant::fromValue(value: contactDetail));
78 //! [ContactDetail set]
79
80 //! [Place get]
81 QPlace place = qmlObject->property(name: "place").value<QPlace>();
82 //! [Place get]
83
84 //! [Place set]
85 qmlObject->setProperty(name: "place", value: QVariant::fromValue(value: place));
86 //! [Place set]
87
88 //! [PlaceAttribute get]
89 QPlaceAttribute placeAttribute = qmlObject->property(name: "attribute").value<QPlaceAttribute>();
90 //! [PlaceAttribute get]
91
92 //! [PlaceAttribute set]
93 qmlObject->setProperty(name: "attribute", value: QVariant::fromValue(value: placeAttribute));
94 //! [PlaceAttribute set]
95
96 //! [Icon get]
97 QPlaceIcon placeIcon = qmlObject->property(name: "icon").value<QPlaceIcon>();
98 //! [Icon get]
99
100 //! [Icon set]
101 qmlObject->setProperty(name: "icon", value: QVariant::fromValue(value: placeIcon));
102 //! [Icon set]
103
104 //! [User get]
105 QPlaceUser placeUser = qmlObject->property(name: "user").value<QPlaceUser>();
106 //! [User get]
107
108 //! [User set]
109 qmlObject->setProperty(name: "user", value: QVariant::fromValue(value: placeUser));
110 //! [User set]
111
112 //! [Ratings get]
113 QPlaceRatings placeRatings = qmlObject->property(name: "ratings").value<QPlaceRatings>();
114 //! [Ratings get]
115
116 //! [Ratings set]
117 qmlObject->setProperty(name: "ratings", value: QVariant::fromValue(value: placeRatings));
118 //! [Ratings set]
119
120 //! [Supplier get]
121 QPlaceSupplier placeSupplier = qmlObject->property(name: "supplier").value<QPlaceSupplier>();
122 //! [Supplier get]
123
124 //! [Supplier set]
125 qmlObject->setProperty(name: "supplier", value: QVariant::fromValue(value: placeSupplier));
126 //! [Supplier set]
127}
128
129

source code of qtlocation/src/location/doc/snippets/cpp/cppqml.cpp