summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-11-24 17:36:47 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-11-28 18:18:42 +0200
commit11281d15e9c36b82dda3361c518161fb11c13ef9 (patch)
tree3fc4b38bf40e25d83648697b273ef83c12dc1496
parentbc48cb777b066259ebec65a9baf50c5a10614a9f (diff)
downloadqtlocation-mapboxgl-11281d15e9c36b82dda3361c518161fb11c13ef9.tar.gz
[qt] Use QOpenGLWidget instead of QGLWidget from Qt 5.4 onwards
-rw-r--r--platform/qt/app/mapwindow.cpp4
-rw-r--r--platform/qt/app/mapwindow.hpp16
-rw-r--r--platform/qt/src/qmapboxgl.cpp1
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 <QGLWidget>
#include <QMapboxGL>
+
+#include <QtGlobal>
+
+// XXX http://stackoverflow.com/questions/24899558/how-to-check-qt-version-to-include-different-header#comment59591604_29887388
+#if QT_VERSION >= 0x050400
+#include <QOpenGLWidget>
+#else
+#include <QGLWidget>
+#endif // QT_VERSION
+
#include <QPropertyAnimation>
+#include <QScopedPointer>
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 <QGuiApplication>
#include <QWindow>
#include <QOpenGLFramebufferObject>
+#include <QOpenGLContext>
#else
#include <QCoreApplication>
#endif