From b6cdc1fb50da570c9f275af82ff5349d679384bb Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Mon, 13 Nov 2017 13:36:55 +0200 Subject: [Qt] Fix deprecation warnings in Qt 5.10 --- platform/qt/src/qmapboxgl.cpp | 5 +++++ platform/qt/src/qt_image.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index fc281fdf1d..c9f85adf4c 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -111,8 +111,13 @@ std::unique_ptr toStyleImage(const QString &id, const QImage .rgbSwapped() .convertToFormat(QImage::Format_ARGB32_Premultiplied); +#if QT_VERSION >= 0x051000 + auto img = std::make_unique(swapped.sizeInBytes()); + memcpy(img.get(), swapped.constBits(), swapped.sizeInBytes()); +#else auto img = std::make_unique(swapped.byteCount()); memcpy(img.get(), swapped.constBits(), swapped.byteCount()); +#endif return std::make_unique( id.toStdString(), diff --git a/platform/qt/src/qt_image.cpp b/platform/qt/src/qt_image.cpp index 403ca9cbd3..a5c92514c1 100644 --- a/platform/qt/src/qt_image.cpp +++ b/platform/qt/src/qt_image.cpp @@ -54,8 +54,13 @@ PremultipliedImage decodeImage(const std::string& string) { throw std::runtime_error("Unsupported image type"); } +#if QT_VERSION >= 0x051000 + auto img = std::make_unique(image.sizeInBytes()); + memcpy(img.get(), image.constBits(), image.sizeInBytes()); +#else auto img = std::make_unique(image.byteCount()); memcpy(img.get(), image.constBits(), image.byteCount()); +#endif return { { static_cast(image.width()), static_cast(image.height()) }, std::move(img) }; -- cgit v1.2.1