QTimer in QQuickItem’s updatePaintNode()



  • 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.


Log in to reply
 

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