Solved Detect arbitrary custom attributes from application QSS style in MyWidget::paintEvent?
-
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 -
@SGaist, awesome, that works! Thanks a lot. Sorry I couldn't find it in the docs.