Hi,
I am trying to place a horizontal scrollbar in the bottom of a widget. The widget in question is one of (3) panes in a splitter window.
The first problem I discovered was that the scrollbar is too long for the width of the window by 62 units.
This code is in the constructor of my widget class.
mpScrollbar
= new QScrollBar ( Qt
::Horizontal,
this );
mpScrollbar->setGeometry ( 0, height() + 20, width() - 62, 20 );
mpScrollbar = new QScrollBar ( Qt::Horizontal, this );
mpScrollbar->setGeometry ( 0, height() + 20, width() - 62, 20 );
To copy to clipboard, switch view to plain text mode
The second problem is that when I resize the window, the scrollbar does not resize with it.
I tried overriding the widget's resizeEvent but when I do, the scrollbar is NEVER drawn.
{
mpScrollbar->setGeometry ( 0, height() + 20, width() - 62, 20 );
mpScrollbar->update();
}
void MyWidget::resizeEvent ( QResizeEvent * event )
{
mpScrollbar->setGeometry ( 0, height() + 20, width() - 62, 20 );
mpScrollbar->update();
}
To copy to clipboard, switch view to plain text mode
Bookmarks