40 QML_NAMED_ELEMENT(GeocodeModel)
44 Q_PROPERTY(QDeclarativeGeoServiceProvider *plugin READ plugin WRITE setPlugin NOTIFY pluginChanged)
45 Q_PROPERTY(
bool autoUpdate READ autoUpdate WRITE setAutoUpdate NOTIFY autoUpdateChanged)
46 Q_PROPERTY(Status status READ status NOTIFY statusChanged)
47 Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged)
48 Q_PROPERTY(
int count READ count NOTIFY countChanged)
49 Q_PROPERTY(
int limit READ limit WRITE setLimit NOTIFY limitChanged)
50 Q_PROPERTY(
int offset READ offset WRITE setOffset NOTIFY offsetChanged)
51 Q_PROPERTY(QVariant query READ query WRITE setQuery NOTIFY queryChanged)
52 Q_PROPERTY(QVariant bounds READ bounds WRITE setBounds NOTIFY boundsChanged)
53 Q_PROPERTY(GeocodeError error READ error NOTIFY errorChanged)
54 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
80 LocationRole = Qt::UserRole + 1
83 explicit QDeclarativeGeocodeModel(QObject *parent =
nullptr);
84 virtual ~QDeclarativeGeocodeModel();
87 void classBegin() override {}
88 void componentComplete() override;
91 int rowCount(
const QModelIndex &parent)
const override;
92 QVariant data(
const QModelIndex &index,
int role)
const override;
93 QHash<
int,QByteArray> roleNames()
const override;
95 void setPlugin(QDeclarativeGeoServiceProvider *plugin);
96 QDeclarativeGeoServiceProvider *plugin()
const;
98 void setBounds(
const QVariant &boundingArea);
99 QVariant bounds()
const;
101 Status status()
const;
102 QString errorString()
const;
103 GeocodeError error()
const;
105 bool autoUpdate()
const;
106 void setAutoUpdate(
bool update);
109 Q_INVOKABLE QDeclarativeGeoLocation *get(
int index);
112 void setLimit(
int limit);
114 void setOffset(
int offset);
116 QVariant query()
const;
117 void setQuery(
const QVariant &query);
118 Q_INVOKABLE
void reset();
119 Q_INVOKABLE
void cancel();
123 void pluginChanged();
124 void statusChanged();
126 void locationsChanged();
127 void autoUpdateChanged();
128 void boundsChanged();
131 void offsetChanged();
137 void queryContentChanged();
138 void geocodeFinished(QGeoCodeReply *reply);
139 void geocodeError(QGeoCodeReply *reply,
140 QGeoCodeReply::Error error,
141 const QString &errorString);
145 QGeoCodingManager *searchManager();
146 void setStatus(Status status);
147 void setError(GeocodeError error,
const QString &errorString);
148 bool autoUpdate_ =
false;
149 bool complete_ =
false;
152 void setLocations(
const QList<QGeoLocation> &locations);
154 QGeoCodeReply *reply_ =
nullptr;
156 QDeclarativeGeoServiceProvider *plugin_ =
nullptr;
157 QGeoShape boundingArea_;
159 QList<QDeclarativeGeoLocation *> declarativeLocations_;
161 Status status_ = QDeclarativeGeocodeModel::Null;
162 QString errorString_;
163 GeocodeError error_ = QDeclarativeGeocodeModel::NoError;
164 QVariant queryVariant_;
165 QGeoCoordinate coordinate_;
166 QDeclarativeGeoAddress *address_ =
nullptr;
167 QString searchString_;