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.
Qt Code:
  1. mpScrollbar = new QScrollBar ( Qt::Horizontal, this );
  2. 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.

Qt Code:
  1. void MyWidget::resizeEvent ( QResizeEvent * event )
  2. {
  3. mpScrollbar->setGeometry ( 0, height() + 20, width() - 62, 20 );
  4. mpScrollbar->update();
  5. }
To copy to clipboard, switch view to plain text mode