diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-04-13 04:48:47 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-04-13 04:49:32 (GMT) |
commit | 8149e7aa743c178f13452e7292ea41dccc8aec46 (patch) | |
tree | 83ed6171fc9541b328c0d223fbb55793a19fbad6 /examples/declarative/focus | |
parent | 35d0792025d515e81b2bf208aa1fd7dce28096e6 (diff) | |
download | Qt-8149e7aa743c178f13452e7292ea41dccc8aec46.zip Qt-8149e7aa743c178f13452e7292ea41dccc8aec46.tar.gz Qt-8149e7aa743c178f13452e7292ea41dccc8aec46.tar.bz2 |
Fix code style in examples
Diffstat (limited to 'examples/declarative/focus')
-rw-r--r-- | examples/declarative/focus/Core/ContextMenu.qml | 5 | ||||
-rw-r--r-- | examples/declarative/focus/Core/GridMenu.qml | 19 | ||||
-rw-r--r-- | examples/declarative/focus/Core/ListViewDelegate.qml | 12 | ||||
-rw-r--r-- | examples/declarative/focus/Core/ListViews.qml | 33 | ||||
-rw-r--r-- | examples/declarative/focus/focus.qml | 35 |
5 files changed, 78 insertions, 26 deletions
diff --git a/examples/declarative/focus/Core/ContextMenu.qml b/examples/declarative/focus/Core/ContextMenu.qml index 56a1b3e..49a54bc 100644 --- a/examples/declarative/focus/Core/ContextMenu.qml +++ b/examples/declarative/focus/Core/ContextMenu.qml @@ -2,13 +2,16 @@ import Qt 4.7 FocusScope { id: container + property bool open: false Item { anchors.fill: parent Rectangle { - anchors.fill: parent; color: "#D1DBBD"; focus: true + anchors.fill: parent + color: "#D1DBBD" + focus: true Keys.onRightPressed: mainView.focus = true } } diff --git a/examples/declarative/focus/Core/GridMenu.qml b/examples/declarative/focus/Core/GridMenu.qml index 75f6be0..c37b17a 100644 --- a/examples/declarative/focus/Core/GridMenu.qml +++ b/examples/declarative/focus/Core/GridMenu.qml @@ -6,32 +6,41 @@ FocusScope { onWantsFocusChanged: if (wantsFocus) mainView.state = "" Rectangle { - clip: true; anchors.fill: parent + anchors.fill: parent + clip: true gradient: Gradient { GradientStop { position: 0.0; color: "#193441" } GradientStop { position: 1.0; color: Qt.darker("#193441") } } GridView { - id: gridView; cellWidth: 152; cellHeight: 152; focus: true + id: gridView x: 20; width: parent.width - 40; height: parent.height + cellWidth: 152; cellHeight: 152 + focus: true model: 12 KeyNavigation.down: listViews KeyNavigation.left: contextMenu delegate: Item { - id: container; width: GridView.view.cellWidth; height: GridView.view.cellHeight + id: container + width: GridView.view.cellWidth; height: GridView.view.cellHeight Rectangle { id: content - color: "transparent"; smooth: true + color: "transparent" + smooth: true anchors.centerIn: parent; width: container.width - 40; height: container.height - 40; radius: 10 + Rectangle { color: "#91AA9D"; x: 3; y: 3; width: parent.width - 6; height: parent.height - 6; radius: 8 } Image { source: "images/qt-logo.png"; anchors.centerIn: parent; smooth: true } } MouseArea { - id: mouseArea; anchors.fill: parent; hoverEnabled: true + id: mouseArea + anchors.fill: parent + hoverEnabled: true + onClicked: { GridView.view.currentIndex = index container.focus = true diff --git a/examples/declarative/focus/Core/ListViewDelegate.qml b/examples/declarative/focus/Core/ListViewDelegate.qml index 35c04cf..96324d7 100644 --- a/examples/declarative/focus/Core/ListViewDelegate.qml +++ b/examples/declarative/focus/Core/ListViewDelegate.qml @@ -7,8 +7,11 @@ Component { Rectangle { id: content - color: "transparent"; smooth: true - anchors.centerIn: parent; width: container.width - 40; height: container.height - 10; radius: 10 + anchors.centerIn: parent; width: container.width - 40; height: container.height - 10 + color: "transparent" + smooth: true + radius: 10 + Rectangle { color: "#91AA9D"; x: 3; y: 3; width: parent.width - 6; height: parent.height - 6; radius: 8 } Text { text: "List element " + (index + 1); color: "#193441"; font.bold: false; anchors.centerIn: parent @@ -17,7 +20,10 @@ Component { } MouseArea { - id: mouseArea; anchors.fill: parent; hoverEnabled: true + id: mouseArea + anchors.fill: parent + hoverEnabled: true + onClicked: { ListView.view.currentIndex = index container.focus = true diff --git a/examples/declarative/focus/Core/ListViews.qml b/examples/declarative/focus/Core/ListViews.qml index b28cc1c..f4384c8 100644 --- a/examples/declarative/focus/Core/ListViews.qml +++ b/examples/declarative/focus/Core/ListViews.qml @@ -7,29 +7,43 @@ FocusScope { ListView { id: list1 + y: wantsFocus ? 10 : 40; width: parent.width / 3; height: parent.height - 20 + focus: true + KeyNavigation.up: gridMenu; KeyNavigation.left: contextMenu; KeyNavigation.right: list2 + model: 10 delegate: ListViewDelegate {} - y: wantsFocus ? 10 : 40; focus: true; width: parent.width / 3; height: parent.height - 20 - model: 10; KeyNavigation.up: gridMenu; KeyNavigation.left: contextMenu; KeyNavigation.right: list2 - Behavior on y { NumberAnimation { duration: 600; easing.type: "OutQuint" } } + + Behavior on y { + NumberAnimation { duration: 600; easing.type: "OutQuint" } + } } ListView { id: list2 - delegate: ListViewDelegate {} y: wantsFocus ? 10 : 40; x: parent.width / 3; width: parent.width / 3; height: parent.height - 20 - model: 10; KeyNavigation.up: gridMenu; KeyNavigation.left: list1; KeyNavigation.right: list3 - Behavior on y { NumberAnimation { duration: 600; easing.type: "OutQuint" } } + KeyNavigation.up: gridMenu; KeyNavigation.left: list1; KeyNavigation.right: list3 + model: 10 + delegate: ListViewDelegate {} + + Behavior on y { + NumberAnimation { duration: 600; easing.type: "OutQuint" } + } } ListView { id: list3 - delegate: ListViewDelegate {} y: wantsFocus ? 10 : 40; x: 2 * parent.width / 3; width: parent.width / 3; height: parent.height - 20 - model: 10; KeyNavigation.up: gridMenu; KeyNavigation.left: list2 - Behavior on y { NumberAnimation { duration: 600; easing.type: "OutQuint" } } + KeyNavigation.up: gridMenu; KeyNavigation.left: list2 + model: 10 + delegate: ListViewDelegate {} + + Behavior on y { + NumberAnimation { duration: 600; easing.type: "OutQuint" } + } } Rectangle { width: parent.width; height: 1; color: "#D1DBBD" } + Rectangle { y: 1; width: parent.width; height: 10 gradient: Gradient { @@ -37,6 +51,7 @@ FocusScope { GradientStop { position: 1.0; color: "transparent" } } } + Rectangle { y: parent.height - 10; width: parent.width; height: 10 gradient: Gradient { diff --git a/examples/declarative/focus/focus.qml b/examples/declarative/focus/focus.qml index d9b6549..22b0e50 100644 --- a/examples/declarative/focus/focus.qml +++ b/examples/declarative/focus/focus.qml @@ -2,19 +2,34 @@ import Qt 4.7 import "Core" Rectangle { - id: window; width: 800; height: 480; color: "#3E606F" + id: window + + width: 800; height: 480 + color: "#3E606F" FocusScope { - id: mainView; focus: true; width: parent.width; height: parent.height + id: mainView + + width: parent.width; height: parent.height + focus: true GridMenu { - id: gridMenu; focus: true - width: parent.width; height: 320; interactive: parent.wantsFocus + id: gridMenu + + width: parent.width; height: 320 + focus: true + interactive: parent.wantsFocus } - ListViews { id: listViews; y: 320; width: parent.width; height: 320 } + ListViews { + id: listViews + y: 320; width: parent.width; height: 320 + } - Rectangle { id: shade; color: "black"; opacity: 0; anchors.fill: parent } + Rectangle { + id: shade + color: "black"; opacity: 0; anchors.fill: parent + } states: State { name: "showListViews" @@ -28,7 +43,10 @@ Rectangle { } Image { - source: "Core/images/arrow.png"; rotation: 90; anchors.verticalCenter: parent.verticalCenter + source: "Core/images/arrow.png" + rotation: 90 + anchors.verticalCenter: parent.verticalCenter + MouseArea { anchors { fill: parent; leftMargin: -10; topMargin: -10; rightMargin: -10; bottomMargin: -10 } onClicked: window.state = "contextMenuOpen" @@ -38,7 +56,8 @@ Rectangle { ContextMenu { id: contextMenu; x: -265; width: 260; height: parent.height } states: State { - name: "contextMenuOpen"; when: !mainView.wantsFocus + name: "contextMenuOpen" + when: !mainView.wantsFocus PropertyChanges { target: contextMenu; x: 0; open: true } PropertyChanges { target: mainView; x: 130 } PropertyChanges { target: shade; opacity: 0.25 } |