Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Can I create custom stylesheet pseudo-states?
In our application we have centralized the styling. Now I want to create a custom control, which will have some
Q_PROPERTYs and I would like to set a different styling for that control in the global stylesheet based on the value of some of these properties.
What comes to mind then, is to create custom pseudo-states for such properties and use these in the stylesheet. In particular I want to set colors and fonts in these pseudo-states. Does Qt5 support this?
Devopia53 last edited by
You can read http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-using-dynamic-properties will help.
@Devopia53 Thanx for the hint - I'm actually very aware of that mechanism, and we are already using it a lot. It serves a slightly different use case however. It could be used, but creating custom pseudo-states seems to fit better in the big picture within the application.
no this is not supported at all, unfortunately.
The only way is to set properties etc. and repolish the widget.
@raven-worx Oke, thanx for the clear answer