Reputation: 59
btn.setStyleSheet("QPushButton {font: 30pt Comic Sans MS"}
btn.setStyleSheet("background-color: red")
I am trying to get my "btn" to be both red and a specific font and size, but can only get one style at a time, in this case; the red command overides the font command.
How can I merge these commands so both are executed?
Upvotes: 0
Views: 1768
Reputation: 59
Solved it:
btn.setStyleSheet("background-color: red;"
"font: bold 30pt Comic Sans MS")
to merge the commands! Thanks!
Upvotes: 1
Reputation: 3
I don't know if this is actually the code you have but you didn't close the brackets for the method nor the double quotes
So this:
btn.setStyleSheet("QPushButton {font: 30pt Comic Sans MS}
btn.setStyleSheet("background-color: red")
Will become this:
btn.setStyleSheet("QPushButton {font: 30pt Comic Sans MS}"}
btn.setStyleSheet("background-color: red")
Try it, but anyway check this document to reference your code to: http://doc.qt.io/qt-4.8/stylesheet-examples.html
Upvotes: 0