Reputation: 2842
I have a widget that i want to have a background image. I've try using background-size but its not working. I know it could be done in qlabel but i want to know if its possible for pyqt4 style sheet. Is there a way to stretch the image depending on the widget's size?
QWidget#widget{
image: url(:/images/image.jpg);
background-size: 100%;
}
Upvotes: 1
Views: 4203
Reputation: 36715
You need border-image
.
QWidget#widget{
border-image: url(:/images/image.jpg);
}
Quoting from the docs:
A background-image does not scale with the size of the widget. To provide a "skin" or background that scales along with the widget size, one must use border-image. Since the border-image property provides an alternate background, it is not required to specify a background-image when border-image is specified. In the case, when both of them are specified, the border-image draws over the background-image.
Upvotes: 2