[Qt-interest] QScrollArea::resize() does not resize the viewport
Nikos Chantziaras
realnc at arcor.de
Sat May 1 21:25:10 CEST 2010
Calling resize() or setGeometry() on a QScrollArea results in the
viewport() dimensions not being updated:
void foo( QScrollArea* scr )
{
scr->resize(500, 500);
do_some_stuff(scr->viewport()->size());
}
do_some_stuff() receives a wrong size. Is this normal? For the code to
work correctly, I need to do:
void foo( QScrollArea* scr )
{
scr->viewport()->resize(500, 500); // <-- Smells funny
do_some_stuff(scr->viewport()->size());
}
Why is that? When the QScrollArea is resized with the mouse, the
viewport changes accordingly. When it's resized by code (like above),
the viewport doesn't change.
More information about the Qt-interest-old
mailing list