forked from qt-creator/qt-creator
Tracing/QmlProfiler/PerfProfiler/CtfVisualizer: Remove pre Qt 6.2 code
- Remove code for Qt below 6.2 from c++ sources and CMakeLists.txt - Remove Qml code from .qrc files - Qbs: Add qt.core.resource_data Groups for Qml code - Remove OpenGL shader .frag and .vert files - Remove Qml import version numbers Change-Id: I3bd1cd95381e66c98ee3af4259e89b0b1eff0709 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
@@ -32,94 +32,82 @@ set(TRACING_CPP_SOURCES
|
||||
tracing_global.h
|
||||
)
|
||||
|
||||
if(${Qt5_VERSION} VERSION_LESS "6.2.0")
|
||||
add_qtc_library(Tracing
|
||||
FEATURE_INFO
|
||||
DEPENDS Utils Qt5::Qml Qt5::Quick
|
||||
PUBLIC_DEPENDS Qt5::Widgets
|
||||
SOURCES
|
||||
${TEST_SOURCES}
|
||||
${TRACING_CPP_SOURCES}
|
||||
qml/tracing.qrc
|
||||
)
|
||||
else() # < Qt 6.2
|
||||
find_package(Qt6 COMPONENTS ShaderTools QUIET)
|
||||
find_package(Qt6 COMPONENTS ShaderTools QUIET)
|
||||
|
||||
add_qtc_library(Tracing
|
||||
CONDITION TARGET Qt6::ShaderTools AND TARGET Qt5::Quick
|
||||
FEATURE_INFO
|
||||
DEPENDS Utils Qt5::Qml Qt5::Quick
|
||||
PUBLIC_DEPENDS Qt5::Widgets
|
||||
SOURCES
|
||||
${TEST_SOURCES}
|
||||
)
|
||||
add_qtc_library(Tracing
|
||||
CONDITION TARGET Qt6::ShaderTools AND TARGET Qt5::Quick
|
||||
FEATURE_INFO
|
||||
DEPENDS Utils Qt5::Qml Qt5::Quick
|
||||
PUBLIC_DEPENDS Qt5::Widgets
|
||||
SOURCES
|
||||
${TEST_SOURCES}
|
||||
)
|
||||
|
||||
if (NOT TARGET Tracing)
|
||||
return()
|
||||
endif()
|
||||
if (NOT TARGET Tracing)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(TRACING_QML_FILES
|
||||
qml/ButtonsBar.qml
|
||||
qml/CategoryLabel.qml
|
||||
qml/Detail.qml
|
||||
qml/FlameGraphDelegate.qml
|
||||
qml/FlameGraphView.qml
|
||||
qml/ImageToolButton.qml
|
||||
qml/MainView.qml
|
||||
qml/Overview.qml
|
||||
qml/RangeDetails.qml
|
||||
qml/RangeMover.qml
|
||||
qml/RowLabel.qml
|
||||
qml/SelectionRange.qml
|
||||
qml/SelectionRangeDetails.qml
|
||||
qml/TimeDisplay.qml
|
||||
qml/TimelineContent.qml
|
||||
qml/TimelineLabels.qml
|
||||
qml/TimelineRulers.qml
|
||||
qml/TimelineText.qml
|
||||
qml/TimeMarks.qml
|
||||
)
|
||||
set(TRACING_QML_FILES
|
||||
qml/ButtonsBar.qml
|
||||
qml/CategoryLabel.qml
|
||||
qml/Detail.qml
|
||||
qml/FlameGraphDelegate.qml
|
||||
qml/FlameGraphView.qml
|
||||
qml/ImageToolButton.qml
|
||||
qml/MainView.qml
|
||||
qml/Overview.qml
|
||||
qml/RangeDetails.qml
|
||||
qml/RangeMover.qml
|
||||
qml/RowLabel.qml
|
||||
qml/SelectionRange.qml
|
||||
qml/SelectionRangeDetails.qml
|
||||
qml/TimeDisplay.qml
|
||||
qml/TimelineContent.qml
|
||||
qml/TimelineLabels.qml
|
||||
qml/TimelineRulers.qml
|
||||
qml/TimelineText.qml
|
||||
qml/TimeMarks.qml
|
||||
)
|
||||
|
||||
set(TRACING_QML_RESOURCES
|
||||
qml/ico_edit.png
|
||||
qml/ico_edit@2x.png
|
||||
qml/ico_rangeselected.png
|
||||
qml/ico_rangeselected@2x.png
|
||||
qml/ico_rangeselection.png
|
||||
qml/ico_rangeselection@2x.png
|
||||
qml/ico_selectionmode.png
|
||||
qml/ico_selectionmode@2x.png
|
||||
qml/range_handle.png
|
||||
qml/range_handle@2.png
|
||||
)
|
||||
set(TRACING_QML_RESOURCES
|
||||
qml/ico_edit.png
|
||||
qml/ico_edit@2x.png
|
||||
qml/ico_rangeselected.png
|
||||
qml/ico_rangeselected@2x.png
|
||||
qml/ico_rangeselection.png
|
||||
qml/ico_rangeselection@2x.png
|
||||
qml/ico_selectionmode.png
|
||||
qml/ico_selectionmode@2x.png
|
||||
qml/range_handle.png
|
||||
qml/range_handle@2.png
|
||||
)
|
||||
|
||||
foreach(file IN LISTS TRACING_QML_FILES TRACING_QML_RESOURCES)
|
||||
get_filename_component(fileName "${file}" NAME)
|
||||
set_source_files_properties("${file}" PROPERTIES QT_RESOURCE_ALIAS "${fileName}")
|
||||
endforeach()
|
||||
foreach(file IN LISTS TRACING_QML_FILES TRACING_QML_RESOURCES)
|
||||
get_filename_component(fileName "${file}" NAME)
|
||||
set_source_files_properties("${file}" PROPERTIES QT_RESOURCE_ALIAS "${fileName}")
|
||||
endforeach()
|
||||
|
||||
qt_add_shaders(Tracing "res_tracingshaders"
|
||||
BATCHABLE
|
||||
PREFIX
|
||||
"/QtCreator/Tracing"
|
||||
BASE
|
||||
"qml"
|
||||
FILES
|
||||
qml/notes_qt6.vert
|
||||
qml/notes_qt6.frag
|
||||
qml/timelineitems_qt6.vert
|
||||
qml/timelineitems_qt6.frag
|
||||
)
|
||||
qt_add_shaders(Tracing "res_tracingshaders"
|
||||
BATCHABLE
|
||||
PREFIX
|
||||
"/QtCreator/Tracing"
|
||||
BASE
|
||||
"qml"
|
||||
FILES
|
||||
qml/notes_qt6.vert
|
||||
qml/notes_qt6.frag
|
||||
qml/timelineitems_qt6.vert
|
||||
qml/timelineitems_qt6.frag
|
||||
)
|
||||
|
||||
qt_add_qml_module(Tracing
|
||||
URI "QtCreator.Tracing"
|
||||
VERSION "1.0"
|
||||
NO_PLUGIN
|
||||
QML_FILES
|
||||
${TRACING_QML_FILES}
|
||||
RESOURCES
|
||||
${TRACING_QML_RESOURCES}
|
||||
SOURCES
|
||||
${TRACING_CPP_SOURCES}
|
||||
)
|
||||
endif() # < Qt 6.2
|
||||
qt_add_qml_module(Tracing
|
||||
URI "QtCreator.Tracing"
|
||||
VERSION "1.0"
|
||||
NO_PLUGIN
|
||||
QML_FILES
|
||||
${TRACING_QML_FILES}
|
||||
RESOURCES
|
||||
${TRACING_QML_RESOURCES}
|
||||
SOURCES
|
||||
${TRACING_CPP_SOURCES}
|
||||
)
|
||||
|
@@ -49,9 +49,7 @@ class TRACING_EXPORT FlameGraph : public QQuickItem
|
||||
Q_PROPERTY(bool zoomed READ isZoomed NOTIFY rootChanged)
|
||||
Q_PROPERTY(int selectedTypeId READ selectedTypeId WRITE setSelectedTypeId
|
||||
NOTIFY selectedTypeIdChanged)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
|
||||
QML_ELEMENT
|
||||
#endif // Qt >= 6.2
|
||||
|
||||
public:
|
||||
FlameGraph(QQuickItem *parent = nullptr);
|
||||
|
@@ -23,11 +23,11 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import QtCreator.Tracing 1.0
|
||||
import QtCreator.Tracing
|
||||
|
||||
ToolBar {
|
||||
id: buttons
|
||||
|
@@ -23,10 +23,10 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
import QtCreator.Tracing 1.0
|
||||
import QtCreator.Tracing
|
||||
|
||||
Item {
|
||||
id: labelContainer
|
||||
|
@@ -23,7 +23,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick
|
||||
|
||||
TimelineText {
|
||||
property bool isLabel: false
|
||||
|
@@ -23,8 +23,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtCreator.Tracing 1.0
|
||||
import QtQuick
|
||||
import QtCreator.Tracing
|
||||
|
||||
Item {
|
||||
id: flamegraphItem
|
||||
|
@@ -23,12 +23,12 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtCreator.Tracing 1.0
|
||||
import QtCreator.Tracing
|
||||
|
||||
import QtQml 2.2
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Controls.Material 2.3
|
||||
import QtQml
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Material
|
||||
|
||||
ScrollView {
|
||||
id: root
|
||||
|
@@ -23,10 +23,10 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
import QtCreator.Tracing 1.0
|
||||
import QtCreator.Tracing
|
||||
|
||||
ToolButton {
|
||||
implicitWidth: 30
|
||||
|
@@ -23,10 +23,10 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
import QtCreator.Tracing 1.0
|
||||
import QtCreator.Tracing
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
|
@@ -23,8 +23,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtCreator.Tracing 1.0
|
||||
import QtQuick
|
||||
import QtCreator.Tracing
|
||||
|
||||
Rectangle {
|
||||
id: overview
|
||||
|
@@ -23,10 +23,10 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.9
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
import QtCreator.Tracing 1.0
|
||||
import QtCreator.Tracing
|
||||
|
||||
Item {
|
||||
id: rangeDetails
|
||||
|
@@ -23,8 +23,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtCreator.Tracing 1.0
|
||||
import QtQuick
|
||||
import QtCreator.Tracing
|
||||
|
||||
Item {
|
||||
id: rangeMover
|
||||
|
@@ -23,9 +23,9 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 2.2
|
||||
import QtCreator.Tracing 1.0
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtCreator.Tracing
|
||||
|
||||
Button {
|
||||
id: button
|
||||
|
@@ -23,7 +23,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick
|
||||
|
||||
RangeMover {
|
||||
id: selectionRange
|
||||
|
@@ -23,10 +23,10 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
import QtCreator.Tracing 1.0
|
||||
import QtCreator.Tracing
|
||||
|
||||
Item {
|
||||
id: selectionRangeDetails
|
||||
|
@@ -23,8 +23,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtCreator.Tracing 1.0
|
||||
import QtQuick
|
||||
import QtCreator.Tracing
|
||||
|
||||
Item {
|
||||
id: timeDisplay
|
||||
|
@@ -23,8 +23,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtCreator.Tracing 1.0
|
||||
import QtQuick
|
||||
import QtCreator.Tracing
|
||||
|
||||
Item {
|
||||
id: timeMarks
|
||||
|
@@ -23,10 +23,10 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 2.2
|
||||
import QtCreator.Tracing 1.0
|
||||
import QtQml.Models 2.1
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtCreator.Tracing
|
||||
import QtQml.Models
|
||||
|
||||
Flickable {
|
||||
id: flick
|
||||
|
@@ -23,9 +23,9 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQml.Models 2.1
|
||||
import QtCreator.Tracing 1.0
|
||||
import QtQuick
|
||||
import QtQml.Models
|
||||
import QtCreator.Tracing
|
||||
|
||||
Flickable {
|
||||
id: categories
|
||||
|
@@ -23,8 +23,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtCreator.Tracing 1.0
|
||||
import QtQuick
|
||||
import QtCreator.Tracing
|
||||
|
||||
Item {
|
||||
id: rulersParent
|
||||
|
@@ -23,8 +23,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtCreator.Tracing 1.0
|
||||
import QtQuick
|
||||
import QtCreator.Tracing
|
||||
|
||||
Text {
|
||||
font.pixelSize: 12
|
||||
|
@@ -1,32 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
varying lowp vec4 color;
|
||||
varying lowp float d;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = color * float(d < (2.0 / 3.0) || d > (5.0 / 6.0));
|
||||
}
|
@@ -1,42 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
attribute vec4 vertexCoord;
|
||||
attribute float distanceFromTop;
|
||||
|
||||
uniform mat4 matrix;
|
||||
uniform vec4 notesColor;
|
||||
|
||||
varying vec4 color;
|
||||
varying float d;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = matrix * vertexCoord;
|
||||
gl_Position.z -= 0.1;
|
||||
gl_Position.w = 1.0;
|
||||
color = notesColor;
|
||||
d = distanceFromTop;
|
||||
}
|
@@ -1,44 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef GL_OES_standard_derivatives
|
||||
#extension GL_OES_standard_derivatives : enable
|
||||
// else we probably have fwidth() in core
|
||||
#endif
|
||||
|
||||
varying lowp vec3 edgeColor;
|
||||
varying lowp vec3 color;
|
||||
varying lowp vec2 barycentric;
|
||||
|
||||
void main()
|
||||
{
|
||||
lowp vec2 d = fwidth(barycentric) * 4.0;
|
||||
lowp vec4 edge_closeness = step(vec4(d.x, d.y, d.x, d.y),
|
||||
vec4(barycentric.x, barycentric.y, 1.0 - barycentric.x, 1.0 - barycentric.y));
|
||||
lowp float total = min(min(edge_closeness[0], edge_closeness[1]),
|
||||
min(edge_closeness[2], edge_closeness[3]));
|
||||
gl_FragColor.rgb = mix(edgeColor, color, total);
|
||||
gl_FragColor.a = 1.0;
|
||||
}
|
@@ -1,59 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
attribute vec4 vertexCoord;
|
||||
attribute vec2 rectSize;
|
||||
attribute float selectionId;
|
||||
attribute vec4 vertexColor;
|
||||
|
||||
uniform vec2 scale;
|
||||
uniform mat4 matrix;
|
||||
uniform vec4 selectionColor;
|
||||
uniform float selectedItem;
|
||||
|
||||
varying vec3 color;
|
||||
varying vec3 edgeColor;
|
||||
varying vec2 barycentric;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = matrix * vertexCoord;
|
||||
|
||||
// Make very narrow events somewhat wider so that they don't collapse into 0 pixels
|
||||
float scaledWidth = scale.x * rectSize.x;
|
||||
float shift = sign(rectSize.x) * max(0.0, 3.0 - abs(scaledWidth)) * 0.0005;
|
||||
gl_Position.x += shift;
|
||||
|
||||
// Ditto for events with very small height
|
||||
float scaledHeight = scale.y * rectSize.y;
|
||||
gl_Position.y += float(rectSize.y > 0.0) * max(0.0, 3.0 - scaledHeight) * 0.003;
|
||||
|
||||
barycentric = vec2(rectSize.x > 0.0 ? 1.0 : 0.0, rectSize.y > 0.0 ? 1.0 : 0.0);
|
||||
color = vertexColor.rgb;
|
||||
float selected = min(1.0, abs(selectionId - selectedItem));
|
||||
edgeColor = mix(selectionColor.rgb, vertexColor.rgb, selected);
|
||||
gl_Position.z += mix(0.0, (shift + 0.0015) / 10.0, selected);
|
||||
gl_Position.w = 1.0;
|
||||
}
|
@@ -30,26 +30,12 @@
|
||||
#include <QOpenGLContext>
|
||||
#include <QOffscreenSurface>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#include <QSGEngine>
|
||||
#include <QSGAbstractRenderer>
|
||||
#endif // < Qt 6
|
||||
|
||||
namespace Timeline {
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
static void renderMessageHandler(QtMsgType type, const QMessageLogContext &context,
|
||||
const QString &message)
|
||||
{
|
||||
if (type > QtDebugMsg)
|
||||
QTest::qFail(message.toLatin1().constData(), context.file, context.line);
|
||||
else
|
||||
QTest::qWarn(message.toLatin1().constData(), context.file, context.line);
|
||||
}
|
||||
#endif // < Qt 6
|
||||
|
||||
void runSceneGraphTest(QSGNode *node)
|
||||
{
|
||||
Q_UNUSED(node)
|
||||
|
||||
QSurfaceFormat format;
|
||||
format.setStencilBufferSize(8);
|
||||
format.setDepthBufferSize(24);
|
||||
@@ -64,26 +50,6 @@ void runSceneGraphTest(QSGNode *node)
|
||||
|
||||
QVERIFY(context.makeCurrent(&surface));
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QSGEngine engine;
|
||||
QSGRootNode root;
|
||||
root.appendChildNode(node);
|
||||
engine.initialize(&context);
|
||||
|
||||
QSGAbstractRenderer *renderer = engine.createRenderer();
|
||||
QVERIFY(renderer != 0);
|
||||
renderer->setRootNode(&root);
|
||||
QtMessageHandler originalHandler = qInstallMessageHandler(renderMessageHandler);
|
||||
renderer->renderScene();
|
||||
qInstallMessageHandler(originalHandler);
|
||||
delete renderer;
|
||||
|
||||
// Unfortunately we cannot check the results of the rendering. But at least we know the shaders
|
||||
// have not crashed here.
|
||||
#else
|
||||
Q_UNUSED(node)
|
||||
#endif // < Qt 6
|
||||
|
||||
context.doneCurrent();
|
||||
}
|
||||
|
||||
|
@@ -86,14 +86,4 @@ QString formatTime(qint64 timestamp, qint64 reference)
|
||||
}
|
||||
}
|
||||
|
||||
void TimeFormatter::setupTimeFormatter()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 2, 0)
|
||||
static const int typeIndex = qmlRegisterSingletonType<TimeFormatter>(
|
||||
"QtCreator.Tracing", 1, 0, "TimeFormatter",
|
||||
[](QQmlEngine *, QJSEngine *){ return new TimeFormatter; });
|
||||
Q_UNUSED(typeIndex)
|
||||
#endif // Qt < 6.2
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -36,18 +36,14 @@ QString TRACING_EXPORT formatTime(qint64 timestamp,
|
||||
|
||||
class TRACING_EXPORT TimeFormatter : public QObject {
|
||||
Q_OBJECT
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
|
||||
QML_ELEMENT
|
||||
QML_SINGLETON
|
||||
#endif // Qt >= 6.2
|
||||
|
||||
public:
|
||||
Q_INVOKABLE QString format(qint64 timestamp, qint64 reference)
|
||||
{
|
||||
return formatTime(timestamp, reference);
|
||||
}
|
||||
|
||||
static void setupTimeFormatter();
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -45,11 +45,7 @@ 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) const override;
|
||||
#endif // < Qt 6
|
||||
|
||||
private:
|
||||
QVector2D m_scale;
|
||||
|
@@ -54,9 +54,7 @@ class TRACING_EXPORT TimelineModel : public QObject
|
||||
Q_PROPERTY(QVariantList labels READ labels NOTIFY labelsChanged)
|
||||
Q_PROPERTY(int count READ count NOTIFY contentChanged)
|
||||
Q_PROPERTY(int defaultRowHeight READ defaultRowHeight CONSTANT)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
|
||||
QML_ANONYMOUS
|
||||
#endif // Qt >= 6.2
|
||||
|
||||
public:
|
||||
class TimelineModelPrivate;
|
||||
|
@@ -36,9 +36,7 @@ class TRACING_EXPORT TimelineNotesModel : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int count READ count NOTIFY changed)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
|
||||
QML_ANONYMOUS
|
||||
#endif // Qt >= 6.2
|
||||
|
||||
public:
|
||||
TimelineNotesModel(QObject *parent = nullptr);
|
||||
|
@@ -41,11 +41,7 @@ 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) const final;
|
||||
#endif // < Qt 6
|
||||
};
|
||||
|
||||
struct NotesGeometry
|
||||
@@ -180,9 +176,9 @@ TimelineNotesRenderPassState::TimelineNotesRenderPassState(int numExpandedRows)
|
||||
m_material.setFlag(QSGMaterial::Blending, true);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
|
||||
m_material.setFlag(QSGMaterial::NoBatching, true);
|
||||
#elif QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
#else
|
||||
m_material.setFlag(QSGMaterial::CustomCompileStep, true);
|
||||
#endif // >= Qt 6.3/6.0
|
||||
#endif // >= Qt 6.3
|
||||
m_expandedRows.reserve(numExpandedRows);
|
||||
for (int i = 0; i < numExpandedRows; ++i)
|
||||
m_expandedRows << createNode();
|
||||
@@ -234,34 +230,14 @@ 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 *, QSGMaterial *) override;
|
||||
#endif // < Qt 6
|
||||
|
||||
private:
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
void initialize() override;
|
||||
|
||||
int m_matrix_id;
|
||||
int m_z_range_id;
|
||||
int m_color_id;
|
||||
#endif // < Qt 6
|
||||
};
|
||||
|
||||
NotesMaterialShader::NotesMaterialShader()
|
||||
: QSGMaterialShader()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/QtCreator/Tracing/notes.vert"));
|
||||
setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/QtCreator/Tracing/notes.frag"));
|
||||
#else // < Qt 6
|
||||
setShaderFileName(VertexStage, ":/QtCreator/Tracing/notes_qt6.vert.qsb");
|
||||
setShaderFileName(FragmentStage, ":/QtCreator/Tracing/notes_qt6.frag.qsb");
|
||||
#endif // < Qt 6
|
||||
}
|
||||
|
||||
static QColor notesColor()
|
||||
@@ -271,16 +247,6 @@ static QColor notesColor()
|
||||
: QColor(255, 165, 0);
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
void NotesMaterialShader::updateState(const RenderState &state, QSGMaterial *, QSGMaterial *)
|
||||
{
|
||||
if (state.isMatrixDirty()) {
|
||||
program()->setUniformValue(m_matrix_id, state.combinedMatrix());
|
||||
program()->setUniformValue(m_z_range_id, GLfloat(1.0));
|
||||
program()->setUniformValue(m_color_id, notesColor());
|
||||
}
|
||||
}
|
||||
#else // < Qt 6
|
||||
bool NotesMaterialShader::updateUniformData(RenderState &state, QSGMaterial *, QSGMaterial *)
|
||||
{
|
||||
QByteArray *buf = state.uniformData();
|
||||
@@ -298,22 +264,6 @@ bool NotesMaterialShader::updateUniformData(RenderState &state, QSGMaterial *, Q
|
||||
|
||||
return true;
|
||||
}
|
||||
#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};
|
||||
return attr;
|
||||
}
|
||||
|
||||
void NotesMaterialShader::initialize()
|
||||
{
|
||||
m_matrix_id = program()->uniformLocation("matrix");
|
||||
m_z_range_id = program()->uniformLocation("_qt_zRange");
|
||||
m_color_id = program()->uniformLocation("notesColor");
|
||||
}
|
||||
#endif // < Qt 6
|
||||
|
||||
QSGMaterialType *NotesMaterial::type() const
|
||||
{
|
||||
@@ -321,11 +271,7 @@ QSGMaterialType *NotesMaterial::type() const
|
||||
return &type;
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QSGMaterialShader *NotesMaterial::createShader() const
|
||||
#else // < Qt 6
|
||||
QSGMaterialShader *NotesMaterial::createShader(QSGRendererInterface::RenderMode) const
|
||||
#endif // < Qt 6
|
||||
{
|
||||
return new NotesMaterialShader;
|
||||
}
|
||||
|
@@ -32,9 +32,7 @@ namespace Timeline {
|
||||
class TRACING_EXPORT TimelineOverviewRenderer : public TimelineAbstractRenderer
|
||||
{
|
||||
Q_OBJECT
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
|
||||
QML_ELEMENT
|
||||
#endif // Qt >= 6.2
|
||||
|
||||
public:
|
||||
TimelineOverviewRenderer(QQuickItem *parent = nullptr);
|
||||
|
@@ -38,9 +38,7 @@ namespace Timeline {
|
||||
class TRACING_EXPORT TimelineRenderer : public TimelineAbstractRenderer
|
||||
{
|
||||
Q_OBJECT
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
|
||||
QML_ELEMENT
|
||||
#endif // Qt >= 6.2
|
||||
|
||||
public:
|
||||
explicit TimelineRenderer(QQuickItem *parent = nullptr);
|
||||
|
@@ -107,12 +107,6 @@ TimelineTheme::TimelineTheme(QObject *parent)
|
||||
|
||||
void TimelineTheme::setupTheme(QQmlEngine *engine)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 2, 0)
|
||||
static const int typeIndex = qmlRegisterSingletonType<Utils::Theme>(
|
||||
"QtCreator.Tracing", 1, 0, "Theme",
|
||||
[](QQmlEngine *, QJSEngine *){ return Utils::proxyTheme(); });
|
||||
Q_UNUSED(typeIndex)
|
||||
#endif // Qt < 6.2
|
||||
engine->addImageProvider(QLatin1String("icons"), new TimelineImageIconProvider);
|
||||
}
|
||||
|
||||
|
@@ -37,10 +37,8 @@ namespace Timeline {
|
||||
class TRACING_EXPORT TimelineTheme : public Utils::Theme
|
||||
{
|
||||
Q_OBJECT
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
|
||||
QML_NAMED_ELEMENT(Theme)
|
||||
QML_SINGLETON
|
||||
#endif // Qt >= 6.2
|
||||
|
||||
public:
|
||||
explicit TimelineTheme(QObject *parent = nullptr);
|
||||
|
@@ -56,9 +56,7 @@ class TRACING_EXPORT TimelineZoomControl : public QObject {
|
||||
Q_PROPERTY(qint64 maximumZoomFactor READ maximumZoomFactor CONSTANT)
|
||||
Q_PROPERTY(qint64 minimumRangeLength READ minimumRangeLength CONSTANT)
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
|
||||
QML_ANONYMOUS
|
||||
#endif // Qt >= 6.2
|
||||
|
||||
public:
|
||||
qint64 maximumZoomFactor() const { return 1 << 10; }
|
||||
|
@@ -40,9 +40,10 @@ Project {
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "QML"
|
||||
prefix: "qml/"
|
||||
files: ["tracing.qrc"]
|
||||
name: "Qml Files"
|
||||
Qt.core.resourcePrefix: "QtCreator/Tracing/"
|
||||
fileTags: "qt.core.resource_data"
|
||||
files: "qml/**"
|
||||
}
|
||||
|
||||
Group {
|
||||
|
@@ -43,16 +43,6 @@ CtfVisualizerTraceView::CtfVisualizerTraceView(QWidget *parent, CtfVisualizerToo
|
||||
: QQuickWidget(parent)
|
||||
{
|
||||
setObjectName(QLatin1String("CtfVisualizerTraceView"));
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 2, 0)
|
||||
qmlRegisterType<Timeline::TimelineRenderer>("QtCreator.Tracing", 1, 0, "TimelineRenderer");
|
||||
qmlRegisterType<Timeline::TimelineOverviewRenderer>("QtCreator.Tracing", 1, 0,
|
||||
"TimelineOverviewRenderer");
|
||||
qmlRegisterAnonymousType<Timeline::TimelineZoomControl>("QtCreator.Tracing", 1);
|
||||
qmlRegisterAnonymousType<Timeline::TimelineModel>("QtCreator.Tracing", 1);
|
||||
qmlRegisterAnonymousType<Timeline::TimelineNotesModel>("QtCreator.Tracing", 1);
|
||||
#endif // Qt < 6.2
|
||||
|
||||
setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
||||
@@ -60,7 +50,6 @@ CtfVisualizerTraceView::CtfVisualizerTraceView(QWidget *parent, CtfVisualizerToo
|
||||
setMinimumHeight(170);
|
||||
|
||||
Timeline::TimelineTheme::setupTheme(engine());
|
||||
Timeline::TimeFormatter::setupTimeFormatter();
|
||||
|
||||
rootContext()->setContextProperty(QLatin1String("timelineModelAggregator"),
|
||||
tool->modelAggregator());
|
||||
|
@@ -39,40 +39,29 @@ set(PERFPROFILER_CPP_SOURCES
|
||||
perftracepointdialog.cpp perftracepointdialog.h perftracepointdialog.ui
|
||||
)
|
||||
|
||||
if(${Qt5_VERSION} VERSION_LESS "6.2.0")
|
||||
add_qtc_plugin(PerfProfiler
|
||||
DEPENDS Tracing Qt5::QuickWidgets
|
||||
PLUGIN_DEPENDS Core Debugger ProjectExplorer QtSupport
|
||||
SOURCES
|
||||
${TEST_SOURCES}
|
||||
${PERFPROFILER_CPP_SOURCES}
|
||||
perfprofiler.qrc
|
||||
)
|
||||
else() # < Qt 6.2
|
||||
add_qtc_plugin(PerfProfiler
|
||||
CONDITION TARGET Tracing
|
||||
DEPENDS Tracing Qt5::QuickWidgets
|
||||
PLUGIN_DEPENDS Core Debugger ProjectExplorer QtSupport
|
||||
SOURCES
|
||||
${TEST_SOURCES}
|
||||
)
|
||||
add_qtc_plugin(PerfProfiler
|
||||
CONDITION TARGET Tracing
|
||||
DEPENDS Tracing Qt5::QuickWidgets
|
||||
PLUGIN_DEPENDS Core Debugger ProjectExplorer QtSupport
|
||||
SOURCES
|
||||
${TEST_SOURCES}
|
||||
)
|
||||
|
||||
if (NOT TARGET PerfProfiler)
|
||||
return()
|
||||
endif()
|
||||
if (NOT TARGET PerfProfiler)
|
||||
return()
|
||||
endif()
|
||||
|
||||
qt_add_resources(PerfProfiler perfprofiler
|
||||
PREFIX "/perfprofiler"
|
||||
tracepoints.sh
|
||||
)
|
||||
qt_add_resources(PerfProfiler perfprofiler
|
||||
PREFIX "/perfprofiler"
|
||||
tracepoints.sh
|
||||
)
|
||||
|
||||
qt_add_qml_module(PerfProfiler
|
||||
URI "QtCreator.PerfProfiler"
|
||||
VERSION "1.0"
|
||||
NO_PLUGIN
|
||||
QML_FILES
|
||||
PerfProfilerFlameGraphView.qml
|
||||
SOURCES
|
||||
${PERFPROFILER_CPP_SOURCES}
|
||||
)
|
||||
endif() # < Qt 6.2
|
||||
qt_add_qml_module(PerfProfiler
|
||||
URI "QtCreator.PerfProfiler"
|
||||
VERSION "1.0"
|
||||
NO_PLUGIN
|
||||
QML_FILES
|
||||
PerfProfilerFlameGraphView.qml
|
||||
SOURCES
|
||||
${PERFPROFILER_CPP_SOURCES}
|
||||
)
|
||||
|
@@ -23,7 +23,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtCreator.PerfProfiler 1.0
|
||||
import QtCreator.PerfProfiler
|
||||
import "../Tracing" // TODO: Turn into module import when possible
|
||||
|
||||
FlameGraphView {
|
||||
|
@@ -70,6 +70,13 @@ QtcPlugin {
|
||||
"perfprofiler.qrc",
|
||||
]
|
||||
|
||||
Group {
|
||||
name: "Qml Files"
|
||||
Qt.core.resourcePrefix: "QtCreator/PerfProfiler/"
|
||||
fileTags: "qt.core.resource_data"
|
||||
files: [ "PerfProfilerFlameGraphView.qml" ]
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "Unit tests"
|
||||
condition: qtc.testsEnabled
|
||||
|
@@ -2,7 +2,4 @@
|
||||
<qresource prefix="/perfprofiler">
|
||||
<file>tracepoints.sh</file>
|
||||
</qresource>
|
||||
<qresource prefix="/QtCreator/PerfProfiler">
|
||||
<file>PerfProfilerFlameGraphView.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@@ -39,10 +39,8 @@ class PerfProfilerFlameGraphData;
|
||||
class PerfProfilerFlameGraphModel : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
|
||||
QML_ELEMENT
|
||||
QML_UNCREATABLE("use the context property")
|
||||
#endif // Qt >= 6.2
|
||||
Q_DISABLE_COPY(PerfProfilerFlameGraphModel);
|
||||
public:
|
||||
PerfProfilerFlameGraphModel(PerfProfilerFlameGraphModel &&) = delete;
|
||||
|
@@ -45,13 +45,6 @@ PerfProfilerFlameGraphView::PerfProfilerFlameGraphView(QWidget *parent, PerfProf
|
||||
PerfProfilerTraceManager *manager = tool->traceManager();
|
||||
m_model = new PerfProfilerFlameGraphModel(manager);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 2, 0)
|
||||
qmlRegisterType<FlameGraph::FlameGraph>("QtCreator.Tracing", 1, 0, "FlameGraph");
|
||||
qmlRegisterUncreatableType<PerfProfilerFlameGraphModel>(
|
||||
"QtCreator.PerfProfiler", 1, 0, "PerfProfilerFlameGraphModel",
|
||||
QLatin1String("use the context property"));
|
||||
#endif // Qt < 6.2
|
||||
|
||||
Timeline::TimelineTheme::setupTheme(engine());
|
||||
|
||||
rootContext()->setContextProperty(QStringLiteral("flameGraphModel"), m_model);
|
||||
|
@@ -41,16 +41,6 @@ PerfProfilerTraceView::PerfProfilerTraceView(QWidget *parent, PerfProfilerTool *
|
||||
: QQuickWidget(parent)
|
||||
{
|
||||
setObjectName(QLatin1String("PerfProfilerTraceView"));
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 2, 0)
|
||||
qmlRegisterType<Timeline::TimelineRenderer>("QtCreator.Tracing", 1, 0, "TimelineRenderer");
|
||||
qmlRegisterType<Timeline::TimelineOverviewRenderer>("QtCreator.Tracing", 1, 0,
|
||||
"TimelineOverviewRenderer");
|
||||
qmlRegisterAnonymousType<Timeline::TimelineZoomControl>("QtCreator.Tracing", 1);
|
||||
qmlRegisterAnonymousType<Timeline::TimelineModel>("QtCreator.Tracing", 1);
|
||||
qmlRegisterAnonymousType<Timeline::TimelineNotesModel>("QtCreator.Tracing", 1);
|
||||
#endif // Qt < 6.2
|
||||
|
||||
setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
||||
@@ -58,7 +48,6 @@ PerfProfilerTraceView::PerfProfilerTraceView(QWidget *parent, PerfProfilerTool *
|
||||
setMinimumHeight(170);
|
||||
|
||||
Timeline::TimelineTheme::setupTheme(engine());
|
||||
Timeline::TimeFormatter::setupTimeFormatter();
|
||||
|
||||
rootContext()->setContextProperty(QLatin1String("timelineModelAggregator"),
|
||||
tool->modelManager());
|
||||
@@ -76,11 +65,7 @@ PerfProfilerTraceView::PerfProfilerTraceView(QWidget *parent, PerfProfilerTool *
|
||||
|
||||
bool PerfProfilerTraceView::isUsable() const
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
return quickWindow()->rendererInterface()->graphicsApi() == QSGRendererInterface::OpenGL;
|
||||
#else
|
||||
return QSGRendererInterface::isApiRhiBased(quickWindow()->rendererInterface()->graphicsApi());
|
||||
#endif
|
||||
}
|
||||
|
||||
void PerfProfilerTraceView::selectByTypeId(int typeId)
|
||||
|
@@ -71,59 +71,48 @@ set(QMLPROFILER_CPP_SOURCES
|
||||
quick3dmodel.cpp quick3dmodel.h
|
||||
)
|
||||
|
||||
if(${Qt5_VERSION} VERSION_LESS "6.2.0")
|
||||
add_qtc_plugin(QmlProfiler
|
||||
DEPENDS QmlDebug QmlJS Tracing Qt5::QuickWidgets Utils
|
||||
PLUGIN_DEPENDS Core Debugger ProjectExplorer QtSupport TextEditor
|
||||
SOURCES
|
||||
${TEST_SOURCES}
|
||||
${QMLPROFILER_CPP_SOURCES}
|
||||
qml/qmlprofiler.qrc
|
||||
)
|
||||
else() # < Qt 6.2
|
||||
find_package(Qt6 COMPONENTS ShaderTools QUIET)
|
||||
find_package(Qt6 COMPONENTS ShaderTools QUIET)
|
||||
|
||||
add_qtc_plugin(QmlProfiler
|
||||
CONDITION TARGET Tracing AND TARGET Qt6::ShaderTools
|
||||
DEPENDS QmlDebug QmlJS Tracing Qt5::QuickWidgets
|
||||
PLUGIN_DEPENDS Core Debugger ProjectExplorer QtSupport TextEditor
|
||||
SOURCES
|
||||
${TEST_SOURCES}
|
||||
)
|
||||
add_qtc_plugin(QmlProfiler
|
||||
CONDITION TARGET Tracing AND TARGET Qt6::ShaderTools
|
||||
DEPENDS QmlDebug QmlJS Tracing Qt5::QuickWidgets
|
||||
PLUGIN_DEPENDS Core Debugger ProjectExplorer QtSupport TextEditor
|
||||
SOURCES
|
||||
${TEST_SOURCES}
|
||||
)
|
||||
|
||||
if (NOT TARGET QmlProfiler)
|
||||
return()
|
||||
endif()
|
||||
if (NOT TARGET QmlProfiler)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(QMLPROFILER_QML_FILES
|
||||
qml/QmlProfilerFlameGraphView.qml
|
||||
)
|
||||
set(QMLPROFILER_QML_FILES
|
||||
qml/QmlProfilerFlameGraphView.qml
|
||||
)
|
||||
|
||||
foreach(file IN LISTS QMLPROFILER_QML_FILES)
|
||||
get_filename_component(fileName "${file}" NAME)
|
||||
set_source_files_properties("${file}" PROPERTIES QT_RESOURCE_ALIAS "${fileName}")
|
||||
endforeach()
|
||||
foreach(file IN LISTS QMLPROFILER_QML_FILES)
|
||||
get_filename_component(fileName "${file}" NAME)
|
||||
set_source_files_properties("${file}" PROPERTIES QT_RESOURCE_ALIAS "${fileName}")
|
||||
endforeach()
|
||||
|
||||
qt_add_shaders(QmlProfiler "res_qmlprofilershaders"
|
||||
BATCHABLE
|
||||
PREFIX
|
||||
"/QtCreator/QmlProfiler"
|
||||
BASE
|
||||
"qml"
|
||||
FILES
|
||||
qml/bindingloops_qt6.frag
|
||||
qml/bindingloops_qt6.vert
|
||||
)
|
||||
qt_add_shaders(QmlProfiler "res_qmlprofilershaders"
|
||||
BATCHABLE
|
||||
PREFIX
|
||||
"/QtCreator/QmlProfiler"
|
||||
BASE
|
||||
"qml"
|
||||
FILES
|
||||
qml/bindingloops_qt6.frag
|
||||
qml/bindingloops_qt6.vert
|
||||
)
|
||||
|
||||
qt_add_qml_module(QmlProfiler
|
||||
URI "QtCreator.QmlProfiler"
|
||||
VERSION "1.0"
|
||||
NO_PLUGIN
|
||||
QML_FILES
|
||||
${QMLPROFILER_QML_FILES}
|
||||
RESOURCES
|
||||
${QMLPROFILER_QML_RESOURCES}
|
||||
SOURCES
|
||||
${QMLPROFILER_CPP_SOURCES}
|
||||
)
|
||||
endif() # < Qt 6.2
|
||||
qt_add_qml_module(QmlProfiler
|
||||
URI "QtCreator.QmlProfiler"
|
||||
VERSION "1.0"
|
||||
NO_PLUGIN
|
||||
QML_FILES
|
||||
${QMLPROFILER_QML_FILES}
|
||||
RESOURCES
|
||||
${QMLPROFILER_QML_RESOURCES}
|
||||
SOURCES
|
||||
${QMLPROFILER_CPP_SOURCES}
|
||||
)
|
||||
|
@@ -55,10 +55,8 @@ struct FlameGraphData {
|
||||
class FlameGraphModel : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
|
||||
QML_NAMED_ELEMENT(QmlProfilerFlameGraphModel)
|
||||
QML_UNCREATABLE("use the context property")
|
||||
#endif // Qt >= 6.2
|
||||
public:
|
||||
enum Role {
|
||||
TypeIdRole = Qt::UserRole + 1, // Sort by data, not by displayed string
|
||||
|
@@ -46,13 +46,6 @@ FlameGraphView::FlameGraphView(QmlProfilerModelManager *manager, QWidget *parent
|
||||
setObjectName("QmlProfiler.FlameGraph.Dock");
|
||||
setWindowTitle(tr("Flame Graph"));
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 2, 0)
|
||||
qmlRegisterType<FlameGraph::FlameGraph>("QtCreator.Tracing", 1, 0, "FlameGraph");
|
||||
qmlRegisterUncreatableType<FlameGraphModel>("QtCreator.QmlProfiler", 1, 0,
|
||||
"QmlProfilerFlameGraphModel",
|
||||
QLatin1String("use the context property"));
|
||||
#endif // Qt < 6.2
|
||||
|
||||
Timeline::TimelineTheme::setupTheme(m_content->engine());
|
||||
|
||||
m_content->rootContext()->setContextProperty(QStringLiteral("flameGraphModel"), m_model);
|
||||
|
@@ -72,12 +72,7 @@ QVariantList InputEventsModel::labels() const
|
||||
|
||||
QMetaEnum InputEventsModel::metaEnum(const char *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
|
||||
return Qt::staticMetaObject.enumerator(Qt::staticMetaObject.indexOfEnumerator(name));
|
||||
}
|
||||
|
||||
QVariantMap InputEventsModel::details(int index) const
|
||||
|
@@ -23,7 +23,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtCreator.QmlProfiler 1.0
|
||||
import QtCreator.QmlProfiler
|
||||
import "../Tracing" // TODO: Turn into module import when possible
|
||||
|
||||
FlameGraphView {
|
||||
|
@@ -1,31 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
varying lowp vec4 color;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = color;
|
||||
}
|
@@ -1,42 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
attribute vec4 vertexCoord;
|
||||
attribute vec2 postScaleOffset;
|
||||
|
||||
uniform mat4 matrix;
|
||||
uniform vec4 bindingLoopsColor;
|
||||
|
||||
varying vec4 color;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = matrix * vertexCoord;
|
||||
gl_Position.x += postScaleOffset.x * 0.005;
|
||||
gl_Position.y += postScaleOffset.y * 0.01;
|
||||
gl_Position.z -= 0.1;
|
||||
gl_Position.w = 1.0;
|
||||
color = bindingLoopsColor;
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/QtCreator/QmlProfiler">
|
||||
<file>bindingloops.vert</file>
|
||||
<file>bindingloops.frag</file>
|
||||
<file>QmlProfilerFlameGraphView.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
@@ -65,9 +65,10 @@ QtcPlugin {
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "QML"
|
||||
prefix: "qml/"
|
||||
files: ["qmlprofiler.qrc"]
|
||||
name: "Qml Files"
|
||||
Qt.core.resourcePrefix: "QtCreator/QmlProfiler/"
|
||||
fileTags: "qt.core.resource_data"
|
||||
files: "qml/**"
|
||||
}
|
||||
|
||||
Group {
|
||||
|
@@ -34,11 +34,7 @@ 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) const override;
|
||||
#endif // < Qt 6
|
||||
BindingLoopMaterial();
|
||||
};
|
||||
|
||||
@@ -299,36 +295,14 @@ 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 *, QSGMaterial *) override;
|
||||
#endif // < Qt 6
|
||||
|
||||
private:
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
void initialize() override;
|
||||
|
||||
int m_matrix_id = 0;
|
||||
int m_z_range_id = 0;
|
||||
int m_color_id = 0;
|
||||
#endif // < Qt 6
|
||||
};
|
||||
|
||||
BindingLoopMaterialShader::BindingLoopMaterialShader()
|
||||
: QSGMaterialShader()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
setShaderSourceFile(QOpenGLShader::Vertex,
|
||||
QStringLiteral(":/QtCreator/QmlProfiler/bindingloops.vert"));
|
||||
setShaderSourceFile(QOpenGLShader::Fragment,
|
||||
QStringLiteral(":/QtCreator/QmlProfiler/bindingloops.frag"));
|
||||
#else // < Qt 6
|
||||
setShaderFileName(VertexStage, ":/QtCreator/QmlProfiler/bindingloops_qt6.vert.qsb");
|
||||
setShaderFileName(FragmentStage, ":/QtCreator/QmlProfiler/bindingloops_qt6.frag.qsb");
|
||||
#endif // < Qt 6
|
||||
}
|
||||
|
||||
static QColor bindingLoopsColor()
|
||||
@@ -336,16 +310,6 @@ static QColor bindingLoopsColor()
|
||||
return Utils::creatorTheme()->color(Utils::Theme::Timeline_HighlightColor);
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
void BindingLoopMaterialShader::updateState(const RenderState &state, QSGMaterial *, QSGMaterial *)
|
||||
{
|
||||
if (state.isMatrixDirty()) {
|
||||
program()->setUniformValue(m_matrix_id, state.combinedMatrix());
|
||||
program()->setUniformValue(m_z_range_id, GLfloat(1.0));
|
||||
program()->setUniformValue(m_color_id, bindingLoopsColor());
|
||||
}
|
||||
}
|
||||
#else // < Qt 6
|
||||
bool BindingLoopMaterialShader::updateUniformData(RenderState &state, QSGMaterial *, QSGMaterial *)
|
||||
{
|
||||
QByteArray *buf = state.uniformData();
|
||||
@@ -363,31 +327,15 @@ bool BindingLoopMaterialShader::updateUniformData(RenderState &state, QSGMateria
|
||||
|
||||
return true;
|
||||
}
|
||||
#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};
|
||||
return attr;
|
||||
}
|
||||
|
||||
void BindingLoopMaterialShader::initialize()
|
||||
{
|
||||
m_matrix_id = program()->uniformLocation("matrix");
|
||||
m_z_range_id = program()->uniformLocation("_qt_zRange");
|
||||
m_color_id = program()->uniformLocation("bindingLoopsColor");
|
||||
}
|
||||
#endif // < Qt 6
|
||||
|
||||
BindingLoopMaterial::BindingLoopMaterial()
|
||||
{
|
||||
setFlag(QSGMaterial::Blending, false);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
|
||||
setFlag(QSGMaterial::NoBatching, true);
|
||||
#elif QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
#else
|
||||
setFlag(QSGMaterial::CustomCompileStep, true);
|
||||
#endif // >= Qt 6.3/6.0
|
||||
#endif // >= Qt 6.3
|
||||
}
|
||||
|
||||
QSGMaterialType *BindingLoopMaterial::type() const
|
||||
@@ -396,11 +344,7 @@ QSGMaterialType *BindingLoopMaterial::type() const
|
||||
return &type;
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QSGMaterialShader *BindingLoopMaterial::createShader() const
|
||||
#else // < Qt 6
|
||||
QSGMaterialShader *BindingLoopMaterial::createShader(QSGRendererInterface::RenderMode) const
|
||||
#endif // < Qt 6
|
||||
{
|
||||
return new BindingLoopMaterialShader;
|
||||
}
|
||||
|
@@ -123,15 +123,6 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, QmlProfilerViewManag
|
||||
groupLayout->setContentsMargins(0, 0, 0, 0);
|
||||
groupLayout->setSpacing(0);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 2, 0)
|
||||
qmlRegisterType<Timeline::TimelineRenderer>("QtCreator.Tracing", 1, 0, "TimelineRenderer");
|
||||
qmlRegisterType<Timeline::TimelineOverviewRenderer>("QtCreator.Tracing", 1, 0,
|
||||
"TimelineOverviewRenderer");
|
||||
qmlRegisterAnonymousType<Timeline::TimelineZoomControl>("QtCreator.Tracing", 1);
|
||||
qmlRegisterAnonymousType<Timeline::TimelineModel>("QtCreator.Tracing", 1);
|
||||
qmlRegisterAnonymousType<Timeline::TimelineNotesModel>("QtCreator.Tracing", 1);
|
||||
#endif // Qt < 6.2
|
||||
|
||||
d->m_mainView = new QQuickWidget(this);
|
||||
d->m_mainView->setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||
d->m_mainView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
@@ -169,7 +160,6 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, QmlProfilerViewManag
|
||||
setMinimumHeight(170);
|
||||
|
||||
Timeline::TimelineTheme::setupTheme(d->m_mainView->engine());
|
||||
Timeline::TimeFormatter::setupTimeFormatter();
|
||||
|
||||
d->m_mainView->rootContext()->setContextProperty(QLatin1String("timelineModelAggregator"),
|
||||
d->m_modelProxy);
|
||||
@@ -298,12 +288,9 @@ void QmlProfilerTraceView::showContextMenu(QPoint position)
|
||||
|
||||
bool QmlProfilerTraceView::isUsable() const
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
return d->m_mainView->quickWindow()->rendererInterface()->graphicsApi()
|
||||
== QSGRendererInterface::OpenGL;
|
||||
#else
|
||||
return QSGRendererInterface::isApiRhiBased(d->m_mainView->quickWindow()->rendererInterface()->graphicsApi());
|
||||
#endif
|
||||
const QSGRendererInterface::GraphicsApi api =
|
||||
d->m_mainView->quickWindow()->rendererInterface()->graphicsApi();
|
||||
return QSGRendererInterface::isApiRhiBased(api);
|
||||
}
|
||||
|
||||
bool QmlProfilerTraceView::isSuspended() const
|
||||
|
@@ -119,18 +119,10 @@ 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;
|
||||
|
@@ -3,31 +3,21 @@ set(TSTFLAMEGRAPHVIEW_CPP_SOURCES
|
||||
tst_flamegraphview.cpp
|
||||
)
|
||||
|
||||
if(${Qt5_VERSION} VERSION_LESS "6.2.0")
|
||||
add_qtc_test(tst_tracing_flamegraphview
|
||||
EXCLUDE_FROM_PRECHECK
|
||||
DEPENDS Tracing Qt5::QuickWidgets Qt5::Quick Utils
|
||||
SOURCES
|
||||
${TSTFLAMEGRAPHVIEW_CPP_SOURCES}
|
||||
flamegraphview.qrc
|
||||
)
|
||||
else() # < Qt 6.2
|
||||
add_qtc_test(tst_tracing_flamegraphview
|
||||
EXCLUDE_FROM_PRECHECK
|
||||
DEPENDS Tracing Qt5::QuickWidgets Qt5::Quick Utils
|
||||
)
|
||||
add_qtc_test(tst_tracing_flamegraphview
|
||||
EXCLUDE_FROM_PRECHECK
|
||||
DEPENDS Tracing Qt5::QuickWidgets Qt5::Quick Utils
|
||||
)
|
||||
|
||||
if (NOT TARGET tst_tracing_flamegraphview) # qt_add_qml_module has no DEPENDS check
|
||||
return()
|
||||
endif()
|
||||
if (NOT TARGET tst_tracing_flamegraphview) # qt_add_qml_module has no DEPENDS check
|
||||
return()
|
||||
endif()
|
||||
|
||||
qt_add_qml_module(tst_tracing_flamegraphview
|
||||
URI "QtCreator.TstTracingFlameGraphView"
|
||||
VERSION "1.0"
|
||||
NO_PLUGIN
|
||||
QML_FILES
|
||||
TestFlameGraphView.qml
|
||||
SOURCES
|
||||
${TSTFLAMEGRAPHVIEW_CPP_SOURCES}
|
||||
)
|
||||
endif() # < Qt 6.2
|
||||
qt_add_qml_module(tst_tracing_flamegraphview
|
||||
URI "QtCreator.TstTracingFlameGraphView"
|
||||
VERSION "1.0"
|
||||
NO_PLUGIN
|
||||
QML_FILES
|
||||
TestFlameGraphView.qml
|
||||
SOURCES
|
||||
${TSTFLAMEGRAPHVIEW_CPP_SOURCES}
|
||||
)
|
||||
|
@@ -23,7 +23,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
import QtCreator.TstTracingFlameGraphView 1.0
|
||||
import QtCreator.TstTracingFlameGraphView
|
||||
import "../Tracing" // TODO: Turn into module import when possible
|
||||
|
||||
FlameGraphView {
|
||||
|
@@ -11,7 +11,16 @@ TracingAutotest {
|
||||
name: "Test sources"
|
||||
files: [
|
||||
"testflamegraphmodel.h",
|
||||
"tst_flamegraphview.cpp", "flamegraphview.qrc"
|
||||
"tst_flamegraphview.cpp"
|
||||
]
|
||||
}
|
||||
|
||||
Group {
|
||||
name: "Qml Files"
|
||||
Qt.core.resourcePrefix: "QtCreator/TstTracingFlameGraphView/"
|
||||
fileTags: "qt.core.resource_data"
|
||||
files: [
|
||||
"TestFlameGraphView.qml",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/QtCreator/TstTracingFlameGraphView">
|
||||
<file>TestFlameGraphView.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
@@ -31,10 +31,9 @@
|
||||
class TestFlameGraphModel : public QStandardItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
|
||||
QML_ELEMENT
|
||||
QML_UNCREATABLE("use the context property")
|
||||
#endif // Qt >= 6.2
|
||||
|
||||
public:
|
||||
enum Role {
|
||||
TypeIdRole = Qt::UserRole + 1,
|
||||
|
@@ -72,22 +72,13 @@ private:
|
||||
|
||||
void tst_FlameGraphView::initMain()
|
||||
{
|
||||
if (Utils::HostOsInfo::isWindowsHost()) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
|
||||
if (Utils::HostOsInfo::isWindowsHost())
|
||||
qputenv("QSG_RHI_BACKEND", "opengl");
|
||||
#endif // Qt >= 6.2
|
||||
}
|
||||
}
|
||||
|
||||
void tst_FlameGraphView::initTestCase()
|
||||
{
|
||||
model.fill();
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 2, 0)
|
||||
qmlRegisterType<FlameGraph::FlameGraph>("QtCreator.Tracing", 1, 0, "FlameGraph");
|
||||
qmlRegisterUncreatableType<TestFlameGraphModel>(
|
||||
"QtCreator.TstTracingFlameGraphView", 1, 0, "TestFlameGraphModel",
|
||||
QLatin1String("use the context property"));
|
||||
#endif // Qt < 6.2
|
||||
|
||||
Timeline::TimelineTheme::setupTheme(widget.engine());
|
||||
|
||||
|
@@ -111,18 +111,10 @@ 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;
|
||||
|
@@ -121,18 +121,10 @@ 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;
|
||||
|
@@ -94,16 +94,6 @@ 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);
|
||||
|
||||
event = QMouseEvent(QMouseEvent::MouseButtonRelease, QPointF(x, y), Qt::LeftButton,
|
||||
Qt::LeftButton, Qt::NoModifier);
|
||||
renderer->mouseReleaseEvent(&event);
|
||||
#endif // < Qt 6
|
||||
}
|
||||
|
||||
void tst_TimelineRenderer::mouseEvents()
|
||||
|
@@ -125,17 +125,7 @@ public:
|
||||
{
|
||||
setResizeMode(QQuickView::SizeRootObjectToView);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 2, 0)
|
||||
qmlRegisterType<TimelineRenderer>("QtCreator.Tracing", 1, 0, "TimelineRenderer");
|
||||
qmlRegisterType<TimelineOverviewRenderer>(
|
||||
"QtCreator.Tracing", 1, 0, "TimelineOverviewRenderer");
|
||||
qmlRegisterAnonymousType<TimelineZoomControl>("QtCreator.Tracing", 1);
|
||||
qmlRegisterAnonymousType<TimelineModel>("QtCreator.Tracing", 1);
|
||||
qmlRegisterAnonymousType<TimelineNotesModel>("QtCreator.Tracing", 1);
|
||||
#endif // Qt < 6.2
|
||||
|
||||
TimelineTheme::setupTheme(engine());
|
||||
TimeFormatter::setupTimeFormatter();
|
||||
|
||||
m_modelAggregator = new TimelineModelAggregator(this);
|
||||
m_model = new DummyModel(m_modelAggregator);
|
||||
@@ -162,11 +152,6 @@ public:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
#endif // Qt < 6
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
||||
ManualTest::ThemeSelector::setTheme(":/themes/flat.creatortheme");
|
||||
|
Reference in New Issue
Block a user