I'm working on a PyQT5 application showing a scrollable area with few to many (thousands) custom widgets.
I have cases where there could be 2000 (maybe more) of these widgets.
Each widget shows a cropped image (I can pan/zoom the image to change the crop area), a text, 2 info icons and 2 buttons (for edit/remove operations).
These widgets are all the same dimensions and style, so I styled them using QSS on the parent object in order to set the style only once at startup.
I actually added all these widgets to a ScrollableArea with a GridLayout in order to have them disposed in a grid fashion and to be able to scroll them up/down.
When resizing the window, the widgets are resized as well in order to fit the new sizes (fixed number of columns).
What happens is that when I create this UI the first time, it needs 6-8 seconds to be shown and when I resize the window, it needs 2-3 seconds to update the widgets with the new size.
The results to the user it that the application is hanging while resizing objects. And this is so annoying to me.
I profiled a bit and I saw the setStylesheet is slowing down things here because it needs to set style on all the widgets.
And here is my question: do you have any suggestion or pointers on how to implement this ScrollableArea with so many styled custom widgets without having this kind of performance issues?
Thank you in advance for any help.