Applying style sheets in pyqt
-
18-09-2019 - |
Question
If i apply a property to a parent widget it is automatically applied for child widgets too.. Is there any way of preventing this?? For example if i set background color as white in a dialog the button,combo boxes and scroll bars looks white as it lacks it native look(have to say it's unpleasant & ugly).. Is there any way that i can apply the stylesheets only to a parent widget not to it's children???
Experts help please..
Solution
Found a solution..
Instead of using
self.groupBox.setStyleSheet("background-color: rgb(255, 255, 255);\n"
"border:1px solid rgb(255, 170, 255);")
use specifically using selector types..
self.groupBox.setStyleSheet("QGroupBox { background-color: rgb(255, 255,\
255); border:1px solid rgb(255, 170, 255); }")
This solves the problem..
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow