From 5525ba6e8ccd98c0405ce77820c20410eb7fac8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sun, 10 Dec 2023 08:51:18 +0100 Subject: [PATCH] Code cleanup --- src/map/tileloader.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/map/tileloader.cpp b/src/map/tileloader.cpp index 2d3c79bb..48aa3b08 100644 --- a/src/map/tileloader.cpp +++ b/src/map/tileloader.cpp @@ -7,6 +7,8 @@ #include "tileloader.h" #define SUBSTITUTE_CHAR '$' +#define IS_INT(zoom) \ + ((QMetaType::Type)((zoom).type()) == QMetaType::Int) class TileImage { @@ -18,7 +20,8 @@ class TileImage void load() { QImage img; - QByteArray z(_tile->zoom().toString().toLatin1()); + QByteArray z(IS_INT(_tile->zoom()) + ? QByteArray::number(_tile->zoom().toInt()) : QByteArray()); QImageReader reader(_file, z); if (_scaledSize) reader.setScaledSize(QSize(_scaledSize, _scaledSize)); @@ -220,7 +223,7 @@ QUrl TileLoader::tileUrl(const FetchTile &tile) const QString TileLoader::tileFile(const FetchTile &tile) const { - QString zoom(((QMetaType::Type)(tile.zoom().type()) == QMetaType::Int) + QString zoom(IS_INT(tile.zoom()) ? tile.zoom().toString() : fsSafeStr(tile.zoom().toString())); return _dir + QLatin1Char('/') + zoom + QLatin1Char('-')