From 0d3edfa4688f6d20a7eaa4cce3011d92e673a405 Mon Sep 17 00:00:00 2001
From: Jens Bache-Wiig <jensbw@gmail.com>
Date: Thu, 6 Oct 2011 14:50:20 +0200
Subject: [PATCH] Add ApplicationWindow to the API

---
 components/ApplicationWindow.qml | 32 ++++++++++++++++++++++++++++++++
 components/StatusBar.qml         |  2 +-
 components/ToolBar.qml           |  3 +--
 components/components.pro        |  3 ++-
 components/qmldir                |  1 +
 src/qtoplevelwindow.h            |  1 +
 6 files changed, 38 insertions(+), 4 deletions(-)
 create mode 100644 components/ApplicationWindow.qml

diff --git a/components/ApplicationWindow.qml b/components/ApplicationWindow.qml
new file mode 100644
index 000000000..001a17d1a
--- /dev/null
+++ b/components/ApplicationWindow.qml
@@ -0,0 +1,32 @@
+import QtQuick 1.1
+
+Window {
+    width: 320
+    height: 240
+
+    property alias toolBar: toolBarArea.data
+    property alias statusBar: statusBarArea.data
+    default property alias data: contentArea.data
+
+    Column {
+        id: toolBarArea
+        anchors.top: parent.top
+        anchors.left: parent.left
+        anchors.right: parent.right
+    }
+
+    Item {
+        id: contentArea
+        anchors.top: toolBarArea.bottom
+        anchors.left: parent.left
+        anchors.right: parent.right
+        anchors.bottom: statusBarArea.top
+    }
+
+    Column {
+        id: statusBarArea
+        anchors.bottom: parent.bottom
+        anchors.left: parent.left
+        anchors.right: parent.right
+    }
+}
diff --git a/components/StatusBar.qml b/components/StatusBar.qml
index aba6c3185..ae2b6fcb5 100644
--- a/components/StatusBar.qml
+++ b/components/StatusBar.qml
@@ -3,7 +3,7 @@ import "."
 import "custom" as Components
 
 StyleItem {
-    width: 200
+    width: parent ? parent.width : 200
     height: 24
     elementType: "statusbar"
 }
diff --git a/components/ToolBar.qml b/components/ToolBar.qml
index 6eda98b7b..855895bbf 100644
--- a/components/ToolBar.qml
+++ b/components/ToolBar.qml
@@ -4,8 +4,7 @@ import "custom" as Components
 
 StyleItem {
     id: toolbar
-    width: 200
+    width: parent ? parent.width : 200
     height: 40
     elementType: "toolbar"
 }
-
diff --git a/components/components.pro b/components/components.pro
index 50e2161fb..5d8865697 100644
--- a/components/components.pro
+++ b/components/components.pro
@@ -40,7 +40,8 @@ QML_FILES = \
             SplitterColumn.qml \
             StatusBar.qml \
             TableColumn.qml \
-            TextField.qml
+            TextField.qml \
+            ApplicationWindow.qml
 
 QML_DIRS = \
         custom \
diff --git a/components/qmldir b/components/qmldir
index cae6b2bca..9264cd462 100644
--- a/components/qmldir
+++ b/components/qmldir
@@ -30,3 +30,4 @@ MenuItem 0.1 MenuItem.qml
 Dialog 0.1 Dialog.qml
 StatusBar 0.1 StatusBar.qml
 SplitterItem 0.1 SplitterItem.qml
+ApplicationWindow 0.1 ApplicationWindow.qml
diff --git a/src/qtoplevelwindow.h b/src/qtoplevelwindow.h
index bd293bd09..cd516e1eb 100644
--- a/src/qtoplevelwindow.h
+++ b/src/qtoplevelwindow.h
@@ -41,6 +41,7 @@ public:
     QGraphicsScene *scene() { return _view->scene(); }
     QDeclarativeView *view() { return _view; }
 
+
     void registerChildWindow(QTopLevelWindow* child);
     void hideChildWindows();
     void initPosition();
-- 
GitLab