Re: Dont understand QListView behavior after filling the QStandardItemModel is finished
Florian Bruhin <[email protected]>
| Newsgroups | gmane.comp.python.pyqt-pykde |
|---|---|
| Message-ID | <[email protected]> |
Hi, On Sat, May 11, 2019 at 05:02:03PM +0200, Gottfried Müller wrote: > The first case displays the the content of the model directly. In the second > case a sleep command is following the filling function. In the second case > the content appears when the sleep time ended. > > But in both cases the content of QStatusBar (counter of generated items) > appears directly after the filling process of the model is ready. > > Why appears the the QListView content in the second case so late? Does an > action exist to force the display of the items before the sleep event? Probably due to some Qt implementation detail. Maybe QStatusBar::showMessage forces redrawing it immediately, while QListView updates as soon as you're back in the main loop. > Note: You can exchange the sleep command with any procedure which needs a > longer time. The behavior is the same. In general, you should never block Qt's main loop, as your application will become unresponsive. Find a way to do the same thing asynchronously, or do it in a worker thread, or call QApplication.processEvents() regularly. Florian -- https://www.qutebrowser.org | [email protected] (Mail/XMPP) GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc I love long mails! | https://email.is-not-s.ms/ _______________________________________________ PyQt mailing list [email protected] https://www.riverbankcomputing.com/mailman/listinfo/pyqt
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE4E5WAAJAG47w528KkW6wyP1VoHIFAlzW9JUACgkQkW6wyP1V oHIC4w/+I7FgMdKZHJErhoBWSlv7mGOt+70WSkOPSnOHPw1nOsiq6Z5TrK9+nJi/ 8Er4/Axl26HS7UAwcgxW0L+BEmDPERJUY0hCKVXS99PRdtih26OMof7Kao6F+bvB JPuwX7grYZlmIpw2fTHGqjbfHtauLTbiMU+P64j/NAyEiMPJc2J6Bk62l7iejmpe vsv5dBkwkDK2oufnsEsrunLHoXAxNGNhBzzl2t6UP9nq6RWyxSMHryHaOhq9plMt pFIelXRzynJwlOR155URjE32Bq18w2iETuwB+/X7YMCCB40IRL+gB0uDS9zxp8vH +SN04qI5zIOeygzN6khO9STq6OQ2afHjJW/1PvzWILt+J7Cu8OxORODg1OlcbDs9 Xm28pvMjSaDeo1y7QjuGhDGRIvAlVOPGcAg6JIb+vIMrO6fff+ZbLmpjVDiJx2I1 Tli2z233mkq3iFN3xyf43XNeFsj4mcH8pRU7lXLz7ObSjTNmN+oU6f4X5LSrjKkW eoalStLxAzvnn+R8J9MLiI6kV93D5jPF7ZwYCsSArghFBonpdBYNcvtf9QMwMj91 Wy6kPpsmwRY2e1T2GZ3dZjdNUcjowuDWgGP8y3HtnQJAvoohE5SSby/JI9MUAoP5 cGf5fC/OpzD/+coWzNNMbNaXbIWfZgwHalzyToYxQPjDG9y9Y3E= =FF1N -----END PGP SIGNATURE-----