Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qplaceicon.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
4#include "qplaceicon.h"
5#include "qplaceicon_p.h"
6#include "qplacemanager.h"
8
9#include <QtCore/QVariant>
10#include <QtQml/QJSValue>
11
13
15
16bool QPlaceIconPrivate::operator == (const QPlaceIconPrivate &other) const
17{
18 return manager == other.manager
19 && parameters == other.parameters;
20}
21
84
92
96QPlaceIcon::QPlaceIcon(const QPlaceIcon &other) noexcept = default;
97
101QPlaceIcon::~QPlaceIcon() = default;
102
107{
108 if (this == &other)
109 return *this;
110
111 d = other.d;
112 return *this;
113}
114
127bool QPlaceIcon::isEqual(const QPlaceIcon &other) const noexcept
128{
129 return *d == *(other.d);
130}
131
132/* ### Need to evaluate whether we need this at all (or perhaps only for tests)
133 \qmlproperty Plugin Icon::plugin
134
135 The property holds the plugin that is responsible for managing this icon.
136*/
137
145{
148 if (value.typeId() == QMetaType::QUrl)
149 return value.toUrl();
150 else if (value.typeId() == QMetaType::QString)
151 return QUrl::fromUserInput(value.toString());
152
153 return QUrl();
154 }
155
156 if (!d->manager)
157 return QUrl();
158
159 return d->manager->d->constructIconUrl(*this, size);
160}
161
172{
173 return d->parameters;
174}
175
180{
182}
183
188{
189 return d->manager;
190}
191
200
205{
206 return (d->manager == 0
207 && d->parameters.isEmpty());
208}
209
210#include "moc_qplaceicon.cpp"
T value(const Key &key, const T &defaultValue=T()) const
Definition qmap.h:357
bool contains(const Key &key) const
Definition qmap.h:341
bool isEmpty() const
Definition qmap.h:269
QVariantMap parameters
QPlaceManager * manager
\inmodule QtLocation
Definition qplaceicon.h:23
QPlaceIcon()
Constructs an icon.
QPlaceManager * manager
Definition qplaceicon.h:29
Q_INVOKABLE QUrl url(const QSize &size=QSize()) const
Returns an icon URL according to the given size.
static const QString SingleUrl
\qmlvaluetype icon \inqmlmodule QtLocation
Definition qplaceicon.h:32
QPlaceIcon & operator=(const QPlaceIcon &other) noexcept
Assigns other to this icon and returns a reference to this icon.
void setParameters(const QVariantMap &parameters)
Sets the parameters of the icon to parameters.
QML_STRUCTURED_VALUEQVariantMap parameters
Definition qplaceicon.h:28
void setManager(QPlaceManager *manager)
Sets the manager that this icon is associated with.
bool isEmpty() const
Returns a boolean indicating whether the all the fields of the icon are empty or not.
~QPlaceIcon()
Destroys the icon.
virtual QUrl constructIconUrl(const QPlaceIcon &icon, const QSize &size) const
QUrl QPlaceManagerEngine::constructIconUrl(const QPlaceIcon &icon, const QSize &size)
\inmodule QtLocation
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qurl.h:94
static QUrl fromUserInput(const QString &userInput, const QString &workingDirectory=QString(), UserInputResolutionOptions options=DefaultResolution)
Returns a valid URL from a user supplied userInput string if one can be deduced.
Definition qurl.cpp:3757
\inmodule QtCore
Definition qvariant.h:65
QUrl toUrl() const
Returns the variant as a QUrl if the variant has userType() \l QMetaType::QUrl; otherwise returns an ...
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum GLuint GLintptr GLsizeiptr size
[1]
#define QT_DEFINE_QSDP_SPECIALIZATION_DTOR(Class)
QLatin1StringView QLatin1String
Definition qstringfwd.h:31
QSharedPointer< T > other(t)
[5]
QNetworkAccessManager manager