ToolBarStyle - removed software buttons.
authorTomasz Olszak <olszak.tomasz@gmail.com>
Tue, 30 Jul 2013 20:38:46 +0000 (20:38 +0000)
committerTomasz Olszak <olszak.tomasz@gmail.com>
Sun, 4 Aug 2013 20:38:28 +0000 (22:38 +0200)
Also toolBar.backAction now triggered when Back HW button
released or ESC released.

Change-Id: I50c1eebf0c0df62cde65239bbfc77829b416be4a
Reviewed-by: Jarosław Staniek <staniek@kde.org>
examples/touch/main.qml
src/controls/View.qml
src/styles/ToolBarStyle.qml
src/styles/ViewStyle.qml

index 7bc6899..f53a684 100644 (file)
@@ -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}
-                    }
-                }
-            }
-        }
-    }
-
 }
index b717a73..a743e66 100644 (file)
@@ -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 }
 }
index b921097..58d96cf 100644 (file)
@@ -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
     }
 }
index 76d4f63..f4ca0e9 100644 (file)
@@ -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}
     }
 }