diff options
Diffstat (limited to 'platform/qt')
-rw-r--r-- | platform/qt/app/mapwindow.cpp | 29 | ||||
-rw-r--r-- | platform/qt/app/mapwindow.hpp | 13 | ||||
-rw-r--r-- | platform/qt/mbgl/gl/gl_impl.hpp | 322 | ||||
-rw-r--r-- | platform/qt/qt.cmake | 42 | ||||
-rw-r--r-- | platform/qt/qt5.cmake | 26 | ||||
-rw-r--r-- | platform/qt/src/headless_backend_qt.cpp | 10 | ||||
-rw-r--r-- | platform/qt/src/http_file_source.cpp | 14 | ||||
-rw-r--r-- | platform/qt/src/qmapbox.cpp | 4 | ||||
-rw-r--r-- | platform/qt/src/qmapboxgl.cpp | 17 | ||||
-rw-r--r-- | platform/qt/src/qmapboxgl_renderer_backend.cpp | 12 | ||||
-rw-r--r-- | platform/qt/src/qt_conversion.hpp | 8 | ||||
-rw-r--r-- | platform/qt/src/qt_geojson.cpp | 8 | ||||
-rw-r--r-- | platform/qt/src/qt_image.cpp | 5 | ||||
-rw-r--r-- | platform/qt/src/sqlite3.cpp | 8 | ||||
-rw-r--r-- | platform/qt/src/timer.cpp | 2 | ||||
-rw-r--r-- | platform/qt/test/qmapboxgl.test.cpp | 5 | ||||
-rw-r--r-- | platform/qt/test/qmapboxgl.test.hpp | 5 |
17 files changed, 179 insertions, 351 deletions
diff --git a/platform/qt/app/mapwindow.cpp b/platform/qt/app/mapwindow.cpp index 536731929e..551af4630b 100644 --- a/platform/qt/app/mapwindow.cpp +++ b/platform/qt/app/mapwindow.cpp @@ -9,13 +9,8 @@ #include <QMouseEvent> #include <QString> -#if QT_VERSION >= 0x050000 -#include <QWindow> -#endif - int kAnimationDuration = 10000; - MapWindow::MapWindow(const QMapboxGLSettings &settings) : m_settings(settings) { @@ -45,13 +40,7 @@ void MapWindow::selfTest() } qreal MapWindow::pixelRatio() { -#if QT_VERSION >= 0x050600 return devicePixelRatioF(); -#elif QT_VERSION >= 0x050000 - return devicePixelRatio(); -#else - return 1; -#endif } @@ -369,11 +358,7 @@ void MapWindow::keyPressEvent(QKeyEvent *ev) void MapWindow::mousePressEvent(QMouseEvent *ev) { -#if QT_VERSION < 0x050000 - m_lastPos = ev->posF(); -#else m_lastPos = ev->localPos(); -#endif if (ev->type() == QEvent::MouseButtonPress) { if (ev->buttons() == (Qt::LeftButton | Qt::RightButton)) { @@ -394,11 +379,7 @@ void MapWindow::mousePressEvent(QMouseEvent *ev) void MapWindow::mouseMoveEvent(QMouseEvent *ev) { -#if QT_VERSION < 0x050000 - QPointF delta = ev->posF() - m_lastPos; -#else QPointF delta = ev->localPos() - m_lastPos; -#endif if (!delta.isNull()) { if (ev->buttons() == Qt::LeftButton && ev->modifiers() & Qt::ShiftModifier) { @@ -406,19 +387,11 @@ void MapWindow::mouseMoveEvent(QMouseEvent *ev) } else if (ev->buttons() == Qt::LeftButton) { m_map->moveBy(delta); } else if (ev->buttons() == Qt::RightButton) { -#if QT_VERSION < 0x050000 - m_map->rotateBy(m_lastPos, ev->posF()); -#else m_map->rotateBy(m_lastPos, ev->localPos()); -#endif } } -#if QT_VERSION < 0x050000 - m_lastPos = ev->posF(); -#else m_lastPos = ev->localPos(); -#endif ev->accept(); } @@ -464,8 +437,6 @@ void MapWindow::paintGL() { m_frameDraws++; m_map->resize(size()); -#if QT_VERSION >= 0x050400 m_map->setFramebufferObject(defaultFramebufferObject(), size() * pixelRatio()); -#endif m_map->render(); } diff --git a/platform/qt/app/mapwindow.hpp b/platform/qt/app/mapwindow.hpp index 6c05f03562..0671c42518 100644 --- a/platform/qt/app/mapwindow.hpp +++ b/platform/qt/app/mapwindow.hpp @@ -3,27 +3,16 @@ #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> +#include <QtGlobal> 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/mbgl/gl/gl_impl.hpp b/platform/qt/mbgl/gl/gl_impl.hpp index b08efe1eec..a3c69214c2 100644 --- a/platform/qt/mbgl/gl/gl_impl.hpp +++ b/platform/qt/mbgl/gl/gl_impl.hpp @@ -2,177 +2,157 @@ #include <QtGlobal> -// Qt4 -#if QT_VERSION < 0x050000 - #if __APPLE__ - #include "TargetConditionals.h" - #include <OpenGL/OpenGL.h> - #include <OpenGL/gl.h> - #include <OpenGL/glext.h> - #elif MBGL_USE_GLES2 - #define GL_GLEXT_PROTOTYPES - #include <GLES2/gl2.h> - #include <GLES2/gl2ext.h> - #else - #define GL_GLEXT_PROTOTYPES - #include <GL/gl.h> - #include <GL/glext.h> - #endif +#include <QOpenGLContext> +#include <QOpenGLFunctions> -// Qt5 -#else - #include <QOpenGLContext> - #include <QOpenGLFunctions> - - #ifndef GL_RGBA8_OES - #define GL_RGBA8_OES GL_RGBA8 - #endif - - #ifndef GL_DEPTH24_STENCIL8_OES - #define GL_DEPTH24_STENCIL8_OES GL_DEPTH24_STENCIL8 - #endif +#ifndef GL_RGBA8_OES +#define GL_RGBA8_OES GL_RGBA8 +#endif - #define glActiveTexture(...) QOpenGLContext::currentContext()->functions()->glActiveTexture(__VA_ARGS__) - #define glAttachShader(...) QOpenGLContext::currentContext()->functions()->glAttachShader(__VA_ARGS__) - #define glBindAttribLocation(...) QOpenGLContext::currentContext()->functions()->glBindAttribLocation(__VA_ARGS__) - #define glBindBuffer(...) QOpenGLContext::currentContext()->functions()->glBindBuffer(__VA_ARGS__) - #define glBindFramebuffer(...) QOpenGLContext::currentContext()->functions()->glBindFramebuffer(__VA_ARGS__) - #define glBindRenderbuffer(...) QOpenGLContext::currentContext()->functions()->glBindRenderbuffer(__VA_ARGS__) - #define glBindTexture(...) QOpenGLContext::currentContext()->functions()->glBindTexture(__VA_ARGS__) - #define glBlendColor(...) QOpenGLContext::currentContext()->functions()->glBlendColor(__VA_ARGS__) - #define glBlendEquation(...) QOpenGLContext::currentContext()->functions()->glBlendEquation(__VA_ARGS__) - #define glBlendEquationSeparate(...) QOpenGLContext::currentContext()->functions()->glBlendEquationSeparate(__VA_ARGS__) - #define glBlendFunc(...) QOpenGLContext::currentContext()->functions()->glBlendFunc(__VA_ARGS__) - #define glBlendFuncSeparate(...) QOpenGLContext::currentContext()->functions()->glBlendFuncSeparate(__VA_ARGS__) - #define glBufferData(...) QOpenGLContext::currentContext()->functions()->glBufferData(__VA_ARGS__) - #define glBufferSubData(...) QOpenGLContext::currentContext()->functions()->glBufferSubData(__VA_ARGS__) - #define glCheckFramebufferStatus(...) QOpenGLContext::currentContext()->functions()->glCheckFramebufferStatus(__VA_ARGS__) - #define glClear(...) QOpenGLContext::currentContext()->functions()->glClear(__VA_ARGS__) - #define glClearColor(...) QOpenGLContext::currentContext()->functions()->glClearColor(__VA_ARGS__) - #define glClearDepthf(...) QOpenGLContext::currentContext()->functions()->glClearDepthf(__VA_ARGS__) - #define glClearStencil(...) QOpenGLContext::currentContext()->functions()->glClearStencil(__VA_ARGS__) - #define glColorMask(...) QOpenGLContext::currentContext()->functions()->glColorMask(__VA_ARGS__) - #define glCompileShader(...) QOpenGLContext::currentContext()->functions()->glCompileShader(__VA_ARGS__) - #define glCompressedTexImage2D(...) QOpenGLContext::currentContext()->functions()->glCompressedTexImage2D(__VA_ARGS__) - #define glCompressedTexSubImage2D(...) QOpenGLContext::currentContext()->functions()->glCompressedTexSubImage2D(__VA_ARGS__) - #define glCopyTexImage2D(...) QOpenGLContext::currentContext()->functions()->glCopyTexImage2D(__VA_ARGS__) - #define glCopyTexSubImage2D(...) QOpenGLContext::currentContext()->functions()->glCopyTexSubImage2D(__VA_ARGS__) - #define glCreateProgram(...) QOpenGLContext::currentContext()->functions()->glCreateProgram(__VA_ARGS__) - #define glCreateShader(...) QOpenGLContext::currentContext()->functions()->glCreateShader(__VA_ARGS__) - #define glCullFace(...) QOpenGLContext::currentContext()->functions()->glCullFace(__VA_ARGS__) - #define glDeleteBuffers(...) QOpenGLContext::currentContext()->functions()->glDeleteBuffers(__VA_ARGS__) - #define glDeleteFramebuffers(...) QOpenGLContext::currentContext()->functions()->glDeleteFramebuffers(__VA_ARGS__) - #define glDeleteProgram(...) QOpenGLContext::currentContext()->functions()->glDeleteProgram(__VA_ARGS__) - #define glDeleteRenderbuffers(...) QOpenGLContext::currentContext()->functions()->glDeleteRenderbuffers(__VA_ARGS__) - #define glDeleteShader(...) QOpenGLContext::currentContext()->functions()->glDeleteShader(__VA_ARGS__) - #define glDeleteTextures(...) QOpenGLContext::currentContext()->functions()->glDeleteTextures(__VA_ARGS__) - #define glDepthFunc(...) QOpenGLContext::currentContext()->functions()->glDepthFunc(__VA_ARGS__) - #define glDepthMask(...) QOpenGLContext::currentContext()->functions()->glDepthMask(__VA_ARGS__) - #define glDepthRangef(...) QOpenGLContext::currentContext()->functions()->glDepthRangef(__VA_ARGS__) - #define glDetachShader(...) QOpenGLContext::currentContext()->functions()->glDetachShader(__VA_ARGS__) - #define glDisable(...) QOpenGLContext::currentContext()->functions()->glDisable(__VA_ARGS__) - #define glDisableVertexAttribArray(...) QOpenGLContext::currentContext()->functions()->glDisableVertexAttribArray(__VA_ARGS__) - #define glDrawArrays(...) QOpenGLContext::currentContext()->functions()->glDrawArrays(__VA_ARGS__) - #define glDrawElements(...) QOpenGLContext::currentContext()->functions()->glDrawElements(__VA_ARGS__) - #define glEnable(...) QOpenGLContext::currentContext()->functions()->glEnable(__VA_ARGS__) - #define glEnableVertexAttribArray(...) QOpenGLContext::currentContext()->functions()->glEnableVertexAttribArray(__VA_ARGS__) - #define glFinish(...) QOpenGLContext::currentContext()->functions()->glFinish(__VA_ARGS__) - #define glFlush(...) QOpenGLContext::currentContext()->functions()->glFlush(__VA_ARGS__) - #define glFramebufferRenderbuffer(...) QOpenGLContext::currentContext()->functions()->glFramebufferRenderbuffer(__VA_ARGS__) - #define glFramebufferTexture2D(...) QOpenGLContext::currentContext()->functions()->glFramebufferTexture2D(__VA_ARGS__) - #define glFrontFace(...) QOpenGLContext::currentContext()->functions()->glFrontFace(__VA_ARGS__) - #define glGenBuffers(...) QOpenGLContext::currentContext()->functions()->glGenBuffers(__VA_ARGS__) - #define glGenerateMipmap(...) QOpenGLContext::currentContext()->functions()->glGenerateMipmap(__VA_ARGS__) - #define glGenFramebuffers(...) QOpenGLContext::currentContext()->functions()->glGenFramebuffers(__VA_ARGS__) - #define glGenRenderbuffers(...) QOpenGLContext::currentContext()->functions()->glGenRenderbuffers(__VA_ARGS__) - #define glGenTextures(...) QOpenGLContext::currentContext()->functions()->glGenTextures(__VA_ARGS__) - #define glGetActiveAttrib(...) QOpenGLContext::currentContext()->functions()->glGetActiveAttrib(__VA_ARGS__) - #define glGetActiveUniform(...) QOpenGLContext::currentContext()->functions()->glGetActiveUniform(__VA_ARGS__) - #define glGetAttachedShaders(...) QOpenGLContext::currentContext()->functions()->glGetAttachedShaders(__VA_ARGS__) - #define glGetAttribLocation(...) QOpenGLContext::currentContext()->functions()->glGetAttribLocation(__VA_ARGS__) - #define glGetBooleanv(...) QOpenGLContext::currentContext()->functions()->glGetBooleanv(__VA_ARGS__) - #define glGetBufferParameteriv(...) QOpenGLContext::currentContext()->functions()->glGetBufferParameteriv(__VA_ARGS__) - #define glGetError(...) QOpenGLContext::currentContext()->functions()->glGetError(__VA_ARGS__) - #define glGetFloatv(...) QOpenGLContext::currentContext()->functions()->glGetFloatv(__VA_ARGS__) - #define glGetFramebufferAttachmentParameteriv(...) QOpenGLContext::currentContext()->functions()->glGetFramebufferAttachmentParameteriv(__VA_ARGS__) - #define glGetIntegerv(...) QOpenGLContext::currentContext()->functions()->glGetIntegerv(__VA_ARGS__) - #define glGetProgramInfoLog(...) QOpenGLContext::currentContext()->functions()->glGetProgramInfoLog(__VA_ARGS__) - #define glGetProgramiv(...) QOpenGLContext::currentContext()->functions()->glGetProgramiv(__VA_ARGS__) - #define glGetRenderbufferParameteriv(...) QOpenGLContext::currentContext()->functions()->glGetRenderbufferParameteriv(__VA_ARGS__) - #define glGetShaderInfoLog(...) QOpenGLContext::currentContext()->functions()->glGetShaderInfoLog(__VA_ARGS__) - #define glGetShaderiv(...) QOpenGLContext::currentContext()->functions()->glGetShaderiv(__VA_ARGS__) - #define glGetShaderPrecisionFormat(...) QOpenGLContext::currentContext()->functions()->glGetShaderPrecisionFormat(__VA_ARGS__) - #define glGetShaderSource(...) QOpenGLContext::currentContext()->functions()->glGetShaderSource(__VA_ARGS__) - #define glGetString(...) QOpenGLContext::currentContext()->functions()->glGetString(__VA_ARGS__) - #define glGetTexParameterfv(...) QOpenGLContext::currentContext()->functions()->glGetTexParameterfv(__VA_ARGS__) - #define glGetTexParameteriv(...) QOpenGLContext::currentContext()->functions()->glGetTexParameteriv(__VA_ARGS__) - #define glGetUniformfv(...) QOpenGLContext::currentContext()->functions()->glGetUniformfv(__VA_ARGS__) - #define glGetUniformiv(...) QOpenGLContext::currentContext()->functions()->glGetUniformiv(__VA_ARGS__) - #define glGetUniformLocation(...) QOpenGLContext::currentContext()->functions()->glGetUniformLocation(__VA_ARGS__) - #define glGetVertexAttribfv(...) QOpenGLContext::currentContext()->functions()->glGetVertexAttribfv(__VA_ARGS__) - #define glGetVertexAttribiv(...) QOpenGLContext::currentContext()->functions()->glGetVertexAttribiv(__VA_ARGS__) - #define glGetVertexAttribPointerv(...) QOpenGLContext::currentContext()->functions()->glGetVertexAttribPointerv(__VA_ARGS__) - #define glHint(...) QOpenGLContext::currentContext()->functions()->glHint(__VA_ARGS__) - #define glIsBuffer(...) QOpenGLContext::currentContext()->functions()->glIsBuffer(__VA_ARGS__) - #define glIsEnabled(...) QOpenGLContext::currentContext()->functions()->glIsEnabled(__VA_ARGS__) - #define glIsFramebuffer(...) QOpenGLContext::currentContext()->functions()->glIsFramebuffer(__VA_ARGS__) - #define glIsProgram(...) QOpenGLContext::currentContext()->functions()->glIsProgram(__VA_ARGS__) - #define glIsRenderbuffer(...) QOpenGLContext::currentContext()->functions()->glIsRenderbuffer(__VA_ARGS__) - #define glIsShader(...) QOpenGLContext::currentContext()->functions()->glIsShader(__VA_ARGS__) - #define glIsTexture(...) QOpenGLContext::currentContext()->functions()->glIsTexture(__VA_ARGS__) - #define glLineWidth(...) QOpenGLContext::currentContext()->functions()->glLineWidth(__VA_ARGS__) - #define glLinkProgram(...) QOpenGLContext::currentContext()->functions()->glLinkProgram(__VA_ARGS__) - #define glPixelStorei(...) QOpenGLContext::currentContext()->functions()->glPixelStorei(__VA_ARGS__) - #define glPolygonOffset(...) QOpenGLContext::currentContext()->functions()->glPolygonOffset(__VA_ARGS__) - #define glReadPixels(...) QOpenGLContext::currentContext()->functions()->glReadPixels(__VA_ARGS__) - #define glReleaseShaderCompiler(...) QOpenGLContext::currentContext()->functions()->glReleaseShaderCompiler(__VA_ARGS__) - #define glRenderbufferStorage(...) QOpenGLContext::currentContext()->functions()->glRenderbufferStorage(__VA_ARGS__) - #define glSampleCoverage(...) QOpenGLContext::currentContext()->functions()->glSampleCoverage(__VA_ARGS__) - #define glScissor(...) QOpenGLContext::currentContext()->functions()->glScissor(__VA_ARGS__) - #define glShaderBinary(...) QOpenGLContext::currentContext()->functions()->glShaderBinary(__VA_ARGS__) - #define glShaderSource(...) QOpenGLContext::currentContext()->functions()->glShaderSource(__VA_ARGS__) - #define glStencilFunc(...) QOpenGLContext::currentContext()->functions()->glStencilFunc(__VA_ARGS__) - #define glStencilFuncSeparate(...) QOpenGLContext::currentContext()->functions()->glStencilFuncSeparate(__VA_ARGS__) - #define glStencilMask(...) QOpenGLContext::currentContext()->functions()->glStencilMask(__VA_ARGS__) - #define glStencilMaskSeparate(...) QOpenGLContext::currentContext()->functions()->glStencilMaskSeparate(__VA_ARGS__) - #define glStencilOp(...) QOpenGLContext::currentContext()->functions()->glStencilOp(__VA_ARGS__) - #define glStencilOpSeparate(...) QOpenGLContext::currentContext()->functions()->glStencilOpSeparate(__VA_ARGS__) - #define glTexImage2D(...) QOpenGLContext::currentContext()->functions()->glTexImage2D(__VA_ARGS__) - #define glTexLevelParameteriv(...) QOpenGLContext::currentContext()->functions()->glTexLevelParameteriv(__VA_ARGS__) - #define glTexParameterf(...) QOpenGLContext::currentContext()->functions()->glTexParameterf(__VA_ARGS__) - #define glTexParameterfv(...) QOpenGLContext::currentContext()->functions()->glTexParameterfv(__VA_ARGS__) - #define glTexParameteri(...) QOpenGLContext::currentContext()->functions()->glTexParameteri(__VA_ARGS__) - #define glTexParameteriv(...) QOpenGLContext::currentContext()->functions()->glTexParameteriv(__VA_ARGS__) - #define glTexSubImage2D(...) QOpenGLContext::currentContext()->functions()->glTexSubImage2D(__VA_ARGS__) - #define glUniform1f(...) QOpenGLContext::currentContext()->functions()->glUniform1f(__VA_ARGS__) - #define glUniform1fv(...) QOpenGLContext::currentContext()->functions()->glUniform1fv(__VA_ARGS__) - #define glUniform1i(...) QOpenGLContext::currentContext()->functions()->glUniform1i(__VA_ARGS__) - #define glUniform1iv(...) QOpenGLContext::currentContext()->functions()->glUniform1iv(__VA_ARGS__) - #define glUniform2f(...) QOpenGLContext::currentContext()->functions()->glUniform2f(__VA_ARGS__) - #define glUniform2fv(...) QOpenGLContext::currentContext()->functions()->glUniform2fv(__VA_ARGS__) - #define glUniform2i(...) QOpenGLContext::currentContext()->functions()->glUniform2i(__VA_ARGS__) - #define glUniform2iv(...) QOpenGLContext::currentContext()->functions()->glUniform2iv(__VA_ARGS__) - #define glUniform3f(...) QOpenGLContext::currentContext()->functions()->glUniform3f(__VA_ARGS__) - #define glUniform3fv(...) QOpenGLContext::currentContext()->functions()->glUniform3fv(__VA_ARGS__) - #define glUniform3i(...) QOpenGLContext::currentContext()->functions()->glUniform3i(__VA_ARGS__) - #define glUniform3iv(...) QOpenGLContext::currentContext()->functions()->glUniform3iv(__VA_ARGS__) - #define glUniform4f(...) QOpenGLContext::currentContext()->functions()->glUniform4f(__VA_ARGS__) - #define glUniform4fv(...) QOpenGLContext::currentContext()->functions()->glUniform4fv(__VA_ARGS__) - #define glUniform4i(...) QOpenGLContext::currentContext()->functions()->glUniform4i(__VA_ARGS__) - #define glUniform4iv(...) QOpenGLContext::currentContext()->functions()->glUniform4iv(__VA_ARGS__) - #define glUniformMatrix2fv(...) QOpenGLContext::currentContext()->functions()->glUniformMatrix2fv(__VA_ARGS__) - #define glUniformMatrix3fv(...) QOpenGLContext::currentContext()->functions()->glUniformMatrix3fv(__VA_ARGS__) - #define glUniformMatrix4fv(...) QOpenGLContext::currentContext()->functions()->glUniformMatrix4fv(__VA_ARGS__) - #define glUseProgram(...) QOpenGLContext::currentContext()->functions()->glUseProgram(__VA_ARGS__) - #define glValidateProgram(...) QOpenGLContext::currentContext()->functions()->glValidateProgram(__VA_ARGS__) - #define glVertexAttrib1f(...) QOpenGLContext::currentContext()->functions()->glVertexAttrib1f(__VA_ARGS__) - #define glVertexAttrib1fv(...) QOpenGLContext::currentContext()->functions()->glVertexAttrib1fv(__VA_ARGS__) - #define glVertexAttrib2f(...) QOpenGLContext::currentContext()->functions()->glVertexAttrib2f(__VA_ARGS__) - #define glVertexAttrib2fv(...) QOpenGLContext::currentContext()->functions()->glVertexAttrib2fv(__VA_ARGS__) - #define glVertexAttrib3f(...) QOpenGLContext::currentContext()->functions()->glVertexAttrib3f(__VA_ARGS__) - #define glVertexAttrib3fv(...) QOpenGLContext::currentContext()->functions()->glVertexAttrib3fv(__VA_ARGS__) - #define glVertexAttrib4f(...) QOpenGLContext::currentContext()->functions()->glVertexAttrib4f(__VA_ARGS__) - #define glVertexAttrib4fv(...) QOpenGLContext::currentContext()->functions()->glVertexAttrib4fv(__VA_ARGS__) - #define glVertexAttribPointer(...) QOpenGLContext::currentContext()->functions()->glVertexAttribPointer(__VA_ARGS__) - #define glViewport(...) QOpenGLContext::currentContext()->functions()->glViewport(__VA_ARGS__) +#ifndef GL_DEPTH24_STENCIL8_OES +#define GL_DEPTH24_STENCIL8_OES GL_DEPTH24_STENCIL8 #endif + +#define glActiveTexture(...) QOpenGLContext::currentContext()->functions()->glActiveTexture(__VA_ARGS__) +#define glAttachShader(...) QOpenGLContext::currentContext()->functions()->glAttachShader(__VA_ARGS__) +#define glBindAttribLocation(...) QOpenGLContext::currentContext()->functions()->glBindAttribLocation(__VA_ARGS__) +#define glBindBuffer(...) QOpenGLContext::currentContext()->functions()->glBindBuffer(__VA_ARGS__) +#define glBindFramebuffer(...) QOpenGLContext::currentContext()->functions()->glBindFramebuffer(__VA_ARGS__) +#define glBindRenderbuffer(...) QOpenGLContext::currentContext()->functions()->glBindRenderbuffer(__VA_ARGS__) +#define glBindTexture(...) QOpenGLContext::currentContext()->functions()->glBindTexture(__VA_ARGS__) +#define glBlendColor(...) QOpenGLContext::currentContext()->functions()->glBlendColor(__VA_ARGS__) +#define glBlendEquation(...) QOpenGLContext::currentContext()->functions()->glBlendEquation(__VA_ARGS__) +#define glBlendEquationSeparate(...) QOpenGLContext::currentContext()->functions()->glBlendEquationSeparate(__VA_ARGS__) +#define glBlendFunc(...) QOpenGLContext::currentContext()->functions()->glBlendFunc(__VA_ARGS__) +#define glBlendFuncSeparate(...) QOpenGLContext::currentContext()->functions()->glBlendFuncSeparate(__VA_ARGS__) +#define glBufferData(...) QOpenGLContext::currentContext()->functions()->glBufferData(__VA_ARGS__) +#define glBufferSubData(...) QOpenGLContext::currentContext()->functions()->glBufferSubData(__VA_ARGS__) +#define glCheckFramebufferStatus(...) QOpenGLContext::currentContext()->functions()->glCheckFramebufferStatus(__VA_ARGS__) +#define glClear(...) QOpenGLContext::currentContext()->functions()->glClear(__VA_ARGS__) +#define glClearColor(...) QOpenGLContext::currentContext()->functions()->glClearColor(__VA_ARGS__) +#define glClearDepthf(...) QOpenGLContext::currentContext()->functions()->glClearDepthf(__VA_ARGS__) +#define glClearStencil(...) QOpenGLContext::currentContext()->functions()->glClearStencil(__VA_ARGS__) +#define glColorMask(...) QOpenGLContext::currentContext()->functions()->glColorMask(__VA_ARGS__) +#define glCompileShader(...) QOpenGLContext::currentContext()->functions()->glCompileShader(__VA_ARGS__) +#define glCompressedTexImage2D(...) QOpenGLContext::currentContext()->functions()->glCompressedTexImage2D(__VA_ARGS__) +#define glCompressedTexSubImage2D(...) QOpenGLContext::currentContext()->functions()->glCompressedTexSubImage2D(__VA_ARGS__) +#define glCopyTexImage2D(...) QOpenGLContext::currentContext()->functions()->glCopyTexImage2D(__VA_ARGS__) +#define glCopyTexSubImage2D(...) QOpenGLContext::currentContext()->functions()->glCopyTexSubImage2D(__VA_ARGS__) +#define glCreateProgram(...) QOpenGLContext::currentContext()->functions()->glCreateProgram(__VA_ARGS__) +#define glCreateShader(...) QOpenGLContext::currentContext()->functions()->glCreateShader(__VA_ARGS__) +#define glCullFace(...) QOpenGLContext::currentContext()->functions()->glCullFace(__VA_ARGS__) +#define glDeleteBuffers(...) QOpenGLContext::currentContext()->functions()->glDeleteBuffers(__VA_ARGS__) +#define glDeleteFramebuffers(...) QOpenGLContext::currentContext()->functions()->glDeleteFramebuffers(__VA_ARGS__) +#define glDeleteProgram(...) QOpenGLContext::currentContext()->functions()->glDeleteProgram(__VA_ARGS__) +#define glDeleteRenderbuffers(...) QOpenGLContext::currentContext()->functions()->glDeleteRenderbuffers(__VA_ARGS__) +#define glDeleteShader(...) QOpenGLContext::currentContext()->functions()->glDeleteShader(__VA_ARGS__) +#define glDeleteTextures(...) QOpenGLContext::currentContext()->functions()->glDeleteTextures(__VA_ARGS__) +#define glDepthFunc(...) QOpenGLContext::currentContext()->functions()->glDepthFunc(__VA_ARGS__) +#define glDepthMask(...) QOpenGLContext::currentContext()->functions()->glDepthMask(__VA_ARGS__) +#define glDepthRangef(...) QOpenGLContext::currentContext()->functions()->glDepthRangef(__VA_ARGS__) +#define glDetachShader(...) QOpenGLContext::currentContext()->functions()->glDetachShader(__VA_ARGS__) +#define glDisable(...) QOpenGLContext::currentContext()->functions()->glDisable(__VA_ARGS__) +#define glDisableVertexAttribArray(...) QOpenGLContext::currentContext()->functions()->glDisableVertexAttribArray(__VA_ARGS__) +#define glDrawArrays(...) QOpenGLContext::currentContext()->functions()->glDrawArrays(__VA_ARGS__) +#define glDrawElements(...) QOpenGLContext::currentContext()->functions()->glDrawElements(__VA_ARGS__) +#define glEnable(...) QOpenGLContext::currentContext()->functions()->glEnable(__VA_ARGS__) +#define glEnableVertexAttribArray(...) QOpenGLContext::currentContext()->functions()->glEnableVertexAttribArray(__VA_ARGS__) +#define glFinish(...) QOpenGLContext::currentContext()->functions()->glFinish(__VA_ARGS__) +#define glFlush(...) QOpenGLContext::currentContext()->functions()->glFlush(__VA_ARGS__) +#define glFramebufferRenderbuffer(...) QOpenGLContext::currentContext()->functions()->glFramebufferRenderbuffer(__VA_ARGS__) +#define glFramebufferTexture2D(...) QOpenGLContext::currentContext()->functions()->glFramebufferTexture2D(__VA_ARGS__) +#define glFrontFace(...) QOpenGLContext::currentContext()->functions()->glFrontFace(__VA_ARGS__) +#define glGenBuffers(...) QOpenGLContext::currentContext()->functions()->glGenBuffers(__VA_ARGS__) +#define glGenerateMipmap(...) QOpenGLContext::currentContext()->functions()->glGenerateMipmap(__VA_ARGS__) +#define glGenFramebuffers(...) QOpenGLContext::currentContext()->functions()->glGenFramebuffers(__VA_ARGS__) +#define glGenRenderbuffers(...) QOpenGLContext::currentContext()->functions()->glGenRenderbuffers(__VA_ARGS__) +#define glGenTextures(...) QOpenGLContext::currentContext()->functions()->glGenTextures(__VA_ARGS__) +#define glGetActiveAttrib(...) QOpenGLContext::currentContext()->functions()->glGetActiveAttrib(__VA_ARGS__) +#define glGetActiveUniform(...) QOpenGLContext::currentContext()->functions()->glGetActiveUniform(__VA_ARGS__) +#define glGetAttachedShaders(...) QOpenGLContext::currentContext()->functions()->glGetAttachedShaders(__VA_ARGS__) +#define glGetAttribLocation(...) QOpenGLContext::currentContext()->functions()->glGetAttribLocation(__VA_ARGS__) +#define glGetBooleanv(...) QOpenGLContext::currentContext()->functions()->glGetBooleanv(__VA_ARGS__) +#define glGetBufferParameteriv(...) QOpenGLContext::currentContext()->functions()->glGetBufferParameteriv(__VA_ARGS__) +#define glGetError(...) QOpenGLContext::currentContext()->functions()->glGetError(__VA_ARGS__) +#define glGetFloatv(...) QOpenGLContext::currentContext()->functions()->glGetFloatv(__VA_ARGS__) +#define glGetFramebufferAttachmentParameteriv(...) QOpenGLContext::currentContext()->functions()->glGetFramebufferAttachmentParameteriv(__VA_ARGS__) +#define glGetIntegerv(...) QOpenGLContext::currentContext()->functions()->glGetIntegerv(__VA_ARGS__) +#define glGetProgramInfoLog(...) QOpenGLContext::currentContext()->functions()->glGetProgramInfoLog(__VA_ARGS__) +#define glGetProgramiv(...) QOpenGLContext::currentContext()->functions()->glGetProgramiv(__VA_ARGS__) +#define glGetRenderbufferParameteriv(...) QOpenGLContext::currentContext()->functions()->glGetRenderbufferParameteriv(__VA_ARGS__) +#define glGetShaderInfoLog(...) QOpenGLContext::currentContext()->functions()->glGetShaderInfoLog(__VA_ARGS__) +#define glGetShaderiv(...) QOpenGLContext::currentContext()->functions()->glGetShaderiv(__VA_ARGS__) +#define glGetShaderPrecisionFormat(...) QOpenGLContext::currentContext()->functions()->glGetShaderPrecisionFormat(__VA_ARGS__) +#define glGetShaderSource(...) QOpenGLContext::currentContext()->functions()->glGetShaderSource(__VA_ARGS__) +#define glGetString(...) QOpenGLContext::currentContext()->functions()->glGetString(__VA_ARGS__) +#define glGetTexParameterfv(...) QOpenGLContext::currentContext()->functions()->glGetTexParameterfv(__VA_ARGS__) +#define glGetTexParameteriv(...) QOpenGLContext::currentContext()->functions()->glGetTexParameteriv(__VA_ARGS__) +#define glGetUniformfv(...) QOpenGLContext::currentContext()->functions()->glGetUniformfv(__VA_ARGS__) +#define glGetUniformiv(...) QOpenGLContext::currentContext()->functions()->glGetUniformiv(__VA_ARGS__) +#define glGetUniformLocation(...) QOpenGLContext::currentContext()->functions()->glGetUniformLocation(__VA_ARGS__) +#define glGetVertexAttribfv(...) QOpenGLContext::currentContext()->functions()->glGetVertexAttribfv(__VA_ARGS__) +#define glGetVertexAttribiv(...) QOpenGLContext::currentContext()->functions()->glGetVertexAttribiv(__VA_ARGS__) +#define glGetVertexAttribPointerv(...) QOpenGLContext::currentContext()->functions()->glGetVertexAttribPointerv(__VA_ARGS__) +#define glHint(...) QOpenGLContext::currentContext()->functions()->glHint(__VA_ARGS__) +#define glIsBuffer(...) QOpenGLContext::currentContext()->functions()->glIsBuffer(__VA_ARGS__) +#define glIsEnabled(...) QOpenGLContext::currentContext()->functions()->glIsEnabled(__VA_ARGS__) +#define glIsFramebuffer(...) QOpenGLContext::currentContext()->functions()->glIsFramebuffer(__VA_ARGS__) +#define glIsProgram(...) QOpenGLContext::currentContext()->functions()->glIsProgram(__VA_ARGS__) +#define glIsRenderbuffer(...) QOpenGLContext::currentContext()->functions()->glIsRenderbuffer(__VA_ARGS__) +#define glIsShader(...) QOpenGLContext::currentContext()->functions()->glIsShader(__VA_ARGS__) +#define glIsTexture(...) QOpenGLContext::currentContext()->functions()->glIsTexture(__VA_ARGS__) +#define glLineWidth(...) QOpenGLContext::currentContext()->functions()->glLineWidth(__VA_ARGS__) +#define glLinkProgram(...) QOpenGLContext::currentContext()->functions()->glLinkProgram(__VA_ARGS__) +#define glPixelStorei(...) QOpenGLContext::currentContext()->functions()->glPixelStorei(__VA_ARGS__) +#define glPolygonOffset(...) QOpenGLContext::currentContext()->functions()->glPolygonOffset(__VA_ARGS__) +#define glReadPixels(...) QOpenGLContext::currentContext()->functions()->glReadPixels(__VA_ARGS__) +#define glReleaseShaderCompiler(...) QOpenGLContext::currentContext()->functions()->glReleaseShaderCompiler(__VA_ARGS__) +#define glRenderbufferStorage(...) QOpenGLContext::currentContext()->functions()->glRenderbufferStorage(__VA_ARGS__) +#define glSampleCoverage(...) QOpenGLContext::currentContext()->functions()->glSampleCoverage(__VA_ARGS__) +#define glScissor(...) QOpenGLContext::currentContext()->functions()->glScissor(__VA_ARGS__) +#define glShaderBinary(...) QOpenGLContext::currentContext()->functions()->glShaderBinary(__VA_ARGS__) +#define glShaderSource(...) QOpenGLContext::currentContext()->functions()->glShaderSource(__VA_ARGS__) +#define glStencilFunc(...) QOpenGLContext::currentContext()->functions()->glStencilFunc(__VA_ARGS__) +#define glStencilFuncSeparate(...) QOpenGLContext::currentContext()->functions()->glStencilFuncSeparate(__VA_ARGS__) +#define glStencilMask(...) QOpenGLContext::currentContext()->functions()->glStencilMask(__VA_ARGS__) +#define glStencilMaskSeparate(...) QOpenGLContext::currentContext()->functions()->glStencilMaskSeparate(__VA_ARGS__) +#define glStencilOp(...) QOpenGLContext::currentContext()->functions()->glStencilOp(__VA_ARGS__) +#define glStencilOpSeparate(...) QOpenGLContext::currentContext()->functions()->glStencilOpSeparate(__VA_ARGS__) +#define glTexImage2D(...) QOpenGLContext::currentContext()->functions()->glTexImage2D(__VA_ARGS__) +#define glTexLevelParameteriv(...) QOpenGLContext::currentContext()->functions()->glTexLevelParameteriv(__VA_ARGS__) +#define glTexParameterf(...) QOpenGLContext::currentContext()->functions()->glTexParameterf(__VA_ARGS__) +#define glTexParameterfv(...) QOpenGLContext::currentContext()->functions()->glTexParameterfv(__VA_ARGS__) +#define glTexParameteri(...) QOpenGLContext::currentContext()->functions()->glTexParameteri(__VA_ARGS__) +#define glTexParameteriv(...) QOpenGLContext::currentContext()->functions()->glTexParameteriv(__VA_ARGS__) +#define glTexSubImage2D(...) QOpenGLContext::currentContext()->functions()->glTexSubImage2D(__VA_ARGS__) +#define glUniform1f(...) QOpenGLContext::currentContext()->functions()->glUniform1f(__VA_ARGS__) +#define glUniform1fv(...) QOpenGLContext::currentContext()->functions()->glUniform1fv(__VA_ARGS__) +#define glUniform1i(...) QOpenGLContext::currentContext()->functions()->glUniform1i(__VA_ARGS__) +#define glUniform1iv(...) QOpenGLContext::currentContext()->functions()->glUniform1iv(__VA_ARGS__) +#define glUniform2f(...) QOpenGLContext::currentContext()->functions()->glUniform2f(__VA_ARGS__) +#define glUniform2fv(...) QOpenGLContext::currentContext()->functions()->glUniform2fv(__VA_ARGS__) +#define glUniform2i(...) QOpenGLContext::currentContext()->functions()->glUniform2i(__VA_ARGS__) +#define glUniform2iv(...) QOpenGLContext::currentContext()->functions()->glUniform2iv(__VA_ARGS__) +#define glUniform3f(...) QOpenGLContext::currentContext()->functions()->glUniform3f(__VA_ARGS__) +#define glUniform3fv(...) QOpenGLContext::currentContext()->functions()->glUniform3fv(__VA_ARGS__) +#define glUniform3i(...) QOpenGLContext::currentContext()->functions()->glUniform3i(__VA_ARGS__) +#define glUniform3iv(...) QOpenGLContext::currentContext()->functions()->glUniform3iv(__VA_ARGS__) +#define glUniform4f(...) QOpenGLContext::currentContext()->functions()->glUniform4f(__VA_ARGS__) +#define glUniform4fv(...) QOpenGLContext::currentContext()->functions()->glUniform4fv(__VA_ARGS__) +#define glUniform4i(...) QOpenGLContext::currentContext()->functions()->glUniform4i(__VA_ARGS__) +#define glUniform4iv(...) QOpenGLContext::currentContext()->functions()->glUniform4iv(__VA_ARGS__) +#define glUniformMatrix2fv(...) QOpenGLContext::currentContext()->functions()->glUniformMatrix2fv(__VA_ARGS__) +#define glUniformMatrix3fv(...) QOpenGLContext::currentContext()->functions()->glUniformMatrix3fv(__VA_ARGS__) +#define glUniformMatrix4fv(...) QOpenGLContext::currentContext()->functions()->glUniformMatrix4fv(__VA_ARGS__) +#define glUseProgram(...) QOpenGLContext::currentContext()->functions()->glUseProgram(__VA_ARGS__) +#define glValidateProgram(...) QOpenGLContext::currentContext()->functions()->glValidateProgram(__VA_ARGS__) +#define glVertexAttrib1f(...) QOpenGLContext::currentContext()->functions()->glVertexAttrib1f(__VA_ARGS__) +#define glVertexAttrib1fv(...) QOpenGLContext::currentContext()->functions()->glVertexAttrib1fv(__VA_ARGS__) +#define glVertexAttrib2f(...) QOpenGLContext::currentContext()->functions()->glVertexAttrib2f(__VA_ARGS__) +#define glVertexAttrib2fv(...) QOpenGLContext::currentContext()->functions()->glVertexAttrib2fv(__VA_ARGS__) +#define glVertexAttrib3f(...) QOpenGLContext::currentContext()->functions()->glVertexAttrib3f(__VA_ARGS__) +#define glVertexAttrib3fv(...) QOpenGLContext::currentContext()->functions()->glVertexAttrib3fv(__VA_ARGS__) +#define glVertexAttrib4f(...) QOpenGLContext::currentContext()->functions()->glVertexAttrib4f(__VA_ARGS__) +#define glVertexAttrib4fv(...) QOpenGLContext::currentContext()->functions()->glVertexAttrib4fv(__VA_ARGS__) +#define glVertexAttribPointer(...) QOpenGLContext::currentContext()->functions()->glVertexAttribPointer(__VA_ARGS__) +#define glViewport(...) QOpenGLContext::currentContext()->functions()->glViewport(__VA_ARGS__) diff --git a/platform/qt/qt.cmake b/platform/qt/qt.cmake index e12e20708f..2e334563ed 100644 --- a/platform/qt/qt.cmake +++ b/platform/qt/qt.cmake @@ -3,7 +3,6 @@ option(WITH_QT_DECODERS "Use builtin Qt image decoders" OFF) option(WITH_QT_I18N "Use builtin Qt i18n support" OFF) -option(WITH_QT_4 "Use Qt4 instead of Qt5" OFF) add_definitions("-D__QT__") @@ -112,11 +111,32 @@ target_link_libraries(mbgl-qt PRIVATE qmapboxgl ) -if(WITH_QT_4) - include(platform/qt/qt4.cmake) -else() - include(platform/qt/qt5.cmake) -endif() +find_package(Qt5Core REQUIRED) +find_package(Qt5Gui REQUIRED) +find_package(Qt5Network REQUIRED) +find_package(Qt5OpenGL REQUIRED) +find_package(Qt5Widgets REQUIRED) +find_package(Qt5Sql REQUIRED) + +# Qt5 always build OpenGL ES2 which is the compatibility +# mode. Qt5 will take care of translating the desktop +# version of OpenGL to ES2. +add_definitions("-DMBGL_USE_GLES2") + +set(MBGL_QT_CORE_LIBRARIES + PUBLIC Qt5::Core + PUBLIC Qt5::Gui + PUBLIC Qt5::OpenGL +) + +set(MBGL_QT_FILESOURCE_LIBRARIES + PUBLIC Qt5::Network + PUBLIC Qt5::Sql +) + +target_link_libraries(mbgl-qt + PRIVATE Qt5::Widgets +) xcode_create_scheme(TARGET mbgl-qt) @@ -128,20 +148,10 @@ if (MASON_PLATFORM STREQUAL "osx" OR MASON_PLATFORM STREQUAL "ios") list(APPEND MBGL_QT_CORE_LIBRARIES PRIVATE "-framework Foundation" ) - if(WITH_QT_4) - list(APPEND MBGL_QT_CORE_LIBRARIES - PRIVATE "-framework OpenGL" - ) - endif() elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") list(APPEND MBGL_QT_CORE_FILES PRIVATE platform/default/thread.cpp ) - if(WITH_QT_4) - list(APPEND MBGL_QT_CORE_LIBRARIES - PRIVATE "-lGL" - ) - endif() elseif (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") add_definitions("-DQT_COMPILING_QIMAGE_COMPAT_CPP") add_definitions("-DRAPIDJSON_HAS_CXX11_RVALUE_REFS") diff --git a/platform/qt/qt5.cmake b/platform/qt/qt5.cmake deleted file mode 100644 index d083c45073..0000000000 --- a/platform/qt/qt5.cmake +++ /dev/null @@ -1,26 +0,0 @@ -find_package(Qt5Core REQUIRED) -find_package(Qt5Gui REQUIRED) -find_package(Qt5Network REQUIRED) -find_package(Qt5OpenGL REQUIRED) -find_package(Qt5Widgets REQUIRED) -find_package(Qt5Sql REQUIRED) - -# Qt5 always build OpenGL ES2 which is the compatibility -# mode. Qt5 will take care of translating the desktop -# version of OpenGL to ES2. -add_definitions("-DMBGL_USE_GLES2") - -set(MBGL_QT_CORE_LIBRARIES - PUBLIC Qt5::Core - PUBLIC Qt5::Gui - PUBLIC Qt5::OpenGL -) - -set(MBGL_QT_FILESOURCE_LIBRARIES - PUBLIC Qt5::Network - PUBLIC Qt5::Sql -) - -target_link_libraries(mbgl-qt - PRIVATE Qt5::Widgets -) diff --git a/platform/qt/src/headless_backend_qt.cpp b/platform/qt/src/headless_backend_qt.cpp index ad3fa42290..3702fdf14a 100644 --- a/platform/qt/src/headless_backend_qt.cpp +++ b/platform/qt/src/headless_backend_qt.cpp @@ -1,12 +1,7 @@ #include <mbgl/gl/headless_backend.hpp> #include <QGLWidget> - -#if QT_VERSION >= 0x050000 #include <QOpenGLContext> -#else -#include <QGLContext> -#endif #include <cassert> @@ -17,13 +12,8 @@ public: ~QtBackendImpl() final = default; gl::ProcAddress getExtensionFunctionPointer(const char* name) final { -#if QT_VERSION >= 0x050000 QOpenGLContext* thisContext = QOpenGLContext::currentContext(); return thisContext->getProcAddress(name); -#else - const QGLContext* thisContext = QGLContext::currentContext(); - return reinterpret_cast<gl::ProcAddress>(thisContext->getProcAddress(name)); -#endif } void activateContext() final { diff --git a/platform/qt/src/http_file_source.cpp b/platform/qt/src/http_file_source.cpp index b95cfed0e9..90abdd0aa3 100644 --- a/platform/qt/src/http_file_source.cpp +++ b/platform/qt/src/http_file_source.cpp @@ -29,9 +29,7 @@ void HTTPFileSource::Impl::request(HTTPRequest* req) } QNetworkRequest networkRequest = req->networkRequest(); -#if QT_VERSION >= 0x050600 networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); -#endif data.first = m_manager->get(networkRequest); connect(data.first, SIGNAL(finished()), this, SLOT(onReplyFinished())); @@ -60,15 +58,7 @@ void HTTPFileSource::Impl::cancel(HTTPRequest* req) if (requestsVector.empty()) { m_pending.erase(it); -#if QT_VERSION >= 0x050000 reply->abort(); -#else - // XXX: We should be aborting the reply here - // but a bug on Qt4 causes the connection of - // other ongoing requests to drop if we call - // abort() too often (and we do). - Q_UNUSED(reply); -#endif } } @@ -105,11 +95,7 @@ std::unique_ptr<AsyncRequest> HTTPFileSource::request(const Resource& resource, } uint32_t HTTPFileSource::maximumConcurrentRequests() { -#if QT_VERSION >= 0x050000 return 20; -#else - return 10; -#endif } } // namespace mbgl diff --git a/platform/qt/src/qmapbox.cpp b/platform/qt/src/qmapbox.cpp index 2180f22d07..ab7160c429 100644 --- a/platform/qt/src/qmapbox.cpp +++ b/platform/qt/src/qmapbox.cpp @@ -5,11 +5,7 @@ #include <mbgl/util/geometry.hpp> #include <mbgl/util/traits.hpp> -#if QT_VERSION >= 0x050000 #include <QOpenGLContext> -#else -#include <QGLContext> -#endif // mbgl::NetworkStatus::Status static_assert(mbgl::underlying_type(QMapbox::Online) == mbgl::underlying_type(mbgl::NetworkStatus::Status::Online), "error"); diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index d008ad86c9..e292bbd195 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -45,11 +45,7 @@ #include <mbgl/util/traits.hpp> #include <mbgl/actor/scheduler.hpp> -#if QT_VERSION >= 0x050000 #include <QGuiApplication> -#else -#include <QCoreApplication> -#endif #include <QDebug> #include <QImage> @@ -140,13 +136,8 @@ std::unique_ptr<mbgl::style::Image> toStyleImage(const QString &id, const QImage .rgbSwapped() .convertToFormat(QImage::Format_ARGB32_Premultiplied); -#if QT_VERSION >= 0x051000 - auto img = std::make_unique<uint8_t[]>(swapped.sizeInBytes()); - memcpy(img.get(), swapped.constBits(), swapped.sizeInBytes()); -#else auto img = std::make_unique<uint8_t[]>(swapped.byteCount()); memcpy(img.get(), swapped.constBits(), swapped.byteCount()); -#endif return std::make_unique<mbgl::style::Image>( id.toStdString(), @@ -1839,14 +1830,6 @@ void QMapboxGLPrivate::render() createRenderer(); } -#if defined(__APPLE__) && QT_VERSION < 0x050000 - // FIXME Qt 4.x provides an incomplete FBO at start. - // See https://bugreports.qt.io/browse/QTBUG-36802 for details. - if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { - return; - } -#endif - m_renderQueued.clear(); m_mapRenderer->render(); } diff --git a/platform/qt/src/qmapboxgl_renderer_backend.cpp b/platform/qt/src/qmapboxgl_renderer_backend.cpp index 917741f5ce..c6de7c6d80 100644 --- a/platform/qt/src/qmapboxgl_renderer_backend.cpp +++ b/platform/qt/src/qmapboxgl_renderer_backend.cpp @@ -1,12 +1,7 @@ #include "qmapboxgl_renderer_backend.hpp" -#include <QtGlobal> - -#if QT_VERSION >= 0x050000 #include <QOpenGLContext> -#else -#include <QGLContext> -#endif +#include <QtGlobal> void QMapboxGLRendererBackend::updateAssumedState() { @@ -39,11 +34,6 @@ void QMapboxGLRendererBackend::updateFramebuffer(quint32 fbo, const mbgl::Size & */ mbgl::gl::ProcAddress QMapboxGLRendererBackend::getExtensionFunctionPointer(const char* name) { -#if QT_VERSION >= 0x050000 QOpenGLContext* thisContext = QOpenGLContext::currentContext(); return thisContext->getProcAddress(name); -#else - const QGLContext* thisContext = QGLContext::currentContext(); - return reinterpret_cast<mbgl::gl::ProcAddress>(thisContext->getProcAddress(name)); -#endif } diff --git a/platform/qt/src/qt_conversion.hpp b/platform/qt/src/qt_conversion.hpp index 99a262be54..070a3dd375 100644 --- a/platform/qt/src/qt_conversion.hpp +++ b/platform/qt/src/qt_conversion.hpp @@ -35,11 +35,7 @@ public: static bool isObject(const QVariant& value) { return value.canConvert(QVariant::Map) || value.type() == QVariant::ByteArray - #if QT_VERSION >= 0x050000 || QString(value.typeName()) == QStringLiteral("QMapbox::Feature"); - #else - || QString(value.typeName()) == QString("QMapbox::Feature"); - #endif } static optional<QVariant> objectMember(const QVariant& value, const char* key) { @@ -121,11 +117,7 @@ public: } static optional<GeoJSON> toGeoJSON(const QVariant& value, Error& error) { - #if QT_VERSION >= 0x050000 if (value.typeName() == QStringLiteral("QMapbox::Feature")) { - #else - if (value.typeName() == QString("QMapbox::Feature")) { - #endif return GeoJSON { asMapboxGLFeature(value.value<QMapbox::Feature>()) }; } else if (value.type() != QVariant::ByteArray) { error = { "JSON data must be in QByteArray" }; diff --git a/platform/qt/src/qt_geojson.cpp b/platform/qt/src/qt_geojson.cpp index 9d0a3e96eb..cd808f016c 100644 --- a/platform/qt/src/qt_geojson.cpp +++ b/platform/qt/src/qt_geojson.cpp @@ -79,11 +79,7 @@ mbgl::Value asMapboxGLPropertyValue(const QVariant &value) { }; switch (value.type()) { -#if QT_VERSION >= 0x050000 case QMetaType::UnknownType: -#else - case QVariant::Invalid: -#endif return mbgl::NullValue {}; case QMetaType::Bool: return { value.toBool() }; @@ -107,11 +103,7 @@ mbgl::Value asMapboxGLPropertyValue(const QVariant &value) { mbgl::FeatureIdentifier asMapboxGLFeatureIdentifier(const QVariant &id) { switch (id.type()) { -#if QT_VERSION >= 0x050000 case QMetaType::UnknownType: -#else - case QVariant::Invalid: -#endif return {}; case QMetaType::ULongLong: return { uint64_t(id.toULongLong()) }; diff --git a/platform/qt/src/qt_image.cpp b/platform/qt/src/qt_image.cpp index 848a9b7f0a..302d398739 100644 --- a/platform/qt/src/qt_image.cpp +++ b/platform/qt/src/qt_image.cpp @@ -45,13 +45,8 @@ PremultipliedImage decodeImage(const std::string& string) { throw std::runtime_error("Unsupported image type"); } -#if QT_VERSION >= 0x051000 - auto img = std::make_unique<uint8_t[]>(image.sizeInBytes()); - memcpy(img.get(), image.constBits(), image.sizeInBytes()); -#else auto img = std::make_unique<uint8_t[]>(image.byteCount()); memcpy(img.get(), image.constBits(), image.byteCount()); -#endif return { { static_cast<uint32_t>(image.width()), static_cast<uint32_t>(image.height()) }, std::move(img) }; diff --git a/platform/qt/src/sqlite3.cpp b/platform/qt/src/sqlite3.cpp index d27ebf354d..6427126875 100644 --- a/platform/qt/src/sqlite3.cpp +++ b/platform/qt/src/sqlite3.cpp @@ -26,22 +26,14 @@ namespace sqlite { void checkQueryError(const QSqlQuery& query) { QSqlError lastError = query.lastError(); if (lastError.type() != QSqlError::NoError) { -#if QT_VERSION >= 0x050300 throw Exception { lastError.nativeErrorCode().toInt(), lastError.databaseText().toStdString() }; -#else - throw Exception { lastError.number(), lastError.databaseText().toStdString() }; -#endif } } void checkDatabaseError(const QSqlDatabase &db) { QSqlError lastError = db.lastError(); if (lastError.type() != QSqlError::NoError) { -#if QT_VERSION >= 0x050300 throw Exception { lastError.nativeErrorCode().toInt(), lastError.databaseText().toStdString() }; -#else - throw Exception { lastError.number(), lastError.databaseText().toStdString() }; -#endif } } diff --git a/platform/qt/src/timer.cpp b/platform/qt/src/timer.cpp index a0c1328d63..4ae3631e55 100644 --- a/platform/qt/src/timer.cpp +++ b/platform/qt/src/timer.cpp @@ -9,9 +9,7 @@ namespace mbgl { namespace util { Timer::Impl::Impl() { -#if QT_VERSION >= 0x050000 timer.setTimerType(Qt::PreciseTimer); -#endif connect(&timer, SIGNAL(timeout()), this, SLOT(timerFired())); } diff --git a/platform/qt/test/qmapboxgl.test.cpp b/platform/qt/test/qmapboxgl.test.cpp index 2a56b346a3..de0314f0ee 100644 --- a/platform/qt/test/qmapboxgl.test.cpp +++ b/platform/qt/test/qmapboxgl.test.cpp @@ -4,9 +4,6 @@ #include <QMapbox> -// We're using QGLFramebufferObject, which is only available in Qt 5 and up. -#if QT_VERSION >= 0x050000 - #include <QOpenGLContext> #include <QOpenGLFunctions> @@ -76,5 +73,3 @@ TEST_F(QMapboxGLTest, TEST_DISABLED_ON_CI(styleUrl)) { map.setStyleUrl(QString()); runUntil(QMapboxGL::MapChangeDidFailLoadingMap); } - -#endif diff --git a/platform/qt/test/qmapboxgl.test.hpp b/platform/qt/test/qmapboxgl.test.hpp index 04d63610ca..43a7c123b7 100644 --- a/platform/qt/test/qmapboxgl.test.hpp +++ b/platform/qt/test/qmapboxgl.test.hpp @@ -3,9 +3,6 @@ #include <QApplication> #include <QMapboxGL> -// We're using QGLFramebufferObject, which is only available in Qt 5 and up. -#if QT_VERSION >= 0x050000 - #include <QGLWidget> #include <QGLFramebufferObject> @@ -32,5 +29,3 @@ private slots: void onMapChanged(QMapboxGL::MapChange); void onNeedsRendering(); }; - -#endif |