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