[SOLVED] widget , background-images , size ;
-
hi
@ ui->widget->setStyleSheet(" background-image: url(pictures/picture.png); ");
@i want that my picture.png have a precise size
thank you :)
-
How about more details about this question ? It helps us.
-
I guess you need to use "background-clip":http://qt-project.org/doc/qt-5/stylesheet-reference.html#background-clip-prop
See "The Box Model":http://qt-project.org/doc/qt-5/stylesheet-customizing.html#the-box-model for more details. -
my picture have 800 width and 500 height
I want every time I resize the screen picture (background image ) is automatically resized
my code@void Menu::resizeEvent(QResizeEvent *event)
{ui->widget->setStyleSheet(" background-image: url(pictures/picture.png); ");
}
@ -
From the doc I sent above:
[quote]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.[/quote] -
thank you, I'll do my best to find a solution .
i think to use pixmap and label .
-
Have you tried ?
@
ui->widget->setStyleSheet(QStringLiteral("border-image: url(:/pictures/picture.png);"));
@ -
andreyc , thank you very much :) ( verry happy ) .
-
You are welcome, Glad to help.