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. UI Multithreading
QtWS25 Last Chance

UI Multithreading

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 6 Posters 790 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.
  • R Offline
    R Offline
    rickm
    wrote on last edited by
    #1

    Folks;
    I have an application with many dialogs that perform screen updates at a very high rate. All of the screen updates appear to be done from the main UI thread. When I run on linux, top reveals that this thread is consuming nearly all cpu time. On a multi-core machine I would like to spread this load out across other cores. Does Qt5 have a mechanism for doing this.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @rickm said in UI Multithreading:

      Does Qt5 have a mechanism for doing this.

      No, all GUI specific stuff has to be done in the main thread. But I wonder what you're updating all the time (and if this is really needed at all since noone will be able to follow the updates)

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • R Offline
        R Offline
        rickm
        wrote on last edited by
        #3

        I cant get into the specifics, but the data is very high volume streaming data comprised of multiple "channels". Each channel is displayed on a separate dialog in real time.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Can you be more precise about what that high volume streaming data is ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          R 1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi
            also how you are read it, if its done in main thread also, that could also account
            for the high usage.

            R 1 Reply Last reply
            1
            • SGaistS SGaist

              Hi,

              Can you be more precise about what that high volume streaming data is ?

              R Offline
              R Offline
              rickm
              wrote on last edited by
              #6

              @sgaist The data is essentially acoustic data read from a sensor.

              Pablo J. RoginaP 1 Reply Last reply
              0
              • R rickm

                @sgaist The data is essentially acoustic data read from a sensor.

                Pablo J. RoginaP Offline
                Pablo J. RoginaP Offline
                Pablo J. Rogina
                wrote on last edited by
                #7

                @rickm said in UI Multithreading:

                data read from a sensor.

                And where/how the sensor reading and eventually some data processing is done?
                Are you using threads for such tasks?

                Upvote the answer(s) that helped you solve the issue
                Use "Topic Tools" button to mark your post as Solved
                Add screenshots via postimage.org
                Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                1 Reply Last reply
                0
                • mrjjM mrjj

                  Hi
                  also how you are read it, if its done in main thread also, that could also account
                  for the high usage.

                  R Offline
                  R Offline
                  rickm
                  wrote on last edited by
                  #8

                  @mrjj The data is read from a socket that is serviced by a non-ui thread. the data is collated and stored in appropriate structures. When enough data is gathered I call dialog->update() which triggers the dialog paint event. In the paint I load a QImage with data and use that to update the dialogs image.

                  Pablo J. RoginaP W 2 Replies Last reply
                  0
                  • R rickm

                    @mrjj The data is read from a socket that is serviced by a non-ui thread. the data is collated and stored in appropriate structures. When enough data is gathered I call dialog->update() which triggers the dialog paint event. In the paint I load a QImage with data and use that to update the dialogs image.

                    Pablo J. RoginaP Offline
                    Pablo J. RoginaP Offline
                    Pablo J. Rogina
                    wrote on last edited by
                    #9

                    @rickm said in UI Multithreading:

                    the data is collated and stored in appropriate structures

                    in that same or another non-ui thread?

                    I load a QImage with data

                    and the image is created in another non-ui thread?

                    Upvote the answer(s) that helped you solve the issue
                    Use "Topic Tools" button to mark your post as Solved
                    Add screenshots via postimage.org
                    Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                    1 Reply Last reply
                    1
                    • R rickm

                      @mrjj The data is read from a socket that is serviced by a non-ui thread. the data is collated and stored in appropriate structures. When enough data is gathered I call dialog->update() which triggers the dialog paint event. In the paint I load a QImage with data and use that to update the dialogs image.

                      W Offline
                      W Offline
                      wrosecrans
                      wrote on last edited by
                      #10

                      @rickm Basically, you can process your audio, and prepare your QImages in other threads, but actually updating the UI has to be done in the main thread. The GUI itself is not thread safe.

                      1 Reply Last reply
                      1

                      • Login

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