I've got a QLabel. I want to display in it imageX.png. I edit the QLabel in Qt Designer.

Say I set the QLabel to a SizePolicy of Fixed Fixed, and I set the geometry, the MaximumSize and the MinimumSize to 50 x 50. Suppose further than imageX.png has a dimension of 100 x 100.

Finally set the QLabel's ScaledContents attribute to True.

If I insert imageX.png into my *.qrc resource file, and set the Pixmap property of my QLabel to use the resource, everything works fine. The image appears as 50 x 50.

However, if I clear the Pixmap property of my QLabel, and connect to the form a *.qss style sheet that sets the QLabel's background-image attribute with a url containing a file path to imageX.png on my hard drive, it does not work. The image appears as 100 x 100, clipped in a 50 x 50 QLabel.

An I doing something wrong? Or do QLabel pixmaps set by style sheets ignore the ScaledContents attribute?