Reputation: 589
I am fairly new to QT and I am playing around with it a bit. I did a lot of android programming in the past. So I really love the android XML-Styling-System where you can change properties for each induviduell gui-element, you can apply styles to buttons (so they look always the same and there is just one place to change properties for all elements the style is applied to) or you can even create themes, so that you set up one set of styles for your whole application.
Is there anything similiar to this in QT? I've seen the stylesheet property to add a stylesheet to a widget. But let's assume I have 20 buttons and they are all suposed to look the same (e.g. all have a green background). Now I can apply a stylesheet to each button. Now I change my mind and I want them red. Do I have to go into each stylesheet again to change it?
I hope my point came across. Btw, what is QML? Seems very powerful but I didn't get it yet. Is it just a different way of styling?
Thanks.
Upvotes: 2
Views: 2416
Reputation: 5207
The selector part of the stylesheet language allows you to have rules that apply to all instances of a class, or all instance of classes of the same base classs, etc.
You can set stylesheets on individual widgets or globally, see QWidget::setStyleSheet()
and QApplication::setStyleSheet()
respectively.
Upvotes: 2