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 blocking during update from slot

UI blocking during update from slot

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 4 Posters 1.3k 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.
  • nageshN Offline
    nageshN Offline
    nagesh
    wrote on last edited by
    #2

    @Nubcake said in UI blocking during update from slot:
    How do you signal the view to update the change in the model?

    N 1 Reply Last reply
    0
    • nageshN nagesh

      @Nubcake said in UI blocking during update from slot:
      How do you signal the view to update the change in the model?

      N Offline
      N Offline
      Nubcake
      wrote on last edited by
      #3

      @nagesh I don't actually, it updates by itself it seems.

      1 Reply Last reply
      0
      • nageshN Offline
        nageshN Offline
        nagesh
        wrote on last edited by
        #4

        @Nubcake some more code snippet is required to answer what is wrong in GUI update.
        treeModel construction and setup with view.

        N 1 Reply Last reply
        0
        • nageshN nagesh

          @Nubcake some more code snippet is required to answer what is wrong in GUI update.
          treeModel construction and setup with view.

          N Offline
          N Offline
          Nubcake
          wrote on last edited by
          #5

          @nagesh Updated original post with the setup

          1 Reply Last reply
          0
          • nageshN Offline
            nageshN Offline
            nagesh
            wrote on last edited by
            #6

            @Nubcake confirm whether your computation and gui update is happening in different thread by printing threadid..

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

              Don't use a convenience model when you want to upgrade stuff that often. Also reduce the update rate - noone can see this in the view so it's not necessary.

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

              N 1 Reply Last reply
              2
              • Christian EhrlicherC Christian Ehrlicher

                Don't use a convenience model when you want to upgrade stuff that often. Also reduce the update rate - noone can see this in the view so it's not necessary.

                N Offline
                N Offline
                Nubcake
                wrote on last edited by
                #8

                @Christian-Ehrlicher Could you explain what you mean by "convenience model"?
                How often should I update the view would you suggest?

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

                  QStandardItemModel is a convenience model optimized for general usage but not for mass (update) data. Use QAbstractItemModel instead.
                  I don't know how often you should update your ui - but 100 updates per second is for sure not needed and to much.

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

                  N 1 Reply Last reply
                  2
                  • Christian EhrlicherC Christian Ehrlicher

                    QStandardItemModel is a convenience model optimized for general usage but not for mass (update) data. Use QAbstractItemModel instead.
                    I don't know how often you should update your ui - but 100 updates per second is for sure not needed and to much.

                    N Offline
                    N Offline
                    Nubcake
                    wrote on last edited by
                    #10

                    @Christian-Ehrlicher I've added QThread::msleep(50) just after emitting the signal to update the UI in the worker thread and it's more responsive as one would expect.

                    However I'm not fond of blocking the worker thread to allow the GUI to become responsive. Is there better way to limit the amount of signals I send to the UI without sleeping the worker thread?

                    JonBJ 1 Reply Last reply
                    0
                    • N Nubcake

                      @Christian-Ehrlicher I've added QThread::msleep(50) just after emitting the signal to update the UI in the worker thread and it's more responsive as one would expect.

                      However I'm not fond of blocking the worker thread to allow the GUI to become responsive. Is there better way to limit the amount of signals I send to the UI without sleeping the worker thread?

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by
                      #11

                      @Nubcake
                      Emit less signals from the worker. Or, probably better, reduce the frequency with which you act on them in the UI thread, or batch some updates together, or similar.

                      1 Reply Last reply
                      2

                      • Login

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