Stylesheet code for two different QScrollBars
-
I know that if you want to make specific stylesheet for some control you should set something like this:
#PushButton1{ color: red; } #PushButton2{ color: blue; }
But what if you want to make same thing for two different QScrollBars, for example one that belong to ListWidget1 and another to ListWidget2 ? What should I write as stylesheet code?
-
I know that if you want to make specific stylesheet for some control you should set something like this:
#PushButton1{ color: red; } #PushButton2{ color: blue; }
But what if you want to make same thing for two different QScrollBars, for example one that belong to ListWidget1 and another to ListWidget2 ? What should I write as stylesheet code?
@DejanPetrovic
You can use Descendant Selector and Child selector, as per https://doc.qt.io/Qt-5/stylesheet-syntax.html#selector-types.I'm not sure of my
#
syntax, but something like these two examples.:#ListWidget1 #PushButton1 { ... } /* A `#PushButton1` anywhere inside `#ListWidget1` */ #ListWidget2 > QPushButton { ... } /* Any `QPushButton` directly on `#ListWidget2` */
-
Thanks for replay, that link explains a lot. Descendant Selector working for me. But now something weird is going on. In Designer now is OK but in final application it doesn't apply as it's showed in picture.
What should I do?
Plus all fonts suddenly becomes bold. So weird.
-
Solved: That issue about fonts becoming bold is causes two splitters. I don't know why but when remove one splitter all is OK