Reputation: 129
I'm using a .qss file to set stylesheet for QPushButton I want to give some buttons a different style than other buttons... Is there any way to do this? Maybe something like
QPushButton#thisbutton{
...
}
Upvotes: 1
Views: 1722
Reputation: 5522
In QT Designer, add a custom property and call it class:
Set the value for this:
In a CSS style sheet set formatting for this class:
That's it!
Upvotes: 3
Reputation: 48307
for a normal QButton you can do it like you write above:
QPushButton{ color: blue}
if you can, then extend with inheritance the button and do:
MyNewButtonClass{color: red}
or you can directly with the name of the object directly:
QPushButton#okButton { color: gray }
you can ofcourse set the style of buttons without duplicating the sheet...you just do:
QPushButton#okButton, QPushButton#acceptButton, QPushButton#cancelButton
{
color: green
}
Upvotes: 1