summaryrefslogtreecommitdiffstats
path: root/examples/sensors/sensor_explorer/qml_app
diff options
context:
space:
mode:
authorWolfgang Beck <wolfgang.beck@nokia.com>2012-01-18 15:53:21 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-18 08:04:54 +0100
commit52e96f616f903a430f8c47e6584c1254284f6132 (patch)
tree5c60ecd32a3ca497b3882ee7c59fcfaf17218aca /examples/sensors/sensor_explorer/qml_app
parent89fad7d8388f396fb229494c915d74b237513847 (diff)
Components exchangeable
Change-Id: If028c67235567de4d7d99775dcd48e8c0a1ebf75 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lincoln Ramsay <lincoln.ramsay@nokia.com>
Diffstat (limited to 'examples/sensors/sensor_explorer/qml_app')
-rw-r--r--examples/sensors/sensor_explorer/qml_app/components/ApplicationWindow.qml51
-rw-r--r--examples/sensors/sensor_explorer/qml_app/components/Button.qml (renamed from examples/sensors/sensor_explorer/qml_app/Button.qml)0
-rw-r--r--examples/sensors/sensor_explorer/qml_app/components/TextField.qml (renamed from examples/sensors/sensor_explorer/qml_app/TextField.qml)6
-rw-r--r--examples/sensors/sensor_explorer/qml_app/components/images/button_background_disabled.png (renamed from examples/sensors/sensor_explorer/qml_app/images/button_background_disabled.png)bin579 -> 579 bytes
-rw-r--r--examples/sensors/sensor_explorer/qml_app/components/images/button_background_normal.png (renamed from examples/sensors/sensor_explorer/qml_app/images/button_background_normal.png)bin901 -> 901 bytes
-rw-r--r--examples/sensors/sensor_explorer/qml_app/components/images/button_background_pressed.png (renamed from examples/sensors/sensor_explorer/qml_app/images/button_background_pressed.png)bin334 -> 334 bytes
-rw-r--r--examples/sensors/sensor_explorer/qml_app/components/images/textfield_background_disabled.png (renamed from examples/sensors/sensor_explorer/qml_app/images/textfield_background_disabled.png)bin936 -> 936 bytes
-rw-r--r--examples/sensors/sensor_explorer/qml_app/components/images/textfield_background_normal.png (renamed from examples/sensors/sensor_explorer/qml_app/images/textfield_background_normal.png)bin767 -> 767 bytes
-rw-r--r--examples/sensors/sensor_explorer/qml_app/main.qml58
9 files changed, 88 insertions, 27 deletions
diff --git a/examples/sensors/sensor_explorer/qml_app/components/ApplicationWindow.qml b/examples/sensors/sensor_explorer/qml_app/components/ApplicationWindow.qml
new file mode 100644
index 00000000..4b67c2c2
--- /dev/null
+++ b/examples/sensors/sensor_explorer/qml_app/components/ApplicationWindow.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtSensors module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+//Import the declarative plugins
+import QtQuick 2.0
+
+Rectangle {
+ id: appWnd
+ x: 0
+ y: 0
+ width: 320
+ height: 480
+ color: "#ececec"
+}
diff --git a/examples/sensors/sensor_explorer/qml_app/Button.qml b/examples/sensors/sensor_explorer/qml_app/components/Button.qml
index ce8feb3f..ce8feb3f 100644
--- a/examples/sensors/sensor_explorer/qml_app/Button.qml
+++ b/examples/sensors/sensor_explorer/qml_app/components/Button.qml
diff --git a/examples/sensors/sensor_explorer/qml_app/TextField.qml b/examples/sensors/sensor_explorer/qml_app/components/TextField.qml
index 681b7122..aad3680a 100644
--- a/examples/sensors/sensor_explorer/qml_app/TextField.qml
+++ b/examples/sensors/sensor_explorer/qml_app/components/TextField.qml
@@ -44,6 +44,8 @@ import QtQuick 2.0
Item {
id: textInputFrame
property alias text: textInput.text
+ signal accepted
+
resources: [
Component{
id: cursorA
@@ -85,6 +87,10 @@ Item {
textInput.focus = false;
}
+ onAccepted: {
+ textInputFrame.accepted();
+ }
+
MouseArea {
anchors.fill: parent
diff --git a/examples/sensors/sensor_explorer/qml_app/images/button_background_disabled.png b/examples/sensors/sensor_explorer/qml_app/components/images/button_background_disabled.png
index 62a00b9a..62a00b9a 100644
--- a/examples/sensors/sensor_explorer/qml_app/images/button_background_disabled.png
+++ b/examples/sensors/sensor_explorer/qml_app/components/images/button_background_disabled.png
Binary files differ
diff --git a/examples/sensors/sensor_explorer/qml_app/images/button_background_normal.png b/examples/sensors/sensor_explorer/qml_app/components/images/button_background_normal.png
index 1fecad5b..1fecad5b 100644
--- a/examples/sensors/sensor_explorer/qml_app/images/button_background_normal.png
+++ b/examples/sensors/sensor_explorer/qml_app/components/images/button_background_normal.png
Binary files differ
diff --git a/examples/sensors/sensor_explorer/qml_app/images/button_background_pressed.png b/examples/sensors/sensor_explorer/qml_app/components/images/button_background_pressed.png
index 149529e1..149529e1 100644
--- a/examples/sensors/sensor_explorer/qml_app/images/button_background_pressed.png
+++ b/examples/sensors/sensor_explorer/qml_app/components/images/button_background_pressed.png
Binary files differ
diff --git a/examples/sensors/sensor_explorer/qml_app/images/textfield_background_disabled.png b/examples/sensors/sensor_explorer/qml_app/components/images/textfield_background_disabled.png
index 98bc601f..98bc601f 100644
--- a/examples/sensors/sensor_explorer/qml_app/images/textfield_background_disabled.png
+++ b/examples/sensors/sensor_explorer/qml_app/components/images/textfield_background_disabled.png
Binary files differ
diff --git a/examples/sensors/sensor_explorer/qml_app/images/textfield_background_normal.png b/examples/sensors/sensor_explorer/qml_app/components/images/textfield_background_normal.png
index b90b50cd..b90b50cd 100644
--- a/examples/sensors/sensor_explorer/qml_app/images/textfield_background_normal.png
+++ b/examples/sensors/sensor_explorer/qml_app/components/images/textfield_background_normal.png
Binary files differ
diff --git a/examples/sensors/sensor_explorer/qml_app/main.qml b/examples/sensors/sensor_explorer/qml_app/main.qml
index 7796b8ab..e6c2f30b 100644
--- a/examples/sensors/sensor_explorer/qml_app/main.qml
+++ b/examples/sensors/sensor_explorer/qml_app/main.qml
@@ -40,18 +40,14 @@
//Import the declarative plugins
import QtQuick 2.0
+import "components"
//! [0]
import Explorer 1.0
//! [0]
-Rectangle {
+ApplicationWindow {
id: mainWnd
- x: 0
- y: 0
- width: 320
- height: 480
- color: "#ececec"
//! [1]
SensorExplorer {
@@ -65,7 +61,7 @@ Rectangle {
anchors.topMargin: 20
anchors.left: parent.left
anchors.right: parent.right
- height: 200
+ height: 170
title: "sensor explorer"
//! [2]
@@ -105,7 +101,7 @@ Rectangle {
anchors.bottomMargin: 5
onSelectedItemChanged: {
- changePropertyButton.enabled = (propertyList.selectedItem === null ?
+ textfield.enabled = (propertyList.selectedItem === null ?
false : propertyList.selectedItem.isWriteable);
}
}
@@ -153,40 +149,48 @@ Rectangle {
}
}
- Button {
- id: changePropertyButton
- anchors.bottom: parent.bottom
+ TextField {
+ id: textfield
+ anchors.top: parent.bottom
+ anchors.topMargin: -35
anchors.left: startstopButton.right
+ anchors.right: parent.right
anchors.margins: 5
- text: "Set"
- enabled: false
height: 30
- width: 60
+ enabled: false
onEnabledChanged: {
- textfield.visible = changePropertyButton.enabled;
+ if (!textfield.enabled) {
+ textfield.closeSoftwareInputPanel();
+ textfield.anchors.top= parent.bottom;
+ textfield.anchors.topMargin= -35;
+ textfield.text = "";
+ }
}
- onClicked: {
+ onFocusChanged: {
+ if (textfield.focus) {
+ textfield.anchors.top= sensorList.bottom
+ textfield.anchors.topMargin= -15
+ }
+ else {
+ textfield.closeSoftwareInputPanel();
+ textfield.anchors.top= parent.bottom;
+ textfield.anchors.topMargin= -35;
+ }
+ }
+
+ onAccepted: {
+
if (explorer.selectedSensorItem !== null
&& propertyList.selectedItem !== null) {
//! [4]
explorer.selectedSensorItem.changePropertyValue(propertyList.selectedItem, textfield.text);
//! [4]
+ propertyList.focus=true;
}
-
textfield.text = "";
}
}
-
- TextField {
- id: textfield
- anchors.bottom: parent.bottom
- anchors.left: changePropertyButton.right
- anchors.right: parent.right
- anchors.margins: 5
- height: 30
- enabled: true
- }
}