@apalomer said in Selected QLabel?:
You have to imagine that label1 lives in two different UI files that end up composed in the same GUI
Then you need to use the UI file/class somewhere in the selector to distinguish. (To be clear: you can use your own class names in the selector, not just Qt inbuilt ones like QFrame or QLabel.)
Anyway, I have tried the descendant selector but I would like to have the name of the ascendant. Something like this:
The available facilities are in the reference I gave, and that does not include "ascendant" direction, only "descendent", as per CSS too.
I guess I will have to change the names at the end....
I don't see why. Presumably the different .ui's classes are different, and that should be usable in the selector.
There is also a supplementary way of distinguishing your labels which may suit. In that same reference page see
Property Selector QPushButton[flat="false"]
and https://doc.qt.io/qt-5/stylesheet-examples.html#customizing-using-dynamic-properties. You can add your own dynamic properties even in Designer on a widget, there is some "add property plus-button" on the properties on any widget.