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().
+2
A:
QAbstractScrollArea::setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ) QAbstractScrollArea::setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff )
Mason Chang
2010-08-02 01:42:01
If I do it that way I can no longer scroll to a specific point using QScrollBar::setValue() (because the scrollbars do not exist)
pafcu
2010-08-02 11:32:22
If you need a scroll bar when needed, use the policy: Qt::ScrollBarAsNeeded.If you want to scroll content programmatic, use QAbstractScrollArea::scrollContentsBy ( int dx, int dy )
Mason Chang
2010-08-03 02:03:02
A:
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); verticalScrollBar()->hide(); verticalScrollBar()->resize(0, 0);
Barry Mavin
2010-08-30 02:37:22