diff --git a/examples/quick/controls/gallery/main.qml b/examples/quick/controls/gallery/main.qml
index 0ca8c7cf8a40637d31f20d8c5606e3e29340b656..0a385a1bd2899cd39cd701340177aaf0ca0882dd 100644
--- a/examples/quick/controls/gallery/main.qml
+++ b/examples/quick/controls/gallery/main.qml
@@ -167,7 +167,7 @@ ApplicationWindow {
         RowLayout {
             id: toolbarLayout
             spacing: 0
-            width: parent.width
+            anchors.fill: parent
             ToolButton {
                 iconSource: "images/window-new.png"
                 onClicked: window1.visible = !window1.visible
diff --git a/src/controls/StatusBar.qml b/src/controls/StatusBar.qml
index be4791bb3338a87336be0a47c5832ffb65a35fe4..d5e8264268c880cf95f595f2dcbece64bdb9b0a8 100644
--- a/src/controls/StatusBar.qml
+++ b/src/controls/StatusBar.qml
@@ -65,6 +65,7 @@ import QtQuick.Controls.Private 1.0
     ApplicationWindow {
         statusBar: StatusBar {
             RowLayout {
+                anchors.fill: parent
                 Label { text: "Read Only" }
             }
         }
@@ -79,9 +80,10 @@ FocusScope {
     Accessible.role: Accessible.StatusBar
 
     width: parent ? parent.width : implicitWidth
-    implicitWidth: container.leftMargin + container.rightMargin + container.calcWidth()
-    implicitHeight: Math.max(container.topMargin + container.bottomMargin + container.calcHeight(),
-                             loader.item ? loader.item.implicitHeight : 19)
+    implicitWidth: container.leftMargin + container.rightMargin
+                   + Math.max(container.layoutWidth, __panel ? __panel.implicitWidth : 0)
+    implicitHeight: container.topMargin + container.bottomMargin
+                    + Math.max(container.layoutHeight, __panel ? __panel.implicitHeight : 0)
 
     /*! \internal */
     property Component style: Qt.createComponent(Settings.style + "/StatusBarStyle.qml", statusbar)
@@ -89,6 +91,9 @@ FocusScope {
     /*! \internal */
     property alias __style: styleLoader.item
 
+    /*! \internal */
+    property Item __panel: panelLoader.item
+
     /*! \internal */
     default property alias __content: container.data
 
@@ -107,7 +112,7 @@ FocusScope {
 
     data: [
         Loader {
-            id: loader
+            id: panelLoader
             anchors.fill: parent
             sourceComponent: styleLoader.item ? styleLoader.item.panel : null
             onLoaded: item.z = -1
@@ -134,12 +139,11 @@ FocusScope {
             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) }
+            property real layoutWidth: layoutItem ? (layoutItem.implicitWidth || layoutItem.width) +
+                                                    (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin +
+                                                                               layoutItem.anchors.rightMargin : 0) : 0
+            property real layoutHeight: layoutItem ? (layoutItem.implicitHeight || layoutItem.height) +
+                                                     (layoutItem.anchors.fill ? layoutItem.anchors.topMargin +
+                                                                                layoutItem.anchors.bottomMargin : 0) : 0
         }]
 }
diff --git a/src/controls/ToolBar.qml b/src/controls/ToolBar.qml
index 90f9d4a3147fc8d9fa82f6ed5256432d44f7bae3..3430ac2ae001a9c1185f9e920e9c66da677c47b5 100644
--- a/src/controls/ToolBar.qml
+++ b/src/controls/ToolBar.qml
@@ -67,6 +67,7 @@ import QtQuick.Controls.Private 1.0
     ApplicationWindow {
         toolBar: ToolBar {
             RowLayout {
+                anchors.fill: parent
                 ToolButton { ... }
                 ToolButton { ... }
                 ToolButton { ... }
@@ -85,8 +86,10 @@ FocusScope {
     LayoutMirroring.childrenInherit: true
 
     width: parent ? parent.width : implicitWidth
-    implicitWidth: container.leftMargin + container.rightMargin + container.calcWidth()
-    implicitHeight: container.topMargin + container.bottomMargin + container.calcHeight()
+    implicitWidth: container.leftMargin + container.rightMargin
+                   + Math.max(container.layoutWidth, __panel ? __panel.implicitWidth : 0)
+    implicitHeight: container.topMargin + container.bottomMargin
+                    + Math.max(container.layoutHeight, __panel ? __panel.implicitHeight : 0)
 
     /*! \internal */
     property Component style: Qt.createComponent(Settings.style + "/ToolBarStyle.qml", toolbar)
@@ -94,6 +97,9 @@ FocusScope {
     /*! \internal */
     property alias __style: styleLoader.item
 
+    /*! \internal */
+    property Item __panel: panelLoader.item
+
     /*! \internal */
     default property alias __content: container.data
 
@@ -112,7 +118,7 @@ FocusScope {
 
     data: [
         Loader {
-            id: loader
+            id: panelLoader
             anchors.fill: parent
             sourceComponent: styleLoader.item ? styleLoader.item.panel : null
             onLoaded: item.z = -1
@@ -139,13 +145,11 @@ FocusScope {
             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) }
+            property real layoutWidth: layoutItem ? (layoutItem.implicitWidth || layoutItem.width) +
+                                                    (layoutItem.anchors.fill ? layoutItem.anchors.leftMargin +
+                                                                               layoutItem.anchors.rightMargin : 0) : 0
+            property real layoutHeight: layoutItem ? (layoutItem.implicitHeight || layoutItem.height) +
+                                                     (layoutItem.anchors.fill ? layoutItem.anchors.topMargin +
+                                                                                layoutItem.anchors.bottomMargin : 0) : 0
         }]
 }