summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTuomo Pelkonen <tuomo.pelkonen@gmail.com>2021-01-18 19:03:07 +0200
committerTuomo Pelkonen <tuomo.pelkonen@gmail.com>2021-01-27 10:12:02 +0200
commitff193e33d80a08ca0c21fdbccc2d63e6b7400d88 (patch)
treeb47fd1b52d76356c9e0359b347cdb96edb7795d4
parent18a562554e9050f0d8b4896237dc0fb306f6a704 (diff)
Fix compilation issues for macOS and Android on Qt 6.0
Task-number: QTBUG-89297 Change-Id: I57acf345b6fc64a93d08d41016c755cae4edd6db Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r--examples/datavisualization/qmlsurface/qml/qmlsurface/Data.qml2
-rw-r--r--examples/datavisualization/volumetric/volumetric.cpp2
-rw-r--r--src/datavisualization/engine/abstract3drenderer.cpp8
-rw-r--r--src/datavisualization/engine/abstract3drenderer_p.h4
-rw-r--r--src/datavisualization/engine/drawer.cpp6
-rw-r--r--src/datavisualization/engine/scatter3drenderer.cpp8
-rw-r--r--src/datavisualization/utils/qutils.h4
-rw-r--r--src/datavisualization/utils/texturehelper.cpp14
-rw-r--r--src/datavisualization/utils/texturehelper_p.h4
-rw-r--r--src/datavisualization/utils/utils.cpp3
-rw-r--r--src/datavisualizationqml2/enumtostringmap.cpp2
-rw-r--r--src/datavisualizationqml2/glstatestore.cpp12
-rw-r--r--src/datavisualizationqml2/glstatestore_p.h2
13 files changed, 39 insertions, 32 deletions
diff --git a/examples/datavisualization/qmlsurface/qml/qmlsurface/Data.qml b/examples/datavisualization/qmlsurface/qml/qmlsurface/Data.qml
index ab976995..5673e1aa 100644
--- a/examples/datavisualization/qmlsurface/qml/qmlsurface/Data.qml
+++ b/examples/datavisualization/qmlsurface/qml/qmlsurface/Data.qml
@@ -28,6 +28,8 @@
****************************************************************************/
import QtQuick
+import QtQml
+import QtQml.Models
Item {
property alias model: dataModel
diff --git a/examples/datavisualization/volumetric/volumetric.cpp b/examples/datavisualization/volumetric/volumetric.cpp
index 781081d1..f9d457f1 100644
--- a/examples/datavisualization/volumetric/volumetric.cpp
+++ b/examples/datavisualization/volumetric/volumetric.cpp
@@ -67,7 +67,7 @@ const int terrainTransparency(12);
static bool isOpenGLES()
{
-#if defined(QT_OPENGL_ES_2)
+#if QT_CONFIG(opengles2)
return true;
#elif (QT_VERSION < QT_VERSION_CHECK(5, 3, 0))
return false;
diff --git a/src/datavisualization/engine/abstract3drenderer.cpp b/src/datavisualization/engine/abstract3drenderer.cpp
index fd81e930..b45cd756 100644
--- a/src/datavisualization/engine/abstract3drenderer.cpp
+++ b/src/datavisualization/engine/abstract3drenderer.cpp
@@ -118,7 +118,7 @@ Abstract3DRenderer::Abstract3DRenderer(Abstract3DController *controller)
m_oldCameraTarget(QVector3D(2000.0f, 2000.0f, 2000.0f)), // Just random invalid target
m_reflectionEnabled(false),
m_reflectivity(0.5),
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
m_funcs_2_1(0),
#endif
m_context(0),
@@ -127,7 +127,7 @@ Abstract3DRenderer::Abstract3DRenderer(Abstract3DController *controller)
{
initializeOpenGLFunctions();
m_isOpenGLES = Utils::isOpenGLES();
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
if (!m_isOpenGLES) {
// Discard warnings about deprecated functions
QtMessageHandler handler = qInstallMessageHandler(discardDebugMsgs);
@@ -193,7 +193,9 @@ Abstract3DRenderer::~Abstract3DRenderer()
m_axisCacheY.clearLabels();
m_axisCacheZ.clearLabels();
+#if !QT_CONFIG(opengles2)
delete m_funcs_2_1;
+#endif
}
void Abstract3DRenderer::contextCleanup()
@@ -212,7 +214,7 @@ void Abstract3DRenderer::initializeOpenGL()
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
if (!m_isOpenGLES) {
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
diff --git a/src/datavisualization/engine/abstract3drenderer_p.h b/src/datavisualization/engine/abstract3drenderer_p.h
index 4155a551..bc7ca819 100644
--- a/src/datavisualization/engine/abstract3drenderer_p.h
+++ b/src/datavisualization/engine/abstract3drenderer_p.h
@@ -41,7 +41,7 @@
#define ABSTRACT3DRENDERER_P_H
#include <QtGui/QOpenGLFunctions>
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
# include <QtOpenGL/QOpenGLFunctions_2_1>
#endif
#include "datavisualizationglobal_p.h"
@@ -333,7 +333,7 @@ protected:
qreal m_reflectivity;
QLocale m_locale;
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
QOpenGLFunctions_2_1 *m_funcs_2_1;
#endif
QPointer<QOpenGLContext> m_context; // Not owned
diff --git a/src/datavisualization/engine/drawer.cpp b/src/datavisualization/engine/drawer.cpp
index 3b873ba4..8d7cdf6e 100644
--- a/src/datavisualization/engine/drawer.cpp
+++ b/src/datavisualization/engine/drawer.cpp
@@ -105,7 +105,7 @@ QFont Drawer::font() const
void Drawer::drawObject(ShaderHelper *shader, AbstractObjectHelper *object, GLuint textureId,
GLuint depthTextureId, GLuint textureId3D)
{
-#if defined(QT_OPENGL_ES_2)
+#if QT_CONFIG(opengles2)
Q_UNUSED(textureId3D);
#endif
if (textureId) {
@@ -121,7 +121,7 @@ void Drawer::drawObject(ShaderHelper *shader, AbstractObjectHelper *object, GLui
glBindTexture(GL_TEXTURE_2D, depthTextureId);
shader->setUniformValue(shader->shadow(), 1);
}
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
if (textureId3D) {
// Activate texture
glActiveTexture(GL_TEXTURE2);
@@ -166,7 +166,7 @@ void Drawer::drawObject(ShaderHelper *shader, AbstractObjectHelper *object, GLui
glDisableVertexAttribArray(shader->posAtt());
// Release textures
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
if (textureId3D) {
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_3D, 0);
diff --git a/src/datavisualization/engine/scatter3drenderer.cpp b/src/datavisualization/engine/scatter3drenderer.cpp
index e999827e..5255b51e 100644
--- a/src/datavisualization/engine/scatter3drenderer.cpp
+++ b/src/datavisualization/engine/scatter3drenderer.cpp
@@ -554,7 +554,7 @@ void Scatter3DRenderer::drawScene(const GLuint defaultFboHandle)
ShaderHelper *pointSelectionShader;
if (!m_isOpenGLES) {
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
if (m_havePointSeries) {
glEnable(GL_POINT_SMOOTH);
glEnable(GL_PROGRAM_POINT_SIZE);
@@ -751,7 +751,7 @@ void Scatter3DRenderer::drawScene(const GLuint defaultFboHandle)
float itemSize = cache->itemSize() / itemScaler;
if (itemSize == 0.0f)
itemSize = m_dotSizeScale;
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
if (drawingPoints && !m_isOpenGLES)
m_funcs_2_1->glPointSize(itemSize * activeCamera->zoomLevel());
#endif
@@ -884,7 +884,7 @@ void Scatter3DRenderer::drawScene(const GLuint defaultFboHandle)
float itemSize = cache->itemSize() / itemScaler;
if (itemSize == 0.0f)
itemSize = m_dotSizeScale;
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
if (drawingPoints && !m_isOpenGLES)
m_funcs_2_1->glPointSize(itemSize * activeCamera->zoomLevel());
#endif
@@ -1195,7 +1195,7 @@ void Scatter3DRenderer::drawScene(const GLuint defaultFboHandle)
}
}
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
if (m_havePointSeries) {
glDisable(GL_POINT_SMOOTH);
glDisable(GL_PROGRAM_POINT_SIZE);
diff --git a/src/datavisualization/utils/qutils.h b/src/datavisualization/utils/qutils.h
index b7001652..65fb8047 100644
--- a/src/datavisualization/utils/qutils.h
+++ b/src/datavisualization/utils/qutils.h
@@ -39,7 +39,7 @@
namespace QtDataVisualization {
#ifndef Q_QDOC
-static inline QSurfaceFormat qDefaultSurfaceFormat(bool antialias = true) Q_DECL_UNUSED;
+static inline QSurfaceFormat qDefaultSurfaceFormat(bool antialias = true);
#endif
static inline QSurfaceFormat qDefaultSurfaceFormat(bool antialias)
{
@@ -65,7 +65,7 @@ static inline QSurfaceFormat qDefaultSurfaceFormat(bool antialias)
ctx->makeCurrent(dummySurface);
}
-#if defined(QT_OPENGL_ES_2)
+#if QT_CONFIG(opengles2)
isES = true;
#elif (QT_VERSION < QT_VERSION_CHECK(5, 3, 0))
isES = false;
diff --git a/src/datavisualization/utils/texturehelper.cpp b/src/datavisualization/utils/texturehelper.cpp
index 4ff56cb3..d424234c 100644
--- a/src/datavisualization/utils/texturehelper.cpp
+++ b/src/datavisualization/utils/texturehelper.cpp
@@ -42,7 +42,7 @@ extern void discardDebugMsgs(QtMsgType type, const QMessageLogContext &context,
TextureHelper::TextureHelper()
{
initializeOpenGLFunctions();
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
if (!Utils::isOpenGLES()) {
// Discard warnings about deprecated functions
QtMessageHandler handler = qInstallMessageHandler(discardDebugMsgs);
@@ -62,7 +62,9 @@ TextureHelper::TextureHelper()
TextureHelper::~TextureHelper()
{
+#if !QT_CONFIG(opengles2)
delete m_openGlFunctions_2_1;
+#endif
}
GLuint TextureHelper::create2DTexture(const QImage &image, bool useTrilinearFiltering,
@@ -115,7 +117,7 @@ GLuint TextureHelper::create3DTexture(const QList<uchar> *data, int width, int h
return 0;
GLuint textureId = 0;
-#if defined(QT_OPENGL_ES_2)
+#if QT_CONFIG(opengles2)
Q_UNUSED(dataFormat);
Q_UNUSED(data);
#else
@@ -290,7 +292,7 @@ GLuint TextureHelper::createGradientTexture(const QLinearGradient &gradient)
GLuint TextureHelper::createDepthTexture(const QSize &size, GLuint textureSize)
{
GLuint depthtextureid = 0;
-#if defined(QT_OPENGL_ES_2)
+#if QT_CONFIG(opengles2)
Q_UNUSED(size);
Q_UNUSED(textureSize);
#else
@@ -316,7 +318,7 @@ GLuint TextureHelper::createDepthTextureFrameBuffer(const QSize &size, GLuint &f
GLuint textureSize)
{
GLuint depthtextureid = createDepthTexture(size, textureSize);
-#if defined(QT_OPENGL_ES_2)
+#if QT_CONFIG(opengles2)
Q_UNUSED(frameBuffer);
#else
if (!Utils::isOpenGLES()) {
@@ -402,7 +404,7 @@ void TextureHelper::convertToGLFormatHelper(QImage &dstImage, const QImage &srcI
const uint *p = (const uint*) srcImage.scanLine(srcImage.height() - 1);
uint *q = (uint*) dstImage.scanLine(0);
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
if (texture_format == GL_BGRA) {
#else
if (texture_format == GL_BGRA8_EXT) {
@@ -457,7 +459,7 @@ void TextureHelper::convertToGLFormatHelper(QImage &dstImage, const QImage &srcI
QRgb TextureHelper::qt_gl_convertToGLFormatHelper(QRgb src_pixel, GLenum texture_format)
{
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
if (texture_format == GL_BGRA) {
#else
if (texture_format == GL_BGRA8_EXT) {
diff --git a/src/datavisualization/utils/texturehelper_p.h b/src/datavisualization/utils/texturehelper_p.h
index 9ef68d74..b9a4fa92 100644
--- a/src/datavisualization/utils/texturehelper_p.h
+++ b/src/datavisualization/utils/texturehelper_p.h
@@ -43,7 +43,7 @@
#include "datavisualizationglobal_p.h"
#include <QtGui/QRgb>
#include <QtGui/QLinearGradient>
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
// 3D Textures are not supported by ES set
# include <QtOpenGL/QOpenGLFunctions_2_1>
#endif
@@ -77,7 +77,7 @@ class TextureHelper : protected QOpenGLFunctions
void convertToGLFormatHelper(QImage &dstImage, const QImage &srcImage, GLenum texture_format);
QRgb qt_gl_convertToGLFormatHelper(QRgb src_pixel, GLenum texture_format);
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
QOpenGLFunctions_2_1 *m_openGlFunctions_2_1;
#endif
friend class Bars3DRenderer;
diff --git a/src/datavisualization/utils/utils.cpp b/src/datavisualization/utils/utils.cpp
index 2503ad2b..6b4c9727 100644
--- a/src/datavisualization/utils/utils.cpp
+++ b/src/datavisualization/utils/utils.cpp
@@ -34,6 +34,7 @@
#include <QtGui/QOffscreenSurface>
#include <QtCore/QCoreApplication>
#include <QtCore/QRegularExpression>
+#include <QLocale>
QT_BEGIN_NAMESPACE_DATAVISUALIZATION
@@ -355,7 +356,7 @@ void Utils::resolveStatics()
ctx->makeCurrent(dummySurface);
}
-#if defined(QT_OPENGL_ES_2)
+#if QT_CONFIG(opengles2)
isES = true;
#elif (QT_VERSION < QT_VERSION_CHECK(5, 3, 0))
isES = false;
diff --git a/src/datavisualizationqml2/enumtostringmap.cpp b/src/datavisualizationqml2/enumtostringmap.cpp
index d683c0a1..e10e8bc0 100644
--- a/src/datavisualizationqml2/enumtostringmap.cpp
+++ b/src/datavisualizationqml2/enumtostringmap.cpp
@@ -393,7 +393,7 @@ EnumToStringMap::EnumToStringMap() :
m_map[GL_FRAMEBUFFER_UNSUPPORTED] = "FRAMEBUFFER_UNSUPPORTED";
m_map[GL_FRAMEBUFFER_BINDING] = "FRAMEBUFFER_BINDING";
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
m_map[GL_RENDERBUFFER_BINDING] = "RENDERBUFFER_BINDING";
#else
m_map[GL_RENDERBUFFER] = "RENDERBUFFER_BINDING";
diff --git a/src/datavisualizationqml2/glstatestore.cpp b/src/datavisualizationqml2/glstatestore.cpp
index 0d24f3f9..dfb4266f 100644
--- a/src/datavisualizationqml2/glstatestore.cpp
+++ b/src/datavisualizationqml2/glstatestore.cpp
@@ -87,7 +87,7 @@ void GLStateStore::storeGLState()
printCurrentState(true);
#endif
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &m_drawFramebuffer);
glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &m_readFramebuffer);
glGetIntegerv(GL_RENDERBUFFER_BINDING, &m_renderbuffer);
@@ -144,7 +144,7 @@ void GLStateStore::printCurrentState(bool in)
if (file->isOpen()) {
QDebug msg(file);
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
GLint drawFramebuffer;
GLint readFramebuffer;
GLint renderbuffer;
@@ -183,7 +183,7 @@ void GLStateStore::printCurrentState(bool in)
GLfloat polygonOffsetUnits;
glGetBooleanv(GL_DEPTH_WRITEMASK, &isDepthWriteEnabled);
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &drawFramebuffer);
glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING, &readFramebuffer);
glGetIntegerv(GL_RENDERBUFFER_BINDING, &renderbuffer);
@@ -226,7 +226,7 @@ void GLStateStore::printCurrentState(bool in)
color.setRgbF(clearColor[0], clearColor[1], clearColor[2]);
color.setAlphaF(clearColor[3]);
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
msg << "---" << endl;
msg << " GL_DRAW_FRAMEBUFFER_BINDING "<< drawFramebuffer << endl;
msg << " GL_READ_FRAMEBUFFER_BINDING "<< readFramebuffer << endl;
@@ -278,7 +278,7 @@ void GLStateStore::printCurrentState(bool in)
void GLStateStore::restoreGLState()
{
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
glBindFramebuffer(GL_READ_FRAMEBUFFER, m_readFramebuffer);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_drawFramebuffer);
glBindRenderbuffer(GL_RENDERBUFFER_BINDING, m_renderbuffer);
@@ -353,7 +353,7 @@ void GLStateStore::restoreGLState()
void GLStateStore::initGLDefaultState()
{
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
m_drawFramebuffer = 0;
m_readFramebuffer = 0;
m_renderbuffer = 0;
diff --git a/src/datavisualizationqml2/glstatestore_p.h b/src/datavisualizationqml2/glstatestore_p.h
index 830f5e64..f5aa0bdd 100644
--- a/src/datavisualizationqml2/glstatestore_p.h
+++ b/src/datavisualizationqml2/glstatestore_p.h
@@ -63,7 +63,7 @@ public:
GLint m_scissorBox[4];
GLboolean m_isScissorTestEnabled;
-#if !defined(QT_OPENGL_ES_2)
+#if !QT_CONFIG(opengles2)
GLint m_drawFramebuffer;
GLint m_readFramebuffer;
GLint m_renderbuffer;