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. QTimer in QQuickItem’s updatePaintNode()

QTimer in QQuickItem’s updatePaintNode()

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.1k Views 1 Watching
  • 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.
  • U Offline
    U Offline
    user28
    wrote on last edited by
    #1

    http://qt-project.org/doc/qt-5.0/qtquick/qtquick-visualcanvas-scenegraph.html
    From this blog, I understand that threaded renderer is used by default on mac.

    Is it possible to start a timer in QQuickItem's updatePaintNode() on mac? During updatePaintNode, on mac we are currently on the scene graph renderer thread with the scene graph's OpenGL context current.

    @QSGNode *AAA::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
    {
    m_timer = new(std::nothrow) QTimer(0);
    m_timer->setInterval(20);
    connect(m_timer, SIGNAL(timeout()), this, SLOT(pulse_()),Qt::DirectConnection);
    m_self_timer->start();
    // Draw stuff
    }@

    I want the timer to be executed continuously and like to destroy it in my class's destructor.. I am not sure how the render thread's event loop works. With the above code, timeout events stop once drawing completes and then re-starts when update occurs the next time.

    Basically , I am using a custom library for drawing an OpenGL component. At certain conditions, if the drawing and GUI threads are different, the library blocks the GUI thread and waits for a pulse event to unblock the UI thread.
    I am trying to send this pulse event from a timer that is running in the renderer thread.

    I am trying to figure out the best place to place my timer in multithreaded environment. Would appreciate any help on this.

    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