Detect arbitrary custom attributes from application QSS style in MyWidget::paintEvent?
-
wrote on 28 May 2016, 20:41 last edited by
So I have a custom widget that I want to style. I use an application-wide style for styling everything else, but my widget has this specific thing that it paints, and it would be very neat if it could retrieve its color from QSS, e. g.:
MyWidget { customThingColor: red }
Is it doable? Certainly, it's not the only way to pass a parameter to a widget, but it would be most neat if I could put ALL the styling code in a single app-wide QSS string.
-
Hi,
You can use designable
Q_PROPERTIES
for that. See here -
wrote on 29 May 2016, 12:50 last edited by
@SGaist, awesome, that works! Thanks a lot. Sorry I couldn't find it in the docs.
1/3