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. Pass custom data from UI thread to SG thread in correct order
Forum Updated to NodeBB v4.3 + New Features

Pass custom data from UI thread to SG thread in correct order

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 710 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.
  • F Offline
    F Offline
    Francesco Pretto
    wrote on last edited by
    #1

    I'm trying to inherit QQuickItem and do some custom Scene Graph rendering. The update() method called in the UI thread will schedule a paint event in the SG render thread that will call the the updatePaintNode(). Is there a built-in mechanism/technique that I can use to pass some custom data from UI thread that will be queued and passed to the item and be available with right order during updatePaintNode() execution? That will be handy, since if I don't have this mechanism I must implement my queue protected by lock in every custom QQuickItem that needs this pattern (lock itself is not enough since I don't want to miss any signal in the UI thread).

    1 Reply Last reply
    0
    • jpnurmiJ Offline
      jpnurmiJ Offline
      jpnurmi
      wrote on last edited by
      #2

      A quote from the docs:
      “
      The main thread is blocked while this function is executed so it is safe to read values from the QQuickItem instance and other objects in the main thread.
      “

      F 1 Reply Last reply
      0
      • jpnurmiJ jpnurmi

        A quote from the docs:
        “
        The main thread is blocked while this function is executed so it is safe to read values from the QQuickItem instance and other objects in the main thread.
        “

        F Offline
        F Offline
        Francesco Pretto
        wrote on last edited by Francesco Pretto
        #3

        @jpnurmi Interesting, thank you. Though I don't like much this approach chosen for QtQuick in general since this means making the UI thread starving a little bit while it could run safely using data on different storage. I found also the mechanism you are talking well described in this document.

        I also just found QQuickFramebufferObject that can use an approach similar to what I was describing by implementing a separate QQuickFramebufferObject::Renderer class that is invoked to synchronize content on the item and perform actual rendering on a FBO.

        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