summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2020-11-20 17:26:26 +0000
committerMike Krus <mike.krus@kdab.com>2021-01-05 16:03:03 +0000
commit090ea5502eac39565e33b3882f2173dd5eae473d (patch)
treee79db00cd7cc50e83bbce5adc06ddda59aa30224 /src
parent173be1a93699c54d9680d809ca5a56ce0ccccd9a (diff)
Enable compiling non-QML API against Qt 5.15
Built with QtQuick disabled. - C++17 required - minor issues with QList vs QVector - QMutexLocker templated vs not - moc forward declaration handling Change-Id: I5540625e74e2c009e528f56203e4b88be8d54599 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src')
-rw-r--r--src/animation/backend/animationclip.cpp2
-rw-r--r--src/core/qscene.cpp5
-rw-r--r--src/core/resources/qresourcemanager_p.h4
-rw-r--r--src/input/backend/actioninput.cpp1
-rw-r--r--src/input/backend/axissetting.cpp1
-rw-r--r--src/input/frontend/qkeyboardhandler.h2
-rw-r--r--src/plugins/renderers/opengl/opengl.pri2
-rw-r--r--src/plugins/renderers/opengl/renderer/frameprofiler_p.h4
-rw-r--r--src/render/framegraph/qframegraphnode.cpp11
-rw-r--r--src/render/materialsystem/qparameter.cpp2
-rw-r--r--src/render/render.pro1
11 files changed, 27 insertions, 8 deletions
diff --git a/src/animation/backend/animationclip.cpp b/src/animation/backend/animationclip.cpp
index 699d4dc50..93a70eadd 100644
--- a/src/animation/backend/animationclip.cpp
+++ b/src/animation/backend/animationclip.cpp
@@ -354,7 +354,7 @@ void AnimationClip::clearData()
float AnimationClip::findDuration()
{
// Iterate over the contained fcurves and find the longest one
- double tMax = 0.0;
+ float tMax = 0.f;
for (const Channel &channel : qAsConst(m_channels)) {
for (const ChannelComponent &channelComponent : qAsConst(channel.channelComponents)) {
const float t = channelComponent.fcurve.endTime();
diff --git a/src/core/qscene.cpp b/src/core/qscene.cpp
index 475f63214..3381dfbe7 100644
--- a/src/core/qscene.cpp
+++ b/src/core/qscene.cpp
@@ -123,7 +123,12 @@ QList<QNode *> QScene::lookupNodes(const QList<QNodeId> &ids) const
{
Q_D(const QScene);
QReadLocker lock(&d->m_lock);
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QList<QNode *> nodes(ids.size());
+#else
+ QList<QNode *> nodes;
+ nodes.reserve(ids.size());
+#endif
int index = 0;
for (QNodeId id : ids)
nodes[index++] = d->m_nodeLookupTable.value(id);
diff --git a/src/core/resources/qresourcemanager_p.h b/src/core/resources/qresourcemanager_p.h
index 954f7b5e4..32d8d081c 100644
--- a/src/core/resources/qresourcemanager_p.h
+++ b/src/core/resources/qresourcemanager_p.h
@@ -165,7 +165,11 @@ public :
}
private:
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QMutexLocker<QMutex> m_locker;
+#else
+ QMutexLocker m_locker;
+#endif
};
private:
diff --git a/src/input/backend/actioninput.cpp b/src/input/backend/actioninput.cpp
index 805fde1cf..ed8708949 100644
--- a/src/input/backend/actioninput.cpp
+++ b/src/input/backend/actioninput.cpp
@@ -53,7 +53,6 @@ namespace Input {
ActionInput::ActionInput()
: AbstractActionInput()
- , m_buttons(0)
{
}
diff --git a/src/input/backend/axissetting.cpp b/src/input/backend/axissetting.cpp
index 53e645c4d..c640cd35a 100644
--- a/src/input/backend/axissetting.cpp
+++ b/src/input/backend/axissetting.cpp
@@ -51,7 +51,6 @@ namespace Input {
AxisSetting::AxisSetting()
: BackendNode()
, m_deadZoneRadius(0.0f)
- , m_axes(0)
, m_smooth(false)
{
}
diff --git a/src/input/frontend/qkeyboardhandler.h b/src/input/frontend/qkeyboardhandler.h
index 6dac60c37..ba6119bc0 100644
--- a/src/input/frontend/qkeyboardhandler.h
+++ b/src/input/frontend/qkeyboardhandler.h
@@ -56,7 +56,9 @@ class Q_3DINPUTSHARED_EXPORT QKeyboardHandler : public Qt3DCore::QComponent
Q_OBJECT
Q_PROPERTY(Qt3DInput::QKeyboardDevice *sourceDevice READ sourceDevice WRITE setSourceDevice NOTIFY sourceDeviceChanged)
Q_PROPERTY(bool focus READ focus WRITE setFocus NOTIFY focusChanged)
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
Q_MOC_INCLUDE("Qt3DInput/qkeyboarddevice.h")
+#endif
public:
explicit QKeyboardHandler(QNode *parent = nullptr);
~QKeyboardHandler();
diff --git a/src/plugins/renderers/opengl/opengl.pri b/src/plugins/renderers/opengl/opengl.pri
index 37da69a1f..4308992e5 100644
--- a/src/plugins/renderers/opengl/opengl.pri
+++ b/src/plugins/renderers/opengl/opengl.pri
@@ -1,5 +1,7 @@
QT += core-private gui-private 3dcore 3dcore-private 3drender 3drender-private opengl-private
+CONFIG += c++17
+
# Qt3D is free of Q_FOREACH - make sure it stays that way:
DEFINES += QT_NO_FOREACH
DEFINES += BUILD_QT3D_MODULE
diff --git a/src/plugins/renderers/opengl/renderer/frameprofiler_p.h b/src/plugins/renderers/opengl/renderer/frameprofiler_p.h
index e94de299f..6a8f884d0 100644
--- a/src/plugins/renderers/opengl/renderer/frameprofiler_p.h
+++ b/src/plugins/renderers/opengl/renderer/frameprofiler_p.h
@@ -141,8 +141,8 @@ public:
{
#ifdef QT3D_SUPPORTS_GL_MONITOR
if (m_monitor.isResultAvailable()) {
- const QList<GLuint64> samples = m_monitor.waitForSamples();
- Q_ASSERT(samples.count() >= 2 * m_recordings.count());
+ const auto &samples = m_monitor.waitForSamples();
+ Q_ASSERT(samples.size() >= 2 * m_recordings.size());
Qt3DCore::QSystemInformationServicePrivate *dservice = Qt3DCore::QSystemInformationServicePrivate::get(m_service);
diff --git a/src/render/framegraph/qframegraphnode.cpp b/src/render/framegraph/qframegraphnode.cpp
index 53b362f01..2a2bda3f2 100644
--- a/src/render/framegraph/qframegraphnode.cpp
+++ b/src/render/framegraph/qframegraphnode.cpp
@@ -379,15 +379,20 @@ QList<QFrameGraphNode *> QFrameGraphNodePrivate::childFrameGraphNodes() const
Q_Q(const QFrameGraphNode);
QList<QFrameGraphNode *> result;
QQueue<QNode *> queue;
- queue.append(q->childNodes().toList());
+ const auto childNodes = q->childNodes();
+ for (auto c: childNodes)
+ queue.append(c);
result.reserve(queue.size());
while (!queue.isEmpty()) {
auto *child = queue.dequeue();
auto *childFGNode = qobject_cast<QFrameGraphNode *>(child);
if (childFGNode != nullptr)
result.push_back(childFGNode);
- else
- queue.append(child->childNodes().toList());
+ else {
+ const auto childNodes = child->childNodes();
+ for (auto c: childNodes)
+ queue.append(c);
+ }
}
return result;
}
diff --git a/src/render/materialsystem/qparameter.cpp b/src/render/materialsystem/qparameter.cpp
index d4a457115..2ce0d172c 100644
--- a/src/render/materialsystem/qparameter.cpp
+++ b/src/render/materialsystem/qparameter.cpp
@@ -41,8 +41,10 @@
#include "qparameter_p.h"
#include <Qt3DRender/private/renderlogging_p.h>
#include <Qt3DRender/qtexture.h>
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <QtCore/qiterable.h>
#include <QtCore/qsequentialiterable.h>
+#endif
/*!
\qmltype Parameter
diff --git a/src/render/render.pro b/src/render/render.pro
index c497ff551..353f95778 100644
--- a/src/render/render.pro
+++ b/src/render/render.pro
@@ -4,6 +4,7 @@ MODULE = 3drender
QT = core-private 3dcore-private opengl
QT_FOR_PRIVATE = concurrent
DEFINES += BUILD_QT3D_MODULE
+CONFIG += c++17
include (backend/render-backend.pri)
include (geometry/geometry.pri)