From ee24bd54f1ae317fd033a9178487d13edb614ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sun, 1 Mar 2020 11:43:08 +0100 Subject: [PATCH] Fixed tile cache reload issues --- src/GUI/mapview.cpp | 2 -- src/map/tileloader.cpp | 11 +++++++++++ src/map/tileloader.h | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/GUI/mapview.cpp b/src/GUI/mapview.cpp index f2a2d9b1..9bdf0f0e 100644 --- a/src/GUI/mapview.cpp +++ b/src/GUI/mapview.cpp @@ -351,7 +351,6 @@ void MapView::setMap(Map *map) centerOn(nc); reloadMap(); - QPixmapCache::clear(); } void MapView::setPOI(POI *poi) @@ -982,7 +981,6 @@ void MapView::setDevicePixelRatio(qreal deviceRatio, qreal mapRatio) _deviceRatio = deviceRatio; _mapRatio = mapRatio; - QPixmapCache::clear(); QRectF vr(mapToScene(viewport()->rect()).boundingRect() .intersected(_map->bounds())); diff --git a/src/map/tileloader.cpp b/src/map/tileloader.cpp index b677fa3c..3642ee01 100644 --- a/src/map/tileloader.cpp +++ b/src/map/tileloader.cpp @@ -169,6 +169,17 @@ void TileLoader::clearCache() dir.remove(list.at(i)); _downloader->clearErrors(); + + QPixmapCache::clear(); +} + +void TileLoader::setScaledSize(int size) +{ + if (_scaledSize == size) + return; + + _scaledSize = size; + QPixmapCache::clear(); } QUrl TileLoader::tileUrl(const Tile &tile) const diff --git a/src/map/tileloader.h b/src/map/tileloader.h index ee2bd71a..d12ba6c4 100644 --- a/src/map/tileloader.h +++ b/src/map/tileloader.h @@ -16,7 +16,7 @@ public: void setUrl(const QString &url) {_url = url;} void setAuthorization(const Authorization &authorization) {_authorization = authorization;} - void setScaledSize(int size) {_scaledSize = size;} + void setScaledSize(int size); void setQuadTiles(bool quadTiles) {_quadTiles = quadTiles;} void loadTilesAsync(QVector &list);