[qt] Use QOpenGLWidget instead of QGLWidget from Qt 5.4 onwards
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <QGuiApplication>
|
||||
#include <QWindow>
|
||||
#include <QOpenGLFramebufferObject>
|
||||
#include <QOpenGLContext>
|
||||
#else
|
||||
#include <QCoreApplication>
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user