PDA

View Full Version : QScrollArea scroll bars wrong size



koan
25th November 2010, 17:46
I am drawing some data in a widget added to a QScrollArea. I scale the data/widget depending on the available size: if the size is too small then I won't scale and that is when I want scroll bars to appear so that the user can scroll to view all the data.

I subclassed QScrollArea so that it emits a signal after a resizeEvent. On receiving the signal the child widget gets the size of it's parent to calculate the scale to use and then resizes itself. This works quite well with one problem: when I resize the application window, the scroll bars don't always update to reflect the change in size of the QScrollArea relative to the content.

How can I tell the QScrollArea it should recalculate the size of the handles on the scroll bars ? Or is there a way to inform it that the content has changed size ?

FelixB
25th November 2010, 17:56
try resizeEvent (http://doc.qt.nokia.com/4.7/qwidget.html#resizeEvent)

koan
25th November 2010, 19:50
try resizeEvent (http://doc.qt.nokia.com/4.7/qwidget.html#resizeEvent)

Can you explain what you mean in more detail ?

FelixB
26th November 2010, 08:00
sorry, forget it. I didn't read your text properly...

koan
26th November 2010, 14:10
When I resize the widget, I'm now calling QWidget::updateGeometry (http://doc.qt.nokia.com/4.7/qwidget.html#updateGeometry) and it seems to work as expected.