From b4e424e0e13f9336234dd06a556f3ec2899d173a Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig <jens.bache-wiig@digia.com> Date: Fri, 10 May 2013 15:35:06 +0200 Subject: [PATCH] Automatically set toolbar width Change-Id: I4038afc1cb22102f8873014d90dedec79cbaa376 Reviewed-by: J-P Nurmi <jpnurmi@digia.com> --- examples/quick/controls/gallery/main.qml | 8 ++------ src/controls/ApplicationWindow.qml | 6 ++++-- src/controls/StatusBar.qml | 3 ++- src/controls/ToolBar.qml | 1 + 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/quick/controls/gallery/main.qml b/examples/quick/controls/gallery/main.qml index aff3cb4c9..7da74031e 100644 --- a/examples/quick/controls/gallery/main.qml +++ b/examples/quick/controls/gallery/main.qml @@ -69,9 +69,8 @@ ApplicationWindow { onAccepted: imageViewer.open(fileUrl) } - ToolBar { + toolBar: ToolBar { id: toolbar - width: parent.width RowLayout { spacing: 2 anchors.verticalCenter: parent.verticalCenter @@ -265,10 +264,7 @@ ApplicationWindow { id:frame enabled: enabledCheck.checked tabPosition: controlPage.item ? controlPage.item.tabPosition : Qt.TopEdge - anchors.top: toolbar.bottom - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.left: parent.left + anchors.fill: parent anchors.margins: Qt.platform.os === "mac" ? 12 : 2 Tab { diff --git a/src/controls/ApplicationWindow.qml b/src/controls/ApplicationWindow.qml index 44b6f187c..f2e181a58 100644 --- a/src/controls/ApplicationWindow.qml +++ b/src/controls/ApplicationWindow.qml @@ -141,11 +141,12 @@ Window { id: backgroundItem anchors.fill: parent - Row { + Item { id: toolBarArea anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right + height: childrenRect.height } Item { @@ -156,11 +157,12 @@ Window { anchors.bottom: statusBarArea.top } - Row { + Item { id: statusBarArea anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: parent.right + height: childrenRect.height } onVisibleChanged: if (visible && menuBar) menuBar.__parentWindow = root diff --git a/src/controls/StatusBar.qml b/src/controls/StatusBar.qml index b5d9e4d82..248c16eeb 100644 --- a/src/controls/StatusBar.qml +++ b/src/controls/StatusBar.qml @@ -70,7 +70,8 @@ Item { id: statusbar activeFocusOnTab: false Accessible.role: Accessible.StatusBar - implicitWidth: parent ? parent.width : loader.item ? loader.item.implicitHeight : 0 + width: parent ? parent.width : implicitWidth + implicitWidth: loader.item.implicitHeight implicitHeight: loader.item ? loader.item.implicitHeight : 0 property Component style: Qt.createComponent(Settings.theme() + "/StatusBarStyle.qml", statusbar) Loader { diff --git a/src/controls/ToolBar.qml b/src/controls/ToolBar.qml index abf8c2fa1..71ef30a51 100644 --- a/src/controls/ToolBar.qml +++ b/src/controls/ToolBar.qml @@ -73,6 +73,7 @@ Item { id: toolbar activeFocusOnTab: false Accessible.role: Accessible.ToolBar + width: parent ? parent.width : implicitWidth implicitWidth: loader.item ? loader.item.implicitWidth : 0 implicitHeight: loader.item ? loader.item.implicitHeight : 0 property Component style: Qt.createComponent(Settings.theme() + "/ToolBarStyle.qml", toolbar) -- GitLab