Stylesheets control Layout objects?
-
Greetings -
Is it possible to have a stylesheet control parameters of a QLayout object in the same way it does for QWidgets? For example, if I have this:
@
QVBoxLayout {
margin-top: 0px;
margin-bottom: 0px;
margin-left: 2px;
margin-right: 2px;
}
@there is no change in the appearance of my application. Do stylesheets simply not work with QLayout objects, or am I just using incorrect syntax?
Thanks!
EDIT: please put code (also qss) inside @-tags or use the code button in the editor, Gerolf
-
I don't think it is possible to apply stylesheets to layout items. There are some properties which are dervied from the style sheet that is applied to the parent widget (spacing), but contentMargins is unfortunately not one of them (directly taken from the currently style).
However, I think it would be quite useful to have such a feature (for example by adding a stylesheet only contentMargins property to QWidget which is inherited by layouts as we have for spacing). So feel free to add a "suggestion":https://bugreports.qt.nokia.com/, +1 from me.
-
Thanks! This is it:
https://bugreports.qt.nokia.com/browse/QTBUG-22862
[quote author="Lukas Geyer" date="1321944258"]I don't think it is possible to apply stylesheets to layout items. There are some properties which are dervied from the style sheet that is applied to the parent widget (spacing), but contentMargins is unfortunately not one of them (directly taken from the currently style).
However, I think it would be quite useful to have such a feature (for example by adding a stylesheet only contentMargins property to QWidget which is inherited by layouts as we have for spacing). So feel free to add a "suggestion":https://bugreports.qt.nokia.com/, +1 from me.[/quote]
-
@JonB
Hi
Nope. Sadly.
https://bugreports.qt.io/browse/QTBUG-22862And as far as i know, Layouts are not really into stylesheets at all.
https://forum.qt.io/topic/32043/qlayout-margin-through-stylesheet-solved/