QT. Rendimiento de QLabel

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

La estructura es:

  • QScrollArea
    • QWidget
      • EFile
      • EFile
      • EFile

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.

preguntado el 03 de mayo de 12 a las 14:05

2 Respuestas

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.

contestado el 03 de mayo de 12 a las 15:05

Sounds like this is what I was looking for. thanks, I will try it. - Eddie

If it really is a file explorer you want to implement, you should consider using a QFileSystemModel en combinación con un QTreeView como se muestra en el ejemplo aquí:

This will save you a lot of trouble.

contestado el 03 de mayo de 12 a las 15:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.