Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Customize QScrollBar intersection using stylesheet Qt

Tags:

c++

css

qt

qt4

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.

like image 208
Kirell Avatar asked Dec 04 '22 08:12

Kirell


2 Answers

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

QAbstractScrollArea::corner {
    background: somecolor;
}

Or, to hide it, use:

background: transparent;
like image 54
Tyr Avatar answered Jan 18 '23 23:01

Tyr


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.

like image 31
Fred Avatar answered Jan 19 '23 01:01

Fred