summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@qt.io>2021-06-09 11:36:10 +0200
committerAlessandro Portale <alessandro.portale@qt.io>2021-06-09 15:30:21 +0000
commit43c5944571601e49ac8dc29491a5000e92f16aaa (patch)
treedeb63c4fff3f7d620666d966b94b882a9d53c9df
parent370410aca06e75139414ae1f5cd34efa541e5c1b (diff)
downloadqt-creator-43c5944571601e49ac8dc29491a5000e92f16aaa.tar.gz
Tracing/QmlProfiler/CtfVisualizer/PerfProfiler: Compile with Qt 6
This makes the tracing lib, its tests and the three plugins which depend on the lib compile with Qt 6. The rectangles are not yet shown most likely because some OpenGL specific code was #ifdef-ed for Qt 6. That code needs to be reimplemented on top of the new Scenegraph API, using the RHI instead of direct OpenGL in a follow-up patch. An assertion failure in QQuickWidget::createFramebufferObject() needs to be fixed as-well. The code still builds and runs assertion free (and the autotests pass) when built against Qt 5. Task-number: QTCREATORBUG-20575 Change-Id: I47ebb477823de2f0d27329dac7c292a466cea1d7 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
-rw-r--r--src/libs/tracing/CMakeLists.txt1
-rw-r--r--src/libs/tracing/runscenegraphtest.cpp5
-rw-r--r--src/libs/tracing/timelineitemsrenderpass.cpp52
-rw-r--r--src/libs/tracing/timelineitemsrenderpass.h4
-rw-r--r--src/libs/tracing/timelinenotesrenderpass.cpp41
-rw-r--r--src/libs/tracing/timelineselectionrenderpass.cpp2
-rw-r--r--src/plugins/ctfvisualizer/ctftimelinemodel.cpp2
-rw-r--r--src/plugins/perfprofiler/perfevent.h1
-rw-r--r--src/plugins/qmlprofiler/inputeventsmodel.cpp7
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerbindingloopsrenderpass.cpp48
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertracefile.cpp8
-rw-r--r--src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp7
-rw-r--r--tests/auto/tracing/flamegraphview/tst_flamegraphview.cpp4
-rw-r--r--tests/auto/tracing/timelineitemsrenderpass/tst_timelineitemsrenderpass.cpp7
-rw-r--r--tests/auto/tracing/timelinenotesrenderpass/tst_timelinenotesrenderpass.cpp7
-rw-r--r--tests/auto/tracing/timelinerenderer/tst_timelinerenderer.cpp4
-rw-r--r--tests/auto/tracing/timelineselectionrenderpass/tst_timelineselectionrenderpass.cpp2
17 files changed, 173 insertions, 29 deletions
diff --git a/src/libs/tracing/CMakeLists.txt b/src/libs/tracing/CMakeLists.txt
index b7205527f3..6db0fdc0db 100644
--- a/src/libs/tracing/CMakeLists.txt
+++ b/src/libs/tracing/CMakeLists.txt
@@ -5,7 +5,6 @@ if (WITH_TESTS)
endif()
add_qtc_library(Tracing
- CONDITION Qt5_VERSION VERSION_LESS 6.0.0
FEATURE_INFO
DEPENDS Utils Qt5::Qml Qt5::Quick
PUBLIC_DEPENDS Qt5::Widgets
diff --git a/src/libs/tracing/runscenegraphtest.cpp b/src/libs/tracing/runscenegraphtest.cpp
index c1210aa5e0..826bb40356 100644
--- a/src/libs/tracing/runscenegraphtest.cpp
+++ b/src/libs/tracing/runscenegraphtest.cpp
@@ -29,8 +29,11 @@
#include <QString>
#include <QOpenGLContext>
#include <QOffscreenSurface>
+
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QSGEngine>
#include <QSGAbstractRenderer>
+#endif // < Qt 6
namespace Timeline {
@@ -59,6 +62,7 @@ void runSceneGraphTest(QSGNode *node)
QVERIFY(context.makeCurrent(&surface));
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QSGEngine engine;
QSGRootNode root;
root.appendChildNode(node);
@@ -74,6 +78,7 @@ void runSceneGraphTest(QSGNode *node)
// Unfortunately we cannot check the results of the rendering. But at least we know the shaders
// have not crashed here.
+#endif // < Qt 6
context.doneCurrent();
}
diff --git a/src/libs/tracing/timelineitemsrenderpass.cpp b/src/libs/tracing/timelineitemsrenderpass.cpp
index 310c7bb6ef..cc0fb7dc67 100644
--- a/src/libs/tracing/timelineitemsrenderpass.cpp
+++ b/src/libs/tracing/timelineitemsrenderpass.cpp
@@ -259,16 +259,16 @@ OpaqueColoredPoint2DWithSize *OpaqueColoredPoint2DWithSize::fromVertexData(QSGGe
const QSGGeometry::Attribute *attributes = geometry->attributes();
Q_ASSERT(attributes[0].position == 0);
Q_ASSERT(attributes[0].tupleSize == 2);
- Q_ASSERT(attributes[0].type == GL_FLOAT);
+ Q_ASSERT(attributes[0].type == QSGGeometry::FloatType);
Q_ASSERT(attributes[1].position == 1);
Q_ASSERT(attributes[1].tupleSize == 2);
- Q_ASSERT(attributes[1].type == GL_FLOAT);
+ Q_ASSERT(attributes[1].type == QSGGeometry::FloatType);
Q_ASSERT(attributes[2].position == 2);
Q_ASSERT(attributes[2].tupleSize == 1);
- Q_ASSERT(attributes[2].type == GL_FLOAT);
+ Q_ASSERT(attributes[2].type == QSGGeometry::FloatType);
Q_ASSERT(attributes[3].position == 3);
Q_ASSERT(attributes[3].tupleSize == 4);
- Q_ASSERT(attributes[3].type == GL_UNSIGNED_BYTE);
+ Q_ASSERT(attributes[3].type == QSGGeometry::UnsignedByteType);
Q_UNUSED(attributes)
return static_cast<OpaqueColoredPoint2DWithSize *>(geometry->vertexData());
}
@@ -358,10 +358,10 @@ static qint64 endTime(const TimelineModel *model, const TimelineRenderState *par
const QSGGeometry::AttributeSet &OpaqueColoredPoint2DWithSize::attributes()
{
static QSGGeometry::Attribute data[] = {
- QSGGeometry::Attribute::create(0, 2, GL_FLOAT, true),
- QSGGeometry::Attribute::create(1, 2, GL_FLOAT),
- QSGGeometry::Attribute::create(2, 1, GL_FLOAT),
- QSGGeometry::Attribute::create(3, 4, GL_UNSIGNED_BYTE)
+ QSGGeometry::Attribute::create(0, 2, QSGGeometry::FloatType, true),
+ QSGGeometry::Attribute::create(1, 2, QSGGeometry::FloatType),
+ QSGGeometry::Attribute::create(2, 1, QSGGeometry::FloatType),
+ QSGGeometry::Attribute::create(3, 4, QSGGeometry::UnsignedByteType)
};
static QSGGeometry::AttributeSet attrs = {
4,
@@ -436,12 +436,19 @@ class TimelineItemsMaterialShader : public QSGMaterialShader
public:
TimelineItemsMaterialShader();
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void updateState(const RenderState &state, QSGMaterial *newEffect,
QSGMaterial *oldEffect) override;
char const *const *attributeNames() const override;
+#else // < Qt 6
+ bool updateUniformData(RenderState &state, QSGMaterial *newEffect,
+ QSGMaterial *oldEffect) override;
+#endif // < Qt 6
private:
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void initialize() override;
+#endif // < Qt 6
int m_matrix_id;
int m_scale_id;
@@ -453,10 +460,16 @@ private:
TimelineItemsMaterialShader::TimelineItemsMaterialShader()
: QSGMaterialShader()
{
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/tracing/timelineitems.vert"));
setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/tracing/timelineitems.frag"));
+#else // < Qt 6
+ setShaderFileName(VertexStage, ":/tracing/timelineitems.vert");
+ setShaderFileName(FragmentStage, ":/tracing/timelineitems.frag");
+#endif // < Qt 6
}
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void TimelineItemsMaterialShader::updateState(const RenderState &state, QSGMaterial *newMaterial,
QSGMaterial *)
{
@@ -469,7 +482,19 @@ void TimelineItemsMaterialShader::updateState(const RenderState &state, QSGMater
program()->setUniformValue(m_z_range_id, GLfloat(1.0));
}
}
+#else // < Qt 6
+bool TimelineItemsMaterialShader::updateUniformData(RenderState &state,
+ QSGMaterial *newMaterial, QSGMaterial *)
+{
+ // TODO: Make this work
+ if (state.isMatrixDirty()) {
+ TimelineItemsMaterial *material = static_cast<TimelineItemsMaterial *>(newMaterial);
+ }
+ return state.isMatrixDirty();
+}
+#endif // < Qt 6
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
char const *const *TimelineItemsMaterialShader::attributeNames() const
{
static const char *const attr[] = {"vertexCoord", "rectSize", "selectionId", "vertexColor", nullptr};
@@ -484,7 +509,7 @@ void TimelineItemsMaterialShader::initialize()
m_selected_item_id = program()->uniformLocation("selectedItem");
m_z_range_id = program()->uniformLocation("_qt_zRange");
}
-
+#endif // < Qt 6
TimelineItemsMaterial::TimelineItemsMaterial() : m_selectedItem(-1)
{
@@ -527,10 +552,19 @@ QSGMaterialType *TimelineItemsMaterial::type() const
return &type;
}
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QSGMaterialShader *TimelineItemsMaterial::createShader() const
{
return new TimelineItemsMaterialShader;
}
+#else // < Qt 6
+QSGMaterialShader *TimelineItemsMaterial::createShader(
+ QSGRendererInterface::RenderMode renderMode) const
+{
+ Q_UNUSED(renderMode);
+ return new TimelineItemsMaterialShader;
+}
+#endif // < Qt 6
TimelineItemsRenderPassState::TimelineItemsRenderPassState(const TimelineModel *model) :
m_indexFrom(std::numeric_limits<int>::max()), m_indexTo(-1)
diff --git a/src/libs/tracing/timelineitemsrenderpass.h b/src/libs/tracing/timelineitemsrenderpass.h
index f08c1952b9..807f0ed551 100644
--- a/src/libs/tracing/timelineitemsrenderpass.h
+++ b/src/libs/tracing/timelineitemsrenderpass.h
@@ -45,7 +45,11 @@ public:
void setSelectionColor(QColor selectionColor);
QSGMaterialType *type() const override;
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QSGMaterialShader *createShader() const override;
+#else
+ QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override;
+#endif // < Qt 6
private:
QVector2D m_scale;
diff --git a/src/libs/tracing/timelinenotesrenderpass.cpp b/src/libs/tracing/timelinenotesrenderpass.cpp
index b1cb402ba8..b397832d7b 100644
--- a/src/libs/tracing/timelinenotesrenderpass.cpp
+++ b/src/libs/tracing/timelinenotesrenderpass.cpp
@@ -40,7 +40,11 @@ class NotesMaterial : public QSGMaterial
{
public:
QSGMaterialType *type() const final;
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QSGMaterialShader *createShader() const final;
+#else // < Qt 6
+ QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const final;
+#endif // < Qt 6
};
struct NotesGeometry
@@ -79,8 +83,8 @@ private:
const QSGGeometry::AttributeSet &NotesGeometry::point2DWithDistanceFromTop()
{
static QSGGeometry::Attribute data[] = {
- QSGGeometry::Attribute::create(0, 2, GL_FLOAT, true),
- QSGGeometry::Attribute::create(1, 1, GL_FLOAT),
+ QSGGeometry::Attribute::create(0, 2, QSGGeometry::FloatType, true),
+ QSGGeometry::Attribute::create(1, 1, QSGGeometry::FloatType),
};
static QSGGeometry::AttributeSet attrs = {
2,
@@ -197,7 +201,7 @@ QSGGeometry *NotesGeometry::createGeometry(QVector<int> &ids, const TimelineMode
QSGGeometry *geometry = new QSGGeometry(point2DWithDistanceFromTop(),
ids.count() * 2);
Q_ASSERT(geometry->vertexData());
- geometry->setDrawingMode(GL_LINES);
+ geometry->setDrawingMode(QSGGeometry::DrawLines);
geometry->setLineWidth(3);
Point2DWithDistanceFromTop *v =
static_cast<Point2DWithDistanceFromTop *>(geometry->vertexData());
@@ -220,12 +224,19 @@ class NotesMaterialShader : public QSGMaterialShader
public:
NotesMaterialShader();
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void updateState(const RenderState &state, QSGMaterial *newEffect,
QSGMaterial *oldEffect) override;
char const *const *attributeNames() const override;
+#else // < Qt 6
+ bool updateUniformData(RenderState &state,
+ QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override;
+#endif // < Qt 6
private:
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void initialize() override;
+#endif // < Qt 6
int m_matrix_id;
int m_z_range_id;
@@ -235,10 +246,16 @@ private:
NotesMaterialShader::NotesMaterialShader()
: QSGMaterialShader()
{
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/tracing/notes.vert"));
setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/tracing/notes.frag"));
+#else // < Qt 6
+ setShaderFileName(VertexStage, ":/tracing/notes.vert");
+ setShaderFileName(FragmentStage, ":/tracing/notes.frag");
+#endif // < Qt 6
}
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void NotesMaterialShader::updateState(const RenderState &state, QSGMaterial *, QSGMaterial *)
{
if (state.isMatrixDirty()) {
@@ -250,7 +267,16 @@ void NotesMaterialShader::updateState(const RenderState &state, QSGMaterial *, Q
program()->setUniformValue(m_color_id, notesColor);
}
}
+#else // < Qt 6
+bool NotesMaterialShader::updateUniformData(QSGMaterialShader::RenderState &state, QSGMaterial *, QSGMaterial *)
+{
+ if (state.isMatrixDirty()) {
+ }
+ return state.isMatrixDirty();
+}
+#endif // < Qt 6
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
char const *const *NotesMaterialShader::attributeNames() const
{
static const char *const attr[] = {"vertexCoord", "distanceFromTop", nullptr};
@@ -263,6 +289,7 @@ void NotesMaterialShader::initialize()
m_z_range_id = program()->uniformLocation("_qt_zRange");
m_color_id = program()->uniformLocation("notesColor");
}
+#endif // < Qt 6
QSGMaterialType *NotesMaterial::type() const
{
@@ -270,10 +297,18 @@ QSGMaterialType *NotesMaterial::type() const
return &type;
}
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QSGMaterialShader *NotesMaterial::createShader() const
{
return new NotesMaterialShader;
}
+#else // < Qt 6
+QSGMaterialShader *NotesMaterial::createShader(QSGRendererInterface::RenderMode renderMode) const
+{
+ Q_UNUSED(renderMode);
+ return new NotesMaterialShader;
+}
+#endif // < Qt 6
void Point2DWithDistanceFromTop::set(float nx, float ny, float nd)
{
diff --git a/src/libs/tracing/timelineselectionrenderpass.cpp b/src/libs/tracing/timelineselectionrenderpass.cpp
index 52be3eda58..3e0aa48964 100644
--- a/src/libs/tracing/timelineselectionrenderpass.cpp
+++ b/src/libs/tracing/timelineselectionrenderpass.cpp
@@ -37,7 +37,7 @@ QSGGeometryNode *createSelectionNode(QSGMaterial *material)
selectionNode->setFlag(QSGNode::OwnsMaterial, false);
QSGGeometry *geometry = new QSGGeometry(OpaqueColoredPoint2DWithSize::attributes(), 4);
Q_ASSERT(geometry->vertexData());
- geometry->setDrawingMode(GL_TRIANGLE_STRIP);
+ geometry->setDrawingMode(QSGGeometry::DrawTriangleStrip);
OpaqueColoredPoint2DWithSize *v = OpaqueColoredPoint2DWithSize::fromVertexData(geometry);
for (int i = 0; i < 4; ++i)
v[i].set(0, 0, 0, 0, 0, 0, 0, 0, 0);
diff --git a/src/plugins/ctfvisualizer/ctftimelinemodel.cpp b/src/plugins/ctfvisualizer/ctftimelinemodel.cpp
index d2e1402925..1c6071bd63 100644
--- a/src/plugins/ctfvisualizer/ctftimelinemodel.cpp
+++ b/src/plugins/ctfvisualizer/ctftimelinemodel.cpp
@@ -250,7 +250,7 @@ qint64 CtfTimelineModel::newStackEvent(const json &event, qint64 normalizedTime,
int selectionId)
{
int nestingLevel = m_openEventIds.size();
- m_maxStackSize = std::max(m_maxStackSize, m_openEventIds.size() + 1);
+ m_maxStackSize = std::max(qsizetype(m_maxStackSize), qsizetype(m_openEventIds.size() + 1));
int index = 0;
qint64 duration = -1;
if (eventPhase == CtfEventTypeBegin) {
diff --git a/src/plugins/perfprofiler/perfevent.h b/src/plugins/perfprofiler/perfevent.h
index dcee855e38..378452646e 100644
--- a/src/plugins/perfprofiler/perfevent.h
+++ b/src/plugins/perfprofiler/perfevent.h
@@ -31,6 +31,7 @@
#include <tracing/traceevent.h>
#include <utils/qtcassert.h>
+#include <QVariant>
#include <QVector>
#include <QDataStream>
diff --git a/src/plugins/qmlprofiler/inputeventsmodel.cpp b/src/plugins/qmlprofiler/inputeventsmodel.cpp
index 386b57806a..5e2b7cb765 100644
--- a/src/plugins/qmlprofiler/inputeventsmodel.cpp
+++ b/src/plugins/qmlprofiler/inputeventsmodel.cpp
@@ -72,7 +72,12 @@ QVariantList InputEventsModel::labels() const
QMetaEnum InputEventsModel::metaEnum(const char *name)
{
- return staticQtMetaObject.enumerator(staticQtMetaObject.indexOfEnumerator(name));
+ return
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ staticQtMetaObject.enumerator(staticQtMetaObject.indexOfEnumerator(name));
+#else // < Qt 6
+ Qt::staticMetaObject.enumerator(Qt::staticMetaObject.indexOfEnumerator(name));
+#endif // < Qt 6
}
QVariantMap InputEventsModel::details(int index) const
diff --git a/src/plugins/qmlprofiler/qmlprofilerbindingloopsrenderpass.cpp b/src/plugins/qmlprofiler/qmlprofilerbindingloopsrenderpass.cpp
index f7eaab21a2..892f384b6a 100644
--- a/src/plugins/qmlprofiler/qmlprofilerbindingloopsrenderpass.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerbindingloopsrenderpass.cpp
@@ -34,7 +34,11 @@ namespace Internal {
class BindingLoopMaterial : public QSGMaterial {
public:
QSGMaterialType *type() const override;
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QSGMaterialShader *createShader() const override;
+#else
+ QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override;
+#endif // < Qt 6
BindingLoopMaterial();
};
@@ -196,8 +200,8 @@ Timeline::TimelineRenderPass::State *QmlProfilerBindingLoopsRenderPass::update(
const QSGGeometry::AttributeSet &BindlingLoopsGeometry::point2DWithOffset()
{
static QSGGeometry::Attribute data[] = {
- QSGGeometry::Attribute::create(0, 2, GL_FLOAT, true),
- QSGGeometry::Attribute::create(1, 2, GL_FLOAT),
+ QSGGeometry::Attribute::create(0, 2, QSGGeometry::FloatType, true),
+ QSGGeometry::Attribute::create(1, 2, QSGGeometry::FloatType),
};
static QSGGeometry::AttributeSet attrs = {
2,
@@ -215,10 +219,10 @@ Point2DWithOffset *BindlingLoopsGeometry::vertexData()
const QSGGeometry::Attribute *attributes = geometry->attributes();
Q_ASSERT(attributes[0].position == 0);
Q_ASSERT(attributes[0].tupleSize == 2);
- Q_ASSERT(attributes[0].type == GL_FLOAT);
+ Q_ASSERT(attributes[0].type == QSGGeometry::FloatType);
Q_ASSERT(attributes[1].position == 1);
Q_ASSERT(attributes[1].tupleSize == 2);
- Q_ASSERT(attributes[1].type == GL_FLOAT);
+ Q_ASSERT(attributes[1].type == QSGGeometry::FloatType);
Q_UNUSED(attributes)
return static_cast<Point2DWithOffset *>(geometry->vertexData());
}
@@ -290,12 +294,19 @@ class BindingLoopMaterialShader : public QSGMaterialShader
public:
BindingLoopMaterialShader();
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void updateState(const RenderState &state, QSGMaterial *newEffect,
QSGMaterial *oldEffect) override;
char const *const *attributeNames() const override;
+#else // < Qt 6
+ bool updateUniformData(RenderState &state, QSGMaterial *newEffect,
+ QSGMaterial *oldEffect) override;
+#endif // < Qt 6
private:
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void initialize() override;
+#endif // < Qt 6
int m_matrix_id = 0;
int m_z_range_id = 0;
@@ -305,10 +316,16 @@ private:
BindingLoopMaterialShader::BindingLoopMaterialShader()
: QSGMaterialShader()
{
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qmlprofiler/bindingloops.vert"));
setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qmlprofiler/bindingloops.frag"));
+#else // < Qt 6
+ setShaderFileName(VertexStage, ":/qmlprofiler/bindingloops.vert");
+ setShaderFileName(FragmentStage, ":/qmlprofiler/bindingloops.frag");
+#endif // < Qt 6
}
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void BindingLoopMaterialShader::updateState(const RenderState &state, QSGMaterial *, QSGMaterial *)
{
if (state.isMatrixDirty()) {
@@ -319,7 +336,19 @@ void BindingLoopMaterialShader::updateState(const RenderState &state, QSGMateria
Utils::creatorTheme()->color(Utils::Theme::Timeline_HighlightColor));
}
}
+#else // < Qt 6
+bool BindingLoopMaterialShader::updateUniformData(RenderState &state,
+ QSGMaterial *newMaterial, QSGMaterial *)
+{
+ // TODO: Make this work
+ if (state.isMatrixDirty()) {
+ BindingLoopMaterial *material = static_cast<BindingLoopMaterial *>(newMaterial);
+ }
+ return state.isMatrixDirty();
+}
+#endif // < Qt 6
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
char const *const *BindingLoopMaterialShader::attributeNames() const
{
static const char *const attr[] = {"vertexCoord", "postScaleOffset", nullptr};
@@ -332,7 +361,7 @@ void BindingLoopMaterialShader::initialize()
m_z_range_id = program()->uniformLocation("_qt_zRange");
m_color_id = program()->uniformLocation("bindingLoopsColor");
}
-
+#endif // < Qt 6
BindingLoopMaterial::BindingLoopMaterial()
{
@@ -345,10 +374,19 @@ QSGMaterialType *BindingLoopMaterial::type() const
return &type;
}
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QSGMaterialShader *BindingLoopMaterial::createShader() const
{
return new BindingLoopMaterialShader;
}
+#else // < Qt 6
+QSGMaterialShader *BindingLoopMaterial::createShader(
+ QSGRendererInterface::RenderMode renderMode) const
+{
+ Q_UNUSED(renderMode);
+ return new BindingLoopMaterialShader;
+}
+#endif // < Qt 6
void Point2DWithOffset::set(float nx, float ny, float nx2, float ny2)
{
diff --git a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp
index c994c37719..e2531e9fe8 100644
--- a/src/plugins/qmlprofiler/qmlprofilertracefile.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertracefile.cpp
@@ -152,7 +152,7 @@ void QmlProfilerTraceFile::loadQtd(QIODevice *device)
while (validVersion && !stream.atEnd() && !stream.hasError() && !isCanceled()) {
QXmlStreamReader::TokenType token = stream.readNext();
- const QStringRef elementName = stream.name();
+ const QStringView elementName = stream.name();
switch (token) {
case QXmlStreamReader::StartDocument : continue;
case QXmlStreamReader::StartElement : {
@@ -327,7 +327,7 @@ void QmlProfilerTraceFile::loadEventTypes(QXmlStreamReader &stream)
while (!stream.atEnd() && !stream.hasError() && !isCanceled()) {
QXmlStreamReader::TokenType token = stream.readNext();
- const QStringRef elementName = stream.name();
+ const QStringView elementName = stream.name();
switch (token) {
case QXmlStreamReader::StartElement: {
@@ -503,7 +503,7 @@ void QmlProfilerTraceFile::loadEvents(QXmlStreamReader &stream)
while (!stream.atEnd() && !stream.hasError() && !isCanceled()) {
QXmlStreamReader::TokenType token = stream.readNext();
- const QStringRef elementName = stream.name();
+ const QStringView elementName = stream.name();
switch (token) {
case QXmlStreamReader::StartElement: {
@@ -588,7 +588,7 @@ void QmlProfilerTraceFile::loadNotes(QXmlStreamReader &stream)
while (!stream.atEnd() && !stream.hasError() && !isCanceled()) {
QXmlStreamReader::TokenType token = stream.readNext();
- const QStringRef elementName = stream.name();
+ const QStringView elementName = stream.name();
switch (token) {
case QXmlStreamReader::StartElement: {
diff --git a/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp
index 0ff9af14b3..642720f34b 100644
--- a/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp
+++ b/src/plugins/qmlprofiler/tests/qmlprofilerbindingloopsrenderpass_test.cpp
@@ -119,11 +119,18 @@ void QmlProfilerBindingLoopsRenderPassTest::testUpdate()
QCOMPARE(node->geometry()->vertexCount(), 7 * 18);
QVERIFY(material2 != nullptr);
QCOMPARE(material1->type(), material2->type());
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QSGMaterialShader *shader1 = material1->createShader();
QVERIFY(shader1 != nullptr);
QSGMaterialShader *shader2 = material2->createShader();
QVERIFY(shader2 != nullptr);
QCOMPARE(shader1->attributeNames(), shader2->attributeNames());
+#else // < Qt 6
+ QSGMaterialShader *shader1 = material1->createShader(QSGRendererInterface::RenderMode2D);
+ QVERIFY(shader1 != 0);
+ QSGMaterialShader *shader2 = material2->createShader(QSGRendererInterface::RenderMode2D);
+ QVERIFY(shader2 != 0);
+#endif // < Qt 6
delete shader1;
delete shader2;
diff --git a/tests/auto/tracing/flamegraphview/tst_flamegraphview.cpp b/tests/auto/tracing/flamegraphview/tst_flamegraphview.cpp
index e48c5f2160..c155f97199 100644
--- a/tests/auto/tracing/flamegraphview/tst_flamegraphview.cpp
+++ b/tests/auto/tracing/flamegraphview/tst_flamegraphview.cpp
@@ -100,7 +100,9 @@ public:
{
for (int i = 0; i < d->colors.count(); ++i) {
d->colors[i] = QPair<QColor, QString>(
- QColor::fromRgb(qrand() % 256, qrand() % 256, qrand() % 256),
+ QColor::fromRgb(QRandomGenerator::global()->bounded(256),
+ QRandomGenerator::global()->bounded(256),
+ QRandomGenerator::global()->bounded(256)),
QString::number(i));
}
}
diff --git a/tests/auto/tracing/timelineitemsrenderpass/tst_timelineitemsrenderpass.cpp b/tests/auto/tracing/timelineitemsrenderpass/tst_timelineitemsrenderpass.cpp
index 7a987332b8..387e539e33 100644
--- a/tests/auto/tracing/timelineitemsrenderpass/tst_timelineitemsrenderpass.cpp
+++ b/tests/auto/tracing/timelineitemsrenderpass/tst_timelineitemsrenderpass.cpp
@@ -111,11 +111,18 @@ void tst_TimelineItemsRenderPass::update()
QCOMPARE(node->geometry()->vertexCount(), 30);
QVERIFY(material2 != 0);
QCOMPARE(material1->type(), material2->type());
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QSGMaterialShader *shader1 = material1->createShader();
QVERIFY(shader1 != 0);
QSGMaterialShader *shader2 = material2->createShader();
QVERIFY(shader2 != 0);
QCOMPARE(shader1->attributeNames(), shader2->attributeNames());
+#else // < Qt 6
+ QSGMaterialShader *shader1 = material1->createShader(QSGRendererInterface::RenderMode2D);
+ QVERIFY(shader1 != 0);
+ QSGMaterialShader *shader2 = material2->createShader(QSGRendererInterface::RenderMode2D);
+ QVERIFY(shader2 != 0);
+#endif // < Qt 6
delete shader1;
delete shader2;
diff --git a/tests/auto/tracing/timelinenotesrenderpass/tst_timelinenotesrenderpass.cpp b/tests/auto/tracing/timelinenotesrenderpass/tst_timelinenotesrenderpass.cpp
index f7891b37d7..8700d63dd9 100644
--- a/tests/auto/tracing/timelinenotesrenderpass/tst_timelinenotesrenderpass.cpp
+++ b/tests/auto/tracing/timelinenotesrenderpass/tst_timelinenotesrenderpass.cpp
@@ -121,11 +121,18 @@ void tst_TimelineNotesRenderPass::update()
QCOMPARE(node->geometry()->vertexCount(), 2);
QVERIFY(material2 != 0);
QCOMPARE(material1->type(), material2->type());
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QSGMaterialShader *shader1 = material1->createShader();
QVERIFY(shader1 != 0);
QSGMaterialShader *shader2 = material2->createShader();
QVERIFY(shader2 != 0);
QCOMPARE(shader1->attributeNames(), shader2->attributeNames());
+#else // < Qt 6
+ QSGMaterialShader *shader1 = material1->createShader(QSGRendererInterface::RenderMode2D);
+ QVERIFY(shader1 != 0);
+ QSGMaterialShader *shader2 = material2->createShader(QSGRendererInterface::RenderMode2D);
+ QVERIFY(shader2 != 0);
+#endif // < Qt 6
delete shader1;
delete shader2;
diff --git a/tests/auto/tracing/timelinerenderer/tst_timelinerenderer.cpp b/tests/auto/tracing/timelinerenderer/tst_timelinerenderer.cpp
index 5378df4467..5fe7fe4695 100644
--- a/tests/auto/tracing/timelinerenderer/tst_timelinerenderer.cpp
+++ b/tests/auto/tracing/timelinerenderer/tst_timelinerenderer.cpp
@@ -95,6 +95,7 @@ void tst_TimelineRenderer::testMouseEvents(DummyRenderer *renderer, int x, int y
QHoverEvent hover(QMouseEvent::HoverMove, QPointF(x, y), QPointF(x - 1, y));
renderer->hoverMoveEvent(&hover);
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
event = QMouseEvent(QMouseEvent::MouseButtonPress, QPointF(x, y), Qt::LeftButton,
Qt::LeftButton, Qt::NoModifier);
renderer->mousePressEvent(&event);
@@ -102,8 +103,7 @@ void tst_TimelineRenderer::testMouseEvents(DummyRenderer *renderer, int x, int y
event = QMouseEvent(QMouseEvent::MouseButtonRelease, QPointF(x, y), Qt::LeftButton,
Qt::LeftButton, Qt::NoModifier);
renderer->mouseReleaseEvent(&event);
-
-
+#endif // < Qt 6
}
void tst_TimelineRenderer::mouseEvents()
diff --git a/tests/auto/tracing/timelineselectionrenderpass/tst_timelineselectionrenderpass.cpp b/tests/auto/tracing/timelineselectionrenderpass/tst_timelineselectionrenderpass.cpp
index 2456ab6674..e4092f725d 100644
--- a/tests/auto/tracing/timelineselectionrenderpass/tst_timelineselectionrenderpass.cpp
+++ b/tests/auto/tracing/timelineselectionrenderpass/tst_timelineselectionrenderpass.cpp
@@ -84,7 +84,7 @@ void compareSelectionNode(QSGNode *node, const QRectF &rect, int selectionId)
QSGGeometryNode *geometryNode = static_cast<QSGGeometryNode *>(node);
QSGGeometry *geometry = geometryNode->geometry();
QCOMPARE(geometry->vertexCount(), 4);
- QCOMPARE(geometry->drawingMode(), (GLenum)GL_TRIANGLE_STRIP);
+ QCOMPARE(geometry->drawingMode(), QSGGeometry::DrawTriangleStrip);
OpaqueColoredPoint2DWithSize *data =
static_cast<OpaqueColoredPoint2DWithSize *>(geometry->vertexData());
float *lowerLeft = reinterpret_cast<float *>(data);