Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to affect GUIs across threads
Forum Updated to NodeBB v4.3 + New Features

How to affect GUIs across threads

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 248 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.
  • M Offline
    M Offline
    Martmists
    wrote on last edited by
    #1

    I'm currently working on a project that uses PortAudio, and I'm trying to use QwtPlot among others to graph various data for debugging, and I'm hoping to include similar things for the end user.
    All of the data processing happens on the low-latency audio thread, which needs to run at the highest speed possible, and as such thread-safe operations are not ideal, as they slow down the program enough to have a noticeable impact. Are there any methods for "queueing" changes across threads for such applications, or any other solutions?

    I've seen various references of QObjects for when threading is needed, but sadly for PortAudio the data is handled on a thread I cannot control.

    jsulmJ 1 Reply Last reply
    0
    • M Martmists

      I'm currently working on a project that uses PortAudio, and I'm trying to use QwtPlot among others to graph various data for debugging, and I'm hoping to include similar things for the end user.
      All of the data processing happens on the low-latency audio thread, which needs to run at the highest speed possible, and as such thread-safe operations are not ideal, as they slow down the program enough to have a noticeable impact. Are there any methods for "queueing" changes across threads for such applications, or any other solutions?

      I've seen various references of QObjects for when threading is needed, but sadly for PortAudio the data is handled on a thread I cannot control.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by jsulm
      #2

      @Martmists said in How to affect GUIs across threads:

      Are there any methods for "queueing" changes across threads for such applications

      Of course: signals/slots with Qt::QueuedConnection connection type, see https://doc.qt.io/qt-5/qt.html#ConnectionType-enum. Qt::QueuedConnection is default when connecting signals/slots between different threads.
      Important rule: never change UI from other threads than UI thread. So, simply emit signals from your audio thread and connect these signals to slots in your UI thread where you then change the UI.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3

      • Login

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