diff options
author | Tomasz Olszak <olszak.tomasz@gmail.com> | 2013-07-30 20:38:46 +0000 |
---|---|---|
committer | Tomasz Olszak <olszak.tomasz@gmail.com> | 2013-08-04 22:38:28 +0200 |
commit | b9d0c40716f0f269af27f7614c5693614ec4e64e (patch) | |
tree | 436c32eb483c5634cd8aeba27079bf3420aaf135 | |
parent | 49eff615c8f486627503470920921bb5c989fb75 (diff) | |
download | qtquickcontrols-tizen-b9d0c40716f0f269af27f7614c5693614ec4e64e.tar.gz qtquickcontrols-tizen-b9d0c40716f0f269af27f7614c5693614ec4e64e.tar.bz2 qtquickcontrols-tizen-b9d0c40716f0f269af27f7614c5693614ec4e64e.zip |
ToolBarStyle - removed software buttons.
Also toolBar.backAction now triggered when Back HW button
released or ESC released.
Change-Id: I50c1eebf0c0df62cde65239bbfc77829b416be4a
Reviewed-by: Jarosław Staniek <staniek@kde.org>
-rw-r--r-- | examples/touch/main.qml | 161 | ||||
-rw-r--r-- | src/controls/View.qml | 5 | ||||
-rw-r--r-- | src/styles/ToolBarStyle.qml | 21 | ||||
-rw-r--r-- | src/styles/ViewStyle.qml | 14 |
4 files changed, 85 insertions, 116 deletions
diff --git a/examples/touch/main.qml b/examples/touch/main.qml index 7bc6899..f53a684 100644 --- a/examples/touch/main.qml +++ b/examples/touch/main.qml @@ -52,14 +52,76 @@ ApplicationWindow { height: 1220 property real curlValue: 0.05 - Item { - id:content + View { + id: content anchors.fill: parent - Loader { - id:loader + + titleBar.text: "Controls Gallery (Theme: " + TizenConfig.theme+")" + titleBar.subText: pageStack.depth > 1 ? pageStack.currentItem: "Main Page" + + backAction.onTriggered: pageStack.depth > 1 ? pageStack.pop() : Qt.quit() + + ListModel { + id: pageModel + ListElement { + title: "Buttons" + page: "content/ButtonPage.qml" + } + ListElement { + title: "Sliders" + page: "content/SliderPage.qml" + } + ListElement { + title: "ProgressBar" + page: "content/ProgressBarPage.qml" + } + ListElement { + title: "Tabs" + page: "content/TabBarPage.qml" + } + ListElement { + title: "CheckBoxes" + page: "content/CheckBoxPage.qml" + } + ListElement { + title: "ContextMenu" + page: "content/ContextMenuPage.qml" + } + ListElement { + title: "SplitView" + page: "content/SplitViewPage.qml" + } + ListElement { + title: "DateTimeEdit" + page: "content/DateTimeEditPage.qml" + } + } + + StackView { + id: pageStack anchors.fill: parent - asynchronous: false - sourceComponent: mainComponent + + initialItem: Item { + width: parent.width + height: parent.height + + + ListView { + id:listView + model: pageModel + anchors.fill: parent + clip:true + + delegate: AndroidDelegate { + text: title + onClicked: { + content.titleBar.subText = Qt.binding(function() {return pageStack.depth > 1 ? title: "Main Page"}) + pageStack.push(Qt.resolvedUrl(page)) + } + } + ScrollDecorator {flickableItem: listView} + } + } } } Rectangle { @@ -162,91 +224,4 @@ ApplicationWindow { } } } - - Component { - id: mainComponent - View { - id: view - anchors.fill: parent - - titleBar.text: "Controls Gallery (Theme: " + TizenConfig.theme+")" - titleBar.subText: pageStack.depth > 1 ? pageStack.currentItem: "Main Page" - property bool active:Qt.application.active - - backAction.onTriggered: pageStack.depth > 1 ? pageStack.pop() : Qt.quit() - // Implements back key navigation - Keys.onReleased: { - if (event.key === Qt.Key_Back) { - if (pageStack.depth > 1) { - pageStack.pop(); - event.accepted = true; - } else { Qt.quit(); } - } - } - - ListModel { - id: pageModel - ListElement { - title: "Buttons" - page: "content/ButtonPage.qml" - } - ListElement { - title: "Sliders" - page: "content/SliderPage.qml" - } - ListElement { - title: "ProgressBar" - page: "content/ProgressBarPage.qml" - } - ListElement { - title: "Tabs" - page: "content/TabBarPage.qml" - } - ListElement { - title: "CheckBoxes" - page: "content/CheckBoxPage.qml" - } - ListElement { - title: "ContextMenu" - page: "content/ContextMenuPage.qml" - } - ListElement { - title: "SplitView" - page: "content/SplitViewPage.qml" - } - ListElement { - title: "DateTimeEdit" - page: "content/DateTimeEditPage.qml" - } - } - - StackView { - id: pageStack - anchors.fill: parent - - initialItem: Item { - width: parent.width - height: parent.height - - - ListView { - id:listView - model: pageModel - anchors.fill: parent - clip:true - - delegate: AndroidDelegate { - text: title - onClicked: { - view.titleBar.subText = Qt.binding(function() {return pageStack.depth > 1 ? title: "Main Page"}) - pageStack.push(Qt.resolvedUrl(page)) - } - } - ScrollDecorator {flickableItem: listView} - } - } - } - } - } - } diff --git a/src/controls/View.qml b/src/controls/View.qml index b717a73..a743e66 100644 --- a/src/controls/View.qml +++ b/src/controls/View.qml @@ -43,8 +43,5 @@ Control { TitleBar { id: prvTitleBar } Item { id: prvContent } ToolBar { id: prvToolBar; view: root } - Action { - id: prvBackAction -// onTriggered: { console.debug("Quit!"); Qt.quit(); } - } + Action {id: prvBackAction } } diff --git a/src/styles/ToolBarStyle.qml b/src/styles/ToolBarStyle.qml index b921097..58d96cf 100644 --- a/src/styles/ToolBarStyle.qml +++ b/src/styles/ToolBarStyle.qml @@ -27,25 +27,8 @@ Style { id: style property ToolBar control: __control - property Component panel: Rectangle { + property Component panel: Item { implicitWidth: 720 - implicitHeight: 98 - color: TizenConfig.toolBar.backgroundColor - - ToolBarButton { - id: moreButton - source: TizenConfig.toolBar.more.source - effectSource: TizenConfig.toolBar.more.effectSource.normal - anchors.left: parent.left - anchors.leftMargin: 26 - } - ToolBarButton { - id: backButton - source: TizenConfig.toolBar.back.source - effectSource: TizenConfig.toolBar.back.effectSource.normal - anchors.right: parent.right - anchors.rightMargin: 26 - onClicked: { /*console.log("back clicked");*/ view.backAction.trigger(); } - } + implicitHeight: 0 } } diff --git a/src/styles/ViewStyle.qml b/src/styles/ViewStyle.qml index 76d4f63..f4ca0e9 100644 --- a/src/styles/ViewStyle.qml +++ b/src/styles/ViewStyle.qml @@ -41,9 +41,23 @@ Style { Binding { target: styleData.toolBar; property: "anchors.left"; value: control.left } Binding { target: styleData.toolBar; property: "anchors.right"; value: control.right } + focus: true + + Keys.onReleased: { + if (event.key === Qt.Key_Back || event.key === Qt.Key_Escape) { + backAction.trigger() + event.accepted = true + } else if (event.key === Qt.Key_Menu || event.key === Qt.Key_F2) { + console.log("NOT IMPLEMENTED: ContextMenu should be shown") + event.accepted = true + } + } + implicitWidth: 720 implicitHeight: 1280 color: TizenConfig.colors.background + Binding {target: parent/*panelLoader*/; property:"focus"; value: true} + Binding {target: control; property:"focus"; value: true} } } |