diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2021-01-11 12:13:48 +0100 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2021-02-01 09:20:47 +0100 |
commit | 7821344a885d0d9b6fd800375b2866278f99d85f (patch) | |
tree | fb931dbf23346fbe78341806f5ed2922f7aec6be | |
parent | 53c3d955bafe75936dd281d479fca9746f5a8990 (diff) | |
download | qt3d-7821344a885d0d9b6fd800375b2866278f99d85f.tar.gz |
Minor fixes to compile against 5.15
Change-Id: Id9574cf23b9af29815d8452915cebfc380fd94d1
Reviewed-by: Mike Krus <mike.krus@kdab.com>
-rw-r--r-- | examples/qt3d/audio-visualizer-qml/touchsettings.cpp | 16 | ||||
-rw-r--r-- | src/core/core.pri | 2 | ||||
-rw-r--r-- | src/input/frontend/qkeyevent.h | 1 | ||||
-rw-r--r-- | src/plugins/renderers/opengl/textures/gltexture.cpp | 4 | ||||
-rw-r--r-- | src/plugins/renderers/rhi/rhi.pro | 6 | ||||
-rw-r--r-- | src/plugins/sceneparsers/assimp/assimpimporter.cpp | 13 | ||||
-rw-r--r-- | src/render/materialsystem/qshaderprogram.cpp | 5 | ||||
-rw-r--r-- | src/render/shadergraph/qshadergenerator.cpp | 4 | ||||
-rw-r--r-- | tests/auto/core/qresourcemanager/tst_qresourcemanager.cpp | 1 | ||||
-rw-r--r-- | tests/auto/global/aspects_startup_shutdown/tst_aspects_startup_shutdown.cpp | 1 | ||||
-rw-r--r-- | tests/auto/render/opengl/graphicshelpergl4/tst_graphicshelpergl4.cpp | 11 | ||||
-rw-r--r-- | tests/auto/render/render.pro | 2 | ||||
-rw-r--r-- | tests/auto/render/vsyncframeadvanceservice/tst_vsyncframeadvanceservice.cpp | 2 | ||||
-rw-r--r-- | tests/manual/sharedtexture/sharedtexture.pro | 6 | ||||
-rw-r--r-- | tests/manual/sharedtexture/videoplayer.h | 8 | ||||
-rw-r--r-- | tests/manual/sharedtextureqml/sharedtextureqml.pro | 6 |
16 files changed, 74 insertions, 14 deletions
diff --git a/examples/qt3d/audio-visualizer-qml/touchsettings.cpp b/examples/qt3d/audio-visualizer-qml/touchsettings.cpp index 3f70df802..477583de0 100644 --- a/examples/qt3d/audio-visualizer-qml/touchsettings.cpp +++ b/examples/qt3d/audio-visualizer-qml/touchsettings.cpp @@ -49,7 +49,15 @@ ****************************************************************************/ #include "touchsettings.h" -#include <QtGui/QInputDevice> + +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +#define DEVICE QInputDevice +#include <QtGui/QInputDevice +#else +#define DEVICE QTouchDevice +#include <QtGui/QTouchDevice> +#endif + #include <QDebug> TouchSettings::TouchSettings(QObject *parent) @@ -62,10 +70,10 @@ bool TouchSettings::isHoverEnabled() const #if defined(Q_OS_IOS) || defined(Q_OS_ANDROID) || defined(Q_OS_QNX) || defined(Q_OS_WINRT) return false; #else - const auto devices = QInputDevice::devices(); + const auto devices = DEVICE::devices(); bool isTouch = false; - for (const QInputDevice *dev : devices) - if (dev->type() == QInputDevice::DeviceType::TouchScreen) { + for (const DEVICE *dev : devices) + if (dev->type() == DEVICE::DeviceType::TouchScreen) { isTouch = true; break; } diff --git a/src/core/core.pri b/src/core/core.pri index 6cf431164..1ff71d3fe 100644 --- a/src/core/core.pri +++ b/src/core/core.pri @@ -9,7 +9,7 @@ HEADERS += \ $$PWD/qt3dcore_global_p.h \ $$PWD/qurlhelper_p.h \ $$PWD/qscene_p.h \ - $$PWD/qabstractfrontendnodemanager.h + $$PWD/qabstractfrontendnodemanager_p.h SOURCES += \ $$PWD/qtickclock.cpp \ diff --git a/src/input/frontend/qkeyevent.h b/src/input/frontend/qkeyevent.h index 52be3b213..acc213b1e 100644 --- a/src/input/frontend/qkeyevent.h +++ b/src/input/frontend/qkeyevent.h @@ -43,6 +43,7 @@ #include <Qt3DInput/qt3dinput_global.h> #include <QtCore/QObject> #include <QtGui/QKeyEvent> +#include <memory> QT_BEGIN_NAMESPACE diff --git a/src/plugins/renderers/opengl/textures/gltexture.cpp b/src/plugins/renderers/opengl/textures/gltexture.cpp index 5f8dee4b4..6fcd19784 100644 --- a/src/plugins/renderers/opengl/textures/gltexture.cpp +++ b/src/plugins/renderers/opengl/textures/gltexture.cpp @@ -692,7 +692,11 @@ void GLTexture::introspectPropertiesFromSharedTextureId() if (ctxGLVersion.first > 4 || (ctxGLVersion.first == 4 && ctxGLVersion.second >= 5)) { // Only for GL 4.5+ #ifdef GL_TEXTURE_TARGET +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QOpenGLFunctions_4_5_Core *gl5 = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_4_5_Core>(); +#else + QOpenGLFunctions_4_5_Core *gl5 = ctx->versionFunctions<QOpenGLFunctions_4_5_Core>(); +#endif if (gl5 != nullptr) gl5->glGetTextureParameteriv(m_sharedTextureId, GL_TEXTURE_TARGET, reinterpret_cast<int *>(&m_properties.target)); #endif diff --git a/src/plugins/renderers/rhi/rhi.pro b/src/plugins/renderers/rhi/rhi.pro index 786749a71..a767223f4 100644 --- a/src/plugins/renderers/rhi/rhi.pro +++ b/src/plugins/renderers/rhi/rhi.pro @@ -4,7 +4,11 @@ PLUGIN_TYPE = renderers PLUGIN_CLASS_NAME = RhiRendererPlugin load(qt_plugin) -QT += core-private gui-private 3dcore 3dcore-private 3drender 3drender-private shadertools shadertools-private +QT += core-private gui-private 3dcore 3dcore-private 3drender 3drender-private + +greaterThan(QT_MAJOR_VERSION, 5) { + QT += shadertools shadertools-private +} # Qt3D is free of Q_FOREACH - make sure it stays that way: DEFINES += QT_NO_FOREACH diff --git a/src/plugins/sceneparsers/assimp/assimpimporter.cpp b/src/plugins/sceneparsers/assimp/assimpimporter.cpp index 90cd378ae..1a775d888 100644 --- a/src/plugins/sceneparsers/assimp/assimpimporter.cpp +++ b/src/plugins/sceneparsers/assimp/assimpimporter.cpp @@ -845,7 +845,12 @@ QGeometryRenderer *AssimpImporter::loadMesh(uint meshIndex) Qt3DAnimation::QMorphingAnimation *morphingAnimation = new Qt3DAnimation::QMorphingAnimation(geometryRenderer); QList<QString> names; + +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QList<Qt3DAnimation::QMorphTarget *> targets; +#else + QVector<Qt3DAnimation::QMorphTarget *> targets; +#endif uint voff = 0; uint noff = 0; uint tanoff = 0; @@ -1162,7 +1167,11 @@ void AssimpImporter::loadAnimation(uint animationIndex) aiMesh *mesh = m_scene->m_aiScene->mMeshes[targetNode->mMeshes[0]]; Qt3DAnimation::QMorphingAnimation *morphingAnimation = new Qt3DAnimation::QMorphingAnimation; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QList<float> positions; +#else + QVector<float> positions; +#endif positions.resize(morphAnim->mNumKeys); // set so that weights array is allocated to correct size in morphingAnimation morphingAnimation->setTargetPositions(positions); @@ -1170,7 +1179,11 @@ void AssimpImporter::loadAnimation(uint animationIndex) aiMeshMorphKey &key = morphAnim->mKeys[j]; positions[j] = key.mTime * tickScale; +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QList<float> weights; +#else + QVector<float> weights; +#endif weights.resize(key.mNumValuesAndWeights); for (int k = 0; k < weights.size(); k++) { const unsigned int value = key.mValues[k]; diff --git a/src/render/materialsystem/qshaderprogram.cpp b/src/render/materialsystem/qshaderprogram.cpp index 87545f5e0..6e1f8ddb7 100644 --- a/src/render/materialsystem/qshaderprogram.cpp +++ b/src/render/materialsystem/qshaderprogram.cpp @@ -877,9 +877,12 @@ QByteArray QShaderProgramPrivate::resolveAutoBindingIndices(const QByteArray &co do { matchStart = shaderCode.indexOf(regexp, matchStart); if (matchStart != -1) { +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) const auto match = regexp.match(QStringView{shaderCode}.mid(matchStart)); +#else + const auto match = regexp.match(shaderCode.mid(matchStart)); +#endif const auto length = match.capturedLength(0); - shaderCode.replace(matchStart, length, replacement.arg(variable++)); } } while (matchStart != -1); diff --git a/src/render/shadergraph/qshadergenerator.cpp b/src/render/shadergraph/qshadergenerator.cpp index ec280e908..21478e3ee 100644 --- a/src/render/shadergraph/qshadergenerator.cpp +++ b/src/render/shadergraph/qshadergenerator.cpp @@ -571,7 +571,7 @@ QByteArray QShaderGenerator::createShaderCode(const QStringList &enabledLayers) // just use vertexPosition directly. // The added benefit is when having arrays, we don't try to create // mat4 v38 = skinningPalelette[100] which would be invalid - QList<Variable> temporaryVariables; + std::vector<Variable> temporaryVariables; // Reserve more than enough space to ensure no reallocation will take place temporaryVariables.reserve(nodes.size() * 8); @@ -580,7 +580,7 @@ QByteArray QShaderGenerator::createShaderCode(const QStringList &enabledLayers) auto createVariable = [&] () -> Variable * { Q_ASSERT(temporaryVariables.capacity() > 0); temporaryVariables.resize(temporaryVariables.size() + 1); - return &temporaryVariables.last(); + return &temporaryVariables.back(); }; auto findVariable = [&] (const QString &name) -> Variable * { diff --git a/tests/auto/core/qresourcemanager/tst_qresourcemanager.cpp b/tests/auto/core/qresourcemanager/tst_qresourcemanager.cpp index d545dc616..b8e0c5357 100644 --- a/tests/auto/core/qresourcemanager/tst_qresourcemanager.cpp +++ b/tests/auto/core/qresourcemanager/tst_qresourcemanager.cpp @@ -30,6 +30,7 @@ #include <QList> #include <Qt3DCore/private/qhandle_p.h> #include <Qt3DCore/private/qresourcemanager_p.h> +#include <QThread> class tst_QResourceManager : public QObject { diff --git a/tests/auto/global/aspects_startup_shutdown/tst_aspects_startup_shutdown.cpp b/tests/auto/global/aspects_startup_shutdown/tst_aspects_startup_shutdown.cpp index fbe58bd0d..bc4eed557 100644 --- a/tests/auto/global/aspects_startup_shutdown/tst_aspects_startup_shutdown.cpp +++ b/tests/auto/global/aspects_startup_shutdown/tst_aspects_startup_shutdown.cpp @@ -72,6 +72,7 @@ #include <Qt3DExtras/QTorusMesh> #include <QPropertyAnimation> +#include <QThread> namespace { diff --git a/tests/auto/render/opengl/graphicshelpergl4/tst_graphicshelpergl4.cpp b/tests/auto/render/opengl/graphicshelpergl4/tst_graphicshelpergl4.cpp index fe87f21b7..2b1aa2b8f 100644 --- a/tests/auto/render/opengl/graphicshelpergl4/tst_graphicshelpergl4.cpp +++ b/tests/auto/render/opengl/graphicshelpergl4/tst_graphicshelpergl4.cpp @@ -36,7 +36,10 @@ #include <QOpenGLShaderProgram> #include <QOpenGLVertexArrayObject> #include <QSurfaceFormat> + +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #include <QtOpenGL/QOpenGLVersionFunctionsFactory> +#endif #if !QT_CONFIG(opengles2) && defined(QT_OPENGL_4_3) @@ -256,7 +259,11 @@ private Q_SLOTS: return; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) if ((m_func = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_4_3_Core>()) != nullptr) { +#else + if ((m_func = m_glContext.versionFunctions<QOpenGLFunctions_4_3_Core>()) != nullptr) { +#endif m_glHelper.initializeHelper(&m_glContext, m_func); m_initializationSuccessful = true; } @@ -924,7 +931,11 @@ private Q_SLOTS: QVERIFY(error == 0); // THEN +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QList<QVector4D> colors(512 * 512); +#else + QVector<QVector4D> colors(512 * 512); +#endif textures[3]->bind(); m_func->glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_FLOAT, colors.data()); textures[3]->release(); diff --git a/tests/auto/render/render.pro b/tests/auto/render/render.pro index dbc724074..b7381b9f3 100644 --- a/tests/auto/render/render.pro +++ b/tests/auto/render/render.pro @@ -156,7 +156,7 @@ qtConfig(qt3d-opengl-renderer):qtConfig(private_tests) { qtConfig(qt3d-simd-sse2):!qtConfig(qt3d-simd-avx2): SUBDIRS += alignedresourcesmanagers-sse } -qtConfig(qt3d-rhi-renderer):qtConfig(private_tests) { +qtConfig(qt3d-rhi-renderer):qtConfig(private_tests):qtHaveModule(shadertools) { SUBDIRS += \ rhi diff --git a/tests/auto/render/vsyncframeadvanceservice/tst_vsyncframeadvanceservice.cpp b/tests/auto/render/vsyncframeadvanceservice/tst_vsyncframeadvanceservice.cpp index e301ecb8d..806adff6b 100644 --- a/tests/auto/render/vsyncframeadvanceservice/tst_vsyncframeadvanceservice.cpp +++ b/tests/auto/render/vsyncframeadvanceservice/tst_vsyncframeadvanceservice.cpp @@ -28,7 +28,7 @@ #include <QtTest/QTest> #include <QSemaphore> - +#include <QThread> #include <Qt3DRender/private/vsyncframeadvanceservice_p.h> class FakeRenderThread final : public QThread diff --git a/tests/manual/sharedtexture/sharedtexture.pro b/tests/manual/sharedtexture/sharedtexture.pro index 72b5bed68..51faf69e2 100644 --- a/tests/manual/sharedtexture/sharedtexture.pro +++ b/tests/manual/sharedtexture/sharedtexture.pro @@ -2,7 +2,11 @@ error( "Couldn't find the manual.pri file!" ) } -QT += widgets 3dcore 3drender 3dinput 3dextras multimedia opengl openglwidgets +QT += widgets 3dcore 3drender 3dinput 3dextras multimedia opengl + +greaterThan(QT_MAJOR_VERSION, 5) { + QT += openglwidgets +} SOURCES += \ videoplayer.cpp \ diff --git a/tests/manual/sharedtexture/videoplayer.h b/tests/manual/sharedtexture/videoplayer.h index b34f3ea78..d609b06d6 100644 --- a/tests/manual/sharedtexture/videoplayer.h +++ b/tests/manual/sharedtexture/videoplayer.h @@ -48,8 +48,14 @@ ** ****************************************************************************/ -#include <QtOpenGLWidgets/QOpenGLWidget> #include <QtGui/QOpenGLFunctions> + +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +#include <QtOpenGLWidgets/QOpenGLWidget> +#else +#include <QtWidgets/QOpenGLWidget> +#endif + #include <QOpenGLVertexArrayObject> #include <QOpenGLBuffer> #include <QOpenGLTexture> diff --git a/tests/manual/sharedtextureqml/sharedtextureqml.pro b/tests/manual/sharedtextureqml/sharedtextureqml.pro index 7c2086013..3fbd2e95a 100644 --- a/tests/manual/sharedtextureqml/sharedtextureqml.pro +++ b/tests/manual/sharedtextureqml/sharedtextureqml.pro @@ -2,7 +2,11 @@ error( "Couldn't find the manual.pri file!" ) } -QT += widgets gui-private 3dcore 3drender 3dinput 3dextras multimedia quick 3dquickextras openglwidgets +QT += widgets gui-private 3dcore 3drender 3dinput 3dextras multimedia quick 3dquickextras + +greaterThan(QT_MAJOR_VERSION, 5) { + QT += openglwidgets +} SOURCES += \ main.cpp \ |