Using QML profiler timeline from QtCreator project



  • I´m trying to integrate the QML profiler timeline from the QtCreator project in my own application. As written in the readme of the lib this should be possible in general.

    The timeline library can be used to display timeline data, primarily for performance analysis. It
    provides a comprehensive set of visual components as well as a set of models that can be extended to
    hold custom timeline data. You can use all the provided QML to get a complete GUI similar to the QML
    profiler or you can mix and match the QML components with your own.
    

    Sourcecode can be found here GitHub

    What I did so far is the following:

    MainWindow::MainWindow(QWidget* parent)
      : QMainWindow(parent)
      , ui(new Ui::MainWindow)
    {
      ui->setupUi(this);
    
      mZoomControl = new Timeline::TimelineZoomControl(this);
      mZoomControl->clear();
    
      qmlRegisterType<Timeline::TimelineRenderer>(
        "TimelineRenderer", 1, 0, "TimelineRenderer");
      qmlRegisterType<Timeline::TimelineOverviewRenderer>(
        "TimelineOverviewRenderer", 1, 0, "TimelineOverviewRenderer");
      qmlRegisterType<Timeline::TimelineZoomControl>();
      qmlRegisterType<Timeline::TimelineModel>();
      qmlRegisterType<Timeline::TimelineNotesModel>();
    
      timeline = new QQuickWidget(this);
      timeline->setResizeMode(QQuickWidget::SizeRootObjectToView);
      timeline->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
      setFocusProxy(timeline);
    
      m_modelProxy = new Timeline::TimelineModelAggregator(0, this);
    
      QVariantList models;
      models.append(QVariant::fromValue(new Timeline::TimelineModel(0, this)));
    
      m_modelProxy->setModels(models);  
    
      Timeline::TimelineTheme::setupTheme(timeline->engine());
      Timeline::TimeFormatter::setupTimeFormatter();
    
      timeline->rootContext()->setContextProperty(
        QLatin1String("timelineModelAggregator"), m_modelProxy);
      timeline->rootContext()->setContextProperty(QLatin1String("zoomControl"),
                                                  mZoomControl);
      timeline->setSource(QUrl(QLatin1String("qrc:/timeline/MainView.qml")));
      ui->centralWidget->layout()->addWidget(timeline);
    }
    

    But something seems missing because when executing the example all that is to be seen looks like this:

    0_1503903368480_2017-08-28 08_55_24-mainwindow.cpp @ QWidgetsWithTimelineFromQtCreator [master] - Qt Creator.png

    Anybody done that before and knows what´s missing?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.