Hidden BusyIndicator still running in the background, How stop it completely (Qt 6.5)
-
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-sceneIs there any solution for Qt 6.5?
-
BusyIndicator should have a "running" property. Set that to false
https://doc.qt.io/qt-6/qml-qtquick-controls-busyindicator.html#running-prop
-
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-sceneIs there any solution for Qt 6.5?
@majorRonk it still runs because BusyIndicator is running by default.
so just use
running: false
visible: false -
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.4I had good experiences with replacing animations with FrameAnimation, but its hard to implement the same behaviour as in BusyIndicator.
-
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
-
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
@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 modeI don't know if the animation driver timer/vsync mode switch has something to do with it?
-
@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 modeI don't know if the animation driver timer/vsync mode switch has something to do with it?
-
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.