Index: sources/gui/qml/components/Footer.qml =================================================================== diff -u -rbd01334f257c35b96b7b232beacbcd7fae60c852 -r98581b325c24eb5ef0ce0ce475ad15320d659140 --- sources/gui/qml/components/Footer.qml (.../Footer.qml) (revision bd01334f257c35b96b7b232beacbcd7fae60c852) +++ sources/gui/qml/components/Footer.qml (.../Footer.qml) (revision 98581b325c24eb5ef0ce0ce475ad15320d659140) @@ -24,12 +24,37 @@ * \brief Denali project Footer section which gives all the children same width with same spacing, aligned in center */ Row { id: _root - property int childrenCount: children.length - readonly property int splits: _root.width / (childrenCount * 2 + 1 ) + property int childrenWidth : _root.width / (childrenCount * 2 + 1 ) + property int childrenCount : children.length - spacing : _root.splits - rightPadding : spacing - leftPadding : spacing + QtObject { id: _private + property int spacing : 0 + } + + // this code will run once and will not run for each child, + // that's becuase the available property to add children is the children property + // and that property can only change by assigning a list to it. + // so it happens once with no performance issue of multiple redundant call. + onChildrenCountChanged: { + // check there is a child + let count = childrenCount + if ( ! count ) return + + + let width = childrenWidth + let spacing = (_root.width - (width * count)) / (count + 1) + + for (let i = 0; i < count; i++) { + if (children[i].width !== width) { + children[i].width = width + } + } + _private.spacing = spacing + } + + spacing : _private.spacing + rightPadding : _private.spacing + leftPadding : _private.spacing width : parent.width anchors.bottom : parent.bottom anchors.bottomMargin: Variables.notificationHeight + Variables.minVGap