summaryrefslogtreecommitdiff
path: root/src/controls/StatusBar.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/StatusBar.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/StatusBar.qml')
-rw-r--r--src/controls/StatusBar.qml6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/controls/StatusBar.qml b/src/controls/StatusBar.qml
index 068b6b20..85cc6681 100644
--- a/src/controls/StatusBar.qml
+++ b/src/controls/StatusBar.qml
@@ -79,7 +79,7 @@ Item {
Accessible.role: Accessible.StatusBar
width: parent ? parent.width : implicitWidth
- implicitWidth: loader.item ? loader.item.implicitWidth : 200
+ implicitWidth: container.leftMargin + container.rightMargin + container.calcWidth()
implicitHeight: Math.max(container.topMargin + container.bottomMargin + container.calcHeight(),
loader.item ? loader.item.implicitHeight : 19)
@@ -134,6 +134,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) : loader.item ? loader.item.implicitHeight : 0) }