Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Using QML profiler timeline from QtCreator project
Forum Updated to NodeBB v4.3 + New Features

Using QML profiler timeline from QtCreator project

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 697 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved