Applying style sheets in pyqt

17,275

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..

Share:
17,275
Jeba
Author by

Jeba

please delete me

Updated on June 29, 2022

Comments

  • Jeba
    Jeba almost 2 years

    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..