Alex Rivera | Logout

How to hide scrollbar in QScrollArea?

Asked 2010-08-01T18:44:11.850
13

How can one hide the scrollbars in a QScrollArea? Currently I use the hide() method on the scrollbars returned by QScrollArea::horizontalScrollBar() and QScrollArea::verticalScrollBar() but the space reserved for scrollbars still remains. Obviously this looks very ugly and is not space efficient. If I remove the scrollbars altogether I can no longer easily scroll to a specific point using QScrollBar::setValue().

Edit
Report

1 Answer

20

Use this code:

QAbstractScrollArea::setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff )
QAbstractScrollArea::setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ) 
answered 2010-08-02T01:42:01.883

Your Answer