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

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -