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
georoutereply_esri.cpp
Go to the documentation of this file.
1// Copyright (C) 2013-2018 Esri <contracts@esri.com>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
6
7#include <QJsonDocument>
8
10
11// JSON reference:
12// https://resources.arcgis.com/en/help/arcgis-rest-api/#/Route_service_with_synchronous_execution/02r300000036000000/
13
15 QObject *parent) :
16 QGeoRouteReply(request, parent)
17{
18 if (!reply) {
19 setError(UnknownError, QStringLiteral("Null reply"));
20 return;
21 }
23 this, &GeoRouteReplyEsri::networkReplyFinished);
25 this, &GeoRouteReplyEsri::networkReplyError);
28}
29
33
34void GeoRouteReplyEsri::networkReplyFinished()
35{
36 QNetworkReply *reply = static_cast<QNetworkReply *>(sender());
38
40 return;
41
43 GeoRouteJsonParserEsri parser(document);
44
45 if (parser.isValid())
46 {
47 setRoutes(parser.routes());
48 setFinished(true);
49 } else {
50 setError(QGeoRouteReply::ParseError, parser.errorString());
51 }
52}
53
54void GeoRouteReplyEsri::networkReplyError(QNetworkReply::NetworkError error)
55{
57 QNetworkReply *reply = static_cast<QNetworkReply *>(sender());
60}
61
GeoRouteReplyEsri(QNetworkReply *reply, const QGeoRouteRequest &request, QObject *parent=nullptr)
\inmodule QtLocation
Error error() const
Returns the error state of this reply.
void setError(Error error, const QString &errorString)
Sets the error state of this reply to error and the textual representation of the error to errorStrin...
void setRoutes(const QList< QGeoRoute > &routes)
Sets the list of routes in the reply to routes.
void setFinished(bool finished)
Sets whether or not this reply has finished to finished.
\inmodule QtLocation
QByteArray readAll()
Reads all remaining data from the device, and returns it as a byte array.
QString errorString() const
Returns a human-readable description of the last device error that occurred.
\inmodule QtCore\reentrant
static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error=nullptr)
Parses json as a UTF-8 encoded JSON document, and creates a QJsonDocument from it.
The QNetworkReply class contains the data and headers for a request sent with QNetworkAccessManager.
void errorOccurred(QNetworkReply::NetworkError)
NetworkError error() const
Returns the error that was found during the processing of this request.
virtual void abort()=0
Aborts the operation immediately and close down any network connections still open.
NetworkError
Indicates all possible error conditions found during the processing of the request.
void finished()
This signal is emitted when the reply has finished processing.
\inmodule QtCore
Definition qobject.h:103
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2960
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
Definition qobject.cpp:2658
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
void deleteLater()
\threadsafe
Definition qobject.cpp:2435
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
#define QStringLiteral(str)
#define Q_UNUSED(x)
QNetworkRequest request(url)
QNetworkReply * reply