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