Reputation: 537
How can i get the default stylesheet colors in python using pyqt
I assigned a StyleSheet
for a QGroupBox
when its activated
self.State.setStyleSheet("QGroupBox { background-color: rgb(0,255,0,20%); border:1px solid rgb(255, 170, 255); }")
I need to have it set to defaults when this particular QGroupBox
is disabled or deactivated
Upvotes: 3
Views: 6436
Reputation: 4649
To restore a previous non-default stylesheet, you can do as Felipe Lema suggests.
To restore a default one, you can use an empty string and call directly:
self.State.setStyleSheet("").
Upvotes: 0
Reputation: 2718
You can save it to a string before changing it (it's a R/W property):
default_style_sheet = self.State.styleSheet()
# ...
self.State.setStyleSheet(fancy_style_sheet)
# ...
self.State.setStyleSheet(default_style_sheet)
Upvotes: 0