Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set a scale for a background-image

I just created a resource file for my project, which got 5 prefixes (Window, background, etc).

My main problem is that, when using the Qt Designer, I go to stylesheet, open it up, Add resource -> background-image.

Unfortunately my picture is way too big for my window, and I can't seem to put it to scale using designer.

After reading some topics on the forums, I have tried to put this in the "stylesheet edit" :

background-image: url(:/background/Backgrounds/Fondecran1.jpg) 0 0 0 0 stretch stretch;

in place of

background-image: url(:/background/Backgrounds/Fondecran1.jpg);

Can anyone help me put it to scale ? Is there a way it can "adapt" as well as it can to changes in the window size ?

Thank you all in advance for your answers.

like image 530
ShadowEntun Avatar asked Sep 06 '17 00:09

ShadowEntun


1 Answers

Instead you may need to use border-image.

Look into the below content in the link provided.

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.

http://doc.qt.io/qt-5/stylesheet-customizing.html

like image 83
Pavan Chandaka Avatar answered Nov 16 '22 02:11

Pavan Chandaka