PyQt6 - Refresh a lot of widget without freezing the GUI
-
Hello, I am at it again! :)
I am looking for some advices to imprice my UI speed.I have a QScrollAera that can have a certain amount of widget in it, the size is arguable, around 20 to 50, but these widgets are made of many other widgets, which at the end takes a lot of time and resource to redraw, and freeze the UI.
The idea is, that I have a setting to, for example, set the border color of the widgets, so when user changes that setting, the app has to redraw all the widgets which take some time - not very user friendly. The redraw is a simple: delete all item in the QSCrollArea container, and redraw all the widget one by one from my model which hold the list of widget to redraw.
I tried with QRunnable - but UI item are not trade safe and one cannot simple pass parent from another thread. I also tried with some async methods, but I am pretty bad at it, so I am not why it did not work, either it cannot work either or I just configured it wrong.
Any idea ? :)
-
Hello, I am at it again! :)
I am looking for some advices to imprice my UI speed.I have a QScrollAera that can have a certain amount of widget in it, the size is arguable, around 20 to 50, but these widgets are made of many other widgets, which at the end takes a lot of time and resource to redraw, and freeze the UI.
The idea is, that I have a setting to, for example, set the border color of the widgets, so when user changes that setting, the app has to redraw all the widgets which take some time - not very user friendly. The redraw is a simple: delete all item in the QSCrollArea container, and redraw all the widget one by one from my model which hold the list of widget to redraw.
I tried with QRunnable - but UI item are not trade safe and one cannot simple pass parent from another thread. I also tried with some async methods, but I am pretty bad at it, so I am not why it did not work, either it cannot work either or I just configured it wrong.
Any idea ? :)
@bashtian I believe I solved my problem. I don't need to delete and redraw them. instead of having just one signal to redraw, I am adding a setting_name param to the signal and just connect the widget part to it, listening to the setting that affect one or the other. It is fast and doesnt freeze the UI that much, sometime when there is a lot of widget to hide or show entirely it can be long, but otherwise its totaly acceptable!
-
B bashtian has marked this topic as solved on