forked from qt-creator/qt-creator
Tracing: Add qml, register types via qt_add_qml_module
Use the CMake-based qml API to create the "QtCreator.Tracing" module. This uses qt_add_qml_module, which was introduced with Qt 6.2. For Qt 6.1 and below, everything compiles and runs like before this change. Change-Id: I4d63f9f724d0628cfaab9d1164c0d575f15d15aa Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
@@ -44,12 +44,14 @@ CtfVisualizerTraceView::CtfVisualizerTraceView(QWidget *parent, CtfVisualizerToo
|
||||
{
|
||||
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);
|
||||
@@ -64,7 +66,7 @@ CtfVisualizerTraceView::CtfVisualizerTraceView(QWidget *parent, CtfVisualizerToo
|
||||
tool->modelAggregator());
|
||||
rootContext()->setContextProperty(QLatin1String("zoomControl"),
|
||||
tool->zoomControl());
|
||||
setSource(QUrl(QLatin1String("qrc:/tracing/MainView.qml")));
|
||||
setSource(QUrl(QLatin1String("qrc:/QtCreator/Tracing/MainView.qml")));
|
||||
|
||||
// Avoid ugly warnings when reading from null properties in QML.
|
||||
connect(tool->modelAggregator(), &QObject::destroyed, this, [this]{ setSource(QUrl()); });
|
||||
|
||||
Reference in New Issue
Block a user