Applying style sheets in pyqt

If I apply the property to the parent widget, it is automatically applied to the child widgets. Is there any way to prevent this? For example, if I set the background color to white in the dialog box, the buttons, combo boxes and scroll bars look white because it lacks its own appearance (let's say it's unpleasant and ugly). Is there a way that I can only apply stylesheets to a parent widget not for them children ???

Experts help ...

+6
python stylesheet qt4 pyqt pyqt4
source share
1 answer

Solution found ..

Instead of using

self.groupBox.setStyleSheet("background-color: rgb(255, 255, 255);\n" "border:1px solid rgb(255, 170, 255);") 

used specifically with selector types.

 self.groupBox.setStyleSheet("QGroupBox { background-color: rgb(255, 255,\ 255); border:1px solid rgb(255, 170, 255); }") 

This solves the problem.

+12
source share

All Articles