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
qplacesupplier.cpp
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
6
7QT_USE_NAMESPACE
8
9QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QPlaceSupplierPrivate)
10
11bool QPlaceSupplierPrivate::operator==(const QPlaceSupplierPrivate &other) const
12{
13 return (
14 this->name == other.name
15 && this->supplierId == other.supplierId
16 && this->url == other.url
17 && this->icon == other.icon
18 );
19}
20
21bool QPlaceSupplierPrivate::isEmpty() const
22{
23 return (name.isEmpty()
24 && supplierId.isEmpty()
25 && url.isEmpty()
26 && icon.isEmpty()
27 );
28}
29
30/*!
31 \class QPlaceSupplier
32 \internal
33 \inmodule QtLocation
34 \ingroup QtLocation-places
35 \ingroup QtLocation-places-data
36 \since 5.6
37
38 \brief The QPlaceSupplier class represents a supplier of a place or content associated
39 with a place.
40
41 Each instance represents a set of data about a supplier, which can include
42 supplier's name, url and icon. The supplier is typically a business or organization.
43
44 Note: The Places API only supports suppliers as 'retrieve-only' objects. Submitting
45 suppliers to a provider is not a supported use case.
46*/
47
48/*!
49 \qmlvaluetype supplier
50 \inqmlmodule QtLocation
51 \ingroup qml-QtLocation5-places
52 \ingroup qml-QtLocation5-places-data
53 \since QtLocation 5.5
54
55 \brief Holds data regarding the supplier of a place, a place's image, review, or editorial.
56
57 Each instance represents a set of data about a supplier, which can include
58 supplier's name, url and icon. The supplier is typically a business or organization.
59
60 Note: The Places API only supports suppliers as 'retrieve-only' objects. Submitting
61 suppliers to a provider is not a supported use case.
62
63 \section1 Example
64
65 The following example shows how to create and display a supplier in QML:
66
67 \snippet declarative/places.qml QtQuick import
68 \snippet declarative/maps.qml QtLocation import
69 \codeline
70 \snippet declarative/places.qml Supplier
71
72 \sa ImageModel, ReviewModel, EditorialModel
73*/
74
75/*!
76 Constructs a new supplier object.
77*/
78QPlaceSupplier::QPlaceSupplier()
79 : d(new QPlaceSupplierPrivate)
80{
81}
82
83/*!
84 Constructs a copy of \a other.
85*/
86QPlaceSupplier::QPlaceSupplier(const QPlaceSupplier &other) noexcept = default;
87
88/*!
89 Destroys the supplier object.
90*/
91QPlaceSupplier::~QPlaceSupplier() = default;
92
93/*!
94 Assigns \a other to this supplier and returns a reference to this
95 supplier.
96*/
97QPlaceSupplier &QPlaceSupplier::operator=(const QPlaceSupplier &other) noexcept
98{
99 if (this == &other)
100 return *this;
101
102 d = other.d;
103 return *this;
104}
105
106/*!
107 \fn bool QPlaceSupplier::operator==(const QPlaceSupplier &lhs, const QPlaceSupplier &rhs) noexcept
108
109 Returns true if \a lhs is equal to \a rhs, otherwise returns false.
110*/
111
112/*!
113 \fn bool QPlaceSupplier::operator!=(const QPlaceSupplier &lhs, const QPlaceSupplier &rhs) noexcept
114
115 Returns true if \a lhs is not equal to \a rhs, otherwise returns false.
116*/
117
118bool QPlaceSupplier::isEqual(const QPlaceSupplier &other) const noexcept
119{
120 return (*(d.constData()) == *(other.d.constData()));
121}
122
123/*!
124 \qmlproperty string Supplier::name
125
126 This property holds the name of the supplier which can be displayed
127 to the user.
128
129 The name can potentially be localized. The language is dependent on the
130 entity that sets it, typically this is the \l Plugin. The \l {Plugin::locales}
131 property defines what language is used.
132*/
133
134/*!
135 \property QPlaceSupplier::name
136 \brief the name of the supplier which can be displayed to the user.
137
138 The name can potentially be localized. The language is dependent on the
139 entity that sets it, typically this is the QPlaceManager.
140 The QPlaceManager::locales() field defines what language is used.
141*/
142QString QPlaceSupplier::name() const
143{
144 return d->name;
145}
146
147/*!
148 Sets the \a name of the supplier.
149*/
150void QPlaceSupplier::setName(const QString &name)
151{
152 d->name = name;
153}
154
155/*!
156 \qmlproperty string Supplier::supplierId
157
158 This property holds the identifier of the supplier. The identifier is unique
159 to the Plugin backend which provided the supplier and is generally
160 not suitable for displaying to the user.
161*/
162
163/*!
164 \property QPlaceSupplier::supplierId
165 \brief the identifier of the supplier.
166
167 The identifier is unique to the manager backend which provided the supplier
168 and is generally not suitable for displaying to the user.
169*/
170QString QPlaceSupplier::supplierId() const
171{
172 return d->supplierId;
173}
174
175/*!
176 Sets the \a identifier of the supplier.
177*/
178void QPlaceSupplier::setSupplierId(const QString &identifier)
179{
180 d->supplierId = identifier;
181}
182
183/*!
184 \qmlproperty url Supplier::url
185
186 This property holds the URL of the supplier's website.
187*/
188
189/*!
190 \property QPlaceSupplier::url
191 \brief the URL of the supplier's website.
192*/
193QUrl QPlaceSupplier::url() const
194{
195 return d->url;
196}
197
198/*!
199 Sets the \a url of the supplier's website.
200*/
201void QPlaceSupplier::setUrl(const QUrl &url)
202{
203 d->url = url;
204}
205
206/*!
207 \qmlproperty PlaceIcon Supplier::icon
208
209 This property holds the icon of the supplier.
210*/
211
212/*!
213 \property QPlaceSupplier::icon
214 \brief the icon of the supplier.
215*/
216QPlaceIcon QPlaceSupplier::icon() const
217{
218 return d->icon;
219}
220
221/*!
222 Sets the \a icon of the supplier.
223*/
224void QPlaceSupplier::setIcon(const QPlaceIcon &icon)
225{
226 d->icon = icon;
227}
228
229/*!
230 Returns true if all fields of the place supplier are 0; otherwise returns false.
231*/
232bool QPlaceSupplier::isEmpty() const
233{
234 return d->isEmpty();
235}
236
237#include "moc_qplacesupplier.cpp"