From e35c53e7f8cfae60eee280cce85c12e708e1ed20 Mon Sep 17 00:00:00 2001
From: Kai Koehne <kai.koehne@nokia.com>
Date: Thu, 11 Nov 2010 11:39:57 +0100
Subject: [PATCH] QmlWizards: Unify templates

Unify the original qml file generated by Qt Quick UI / Qt Quick
Application wizards. Use a default size of 360x360.
Furthermore, add a MouseArea such that clicking on the app will close
it (demonstrating the use of Qt.quit()).

Reviewed-by: Alessandro Portale
---
 share/qtcreator/templates/qmlapp/qml/app/main.qml   | 10 ++++++++--
 src/plugins/qmljseditor/qmlfilewizard.cpp           |  5 +++--
 .../qmlprojectapplicationwizard.cpp                 | 13 +++++++++----
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/share/qtcreator/templates/qmlapp/qml/app/main.qml b/share/qtcreator/templates/qmlapp/qml/app/main.qml
index 42136251dc1..4ef3a885a1e 100644
--- a/share/qtcreator/templates/qmlapp/qml/app/main.qml
+++ b/share/qtcreator/templates/qmlapp/qml/app/main.qml
@@ -1,10 +1,16 @@
 import Qt 4.7
 
 Rectangle {
-    width: 200
-    height: 323
+    width: 360
+    height: 360
     Text {
         text: "Hello World"
         anchors.centerIn: parent
     }
+    MouseArea {
+        anchors.fill: parent
+        onClicked: {
+            Qt.quit();
+        }
+    }
 }
diff --git a/src/plugins/qmljseditor/qmlfilewizard.cpp b/src/plugins/qmljseditor/qmlfilewizard.cpp
index 3687f5ef3b3..31918e7ec43 100644
--- a/src/plugins/qmljseditor/qmlfilewizard.cpp
+++ b/src/plugins/qmljseditor/qmlfilewizard.cpp
@@ -62,11 +62,12 @@ QString QmlFileWizard::fileContents(const QString &fileName) const
     QTextStream str(&contents);
 //    str << CppTools::AbstractEditorSupport::licenseTemplate();
 
+    // 100:62 is the 'golden ratio'
     str << QLatin1String("import Qt 4.7\n")
         << QLatin1String("\n")
         << QLatin1String("Rectangle {\n")
-        << QLatin1String("    width: 640\n")
-        << QLatin1String("    height: 480\n")
+        << QLatin1String("    width: 100\n")
+        << QLatin1String("    height: 62\n")
         << QLatin1String("}\n");
 
     return contents;
diff --git a/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp b/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp
index c58241c2c89..f59d6c202bf 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectapplicationwizard.cpp
@@ -117,13 +117,18 @@ Core::GeneratedFiles QmlProjectApplicationWizard::generateFiles(const QWizard *w
             << "import Qt 4.7" << endl
             << endl
             << "Rectangle {" << endl
-            << "    width: 200" << endl
-            << "    height: 200" << endl
+            << "    width: 360" << endl
+            << "    height: 360" << endl
             << "    Text {" << endl
-            << "        x: 66" << endl
-            << "        y: 93" << endl
+            << "        anchors.centerIn: parent" << endl
             << "        text: \"Hello World\"" << endl
             << "    }" << endl
+            << "    MouseArea {" << endl
+            << "        anchors.fill: parent" << endl
+            << "        onClicked: {" << endl
+            << "            Qt.quit();" << endl
+            << "        }" << endl
+            << "    }" << endl
             << "}" << endl;
     }
     Core::GeneratedFile generatedMainFile(mainFileName);
-- 
GitLab