From 11281d15e9c36b82dda3361c518161fb11c13ef9 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Thu, 24 Nov 2016 17:36:47 +0200 Subject: [qt] Use QOpenGLWidget instead of QGLWidget from Qt 5.4 onwards --- platform/qt/app/mapwindow.cpp | 4 ++-- platform/qt/app/mapwindow.hpp | 16 +++++++++++++++- platform/qt/src/qmapboxgl.cpp | 1 + 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/platform/qt/app/mapwindow.cpp b/platform/qt/app/mapwindow.cpp index c224d8ecee..28a3f1df4b 100644 --- a/platform/qt/app/mapwindow.cpp +++ b/platform/qt/app/mapwindow.cpp @@ -38,9 +38,9 @@ void MapWindow::selfTest() } qreal MapWindow::pixelRatio() { -#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) +#if QT_VERSION >= 0x050600 return devicePixelRatioF(); -#elif (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) +#elif QT_VERSION >= 0x050000 return devicePixelRatio(); #else return 1; diff --git a/platform/qt/app/mapwindow.hpp b/platform/qt/app/mapwindow.hpp index 2ce93419fd..23880902d3 100644 --- a/platform/qt/app/mapwindow.hpp +++ b/platform/qt/app/mapwindow.hpp @@ -1,15 +1,29 @@ #ifndef MAPWINDOW_H #define MAPWINDOW_H -#include #include + +#include + +// XXX http://stackoverflow.com/questions/24899558/how-to-check-qt-version-to-include-different-header#comment59591604_29887388 +#if QT_VERSION >= 0x050400 +#include +#else +#include +#endif // QT_VERSION + #include +#include class QKeyEvent; class QMouseEvent; class QWheelEvent; +#if QT_VERSION >= 0x050400 +class MapWindow : public QOpenGLWidget +#else class MapWindow : public QGLWidget +#endif // QT_VERSION { Q_OBJECT diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index e1a8a463ef..dfd6ff58d8 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #else #include #endif -- cgit v1.2.1