From 0de8f9673770ecce815484826150898acc9a60f5 Mon Sep 17 00:00:00 2001 From: Juhapekka Piiroinen <ext-juha-pekka.piiroinen@nokia.com> Date: Wed, 22 Feb 2012 13:29:13 +0200 Subject: [PATCH] Updated MeeGo 1.2 Harmattan QtQuick application template. Includes an updated MeeGo/Harmattan application template for QtQuick application wizard. Change-Id: I746ccea7c0f680f5b4b177481b7eb18f861ad136 Reviewed-by: Alessandro Portale <alessandro.portale@nokia.com> --- .../qtquickapp/qml/app/meego10/MainPage.qml | 65 +++++++++++++++---- .../qtquickapp/qml/app/meego10/main.qml | 42 ++++++++++-- 2 files changed, 92 insertions(+), 15 deletions(-) diff --git a/share/qtcreator/templates/qtquickapp/qml/app/meego10/MainPage.qml b/share/qtcreator/templates/qtquickapp/qml/app/meego10/MainPage.qml index 9de64968f44..79ec4ad1c0a 100644 --- a/share/qtcreator/templates/qtquickapp/qml/app/meego10/MainPage.qml +++ b/share/qtcreator/templates/qtquickapp/qml/app/meego10/MainPage.qml @@ -2,22 +2,65 @@ import QtQuick 1.1 import com.nokia.meego 1.0 Page { + id: page tools: commonTools - Label { - id: label - anchors.centerIn: parent - text: qsTr("Hello world!") - visible: false + property string title : "Application Title" + + Image { + id: pageHeader + anchors { + top: page.top + left: page.left + right: page.right + } + + height: parent.width < parent.height ? 72 : 46 + width: parent.width + source: "image://theme/meegotouch-view-header-fixed" + (theme.inverted ? "-inverted" : "") + z: 1 + + Label { + id: header + anchors { + verticalCenter: parent.verticalCenter + left: parent.left + leftMargin: 16 + } + platformStyle: LabelStyle { + fontFamily: "Nokia Pure Text Light" + fontPixelSize: 32 + } + text: page.title + } } - Button{ + Flickable { + id: pageFlickableContent anchors { - horizontalCenter: parent.horizontalCenter - top: label.bottom - topMargin: 10 + top: pageHeader.bottom + bottom: page.bottom + left: page.left + right: page.right + margins: 16 } - text: qsTr("Click here!") - onClicked: label.visible = true + contentHeight: pageContent.height + contentWidth: pageContent.width + flickableDirection: Flickable.VerticalFlick + + Column { + id: pageContent + width: page.width - pageFlickableContent.anchors.margins * 2 + spacing: 16 + + Button{ + text: qsTr("Click here!") + onClicked: appWindow.showStatusBar = !appWindow.showStatusBar + } + } + } + + ScrollDecorator { + flickableItem: pageFlickableContent } } diff --git a/share/qtcreator/templates/qtquickapp/qml/app/meego10/main.qml b/share/qtcreator/templates/qtquickapp/qml/app/meego10/main.qml index bfb4552a29c..37c6a0263d0 100644 --- a/share/qtcreator/templates/qtquickapp/qml/app/meego10/main.qml +++ b/share/qtcreator/templates/qtquickapp/qml/app/meego10/main.qml @@ -12,19 +12,53 @@ PageStackWindow { ToolBarLayout { id: commonTools - visible: true + + ToolIcon { + visible: pageStack.depth > 1 + platformIconId: "toolbar-back" + onClicked: { + pageStack.pop(); + } + } + + ToolButton { + anchors.horizontalCenter: parent.horizontalCenter + text: theme.inverted ? "Inverted" : "Non-Inverted" + onClicked: { + theme.inverted = !theme.inverted; + } + } + ToolIcon { platformIconId: "toolbar-view-menu" - anchors.right: (parent === undefined) ? undefined : parent.right - onClicked: (myMenu.status === DialogStatus.Closed) ? myMenu.open() : myMenu.close() + onClicked: { + appWindow.showToolBar = false; + myMenu.open(); + } } } + QueryDialog { + id: aboutDialog + titleText: "Application Title" + message: "(C) [year] [your name]\n[version]" + } + Menu { id: myMenu visualParent: pageStack MenuLayout { - MenuItem { text: qsTr("Sample menu item") } + MenuItem { + text: qsTr("About") + onClicked: { + aboutDialog.open(); + } + } + } + onStatusChanged: { + if (status === DialogStatus.Closed) { + appWindow.showToolBar = true; + } } } } -- GitLab