i dynamically adding , removing widgets in qscrollarea, , show @ 4 widgets @ same time before scroll bar appears. basically, if have 0-3 widgets , add one, scroll area resized fit new height, after that, height stays @ 4 widgets size , have scroll see 5th, 6th, ... currently, call following method when widget inserted/removed. void widgetlist::resizescrollarea() { // height of first 4 widgets int widgetsheight = 0; (int = 0; < _widgets.size() && < 4; ++i) { // height of widget widgetsheight += _widgets.at(i)->sizehint().height(); } // leeway make sure have gap between widgets _ui->scrollarea->setfixedheight(widgetsheight + 5); } the problem sizehint() isn't correct height (sometimes big), neither size() (often small). scroll area bit big content, works. not widgets have same height, , sizehint seems correct one, , size. understand sizehint size widget have, not 1 layout gives it, don't why size incor...
Comments
Post a Comment