Commit e35c53e7 authored by Kai Koehne's avatar Kai Koehne
Browse files

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
parent 8f85202f
import Qt 4.7 import Qt 4.7
Rectangle { Rectangle {
width: 200 width: 360
height: 323 height: 360
Text { Text {
text: "Hello World" text: "Hello World"
anchors.centerIn: parent anchors.centerIn: parent
} }
MouseArea {
anchors.fill: parent
onClicked: {
Qt.quit();
}
}
} }
...@@ -62,11 +62,12 @@ QString QmlFileWizard::fileContents(const QString &fileName) const ...@@ -62,11 +62,12 @@ QString QmlFileWizard::fileContents(const QString &fileName) const
QTextStream str(&contents); QTextStream str(&contents);
// str << CppTools::AbstractEditorSupport::licenseTemplate(); // str << CppTools::AbstractEditorSupport::licenseTemplate();
// 100:62 is the 'golden ratio'
str << QLatin1String("import Qt 4.7\n") str << QLatin1String("import Qt 4.7\n")
<< QLatin1String("\n") << QLatin1String("\n")
<< QLatin1String("Rectangle {\n") << QLatin1String("Rectangle {\n")
<< QLatin1String(" width: 640\n") << QLatin1String(" width: 100\n")
<< QLatin1String(" height: 480\n") << QLatin1String(" height: 62\n")
<< QLatin1String("}\n"); << QLatin1String("}\n");
return contents; return contents;
......
...@@ -117,13 +117,18 @@ Core::GeneratedFiles QmlProjectApplicationWizard::generateFiles(const QWizard *w ...@@ -117,13 +117,18 @@ Core::GeneratedFiles QmlProjectApplicationWizard::generateFiles(const QWizard *w
<< "import Qt 4.7" << endl << "import Qt 4.7" << endl
<< endl << endl
<< "Rectangle {" << endl << "Rectangle {" << endl
<< " width: 200" << endl << " width: 360" << endl
<< " height: 200" << endl << " height: 360" << endl
<< " Text {" << endl << " Text {" << endl
<< " x: 66" << endl << " anchors.centerIn: parent" << endl
<< " y: 93" << endl
<< " text: \"Hello World\"" << endl << " text: \"Hello World\"" << endl
<< " }" << endl << " }" << endl
<< " MouseArea {" << endl
<< " anchors.fill: parent" << endl
<< " onClicked: {" << endl
<< " Qt.quit();" << endl
<< " }" << endl
<< " }" << endl
<< "}" << endl; << "}" << endl;
} }
Core::GeneratedFile generatedMainFile(mainFileName); Core::GeneratedFile generatedMainFile(mainFileName);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment