Ayeayeron
Ayeayeron

Reputation: 459

Removing arrows from scrollbar in Qt

I'm using a small black and white screen and need the scrollbar to just be a black slider in a black outer frame. I got what I wanted using style sheets but including them in the configuration when installing takes up too much space so I can't use them. Is it possible to remove the arrows by inheriting from QStyle or something? thanks

Upvotes: 0

Views: 2717

Answers (3)

dimsuz
dimsuz

Reputation: 9207

You should create a subclass of a QStyle (or some subclass like QCommonStyle) and reimplement its drawComplexControl() function to paint CC_ScrollBar element by yourself.

Read QStyle's documentation for more.

Upvotes: 1

cybevnm
cybevnm

Reputation: 2566

You can try to change palette settings for your scroll bar (according to designer scroll bar arrow color is "button text" color), but this approach looks lick little hack... More "heavy" approach, is inherit from scroll bar widget and reimplement paint method, but there are it is looks like overkill...
So, you must choose little hack vs overkill :). Though maybe there are exist another solution

Upvotes: 0

Troubadour
Troubadour

Reputation: 13431

This might be a dumb answer but would it help if you just specified the style sheet itself in code as a QString argument to setStyleSheet rather than maintain a separate file for it?

Upvotes: 0

Related Questions