When working with a Qt application, if I create a Widget as the root and have an associated QHboxLayout with the Widget, when I add Widgets into the layout, calling children()
on the Widget (root) will return a list of it's children Widgets, including the layout object that is attached to the Widget. When reading the documentation for Qt layouts, layouts are described as something that should be associated with a QWidget, not a child of one, because it can be set calling setLayout
. The layout is not rendered, yet the layout has a parent. The layout is responsible for aiding in children resizing for the QWidget.
My question is, why would be a Qlayout have a parent, what purpose is this used for?, and why would a layout be returned as a child of a QWidget with I call children()
on the Widget?, I would never want a layout returned, I would expect only Widgets returned, given that it is not actually rendered, unlike a widget, but serves the purpose is aiding in rendering for widget resizing.