How to hide QScrollBar
arrows?
I need to hide in horizontal scrollbar.
I was trying to hide with setStyleSheet
:
setStyleSheet(" QScrollBar:left-arrow:horizontal, QScrollBar::right-arrow:horizontal { height:0px; }" )
but it doesn't work.
How to hide QScrollBar
arrows?
I need to hide in horizontal scrollbar.
I was trying to hide with setStyleSheet
:
setStyleSheet(" QScrollBar:left-arrow:horizontal, QScrollBar::right-arrow:horizontal { height:0px; }" )
but it doesn't work.
If you need to hide just the arrows inside buttons then you can try to set background and border in this way:
If you want to hide whole buttons then you go with code below.
I know this is an old question, but I've ran into an issue with this question's approved answer, and I've found a fix for it so I'm going to leave this here in case someone runs into the same problem that I did.
While the accepted answer suggests setting
border
,background
andcolor
tonone
, this only visually hides the scrollbar arrows. What I mean by this is that you can still click them, and the scrollbar's handle, while it can move to the place they occupied, can not be clicked on if your cursor is in the area the arrow buttons occupied.To also functionally hide them, you should set their
width
andheight
styles to0px
as well. This will make it so you can click on the handle if the scrollbar's handle is in the area the arrow-buttons occupied.Create a
QScrollBar
and assign it this stylesheet and this should do the trick. See example below.In order to hide a scroll bar you can set the scroll bar policy for that particular scroll bar (horizontal in your case). For example: