Eddie
Eddie

Reputation: 1643

QT. QLabel perfomance

In my application I have a file manager similar to the standart windows explorer.

The structure is:

etc...

Each EFile widget contains 5 QLabels. So when the count of files is more than 30 I have a little delay while they are being created. I decided to create only visible files and create hidden on scroll or resize when they become visible. But it's not a solution - the delay remained (although it decreased of course).

The question is how should I modify my application to remove the delay while showing files.

Upvotes: 0

Views: 141

Answers (2)

Chris
Chris

Reputation: 1643

If it really is a file explorer you want to implement, you should consider using a QFileSystemModel in combination with a QTreeView as shown in the example here:
http://qt-project.org/doc/qt-4.8/qfilesystemmodel.html

This will save you a lot of trouble.

Upvotes: 0

ypnos
ypnos

Reputation: 52317

The answer is that you do not compose your custom widget of QLabels. Instead, you overwrite the paint() function and draw the texts/pixmaps with QPainter. It is not as much work as it sounds. There are tons of examples for that in the Qt examples/tutorials.

Upvotes: 2

Related Questions