QT. Rendimiento de QLabel
Frecuentes
Visto 118 veces
0
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.
2 Respuestas
2
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
0
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í:
http://qt-project.org/doc/qt-4.8/qfilesystemmodel.html
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 c++ performance qt widget or haz tu propia pregunta.
Sounds like this is what I was looking for. thanks, I will try it. - Eddie