Does the QScrollBar style sheet leave a scrollbar background with a checkerboard pattern?

When I use the QScrollBar style using the stylesheet, the background color will be marked instead of solid.

 QScrollBar:horizontal { background-color: grey; } 

enter image description here

How to make scrollbar background solid color?

+8
c ++ css stylesheet qt
source share
1 answer

What you call a "background" is actually two sub add-page elements of add-page and sub-page . You need to define a background element for these subelements.

The simplest solution would be to remove background on both. Then it inherits the background color grey that you have already set to QScrollBar :

 QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { background: none; } 

enter image description here

But if you wish, you can style each to your liking:

 QScrollBar::sub-page:horizontal { background: red; } QScrollBar::add-page:horizontal { background: green; } 

enter image description here

A source

Unfortunately, this decision is quite difficult to guess from the official documentation .

+19
source share

All Articles