[Interest] Interest Digest, Vol 26, Issue 62

Rayner Pupo rpgomez at uci.cu
Wed Nov 20 21:59:48 CET 2013

> Hi
> I have a widget to which I want to apply a background image
> I have done this by using a style sheet -
> background-image: url(:/TestLogo/ASL2014 EMU Landscape background.jpg);
> background-position: top left; background-repeat: no-repeat;
> This is fine as far as it goes-
> But when the window is re-sized by the user the image does not fill the
> whole of the widget. How is the best way to apply a background image to a
> widget and have it fill the whole of the widget when it is resized?
> Thanks

try to subclass QWidget and reimplement paintEvent()
inside this function you can draw the image you want scaled to the widget size
III Escuela Internacional de Invierno en la UCI del 17 al 28 de febrero del 2014. Ver www.uci.cu                                                                                    

More information about the Interest mailing list