5

I'm trying to customize my UI. I don't know how to make a style sheet entry pertain to anything except the parent and ALL of the children. For example I run this line:

self.lnchTab.setStyleSheet('QWidget { background-color: #1d1d1d ; color: #f8f8f8}')

And I change ALL of the elements beneath self.lnchTab to be darkish grey. I want only the self.lnchTab to be dark grey, and not the text, inputs, and buttons within it.

How do I accomplish this?

Thanks for any help. Google is giving nothing useful or even near what I'm trying to find.

Vii
  • 813
  • 3
  • 20
  • 32

1 Answers1

14

You can give self.lnchTab object some name/id and then you can use id-selector in style-sheet:

self.lnchTab.setObjectName("myParentWidget");
self.lnchTab.setStyleSheet('QWidget#myParentWidget { background-color: #1d1d1d ; color: #f8f8f8}')
Ammar
  • 1,947
  • 14
  • 15