9#include <QtCore/QCoreApplication>
10#include <QtCore/QMetaObject>
11#include <QtQml/QQmlEngine>
12#include <QtQml/QQmlInfo>
13#include <QtLocation/QGeoServiceProvider>
14#include <QtLocation/QPlaceAttribute>
15#include <QtLocation/QPlaceManager>
16#include <QtLocation/QPlaceDetailsReply>
17#include <QtLocation/QPlaceReply>
18#include <QtLocation/QPlaceIdReply>
19#include <QtLocation/QPlaceContactDetail>
156 this, &QDeclarativePlace::contactsModified);
170 this, &QDeclarativePlace::contactsModified);
203 this, &QDeclarativePlace::pluginReady);
207void QDeclarativePlace::pluginReady()
230 if (!m_reviewModel) {
235 return m_reviewModel;
260 if (!m_editorialModel) {
265 return m_editorialModel;
277 synchronizeCategories();
281 if (m_location && m_location->
parent() ==
this) {
283 }
else if (!m_location || m_location->
parent() !=
this) {
292 if (previous.
icon() != m_src.
icon())
294 if (previous.
name() != m_src.
name())
324 pullExtendedAttributes();
325 synchronizeContacts();
350 if (m_contactDetails->
value(
key).
typeId() == QMetaType::QVariantList) {
352 for (
const QVariant &detailVar : detailsVarList)
357 result.setContactDetails(
key, cppDetails);
374 if (m_location && m_location->
parent() ==
this)
394 if (m_src.
ratings() != rating) {
558 Status originalStatus = m_status;
562 if (originalStatus != m_status)
574void QDeclarativePlace::finished()
580 switch (m_reply->
type()) {
582 QPlaceIdReply *idReply = qobject_cast<QPlaceIdReply *>(m_reply);
606 m_errorString.
clear();
627 primarySignalsEmission(
key);
633void QDeclarativePlace::cleanupDeletedCategories()
639 m_categoriesToBeDeleted.
clear();
720 return m_errorString;
785 return m_extendedAttributes;
796 return m_contactDetails;
823 if (
object->m_categoriesToBeDeleted.contains(
value))
827 object->m_categories.append(
value);
830 object->m_src.setCategories(
list);
832 emit object->categoriesChanged();
864 if (
object->m_categories.isEmpty())
872 object->m_categories.clear();
874 emit object->categoriesChanged();
881void QDeclarativePlace::synchronizeCategories()
884 m_categories.
clear();
887 m_categories.
append(declarativeValue);
948 if (m_favorite && m_favorite->
parent() ==
this)
979 if (m_favorite == 0) {
982 place->copyFrom(
this);
990void QDeclarativePlace::pullExtendedAttributes()
997 for (
const QString &attributeType : attributeTypes) {
998 m_extendedAttributes->
insert(attributeType,
1008void QDeclarativePlace::synchronizeContacts()
1011 for (
const QString &contactType : m_contactDetails->
keys()) {
1015 if (
obj->parent() ==
this)
1022 for (
const QString &contactType : m_src.contactTypes()) {
1027 m_contactDetails->
insert(contactType, declContacts);
1029 primarySignalsEmission();
1038void QDeclarativePlace::primarySignalsEmission(
const QString &
type)
1045 if (!
type.isEmpty())
1054 if (!
type.isEmpty())
1063 if (!
type.isEmpty())
1098 if (!serviceProvider)
1103 if (!placeManager) {
1109 return placeManager;
1115QString QDeclarativePlace::primaryValue(
const QString &contactType)
const
1118 if (
value.userType() == qMetaTypeId<QJSValue>())
1121 if (
value.userType() == QMetaType::QVariantList) {
1125 }
else if (
value.metaType() == QMetaType::fromType<QPlaceContactDetail>()) {
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
void setLocation(const QGeoLocation &src)
\qmlproperty QGeoLocation QtPositioning::Location::location
QGeoServiceProvider * sharedGeoServiceProvider() const
void setPlace(QDeclarativePlace *place)
void initializeCollection(int totalCount, const QPlaceContent::Collection &collection)
void primaryWebsiteChanged()
QDeclarativePlaceReviewModel * reviewModel
\qmlproperty ReviewModel Place::reviewModel
void setStatus(Status status, const QString &errorString=QString())
\qmlproperty enumeration Place::status
void primaryPhoneChanged()
void setLocation(QDeclarativeGeoLocation *location)
\qmlproperty QtPositioning::Location Place::location
Q_INVOKABLE QString errorString() const
\qmlmethod string Place::errorString()
QDeclarativePlaceImageModel * imageModel
\qmlproperty ImageModel Place::imageModel
static qsizetype category_count(QQmlListProperty< QDeclarativeCategory > *prop)
QObject * extendedAttributes
QDeclarativePlace * favorite
static QDeclarativeCategory * category_at(QQmlListProperty< QDeclarativeCategory > *prop, qsizetype index)
void setPlaceId(const QString &placeId)
\qmlproperty string Place::placeId
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void setFavorite(QDeclarativePlace *favorite)
void setPlace(const QPlace &src)
void setSupplier(const QPlaceSupplier &supplier)
\qmlproperty Supplier Place::supplier
void extendedAttributesChanged()
QDeclarativePlace(QObject *parent=nullptr)
\qmltype Place \instantiates QDeclarativePlace \inqmlmodule QtLocation
Q_INVOKABLE void remove()
\qmlmethod void Place::remove()
QDeclarativeGeoServiceProvider * plugin
static void category_clear(QQmlListProperty< QDeclarativeCategory > *prop)
QDeclarativeContactDetails * contactDetails
void detailsFetchedChanged()
Q_INVOKABLE void getDetails()
\qmlmethod void Place::getDetails()
void setPlugin(QDeclarativeGeoServiceProvider *plugin)
\qmlproperty Plugin Place::plugin
void setVisibility(Visibility visibility)
void attributionChanged()
QDeclarativePlaceEditorialModel * editorialModel
\qmlproperty EditorialModel Place::editorialModel
static void category_append(QQmlListProperty< QDeclarativeCategory > *prop, QDeclarativeCategory *value)
void setIcon(const QPlaceIcon &icon)
void setAttribution(const QString &attribution)
\qmlproperty string Place::attribution
Q_INVOKABLE void initializeFavorite(QDeclarativeGeoServiceProvider *plugin)
\qmlmethod void Place::initializeFavorite(Plugin destinationPlugin)
Q_INVOKABLE void save()
\qmlmethod void Place::save()
void setRatings(const QPlaceRatings &ratings)
\qmlproperty Ratings Place::ratings
QQmlListProperty< QDeclarativeCategory > categories
\qmlproperty list<Category> Place::categories
void primaryEmailChanged()
Q_INVOKABLE void copyFrom(QDeclarativePlace *original)
\qmlmethod void Place::copyFrom(Place original)
QDeclarativeGeoLocation * location
void setName(const QString &name)
\qmlproperty string Place::name
Error error() const
Returns an error code describing the error which occurred during the last operation that was performe...
QPlaceManager * placeManager() const
Returns the QPlaceManager made available by the service provider.
QString errorString() const
Returns a string describing the error which occurred during the last operation that was performed by ...
The QJSValue class acts as a container for Qt/JavaScript data types.
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
qsizetype removeAll(const AT &t)
qsizetype count() const noexcept
void append(parameter_type t)
QObject * parent() const
Returns a pointer to the parent object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void deleteLater()
\threadsafe
QPlace place() const
Returns the place that was fetched.
OperationType operationType() const
Returns the operation type of the reply.
QString id() const
Returns the relevant identifier for the operation.
QPlaceIdReply * savePlace(const QPlace &place)
Saves a specified place.
QPlaceDetailsReply * getPlaceDetails(const QString &placeId) const
Retrieves a details of place corresponding to the given placeId.
QPlace compatiblePlace(const QPlace &place) const
Returns a pruned or modified version of the original place which is suitable to be saved into this ma...
QPlaceIdReply * removePlace(const QString &placeId)
Removes the place corresponding to placeId from the manager.
QPlaceReply::Error error() const
Returns the error code.
void finished()
This signal is emitted when this reply has finished processing.
virtual void abort()
Cancels the operation immediately.
QString errorString() const
Returns the error string of the reply.
virtual Type type() const
Returns the type of the reply.
void setVisibility(QLocation::Visibility visibility)
Sets the visibility of the place to visibility.
QString primaryPhone() const
Returns the primary phone number for this place.
void setIcon(const QPlaceIcon &icon)
Sets the icon of the place.
QList< QPlaceContactDetail > contactDetails(const QString &contactType) const
Returns a list of contact details of the specified contactType.
QLocation::Visibility visibility() const
Returns the visibility of the place.
void setPlaceId(const QString &identifier)
Sets the identifier of the place.
void setAttribution(const QString &attribution)
Sets the attribution string of the place.
void setRatings(const QPlaceRatings &ratings)
Sets the aggregated rating of the place.
QStringList extendedAttributeTypes() const
Returns the types of extended attributes that this place has.
QPlaceIcon icon() const
Returns the icon of the place.
QUrl primaryWebsite() const
Returns the primary website of the place.
QString primaryEmail() const
Returns the primary email address for this place.
QList< QPlaceCategory > categories() const
Returns categories that this place belongs to.
int totalContentCount(QPlaceContent::Type type) const
Returns the total count of content objects of the given type.
QString attribution() const
Returns a rich text attribution string of the place.
QGeoLocation location() const
Returns the location of the place.
QPlaceAttribute extendedAttribute(const QString &attributeType) const
Returns the exteded attribute corresponding to the specified attributeType.
QPlaceSupplier supplier() const
Returns the supplier of this place.
void setSupplier(const QPlaceSupplier &supplier)
Sets the supplier of this place to supplier.
QString primaryFax() const
Returns the primary fax number for this place.
void setName(const QString &name)
Sets the name of the place.
QPlaceRatings ratings() const
Returns an aggregated rating of the place.
QString placeId() const
Returns the identifier of the place.
QPlaceContent::Collection content(QPlaceContent::Type type) const
Returns a collection of content associated with a place.
bool detailsFetched() const
Returns true if the details of this place have been fetched, otherwise returns false.
QString name() const
Returns the name of the place.
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
The QQmlPropertyMap class allows you to set key-value pairs that can be used in QML bindings.
Q_INVOKABLE QStringList keys() const
Returns the list of keys.
void valueChanged(const QString &key, const QVariant &value)
This signal is emitted whenever one of the values in the map is changed.
void insert(const QString &key, const QVariant &value)
Sets the value associated with key to value.
QVariant value(const QString &key) const
Returns the value associated with key.
\macro QT_RESTRICTED_CAST_FROM_ASCII
void clear()
Clears the contents of the string and makes it null.
QList< QVariant > toList() const
Returns the variant as a QVariantList if the variant has userType() \l QMetaType::QVariantList.
int typeId() const
Returns the storage type of the value stored in the variant.
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
const QLoggingCategory & category()
[1]
list append(new Employee("Blackpool", "Stephen"))
qDeleteAll(list.begin(), list.end())
QT_BEGIN_NAMESPACE const char CONTEXT_NAME[]
const char PLUGIN_ERROR[]
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
QList< QVariant > QVariantList
GLsizei GLenum * categories
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
#define QStringLiteral(str)
static QVariant toVariant(const QV4::Value &value, QMetaType typeHint, bool createJSValueForObjectsAndSymbols, V4ObjectSet *visitedObjects)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent