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
qplacecategory.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
7
9
10QT_DEFINE_QSDP_SPECIALIZATION_DTOR(QPlaceCategoryPrivate)
11
12
13bool QPlaceCategoryPrivate::isEmpty() const
14{
15 return categoryId.isEmpty()
16 && name.isEmpty()
17 && icon.isEmpty()
18 && QLocation::UnspecifiedVisibility == visibility;
19}
20
21/*!
22 \class QPlaceCategory
23 \inmodule QtLocation
24 \ingroup QtLocation-places
25 \ingroup QtLocation-places-data
26 \since 5.6
27
28 \brief The QPlaceCategory class represents a category that a \l QPlace can be associated with.
29
30 Categories are used to search for places based on the categories they are associated with. The
31 list/tree of available categories can be obtained from \l QPlaceManager. The
32 \l QPlaceSearchRequest::setCategories() function can be used to limit the search results to
33 places with the specified categories.
34
35 If the \l QGeoServiceProvider supports it, categories can be created and removed. This
36 functionality is available in the \l QPlaceManager class.
37*/
38
39/*!
40 Constructs a category.
41*/
42QPlaceCategory::QPlaceCategory()
43 : d(new QPlaceCategoryPrivate)
44{
45}
46
47/*!
48 Constructs a category which is a copy of \a other.
49*/
50QPlaceCategory::QPlaceCategory(const QPlaceCategory &other) noexcept = default;
51
52/*!
53 Destroys the category.
54*/
55QPlaceCategory::~QPlaceCategory() = default;
56
57/*!
58 Assigns \a other to this category and returns a reference to this category.
59*/
60QPlaceCategory &QPlaceCategory::operator=(const QPlaceCategory &other) noexcept
61{
62 if (this == &other)
63 return *this;
64
65 d = other.d;
66 return *this;
67}
68
69/*!
70 \fn bool QPlaceCategory::operator==(const QPlaceCategory &lhs, const QPlaceCategory &rhs) noexcept
71
72 Returns true if \a lhs is equal to \a rhs; otherwise returns false.
73*/
74
75/*!
76 \fn bool QPlaceCategory::operator!=(const QPlaceCategory &lhs, const QPlaceCategory &rhs) noexcept
77
78 Returns true if \a lhs is not equal to \a rhs; otherwise returns false.
79*/
80
81bool QPlaceCategory::isEqual(const QPlaceCategory &other) const noexcept
82{
83 return d->categoryId == other.d->categoryId &&
84 d->name == other.d->name &&
85 (d->visibility == QLocation::UnspecifiedVisibility ||
86 other.d->visibility == QLocation::UnspecifiedVisibility ||
87 d->visibility == other.d->visibility) &&
88 d->icon == other.d->icon;
89}
90
91/*!
92 Returns the identifier of the category. The category identifier is a string which uniquely identifies this category
93 within a particular \l QPlaceManager. The identifier is only meaningful to the QPlaceManager
94 that generated it and is not transferable between managers.
95*/
96QString QPlaceCategory::categoryId() const
97{
98 return d->categoryId;
99}
100
101/*!
102 Sets the \a identifier of the category.
103*/
104void QPlaceCategory::setCategoryId(const QString &identifier)
105{
106 d->categoryId = identifier;
107}
108
109/*!
110 Returns the name of category.
111*/
112QString QPlaceCategory::name() const
113{
114 return d->name;
115}
116
117/*!
118 Sets the \a name of the category.
119*/
120void QPlaceCategory::setName(const QString &name)
121{
122 d->name = name;
123}
124
125/*!
126 Sets the \a visibility of the category.
127*/
128void QPlaceCategory::setVisibility(QLocation::Visibility visibility)
129{
130 d->visibility = visibility;
131}
132
133/*!
134 Returns the visibility of the category.
135*/
136QLocation::Visibility QPlaceCategory::visibility() const
137{
138 return d->visibility;
139}
140
141/*!
142 Returns the icon associated with the category.
143*/
144QPlaceIcon QPlaceCategory::icon() const
145{
146 return d->icon;
147}
148
149/*!
150 Sets the \a icon of the category.
151*/
152void QPlaceCategory::setIcon(const QPlaceIcon &icon)
153{
154 d->icon = icon;
155}
156
157/*!
158 Returns a boolean indicating whether the all the fields of the place category are empty or not.
159*/
160bool QPlaceCategory::isEmpty() const
161{
162 return d->isEmpty();
163}
164
165QT_END_NAMESPACE
Combined button and popup list for selecting options.