Dealing with lots of objects is very slow
-
So i am making a music app (like MusicBee) and am dealing with relatively big amount of QLabels in a QSplitter (5 widgets in splitter, each one is like a column filled with labels). Each column represents some type of information certain audio file has in its tags (album, artist, title, year, etc.). Column is filled when it has around 70 labels, so around 350 labels are visible to user but user can scroll down at any time to see other files' info. The thing is that there is a lag spike when i try to load more than 200 songs (when its 2000 user has to wait more than 10 seconds). Is there any way to improve the performance to make it faster? i tried saving those objects in a list a dict and then getting them depending on which group of files' info needs to be shown, but it barely helps since most of the time is probably spent on drawing that stuff…
-
So i am making a music app (like MusicBee) and am dealing with relatively big amount of QLabels in a QSplitter (5 widgets in splitter, each one is like a column filled with labels). Each column represents some type of information certain audio file has in its tags (album, artist, title, year, etc.). Column is filled when it has around 70 labels, so around 350 labels are visible to user but user can scroll down at any time to see other files' info. The thing is that there is a lag spike when i try to load more than 200 songs (when its 2000 user has to wait more than 10 seconds). Is there any way to improve the performance to make it faster? i tried saving those objects in a list a dict and then getting them depending on which group of files' info needs to be shown, but it barely helps since most of the time is probably spent on drawing that stuff…
Why not use something like a
QListView
orQTableView
? -
Hi
That many labels are heavy to draw.
A listView / Table with a delegate will be much faster.
Look at
https://forum.qt.io/topic/62363/custom-delegate/3
for starter code.