7#include <QtCore/QCoreApplication>
8#include <QtQml/QQmlInfo>
9#include <QtPositioning/QGeoCircle>
10#include <QtLocation/QGeoServiceProvider>
11#include <QtLocation/QGeoCodingManager>
12#include <QtLocation/private/qgeocodereply_p.h>
13#include <QtPositioning/QGeoPolygon>
92 declarativeLocations_.
clear();
125 if (!serviceProvider)
129 if (!geocodingManager) {
143 reply_ = geocodingManager->
reverseGeocode(coordinate_, boundingArea_);
151 }
else if (address_) {
153 reply_ = geocodingManager->
geocode(address_->
address(), boundingArea_);
161 }
else if (!searchString_.
isEmpty()) {
163 reply_ = geocodingManager->
geocode(searchString_, limit_, offset_, boundingArea_);
177void QDeclarativeGeocodeModel::abortRequest()
202 return declarativeLocations_.
count();
210 if (!
index.isValid())
212 if (
index.row() >= declarativeLocations_.
count())
280 if (!geocodingManager) {
313 if (boundingArea.
userType() == qMetaTypeId<QGeoRectangle>())
315 else if (boundingArea.
userType() == qMetaTypeId<QGeoCircle>())
317 else if (boundingArea.
userType() == qMetaTypeId<QGeoShape>())
321 if (boundingArea_ ==
s)
357 int oldCount = declarativeLocations_.
count();
358 setLocations(
reply->locations());
362 if (oldCount != declarativeLocations_.
count())
378 int oldCount = declarativeLocations_.
count();
381 setLocations(
reply->locations());
471 declarativeLocations_.
clear();
487 return declarativeLocations_.
count();
502 if (index < 0 || index >= declarativeLocations_.
count()) {
506 return declarativeLocations_.
at(
index);
573 if (!declarativeLocations_.
isEmpty()) {
613 return queryVariant_;
618 if (
query == queryVariant_)
621 if (
query.userType() == qMetaTypeId<QGeoCoordinate>()) {
626 searchString_.
clear();
629 }
else if (
query.typeId() == QMetaType::QString) {
630 searchString_ =
query.toString();
641 searchString_.
clear();
671 queryVariant_ =
query;
void endResetModel()
Completes a model reset operation.
virtual QHash< int, QByteArray > roleNames() const
void beginResetModel()
Begins a model reset operation.
QObject * parent() const
Returns a pointer to the parent object.
void countryCodeChanged()
QGeoServiceProvider * sharedGeoServiceProvider() const
void queryContentChanged()
void setStatus(Status status)
void geocodeFinished(QGeoCodeReply *reply)
void setError(GeocodeError error, const QString &errorString)
void componentComplete() override
void setAutoUpdate(bool update)
void setQuery(const QVariant &query)
QDeclarativeGeoServiceProvider * plugin
void update()
\qmlmethod void QtLocation::GeocodeModel::update()
virtual ~QDeclarativeGeocodeModel()
void setBounds(const QVariant &boundingArea)
@ MissingRequiredParameterError
Q_INVOKABLE QDeclarativeGeoLocation * get(int index)
\qmlmethod Location QtLocation::GeocodeModel::get(int index)
int rowCount(const QModelIndex &parent) const override
void setPlugin(QDeclarativeGeoServiceProvider *plugin)
void geocodeError(QGeoCodeReply *reply, QGeoCodeReply::Error error, const QString &errorString)
QDeclarativeGeocodeModel(QObject *parent=nullptr)
\qmltype GeocodeModel \instantiates QDeclarativeGeocodeModel \inqmlmodule QtLocation
QHash< int, QByteArray > roleNames() const override
QVariant data(const QModelIndex &index, int role) const override
void setOffset(int offset)
Q_INVOKABLE void cancel()
\qmlmethod void QtLocation::GeocodeModel::cancel()
Q_INVOKABLE void reset()
\qmlmethod void QtLocation::GeocodeModel::reset()
bool isEmpty() const
Returns whether this address is empty.
bool isFinished() const
Return true if the operation completed successfully or encountered an error which cause the operation...
Error
Describes an error which prevented the completion of the operation.
Error error() const
Returns the error state of this reply.
virtual void abort()
Cancels the operation immediately.
QString errorString() const
Returns the textual representation of the error state of this reply.
void errorOccurred(QGeoCodeReply *reply, QGeoCodeReply::Error error, const QString &errorString=QString())
QGeoCodeReply * geocode(const QGeoAddress &address, const QGeoShape &bounds=QGeoShape())
Begins the geocoding of address.
QGeoCodeReply * reverseGeocode(const QGeoCoordinate &coordinate, const QGeoShape &bounds=QGeoShape())
Begins the reverse geocoding of coordinate.
void finished(QGeoCodeReply *reply)
bool isValid
This property holds the validity of this geo coordinate.
@ MissingRequiredParameterError
Error geocodingError() const
Returns an error code describing the error which occurred during the last attempt to create a geocodi...
QString geocodingErrorString() const
Returns a string describing the error which occurred during the last attempt to create a geocoding ma...
QGeoCodingManager * geocodingManager() const
Returns the QGeoCodingManager made available by the service provider.
ShapeType type
This property holds the type of this geo shape.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
qsizetype count() const noexcept
NetworkError error() const
Returns the error that was found during the processing of this request.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
void deleteLater()
\threadsafe
\macro QT_RESTRICTED_CAST_FROM_ASCII
void clear()
Clears the contents of the string and makes it null.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
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 >
list append(new Employee("Blackpool", "Stephen"))
qDeleteAll(list.begin(), list.end())
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
GLenum GLuint GLintptr offset
GLuint GLuint64EXT address
GLuint const GLint * locations
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
#define QStringLiteral(str)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent