41 QML_NAMED_ELEMENT(GeocodeModel)
43 Q_PROPERTY(QDeclarativeGeoServiceProvider *plugin READ plugin WRITE setPlugin NOTIFY pluginChanged)
44 Q_PROPERTY(
bool autoUpdate READ autoUpdate WRITE setAutoUpdate NOTIFY autoUpdateChanged)
45 Q_PROPERTY(Status status READ status NOTIFY statusChanged)
46 Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged)
47 Q_PROPERTY(
int count READ count NOTIFY countChanged)
48 Q_PROPERTY(
int limit READ limit WRITE setLimit NOTIFY limitChanged)
49 Q_PROPERTY(
int offset READ offset WRITE setOffset NOTIFY offsetChanged)
50 Q_PROPERTY(QVariant query READ query WRITE setQuery NOTIFY queryChanged)
51 Q_PROPERTY(QVariant bounds READ bounds WRITE setBounds NOTIFY boundsChanged)
52 Q_PROPERTY(GeocodeError error READ error NOTIFY errorChanged)
53 Q_INTERFACES(QQmlParserStatus)
65 NoError = QGeoCodeReply::NoError,
66 EngineNotSetError = QGeoCodeReply::EngineNotSetError,
67 CommunicationError = QGeoCodeReply::CommunicationError,
68 ParseError = QGeoCodeReply::ParseError,
69 UnsupportedOptionError = QGeoCodeReply::UnsupportedOptionError,
70 CombinationError = QGeoCodeReply::CombinationError,
71 UnknownError = QGeoCodeReply::UnknownError,
75 UnknownParameterError = 100,
76 MissingRequiredParameterError
81 LocationRole = Qt::UserRole + 1
84 explicit QDeclarativeGeocodeModel(QObject *parent =
nullptr);
85 virtual ~QDeclarativeGeocodeModel();
88 void classBegin() override {}
89 void componentComplete() override;
92 int rowCount(
const QModelIndex &parent)
const override;
93 QVariant data(
const QModelIndex &index,
int role)
const override;
94 QHash<
int,QByteArray> roleNames()
const override;
96 void setPlugin(QDeclarativeGeoServiceProvider *plugin);
97 QDeclarativeGeoServiceProvider *plugin()
const;
99 void setBounds(
const QVariant &boundingArea);
100 QVariant bounds()
const;
102 Status status()
const;
103 QString errorString()
const;
104 GeocodeError error()
const;
106 bool autoUpdate()
const;
107 void setAutoUpdate(
bool update);
110 Q_INVOKABLE QDeclarativeGeoLocation *get(
int index);
113 void setLimit(
int limit);
115 void setOffset(
int offset);
117 QVariant query()
const;
118 void setQuery(
const QVariant &query);
119 Q_INVOKABLE
void reset();
120 Q_INVOKABLE
void cancel();
124 void pluginChanged();
125 void statusChanged();
127 void locationsChanged();
128 void autoUpdateChanged();
129 void boundsChanged();
132 void offsetChanged();
138 void queryContentChanged();
139 void geocodeFinished(QGeoCodeReply *reply);
140 void geocodeError(QGeoCodeReply *reply,
141 QGeoCodeReply::Error error,
142 const QString &errorString);
146 QGeoCodingManager *searchManager();
147 void setStatus(Status status);
148 void setError(GeocodeError error,
const QString &errorString);
149 bool autoUpdate_ =
false;
150 bool complete_ =
false;
153 void setLocations(
const QList<QGeoLocation> &locations);
155 QGeoCodeReply *reply_ =
nullptr;
157 QDeclarativeGeoServiceProvider *plugin_ =
nullptr;
158 QGeoShape boundingArea_;
160 QList<QDeclarativeGeoLocation *> declarativeLocations_;
162 Status status_ = QDeclarativeGeocodeModel::Null;
163 QString errorString_;
164 GeocodeError error_ = QDeclarativeGeocodeModel::NoError;
165 QVariant queryVariant_;
166 QGeoCoordinate coordinate_;
167 QDeclarativeGeoAddress *address_ =
nullptr;
168 QString searchString_;