resize - Qt: How to fit content to QScrollArea -
i reimplement qscrollarea , want add serveral widgets @ runtime. problem is, till scrollbars shown content of qscrollarea doesnt fit it. if add more widgets scrollbars shown content fits correctly.
i tried after adding widgets
this->widget()->resize(this->widget()->sizehint());
or
this->widget()->adjustsize();
but doesn't worked. have resize content? why content fits after scrollbars appear?
- add appropriate layout scroll area before setting widget.
- set size constraints(min , max property ) of widgets being added
- i not sure widget layout inside scroll area, can make use of spacers align widgets ( when there not many widgets fill scroll area scroll bar appear)
Comments
Post a Comment