[SOLVED] widget , background-images , size ;
-
wrote on 19 Aug 2014, 15:43 last edited by
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.
-
wrote on 19 Aug 2014, 16:15 last edited by
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. -
wrote on 19 Aug 2014, 16:18 last edited by
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); ");
}
@ -
wrote on 19 Aug 2014, 17:22 last edited by
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] -
wrote on 19 Aug 2014, 17:32 last edited by
thank you, I'll do my best to find a solution .
i think to use pixmap and label .
-
wrote on 19 Aug 2014, 17:41 last edited by
Have you tried ?
@
ui->widget->setStyleSheet(QStringLiteral("border-image: url(:/pictures/picture.png);"));
@ -
wrote on 20 Aug 2014, 22:55 last edited by
andreyc , thank you very much :) ( verry happy ) .
-
wrote on 21 Aug 2014, 02:25 last edited by
You are welcome, Glad to help.
1/9