Hello! Faced such a difficulty:
I wrote my widget, redefined the paintEvent () method in it:
class My_PushButton : public QPushButton { //какой то код }; I want to apply the styles specified in the style.qss file to this widget.
And in any way it does not work. Styles are not applied to the widget, only to their own, they are applied to all the rest.
through setObjectName I set the name, and in the styles I tried to prescribe in different ways:
#mybutton My_PushButton#mybutton QPushButton#mybutton QPushButton>My_PushButton#mybutton QPushButton My_PushButton#mybutton None of the above options worked. Tell me how to set selectors correctly, to your own widgets