c++ - Qt Layout relationship between QLayoutItem and QWidget -
this isn't clarified in documentation, happens when instance, call qboxlayout::insertwidget. allocates qlayoutitem, somehow associates widget , adds qlayoutitem layout? why need such indirection? i'm making custom layout , want able insert widgets @ index of layout, not aware of mechanics.
because layouts operate layout items, not widgets. qlayoutitem contains list of it's own functions used position layoutitem inside layout, , resize/align it.
take simple example: have vertical layout 300px wide. means each layout item add 300px wide. imagine adding 50x50 widget it. since layout has it's own geometry, sizehing, , other stuff, able insert widget (the layoutitem stay 300px wide, , widget stay 50px wide, nothing break), hard/impossible if operated widgets directly.
Comments
Post a Comment