I think that if the bar is wider than the standard bar, you will need to adjust the scroll area viewport's contents margins accordingly and maybe also position the new bar yourself inside a reimplemented resizeEvent.
I think that if the bar is wider than the standard bar, you will need to adjust the scroll area viewport's contents margins accordingly and maybe also position the new bar yourself inside a reimplemented resizeEvent.
Thanks for the response. Could you elaborate on this : scroll area viewport's contents margins
Is the viewport a subcontrol of the scrollArea widget. I am unable to get any information on the subcontrols that belong to QScrollArea.
I tried setting the margins using the setViewportMargins(), but it didn't work.
ScrollArea::ScrollArea(QWidget *parent, QScrollBar *scrollbar) :
QScrollArea(parent)
{
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOf f);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
setVerticalScrollBar(scrollbar);
setViewportMargins(0, 0, 50, 0);
}
I am not familiar with the resize event so I have not tried it yet. I just wanted to make sure if I was on the correct path.
Scroll.PNG
Tried to add the setViewportMargins in the resize event function, but that didn't work either. Any other hints? I've looked everywhere but haven't found anything. Looks like I might have to create a custom scroll bar and link the signals to the scrollarea widget.
The scroll bar is still clipped off. I am unable to move it's position within QScrollArea Widget.
Ok, but in the resize event you were supposed to reposition the scrollbar to where you want it to be. Calling the base class implementation will position the bar exactly the same way as originally.
Hmm, I guess that is the part I am tripping. What function call do you use to reposition the bar?
Bookmarks