[[Quickshell]] --- # Item Size Position `Item` type is the base type for "visual items". It has two properties: - actual size ( width, height ) - implicit/desired size ( implicitWidth, implicitHeight ) Implicit size is used by containers to determine their own. ## Container items Container (ie. `Item`): ```qml implicitWidth: child.implicitWidth + margin * 2 implicitHeight: child.implicitHeight + margin * 2 ``` ^ `WrapperItem` does this margin for us. Child (ie. `Rectangle`): ```qml x: parent.margin y: parent.margin width: parent.width - parent.margin * 2 height: parent.height - parent.margin * 2 implicitWidth: 50 implicitHeight: 50 ``` [Binding](https://doc.qt.io/qt-6/qml-qtqml-binding.html) can be used to map any property [Anchors](https://doc.qt.io/qt-6/qtquick-positioning-anchors.html) are a shorthand way to achieve many common position and size bindings. Using a containers' Item.childrenRect to determine size of children is a mistake. Item.childrenRect represents the actual geometry of all child items, not the mplicit one. Use [MarginWrapperManager](https://quickshell.org/docs/types/Quickshell.Widgets/MarginWrapperManager) to handle size and position of container and a single child item. ## Layouts