Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide QScrollBar arrows

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.

like image 797
programtg Avatar asked Jan 16 '14 08:01

programtg


People also ask

Can you hide scrollbar CSS?

To hide the scrollbar and disable scrolling, we can use the CSS overflow property. This property determines what to do with content that extends beyond the boundaries of its container. To prevent scrolling with this property, just apply the rule overflow: hidden to the body (for the entire page) or a container element.

How do I customize my scroll bar?

Scrollbar Selectors For webkit browsers, you can use the following pseudo elements to customize the browser's scrollbar: ::-webkit-scrollbar the scrollbar. ::-webkit-scrollbar-button the buttons on the scrollbar (arrows pointing upwards and downwards). ::-webkit-scrollbar-thumb the draggable scrolling handle.

How do I stop scrolling without scrollbar hiding?

Disabling scroll with only CSS. There's another way to disable scrolling that is commonly used when opening modals or scrollable floating elements. And it is simply by adding the CSS property overflow: hidden; on the element you want to prevent the scroll.


1 Answers

Create a QScrollBar and assign it this stylesheet and this should do the trick. See example below.

QScrollBar:vertical {
  width: 15px;
  background: #f1f1f1;
}

QScrollBar::handle:vertical {
  background: #888;
}

QScrollBar::add-line:vertical {
  border: 2px solid gray;
  background: #f1f1f1;
}

QScrollBar::sub-line:horizontal {
  border: 2px solid gray;
  background: #f1f1f1;
}

QScrollBar::handle:hover:vertical {
  background: #555;
}
like image 154
user11738998 Avatar answered Sep 23 '22 07:09

user11738998