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. Hidden BusyIndicator still running in the background, How stop it completely (Qt 6.5)
Forum Updated to NodeBB v4.3 + New Features

Hidden BusyIndicator still running in the background, How stop it completely (Qt 6.5)

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
9 Posts 3 Posters 114 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
    majorRonk
    wrote last edited by majorRonk
    #1
            BusyIndicator {
               id: busyIndicator
    
               width: 120
               height: 120
    
               anchors.horizontalCenter: rootImage.horizontalCenter
               anchors.top: rootImage.top
               anchors.topMargin: 70
    
               visible: root.visible
            }
    

    I try to set visible and/or running of the BusyIndicator to false but somehow its still running in the background and using a lot of cpu although its hidden.

    Problem disappears when i manually minimize and maximize the app window.

    I found an old thread and a bugfix with similar problem. But the customized BusyIndicator didnt fix the problem for me.
    https://codereview.qt-project.org/c/qt/qtdeclarative/+/594118
    https://forum.qt.io/topic/122897/what-causes-qsgrenderthread-to-have-constant-cpu-usage-on-a-static-scene

    Is there any solution for Qt 6.5?

    Ronel_qtmasterR 1 Reply Last reply
    0
    • M Offline
      M Offline
      majorRonk
      wrote last edited by majorRonk
      #2

      Other question:
      Is it possible to access the animator property inside of the BusyIndicator and f.e. stop it ? (i guess its a RotationAnimator)

      1 Reply Last reply
      0
      • J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote last edited by
        #3

        BusyIndicator should have a "running" property. Set that to false

        https://doc.qt.io/qt-6/qml-qtquick-controls-busyindicator.html#running-prop


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        1 Reply Last reply
        0
        • M majorRonk
                  BusyIndicator {
                     id: busyIndicator
          
                     width: 120
                     height: 120
          
                     anchors.horizontalCenter: rootImage.horizontalCenter
                     anchors.top: rootImage.top
                     anchors.topMargin: 70
          
                     visible: root.visible
                  }
          

          I try to set visible and/or running of the BusyIndicator to false but somehow its still running in the background and using a lot of cpu although its hidden.

          Problem disappears when i manually minimize and maximize the app window.

          I found an old thread and a bugfix with similar problem. But the customized BusyIndicator didnt fix the problem for me.
          https://codereview.qt-project.org/c/qt/qtdeclarative/+/594118
          https://forum.qt.io/topic/122897/what-causes-qsgrenderthread-to-have-constant-cpu-usage-on-a-static-scene

          Is there any solution for Qt 6.5?

          Ronel_qtmasterR Offline
          Ronel_qtmasterR Offline
          Ronel_qtmaster
          wrote last edited by
          #4

          @majorRonk it still runs because BusyIndicator is running by default.
          so just use
          running: false
          visible: false

          1 Reply Last reply
          0
          • M Offline
            M Offline
            majorRonk
            wrote last edited by majorRonk
            #5

            As i said, setting running or visible to false does not solve the problem.

            I have a QQuickItem (repeating drawing image of a vnc client) which starts after the animation ends.
            I tested animators like RotationAnimator and ScaleAnimator.
            Both continue to slow down my application,
            even after i set running to false and the parent item's visibility is set to false.

            Somehow its gone, when i minimize and maximize the mainwindow once.
            I don't know why.
            I'm working on Ubuntu 22.04, Qt 6.5.4

            I had good experiences with replacing animations with FrameAnimation, but its hard to implement the same behaviour as in BusyIndicator.

            1 Reply Last reply
            0
            • J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote last edited by
              #6

              I somehow doubt that, setting running to false should stop the animation no matter what.

              However if you really need a workaround, pack the BusyIndicator in a Loader and deactivate the loader. That will definitely destroy the object instance. If you still have issues after that, the problem is somewhere else in your code


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              M 1 Reply Last reply
              0
              • J.HilkJ J.Hilk

                I somehow doubt that, setting running to false should stop the animation no matter what.

                However if you really need a workaround, pack the BusyIndicator in a Loader and deactivate the loader. That will definitely destroy the object instance. If you still have issues after that, the problem is somewhere else in your code

                M Offline
                M Offline
                majorRonk
                wrote last edited by majorRonk
                #7

                @J.Hilk
                I dynamically create and destroy Busyindicator with Loader by setting sourceComponent to undefined and this does not fix it...

                Here some output for qt.scenegraph:

                qt.scenegraph.general - debug - threaded render loop
                qt.scenegraph.general - debug - Using sg animation driver
                qt.scenegraph.general - debug - Animation Driver: using vsync: 16.67 ms
                qt.scenegraph.general - debug - Using sg animation driver
                qt.scenegraph.general - debug - Animation Driver: using vsync: 16.67 ms
                qt.scenegraph.general - debug - Creating QRhi with backend OpenGL for window 0x61b18376bca0 (wflags 0x1)
                qt.scenegraph.general - debug - Created QRhi 0x72b70c0049d0 for window 0x61b18376bca0
                qt.scenegraph.general - debug - MSAA sample count for the swapchain is 1. Alpha channel requested = no.
                qt.scenegraph.general - debug - rhi texture atlas dimensions: 1024x1024
                qt.scenegraph.general - debug - animation driver switched to timer mode
                qt.scenegraph.general - debug - Using sg animation driver
                qt.scenegraph.general - debug - animation driver switched to vsync mode
                

                I don't know if the animation driver timer/vsync mode switch has something to do with it?

                M 1 Reply Last reply
                0
                • M majorRonk

                  @J.Hilk
                  I dynamically create and destroy Busyindicator with Loader by setting sourceComponent to undefined and this does not fix it...

                  Here some output for qt.scenegraph:

                  qt.scenegraph.general - debug - threaded render loop
                  qt.scenegraph.general - debug - Using sg animation driver
                  qt.scenegraph.general - debug - Animation Driver: using vsync: 16.67 ms
                  qt.scenegraph.general - debug - Using sg animation driver
                  qt.scenegraph.general - debug - Animation Driver: using vsync: 16.67 ms
                  qt.scenegraph.general - debug - Creating QRhi with backend OpenGL for window 0x61b18376bca0 (wflags 0x1)
                  qt.scenegraph.general - debug - Created QRhi 0x72b70c0049d0 for window 0x61b18376bca0
                  qt.scenegraph.general - debug - MSAA sample count for the swapchain is 1. Alpha channel requested = no.
                  qt.scenegraph.general - debug - rhi texture atlas dimensions: 1024x1024
                  qt.scenegraph.general - debug - animation driver switched to timer mode
                  qt.scenegraph.general - debug - Using sg animation driver
                  qt.scenegraph.general - debug - animation driver switched to vsync mode
                  

                  I don't know if the animation driver timer/vsync mode switch has something to do with it?

                  M Offline
                  M Offline
                  majorRonk
                  wrote last edited by majorRonk
                  #8
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    majorRonk
                    wrote last edited by majorRonk
                    #9

                    I think a found what caused the slow performance.
                    In the same window i'm drawing a FrameAnimation
                    which is continously moving rectangle from left to right.
                    Actually its not a big computation.

                    Its strange, because i have already replaced a slower SequentialAnimation with this FrameAnimation. Which improves the performance.
                    Now i found out it still affects my application together with this BusyIndicator.

                    Still don't know why its only starting to work again after i minimize and maximize the window....

                    edit:

                    After i disable vsync with qputenv("QSG_NO_VSYNC", "0") it works again.

                    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