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
qdeclarativeplace_p.h
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#ifndef QDECLARATIVEPLACE_P_H
5#define QDECLARATIVEPLACE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtLocation/private/qlocationglobal_p.h>
19#include <QtCore/QObject>
20#include <QtQml/QQmlListProperty>
21#include <QtQml/QQmlParserStatus>
22#include <QtQml/QQmlPropertyMap>
23#include <QtLocation/QPlace>
24#include <QtLocation/QPlaceRatings>
25#include <QtLocation/QPlaceIcon>
26
27#include <QtPositioningQuick/private/qdeclarativegeolocation_p.h>
28#include <QtLocation/private/qdeclarativecategory_p.h>
29#include <QtLocation/private/qdeclarativeplacecontentmodel_p.h>
30
32
33class QPlaceReply;
34class QPlaceManager;
35class QPlaceSupplier;
37
38class Q_LOCATION_EXPORT QDeclarativePlace : public QObject, public QQmlParserStatus
39{
44
45 Q_PROPERTY(QPlace place READ place WRITE setPlace)
46 Q_PROPERTY(QDeclarativeGeoServiceProvider *plugin READ plugin WRITE setPlugin NOTIFY pluginChanged)
48 Q_PROPERTY(QDeclarativeGeoLocation *location READ location WRITE setLocation NOTIFY locationChanged)
49 Q_PROPERTY(QPlaceRatings ratings READ ratings WRITE setRatings NOTIFY ratingsChanged)
50 Q_PROPERTY(QPlaceSupplier supplier READ supplier WRITE setSupplier NOTIFY supplierChanged)
51 Q_PROPERTY(QPlaceIcon icon READ icon WRITE setIcon NOTIFY iconChanged)
52 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
53 Q_PROPERTY(QString placeId READ placeId WRITE setPlaceId NOTIFY placeIdChanged)
54 Q_PROPERTY(QString attribution READ attribution WRITE setAttribution NOTIFY attributionChanged)
55
56 Q_PROPERTY(QDeclarativePlaceReviewModel *reviewModel READ reviewModel NOTIFY reviewModelChanged)
57 Q_PROPERTY(QDeclarativePlaceImageModel *imageModel READ imageModel NOTIFY imageModelChanged)
58 Q_PROPERTY(QDeclarativePlaceEditorialModel *editorialModel READ editorialModel NOTIFY editorialModelChanged)
59
60 Q_PROPERTY(QObject *extendedAttributes READ extendedAttributes NOTIFY extendedAttributesChanged)
61 Q_PROPERTY(QDeclarativeContactDetails *contactDetails READ contactDetails NOTIFY contactDetailsChanged)
62 Q_PROPERTY(bool detailsFetched READ detailsFetched NOTIFY detailsFetchedChanged)
63 Q_PROPERTY(Status status READ status NOTIFY statusChanged)
64
65 Q_PROPERTY(QString primaryPhone READ primaryPhone NOTIFY primaryPhoneChanged)
66 Q_PROPERTY(QString primaryFax READ primaryFax NOTIFY primaryFaxChanged)
67 Q_PROPERTY(QString primaryEmail READ primaryEmail NOTIFY primaryEmailChanged)
68 Q_PROPERTY(QUrl primaryWebsite READ primaryWebsite NOTIFY primaryWebsiteChanged)
69
70 Q_PROPERTY(Visibility visibility READ visibility WRITE setVisibility NOTIFY visibilityChanged)
71 Q_PROPERTY(QDeclarativePlace *favorite READ favorite WRITE setFavorite NOTIFY favoriteChanged)
72
74
75public:
76 explicit QDeclarativePlace(QObject *parent = nullptr);
77 QDeclarativePlace(const QPlace &src, QDeclarativeGeoServiceProvider *plugin, QObject *parent = nullptr);
79
80 enum Status {Ready, Saving, Fetching, Removing, Error};
82 UnspecifiedVisibility = QLocation::UnspecifiedVisibility,
83 DeviceVisibility = QLocation::DeviceVisibility,
84 PrivateVisibility = QLocation::PrivateVisibility,
85 PublicVisibility = QLocation::PublicVisibility
86 };
87
88 //From QQmlParserStatus
89 void classBegin() override {}
90 void componentComplete() override;
91
92 void setPlugin(QDeclarativeGeoServiceProvider *plugin);
93 QDeclarativeGeoServiceProvider *plugin() const;
94
98
99 QPlace place() const;
100 void setPlace(const QPlace &src);
101
102 QQmlListProperty<QDeclarativeCategory> categories();
103 static void category_append(QQmlListProperty<QDeclarativeCategory> *prop,
105 static qsizetype category_count(QQmlListProperty<QDeclarativeCategory> *prop);
106 static QDeclarativeCategory *category_at(QQmlListProperty<QDeclarativeCategory> *prop, qsizetype index);
107 static void category_clear(QQmlListProperty<QDeclarativeCategory> *prop);
108
110 void setLocation(QDeclarativeGeoLocation *location);
111 QPlaceRatings ratings() const;
112 void setRatings(const QPlaceRatings &ratings);
113 QPlaceSupplier supplier() const;
114 void setSupplier(const QPlaceSupplier &supplier);
115 QPlaceIcon icon() const;
116 void setIcon(const QPlaceIcon &icon);
117 QString name() const;
118 void setName(const QString &name);
119 QString placeId() const;
120 void setPlaceId(const QString &placeId);
121 QString attribution() const;
122 void setAttribution(const QString &attribution);
123 bool detailsFetched() const;
124
125 Status status() const;
126 void setStatus(Status status, const QString &errorString = QString());
127
128 Q_INVOKABLE void getDetails();
129 Q_INVOKABLE void save();
130 Q_INVOKABLE void remove();
131 Q_INVOKABLE QString errorString() const;
132
133 QString primaryPhone() const;
134 QString primaryFax() const;
135 QString primaryEmail() const;
136 QUrl primaryWebsite() const;
137
138 QQmlPropertyMap *extendedAttributes() const;
139
140 QDeclarativeContactDetails *contactDetails() const;
141
142 Visibility visibility() const;
143 void setVisibility(Visibility visibility);
144
145 QDeclarativePlace *favorite() const;
146 void setFavorite(QDeclarativePlace *favorite);
147
148 Q_INVOKABLE void copyFrom(QDeclarativePlace *original);
149 Q_INVOKABLE void initializeFavorite(QDeclarativeGeoServiceProvider *plugin);
150
165
170
176
177private Q_SLOTS:
178 void finished();
179 void contactsModified(const QString &, const QVariant &);
180 void pluginReady();
181 void cleanupDeletedCategories();
182private:
183 void synchronizeCategories();
184 void pullExtendedAttributes();
185 void synchronizeContacts();
186 void primarySignalsEmission(const QString &type = QString());
187 QString primaryValue(const QString &contactType) const;
188
189private:
191
192 QList<QDeclarativeCategory *> m_categories;
193 QDeclarativeGeoLocation *m_location = nullptr;
194 QDeclarativePlaceReviewModel *m_reviewModel = nullptr;
195 QDeclarativePlaceImageModel *m_imageModel = nullptr;
196 QDeclarativePlaceEditorialModel *m_editorialModel = nullptr;
197 QQmlPropertyMap *m_extendedAttributes = nullptr;
198 QDeclarativeContactDetails *m_contactDetails = nullptr;
199
200 QPlace m_src;
201
202 QPlaceReply *m_reply = nullptr;
203
204 QDeclarativeGeoServiceProvider *m_plugin = nullptr;
205 bool m_complete = false;
206
207 QString m_prevPrimaryPhone;
208 QString m_prevPrimaryEmail;
209 QString m_prevPrimaryFax;
210 QUrl m_prevPrimaryWebsite;
211
212 QDeclarativePlace *m_favorite = nullptr;
213
214 Status m_status = Ready;
215 QString m_errorString;
216
217 QList<QDeclarativeCategory *>m_categoriesToBeDeleted;
218};
219
221
223
224#endif // QDECLARATIVEPLACE_P_H
void primaryWebsiteChanged()
void contactDetailsChanged()
void primaryPhoneChanged()
QQmlListProperty< QDeclarativeCategory > categories()
void classBegin() override
Invoked after class creation, but before any properties have been set.
void editorialModelChanged()
void reviewModelChanged()
void extendedAttributesChanged()
void imageModelChanged()
QDeclarativePlaceEditorialModel * editorialModel()
void detailsFetchedChanged()
QDeclarativePlaceImageModel * imageModel()
void attributionChanged()
void primaryFaxChanged()
void visibilityChanged()
QDeclarativePlaceReviewModel * reviewModel()
void primaryEmailChanged()
void categoriesChanged()
\inmodule QtCore
Definition qobject.h:103
\inmodule QtLocation
Definition qplaceicon.h:23
\inmodule QtLocation
\inmodule QtLocation
\inmodule QtLocation
Definition qplacereply.h:15
\inmodule QtLocation
\inmodule QtLocation
Definition qplace.h:25
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
Definition qqmllist.h:24
The QQmlParserStatus class provides updates on the QML parser state.
The QQmlPropertyMap class allows you to set key-value pairs that can be used in QML bindings.
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qurl.h:94
\inmodule QtCore
Definition qvariant.h:65
void statusChanged(QQmlComponent::Status status)
[1]
Definition qlogging.cpp:11
employee setName("Richard Schmit")
@ PublicVisibility
Definition qlocation.h:21
@ UnspecifiedVisibility
Definition qlocation.h:18
@ PrivateVisibility
Definition qlocation.h:20
@ DeviceVisibility
Definition qlocation.h:19
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLint location
GLuint index
[2]
GLenum src
GLenum type
GLuint name
GLsizei GLenum * categories
#define QML_DECLARE_TYPE(TYPE)
Definition qqml.h:19
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_INVOKABLE
#define Q_INTERFACES(x)
#define Q_SLOTS
#define Q_ENUMS(x)
#define Q_SIGNALS
ptrdiff_t qsizetype
Definition qtypes.h:165
#define explicit
settings remove("monkey")
myAction setIcon(SomeIcon)
QNetworkAccessManager manager