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