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
qplacecontactdetail.cpp
Go to the documentation of this file.
1
// Copyright (C) 2015 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
"qplacecontactdetail_p.h"
6
#
include
"qplacecontactdetail.h"
7
8
QT_USE_NAMESPACE
9
10
QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QPlaceContactDetailPrivate)
11
12
bool
QPlaceContactDetailPrivate::operator== (
const
QPlaceContactDetailPrivate &other)
const
13
{
14
return
label == other.label
15
&& value == other.value;
16
}
17
18
/*!
19
\class QPlaceContactDetail
20
\brief The QPlaceContactDetail class represents a contact detail such as a phone number or website url.
21
\inmodule QtLocation
22
23
\ingroup QtLocation-places
24
\ingroup QtLocation-places-data
25
26
The detail consists of a label and value. The label is a localized string that can be presented
27
to the end user that describes that detail value which is the actual phone number, email address and so on.
28
29
\section1 Contact Types
30
31
The QPlaceContactDetail class defines some constant strings which characterize standard \e {contact types}.
32
\list
33
\li QPlaceContactDetail::Phone
34
\li QPlaceContactDetail::Email
35
\li QPlaceContactDetail::Website
36
\li QPlaceContactDetail::Fax
37
\endlist
38
39
These types are used to access and modify contact details in QPlace via:
40
\list
41
\li QPlace::contactDetails()
42
\li QPlace::setContactDetails()
43
\li QPlace::appendContactDetail()
44
\li QPlace::contactTypes()
45
\endlist
46
47
The \e {contact type} is intended to be a string type so that providers are able to introduce new contact
48
types if necessary.
49
*/
50
51
/*!
52
\qmlvaluetype contactDetail
53
\inqmlmodule QtLocation
54
\ingroup qml-QtLocation5-places
55
\ingroup qml-QtLocation5-places-data
56
\since QtLocation 5.5
57
58
\brief The contactDetail type holds a contact detail such as a phone number or a website
59
address.
60
61
The contactDetail provides a single detail on how one could contact a \l Place. The
62
contactDetail consists of a \l {contactDetail::}{label}, which is a localized string
63
describing the contact method, and a \l {contactDetail::}{value} representing the actual
64
contact detail.
65
66
\section1 Examples
67
68
The following example demonstrates how to assign a single phone number to a place in JavaScript:
69
\snippet declarative/places.qml ContactDetails write single
70
71
The following demonstrates how to assign multiple phone numbers to a place in JavaScript:
72
\snippet declarative/places.qml ContactDetails write multiple
73
74
Note, due to limitations of the QQmlPropertyMap, it is not possible
75
to declaratively specify the contact details in QML, it can only be accomplished
76
via JavaScript.
77
*/
78
79
/*!
80
\variable QPlaceContactDetail::Phone
81
The constant to specify phone contact details
82
*/
83
const
QString QPlaceContactDetail::Phone(QLatin1String(
"phone"
));
84
85
/*!
86
\variable QPlaceContactDetail::Email
87
The constant to specify email contact details.
88
*/
89
const
QString QPlaceContactDetail::Email(QLatin1String(
"email"
));
90
91
/*!
92
\variable QPlaceContactDetail::Website
93
The constant used to specify website contact details.
94
*/
95
const
QString QPlaceContactDetail::Website(QLatin1String(
"website"
));
96
97
/*!
98
\variable QPlaceContactDetail::Fax
99
The constant used to specify fax contact details.
100
*/
101
const
QString QPlaceContactDetail::Fax(QLatin1String(
"fax"
));
102
103
/*!
104
Constructs a contact detail.
105
*/
106
QPlaceContactDetail::QPlaceContactDetail()
107
: d_ptr(
new
QPlaceContactDetailPrivate)
108
{
109
}
110
111
/*!
112
Destroys the contact detail.
113
*/
114
QPlaceContactDetail::~QPlaceContactDetail() =
default
;
115
116
/*!
117
Creates a copy of \a other.
118
*/
119
QPlaceContactDetail::QPlaceContactDetail(
const
QPlaceContactDetail &other)
noexcept
=
default
;
120
121
/*!
122
Assigns \a other to this contact detail and returns a reference to this
123
contact detail.
124
*/
125
QPlaceContactDetail &QPlaceContactDetail::operator=(
const
QPlaceContactDetail &other)
noexcept
126
{
127
if
(
this
== &other)
128
return
*
this
;
129
130
d_ptr = other.d_ptr;
131
return
*
this
;
132
}
133
134
/*!
135
\fn bool QPlaceContactDetail::operator==(const QPlaceContactDetail &lhs, const QPlaceContactDetail &rhs) noexcept
136
137
Returns true if the contact detail \a lhs is equal to \a rhs,
138
otherwise returns false.
139
*/
140
bool
QPlaceContactDetail::isEqual(
const
QPlaceContactDetail &other)
const
noexcept
141
{
142
if
(d_ptr == other.d_ptr)
143
return
true
;
144
return
( *(d_ptr.constData()) == *(other.d_ptr.constData()));
145
}
146
147
/*!
148
\fn bool QPlaceContactDetail::operator!=(const QPlaceContactDetail &lhs, const QPlaceContactDetail &rhs) noexcept
149
150
Returns true if the contact detail \a lhs is not equal to \a rhs,
151
otherwise returns false.
152
*/
153
154
/*!
155
\qmlproperty string QtLocation::contactDetail::label
156
157
This property holds a label describing the contact detail.
158
159
The label can potentially be localized. The language is dependent on the entity that sets it,
160
typically this is the \l {Plugin}. The \l {Plugin::locales} property defines
161
what language is used.
162
*/
163
164
/*!
165
\property QPlaceContactDetail::label
166
\brief a label describing the contact detail.
167
168
The label can potentially be localized. The language is dependent on the entity that sets it,
169
typically this is the manager from which the places are sourced.
170
The QPlaceManager::locales() field defines what language is used.
171
*/
172
QString QPlaceContactDetail::label()
const
173
{
174
return
d_ptr->label;
175
}
176
177
void
QPlaceContactDetail::setLabel(
const
QString &label)
178
{
179
d_ptr->label = label;
180
}
181
182
/*!
183
\qmlproperty string QtLocation::contactDetail::value
184
185
This property holds the value of the contact detail which may be a phone number, an email
186
address, a website url and so on.
187
*/
188
189
/*!
190
\property QPlaceContactDetail::value
191
\brief the value of the contact detail.
192
*/
193
QString QPlaceContactDetail::value()
const
194
{
195
return
d_ptr->value;
196
}
197
198
void
QPlaceContactDetail::setValue(
const
QString &value)
199
{
200
d_ptr->value = value;
201
}
202
203
/*!
204
Clears the contact detail.
205
*/
206
void
QPlaceContactDetail::clear()
207
{
208
d_ptr->label.clear();
209
d_ptr->value.clear();
210
}
211
212
#
include
"moc_qplacecontactdetail.cpp"
qtlocation
src
location
places
qplacecontactdetail.cpp
Generated on
for Qt by
1.18.0