summaryrefslogtreecommitdiff
path: root/src/controls/ToolBar.qml
diff options
context:
space:
mode:
authorJens Bache-Wiig <jens.bache-wiig@digia.com>2013-06-03 13:37:25 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-03 14:54:10 +0200
commit207366038543adf5ee6384ff2577410f48df7a13 (patch)
treeebdbacb351573e006acda067827e718f988c334e /src/controls/ToolBar.qml
parentcbd4b0f4e83cd458bd0f1ecbb53f1d789dfe9ff7 (diff)
downloadqtquickcontrols-207366038543adf5ee6384ff2577410f48df7a13.tar.gz
Fix incorrect size hint for ToolBar and StatusBar
We only cared about reserving space for the height but while trying to actually get the minimumSize for a window based on the toolbar content I realized that we really need to calculate the width as well. Change-Id: I7b55b66a2475a2355d30614095f173a39f47f2f1 Reviewed-by: Caroline Chao <caroline.chao@digia.com>
Diffstat (limited to 'src/controls/ToolBar.qml')
-rw-r--r--src/controls/ToolBar.qml6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/controls/ToolBar.qml b/src/controls/ToolBar.qml
index e5cc8419..b73a6f3e 100644
--- a/src/controls/ToolBar.qml
+++ b/src/controls/ToolBar.qml
@@ -83,7 +83,7 @@ Item {
Accessible.role: Accessible.ToolBar
width: parent ? parent.width : implicitWidth
- implicitWidth: loader.item ? loader.item.implicitWidth : 200
+ implicitWidth: container.leftMargin + container.rightMargin + container.calcWidth()
implicitHeight: container.topMargin + container.bottomMargin + container.calcHeight()
/*! \internal */
@@ -137,6 +137,10 @@ Item {
property int rightMargin: __style ? __style.padding.right : 0
property Item layoutItem: container.children.length === 1 ? container.children[0] : null
+ function calcWidth() { return (layoutItem ? (layoutItem.implicitWidth || layoutItem.width) +
+ (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin +
+ layoutItem.anchors.rightMargin : 0) :
+ loader.item ? loader.item.implicitWidth : 0) }
function calcHeight () { return (layoutItem ? (layoutItem.implicitHeight || layoutItem.height) +
(layoutItem.anchors.fill ? layoutItem.anchors.topMargin +
layoutItem.anchors.bottomMargin : 0) :