PDA

View Full Version : Moving the horizontal QScrollbar of a QScrollArea at the top of the QScrollArea



planglois
7th March 2008, 00:26
Hello!

I need to move the position of the horizontal scroll bar of a QScrollArea at the top of the widget. Is there anyone who know how to do this?

Thanks,
py

wysota
7th March 2008, 01:07
Yes, it's quite simple. You need to subclass the widget, set viewport margins (using QAbstractScrollArea::setViewportMargins)so that the margin is in the top and not in the bottom of the viewport and reimplement resizeEvent() where you will have to reposition the horizontal scrollbar after every resize of the widget. Be aware of the fact that hiding and showing the scroll bar will probably require a bit more work to keep the viewport margins coherent.

planglois
10th March 2008, 21:16
Thanks wysota,

I'll try that this week and I will let you know the outcomes..

py