qtqt5qt-designerqtstylesheetsqgroupbox

How to maintain default background color of each items inside Qt group box?


When I changed the background color of Qt group box so combobox background color is also changed. Which is inside the group box. I want default color of combobox so this is why i am not changing the bg-color of combobox. Please tell me how can I change the background color of Qt group box without changing default bg-color of inside items. I changed the background of QT group box using style sheet in qt designer (ui). I am beginner please help.

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here


Solution

  • you should follow these steps :

    1. set specific names for your objects :

    enter image description here

    1. select parent object and add a stylesheet to the parent like this :

    enter image description here

    1. this is the Stylesheet :

      QGroupBox#gBox1 { background-color: rgb(138, 226, 52); }

    first, you should set which kind of class you want like QGroupBox, and for set style, to the specific object you call its object name after #.

    1. out put :

    enter image description here