diff --git a/src/controls/ToolBarApplicationHeader.qml b/src/controls/ToolBarApplicationHeader.qml --- a/src/controls/ToolBarApplicationHeader.qml +++ b/src/controls/ToolBarApplicationHeader.qml @@ -39,100 +39,90 @@ //FIXME: needs a property difinition to have its own type in qml property string _internal: "" - pageDelegate: Item { + pageDelegate: RowLayout { id: delegateItem readonly property bool current: __appWindow.pageStack.currentIndex == index - property Row layout //don't scroll except just the nav buttons implicitWidth: parent.parent.width - height*2 height: parent.height - Row { - id: layout + Separator { anchors.verticalCenter: parent.verticalCenter - spacing: 2 - - Separator { - anchors.verticalCenter: parent.verticalCenter - height: parent.height * 0.6 - visible: index > 0 - } - PrivateActionToolButton { - anchors.verticalCenter: parent.verticalCenter - kirigamiAction: page && page.actions ? page.actions.left : null - showText: false - } - PrivateActionToolButton { - anchors.verticalCenter: parent.verticalCenter - kirigamiAction: page && page.actions ? page.actions.main : null - showText: false - } - PrivateActionToolButton { - anchors.verticalCenter: parent.verticalCenter - kirigamiAction: page && page.actions ? page.actions.right : null - showText: false - } - Separator { - anchors.verticalCenter: parent.verticalCenter - height: parent.height * 0.6 - visible: page && page.actions && (page.actions.left || page.actions.main || page.actions.right) - } - - Row { - id: contextActionsContainer - property var overflowSet: [] + Layout.preferredHeight: parent.height * 0.6 + visible: index > 0 + } + PrivateActionToolButton { + anchors.verticalCenter: parent.verticalCenter + kirigamiAction: page && page.actions ? page.actions.left : null + } + PrivateActionToolButton { + anchors.verticalCenter: parent.verticalCenter + kirigamiAction: page && page.actions ? page.actions.main : null + } + PrivateActionToolButton { + anchors.verticalCenter: parent.verticalCenter + kirigamiAction: page && page.actions ? page.actions.right : null + } + Separator { + anchors.verticalCenter: parent.verticalCenter + Layout.preferredHeight: parent.height * 0.6 + visible: page && page.actions && (page.actions.left || page.actions.main || page.actions.right) + } - Repeater { - id: repeater - model: page && page.actions.contextualActions ? page.actions.contextualActions : null - delegate: PrivateActionToolButton { - id: actionDelegate - anchors.verticalCenter: parent.verticalCenter - kirigamiAction: modelData - property bool fits: x+contextActionsContainer.x+layout.x+width < delegateItem.width - moreButton.width - onFitsChanged: updateOverflowSet() - function updateOverflowSet() { - var index = contextActionsContainer.overflowSet.findIndex(function(act){ - return act == modelData}); - - if ((fits || !modelData.visible) && index > -1) { - contextActionsContainer.overflowSet.splice(index, 1); - } else if (!fits && modelData.visible && index == -1) { - contextActionsContainer.overflowSet.push(modelData); - } - contextActionsContainer.overflowSetChanged(); + Row { + id: contextActionsContainer + Layout.fillWidth: true + Layout.fillHeight: true + anchors.verticalCenter: parent.verticalCenter + property var overflowSet: [] + + Repeater { + id: repeater + model: page && page.actions.contextualActions ? page.actions.contextualActions : null + delegate: PrivateActionToolButton { + id: actionDelegate + anchors.verticalCenter: parent.verticalCenter + kirigamiAction: modelData + readonly property bool fits: x+implicitWidth < contextActionsContainer.width + onFitsChanged: updateOverflowSet() + function updateOverflowSet() { + var index = contextActionsContainer.overflowSet.findIndex(function(act){ + return act == modelData}); + + if ((fits || !modelData.visible) && index > -1) { + contextActionsContainer.overflowSet.splice(index, 1); + } else if (!fits && modelData.visible && index == -1) { + contextActionsContainer.overflowSet.push(modelData); } - visible: modelData.visible && fits + contextActionsContainer.overflowSetChanged(); + } + visible: modelData.visible && fits - Connections { - target: modelData - onVisibleChanged: actionDelegate.updateOverflowSet(); - } - Component.onCompleted: { - actionDelegate.updateOverflowSet(); - } + Connections { + target: modelData + onVisibleChanged: actionDelegate.updateOverflowSet(); + } + Component.onCompleted: { + actionDelegate.updateOverflowSet(); } } } } - Heading { id: heading anchors.verticalCenter: parent.verticalCenter - visible: layout.width <= 0 + horizontalAlignment: Qt.AlignRight opacity: delegateItem.current ? 1 : 0.4 color: Theme.textColor elide: Text.ElideRight text: page ? page.title : "" font.pointSize: Math.max(1, (parent.height / 1.6) / Units.devicePixelRatio) } + Controls.ToolButton { id: moreButton - anchors { - right: parent.right - verticalCenter: parent.verticalCenter - } + anchors.verticalCenter: parent.verticalCenter Icon { anchors.fill: parent