background picture won't apply to main widget
-
I've met a problem when applying a background picture in stylesheets at .ui designer on the main widget (window), the picture gets on every single widget besides the main (buttons, labels etc get the texture excepts the window background).
it happens on the built and launched application, even trough the background does apply right in the .ui designer and all seems right until you launch it.
also a background color instead of a picture works fine.
what can cause it?
(tried with Qt5.3 on windows7 x64, Qt 5.4 kubuntu x64, lubuntu x32) -
found some kind of a passby to solve that issue.
applying a QStackedWidget as the second widget in hierarchy, right after the main widget, makes it look just as it has to be, awful to use stacked widget in such way if you only need one "page" in your application tho. -
These are cascadind style sheets. This means they match not only the widget you set it on but also any children.
If you want to match a single specific widget give it a name (setObjectName()
or the corresponding field in the designer) and refer to it explicitly in the stylesheet e.g.#SomeWidget { background-image: url(...) }
-
@Chris-Kawa, you got me wrong i guess, the problem is not stylesheet inheritance, it's about the target widget itself NOT getting the stylesheet, instead that only passing style to children, naming him doesn't affect the result too.