Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qgeomapreplyosm.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 Aaron McCarthy <mccarthy.aaron@gmail.com>
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
include
"qgeomapreplyosm.h"
6
7
#
include
<
QtLocation
/
private
/
qgeotilespec_p
.
h
>
8
9
QGeoMapReplyOsm::QGeoMapReplyOsm(QNetworkReply *reply,
10
const
QGeoTileSpec &spec,
11
const
QString &imageFormat,
12
QObject *parent)
13
: QGeoTiledMapReply(spec, parent)
14
{
15
if
(!reply) {
16
setError(UnknownError, QStringLiteral(
"Null reply"
));
17
return
;
18
}
19
connect(reply, &QNetworkReply::finished,
20
this
, &QGeoMapReplyOsm::networkReplyFinished);
21
connect(reply, &QNetworkReply::errorOccurred,
22
this
, &QGeoMapReplyOsm::networkReplyError);
23
connect(
this
, &QGeoTiledMapReply::aborted, reply, &QNetworkReply::abort);
24
connect(
this
, &QObject::destroyed, reply, &QObject::deleteLater);
25
setMapImageFormat(imageFormat);
26
}
27
28
QGeoMapReplyOsm::~QGeoMapReplyOsm()
29
{
30
}
31
32
void
QGeoMapReplyOsm::networkReplyFinished()
33
{
34
QNetworkReply *reply =
static_cast
<QNetworkReply *>(sender());
35
reply->deleteLater();
36
37
if
(reply->error() != QNetworkReply::NoError)
// Already handled in networkReplyError
38
return
;
39
40
QByteArray a = reply->readAll();
41
42
setMapImageData(a);
43
setFinished(
true
);
44
}
45
46
void
QGeoMapReplyOsm::networkReplyError(QNetworkReply::NetworkError error)
47
{
48
QNetworkReply *reply =
static_cast
<QNetworkReply *>(sender());
49
reply->deleteLater();
50
if
(error == QNetworkReply::OperationCanceledError)
51
setFinished(
true
);
52
else
53
setError(QGeoTiledMapReply::CommunicationError, reply->errorString());
54
55
}
qtlocation
src
plugins
geoservices
osm
qgeomapreplyosm.cpp
Generated on
for Qt by
1.18.0