blaylockr
21st July 2008, 15:06
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 );
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.
void MyWidget::resizeEvent ( QResizeEvent * event )
{
mpScrollbar->setGeometry ( 0, height() + 20, width() - 62, 20 );
mpScrollbar->update();
}
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 );
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.
void MyWidget::resizeEvent ( QResizeEvent * event )
{
mpScrollbar->setGeometry ( 0, height() + 20, width() - 62, 20 );
mpScrollbar->update();
}