Re: QLabel with scaled contents pixmap not updated after painting
Florian Bruhin <[email protected]>
| Newsgroups | gmane.comp.python.pyqt-pykde |
|---|---|
| Message-ID | <[email protected]> |
Hey, On Tue, Nov 26, 2019 at 01:47:40PM +0100, Maurizio Berti wrote: > I noticed a strange behavior when drawing over an existing QPixmap of a > QLabel. > When scaledContents is false (the default), the image is updated correctly: > > [...] > > But if I use setScaledContents(True) in the init, the image is not updated > anymore, not even after calling repaint or hiding/showing the label again. > So far, the only way I found to show the changes is to set the scaled > contents to false and back again to true, right after closing the painter. > > I have to specify that I'm using an old version of PyQt (5.7.1) which I > cannot update, so maybe the issue has been already solved. Also, I'm on > Linux, using xorg-x11. > > Can anyone confirm this? I can reproduce with Qt 5.14, but I don't think it necessarily is a Qt bug. Looking at the code, turning on scaledContents resizes the underlying pixmap once and then caches it: https://github.com/qt/qtbase/blob/v5.14.0-beta3/src/widgets/widgets/qlabel.cpp#L1092-L1104 What's your actual usecase? You could probably either modify/redisplay the pixmap, or perhaps have a widget with a transparent background over the QLabel instead. Florian -- [email protected] (Mail/XMPP) | https://www.qutebrowser.org https://bruhin.software/ | https://github.com/sponsors/The-Compiler/ 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----- iQIzBAEBCAAdFiEE4E5WAAJAG47w528KkW6wyP1VoHIFAl3dIfkACgkQkW6wyP1V oHLx9g//a8UUr7IsewJR/MGXwDP3xIsiMjQIC+oWOpzTXdpIBjeKojAWisDpZzxV WP8KqJ39oGMvWJWwyU5fPW5re4xDjlGokvpESOJMnGQ6MIAJwC0lmD+dxkKjl40E rTi6yUSk+EKPOGsROPMEj8z9byQftCC3Inu83pQNq0WUiZVz1oXvm3D3e0w8BCVi KJZgzRcgaV3KrYXdWiHS76/NFLskM7vICaHPU4e/+T2RUblQt5QHCdVULQAI0Txg HIRnpqdnP14EhsNbu3+IB+fJYz7TT81tW5qomcRFqkASlsWMO2AY57ToRxJHP0qS XD3PGFGKBoRV6NesAk4glTzLXN3TH/atwWSLDXhcCAnBQ/dajYLpmU0e94trfOUQ N2Qr+EJxR+OBJMO4qrIUUER2H9JdwI0n3XwqmN8uznaG/jP2X1A07AK6cKhRZ/qf sJBU8IHVdCip2zgIteR4FTVgpir//mz10NdeA7SevLmQxjr/XFfULGzCylxbjrGI Wlkdzl3SfPqp1WGhAmOmZu64F5sZbGed+TIybVTX//87M+vT99rb24mSJCQ9eVpW iJR4ftRhuM3lvhCCtOIZDQCYSUJGmk6gX5fErrtKnxHAohS5XKzXPzQeH14PBNId ihWfrQYr7chorWRc8Yf3n2mX2jvV5kil/LGLwN43FcPpKGA/bb8= =dQcz -----END PGP SIGNATURE-----