Kirell
Kirell

Reputation: 9828

Customize QScrollBar intersection using stylesheet Qt

I’ve already customize my horizontal and vertical scrollbars using a stylesheet no problem. But there still an annoying tiny area which remains blank :

The intersection of an horizontal and vertical bar. A small rectangle.

How could I change its color ? (Using stylesheets )

Thank you !

Qt 4.7.1 on Mac OSX Snow Leopard

Ps: Even on the Qt stylesheet example it’s still white.

Upvotes: 5

Views: 3355

Answers (2)

Tyr
Tyr

Reputation: 802

I realise this is an old question, but I found a better solution.

QAbstractScrollArea::corner {
    background: somecolor;
}

Or, to hide it, use:

background: transparent;

Upvotes: 17

Fred
Fred

Reputation: 4954

By default, the scroll area corner will be painted with the Window palette. Unfortunately, you cannot change the Window palette using only stylesheets. However, what you can do is create a dummy widget and set it to be displayed in the corner area with QAbstractScrollArea::setCornerWidget(QWidget *widget), and then use the stylesheet to change the color of that widget.

Upvotes: 3

Related Questions