diff options
Diffstat (limited to 'examples/sensors/qmlqtsensors')
-rw-r--r-- | examples/sensors/qmlqtsensors/CMakeLists.txt | 54 | ||||
-rw-r--r-- | examples/sensors/qmlqtsensors/components/ApplicationWindow.qml | 59 | ||||
-rw-r--r-- | examples/sensors/qmlqtsensors/components/Button.qml | 85 | ||||
-rw-r--r-- | examples/sensors/qmlqtsensors/components/Divider.qml | 71 | ||||
-rw-r--r-- | examples/sensors/qmlqtsensors/components/images/button_background_disabled.png | bin | 579 -> 0 bytes | |||
-rw-r--r-- | examples/sensors/qmlqtsensors/components/images/button_background_normal.png | bin | 901 -> 0 bytes | |||
-rw-r--r-- | examples/sensors/qmlqtsensors/components/images/button_background_pressed.png | bin | 228 -> 0 bytes | |||
-rw-r--r-- | examples/sensors/qmlqtsensors/doc/src/qmlqtsensors.qdoc | 70 | ||||
-rw-r--r-- | examples/sensors/qmlqtsensors/main.cpp | 52 | ||||
-rw-r--r-- | examples/sensors/qmlqtsensors/qmlqtsensors.pro | 16 | ||||
-rw-r--r-- | examples/sensors/qmlqtsensors/qmlqtsensors.qml | 259 | ||||
-rw-r--r-- | examples/sensors/qmlqtsensors/qmlqtsensors.qrc | 11 |
12 files changed, 0 insertions, 677 deletions
diff --git a/examples/sensors/qmlqtsensors/CMakeLists.txt b/examples/sensors/qmlqtsensors/CMakeLists.txt deleted file mode 100644 index dba938a4..00000000 --- a/examples/sensors/qmlqtsensors/CMakeLists.txt +++ /dev/null @@ -1,54 +0,0 @@ -cmake_minimum_required(VERSION 3.16) -project(qmlqtsensors LANGUAGES CXX) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -set(CMAKE_AUTOUIC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/qmlqtsensors") - -find_package(Qt6 COMPONENTS Core Gui Quick) - -qt_add_executable(qmlqtsensors - main.cpp -) -set_target_properties(qmlqtsensors PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) -target_link_libraries(qmlqtsensors PUBLIC - Qt::Core - Qt::Gui - Qt::Quick -) - - -# Resources: -set(qmlqtsensors_resource_files - "components/ApplicationWindow.qml" - "components/Button.qml" - "components/Divider.qml" - "components/images/button_background_disabled.png" - "components/images/button_background_normal.png" - "components/images/button_background_pressed.png" - "qmlqtsensors.qml" -) - -qt6_add_resources(qmlqtsensors "qmlqtsensors" - PREFIX - "/" - FILES - ${qmlqtsensors_resource_files} -) - -install(TARGETS qmlqtsensors - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) diff --git a/examples/sensors/qmlqtsensors/components/ApplicationWindow.qml b/examples/sensors/qmlqtsensors/components/ApplicationWindow.qml deleted file mode 100644 index d238627c..00000000 --- a/examples/sensors/qmlqtsensors/components/ApplicationWindow.qml +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 - -Rectangle { - id: appWnd - width: 320 - height: 480 - color: "#868482" -} diff --git a/examples/sensors/qmlqtsensors/components/Button.qml b/examples/sensors/qmlqtsensors/components/Button.qml deleted file mode 100644 index 59c0f9c2..00000000 --- a/examples/sensors/qmlqtsensors/components/Button.qml +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 - -//Implementation of the Button control. -Item { - id: button - width: 30 - height: 100 - property alias text: innerText.text - signal clicked - - Image { - id: backgroundImage - anchors.fill: parent - source: (button.enabled ? "images/button_background_normal.png" : "images/button_background_disabled.png") - } - - Text { - id: innerText - anchors.centerIn: parent - color: "white" - font.bold: true - } - - //Mouse area to react on click events - MouseArea { - anchors.fill: button - onClicked: { button.clicked();} - onPressed: { - backgroundImage.source = "images/button_background_pressed.png" } - onReleased: { - backgroundImage.source = (button.enabled ? "images/button_background_normal.png" : "images/button_background_disabled.png") - } - } -} diff --git a/examples/sensors/qmlqtsensors/components/Divider.qml b/examples/sensors/qmlqtsensors/components/Divider.qml deleted file mode 100644 index 50e57710..00000000 --- a/examples/sensors/qmlqtsensors/components/Divider.qml +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 QtQuick - -Column { - spacing: 5 - width: parent.width - property alias label: textLabel.text - - Rectangle { - border.width: 1 - height: 2 - width: parent.width - anchors.margins: 20 - border.color: "#2d2b19" - } - Text { - id: textLabel - width: parent.width - horizontalAlignment: Text.AlignHCenter - font.bold: true - } -} diff --git a/examples/sensors/qmlqtsensors/components/images/button_background_disabled.png b/examples/sensors/qmlqtsensors/components/images/button_background_disabled.png Binary files differdeleted file mode 100644 index 62a00b9a..00000000 --- a/examples/sensors/qmlqtsensors/components/images/button_background_disabled.png +++ /dev/null diff --git a/examples/sensors/qmlqtsensors/components/images/button_background_normal.png b/examples/sensors/qmlqtsensors/components/images/button_background_normal.png Binary files differdeleted file mode 100644 index 1fecad5b..00000000 --- a/examples/sensors/qmlqtsensors/components/images/button_background_normal.png +++ /dev/null diff --git a/examples/sensors/qmlqtsensors/components/images/button_background_pressed.png b/examples/sensors/qmlqtsensors/components/images/button_background_pressed.png Binary files differdeleted file mode 100644 index e0ba0e7a..00000000 --- a/examples/sensors/qmlqtsensors/components/images/button_background_pressed.png +++ /dev/null diff --git a/examples/sensors/qmlqtsensors/doc/src/qmlqtsensors.qdoc b/examples/sensors/qmlqtsensors/doc/src/qmlqtsensors.qdoc deleted file mode 100644 index 85fda325..00000000 --- a/examples/sensors/qmlqtsensors/doc/src/qmlqtsensors.qdoc +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Free Documentation License Usage -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. Please review the following information to ensure -** the GNU Free Documentation License version 1.3 requirements -** will be met: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \example qmlqtsensors - \title Qt Sensors - QML Example - \ingroup qtsensors-examples - \image qmlqtsensors.png - - \section2 Qt Sensors in QML - \brief The QtSensors - QML example demonstrates the QML sensors types in the QtSensors import. - - - To write a QML application that will use the QML sensors types in the QtSensors import you need to to the following steps: - - Import the QtSensors declarative plugin: - - \snippet qmlqtsensors/qmlqtsensors.qml 0 - - Add the Sensor QML types into your qml file. - - In this example we use the TiltSensor: - - \snippet qmlqtsensors/qmlqtsensors.qml 1 - - The Tilt-, AmbientLight- and the Proximity QML sensor types have the 'enabled' property in common. - To start or stop the sensor set this property to true or false. - - \snippet qmlqtsensors/qmlqtsensors.qml 2 - - Reading the data can be done for each sensor type like following: - - \l {TiltSensor} {TiltSensor} - - \snippet qmlqtsensors/qmlqtsensors.qml 3 - \snippet qmlqtsensors/qmlqtsensors.qml 4 - - \l {AmbientLightSensor} {AmbientLightSensor} - - \snippet qmlqtsensors/qmlqtsensors.qml 5 - - \l {ProximitySensor} {ProximitySensor} - - \snippet qmlqtsensors/qmlqtsensors.qml 6 -*/ - diff --git a/examples/sensors/qmlqtsensors/main.cpp b/examples/sensors/qmlqtsensors/main.cpp deleted file mode 100644 index 3615d892..00000000 --- a/examples/sensors/qmlqtsensors/main.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -#include "../stub.h" -SENSORS_EXAMPLE_MAIN(qmlqtsensors) diff --git a/examples/sensors/qmlqtsensors/qmlqtsensors.pro b/examples/sensors/qmlqtsensors/qmlqtsensors.pro deleted file mode 100644 index 4c8e83b3..00000000 --- a/examples/sensors/qmlqtsensors/qmlqtsensors.pro +++ /dev/null @@ -1,16 +0,0 @@ -TEMPLATE = app -TARGET = qmlqtsensors -QT += quick -qtConfig(static):QT += sensors - -SOURCES = main.cpp - -RESOURCES += \ - qmlqtsensors.qrc - -OTHER_FILES = \ - $$files(*.qml) \ - components - -target.path = $$[QT_INSTALL_EXAMPLES]/sensors/qmlqtsensors -INSTALLS += target diff --git a/examples/sensors/qmlqtsensors/qmlqtsensors.qml b/examples/sensors/qmlqtsensors/qmlqtsensors.qml deleted file mode 100644 index 5c676df0..00000000 --- a/examples/sensors/qmlqtsensors/qmlqtsensors.qml +++ /dev/null @@ -1,259 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtSensors module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -/* Layout - mainWnd - / ---------------------------------------------------------------------------------- -|-------------------------------------------------------------------------------- -|| labelTitle | -|-------------------------------------------------------------------------------- -|-------------------------------------------------------------------------------- <---- tiltLine -|-------------------------------------------------------------------------------- -|| labelTilt | -|-------------------------------------------------------------------------------- -| / accuracyRect / speedRect -|-------------------------------------------||----------------------------------| -|| Accuracy <----- textAccuracy || Speed <-----textSpeed | -|| value <- textAccuracyValue || value <- textSpeedValue | -|| ----------------- ------------------ || --------------- ---------------- | -|| | accuracyLower | | accuracyHigher | || | speedLower | | speedHigher | | -|| ----------------- ------------------ || --------------- ---------------- | -|------------------------------------------ ||----------------------------------| -| ----------- -| |Calibrate| <------------------ calibrate -| ----------- -| --------- -| |Degree | <-------------------- useRadian X Rotation: 0 <------------------ xrottext -| --------- -| --------- -| |Start | <-------------------- tiltStart Y Rotation: 0 <------------------ yrottext -| --------- -|-------------------------------------------------------------------------------- <---- ambientlightLine -|-------------------------------------------------------------------------------- -|| labelAmbientLight | -|-------------------------------------------------------------------------------- -| --------- -| |Start | <-------------------- ablStart Ambient light: - <--------------- abltext -| --------- -|-------------------------------------------------------------------------------- <---- proximityLine -|-------------------------------------------------------------------------------- -|| labelProximityLight | -|-------------------------------------------------------------------------------- -| --------- -| |Start | <-------------------- proxiStart Proximity: - <--------------- proxitext -| --------- ------------------------------------------------------------------------------- -*/ - -//Import the declarative plugins -import QtQuick -import "components" - -//! [0] -import QtSensors -//! [0] - -ApplicationWindow { - - anchors.fill: parent - - // Sensor types used - //! [1] - TiltSensor { - id: tilt - active: false - } - //! [1] - - AmbientLightSensor { - id: ambientlight - active: false - //! [5] - onReadingChanged: { - if (reading.lightLevel == AmbientLightReading.Dark) - ambientlighttext.text = "Ambient light: Dark"; - else if (reading.lightLevel == AmbientLightReading.Twilight) - ambientlighttext.text = "Ambient light: Twilight"; - else if (reading.lightLevel == AmbientLightReading.Light) - ambientlighttext.text = "Ambient light: Light"; - else if (reading.lightLevel == AmbientLightReading.Bright) - ambientlighttext.text = "Ambient light: Bright"; - else if (reading.lightLevel == AmbientLightReading.Sunny) - ambientlighttext.text = "Ambient light: Sunny"; - else - ambientlighttext.text = "Ambient light: Unknown"; - } - //! [5] - } - - ProximitySensor { - id: proxi - active: false - } - - Column { - spacing: 10 - anchors.fill: parent - anchors.margins: 5 - - Text { - id: labelTitle - width: parent.width - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 30 - font.bold: true - text: "QML QtSensors" - } - - // Tilt region - Divider { label: "TiltSensor" } - - Row { - spacing: 20 - width: parent.width - anchors.margins: 5 - Button { - id: calibrate - height: 30 - width: 80 - text: "Calibrate" - onClicked: tilt.calibrate(); - } - Text { - id: xrottext - height: 30 - verticalAlignment: Text.AlignVCenter - //! [3] - text: "X Rotation: " + (tilt.reading ? tilt.reading.xRotation.toFixed(2) + "°" : "Unknown") - //! [3] - } - } - Row { - spacing: 20 - width: parent.width - anchors.margins: 5 - Button { - id: tiltStart - height: 30 - width: 80 - text: tilt.active ? "Stop" : "Start" - onClicked: { - //! [2] - tilt.active = (tiltStart.text === "Start"); - //! [2] - } - } - Text { - id: yrottext - height: 30 - verticalAlignment: Text.AlignVCenter - //! [4] - text: "Y Rotation: " + (tilt.reading ? tilt.reading.yRotation.toFixed(2) + "°" : "Unknown") - //! [4] - } - } - - Divider { label: "AmbientLightSensor" } - - Row { - spacing: 20 - width: parent.width - anchors.margins: 5 - - Button{ - id: ambientlightStart - height: 30 - width: 80 - text: ambientlight.active ? "Stop" : "Start" - onClicked: { - ambientlight.active = (ambientlightStart.text === "Start" ? true : false); - } - } - - Text { - id: ambientlighttext - height: 30 - verticalAlignment: Text.AlignVCenter - text: "Ambient light: Unknown" - } - } - - // Proximity region - Divider { label: "ProximitySensor" } - - Row { - spacing: 20 - width: parent.width - anchors.margins: 5 - - Button { - id: proxiStart - height: 30 - width: 80 - text: proxi.active ? "Stop" : "Start" - - onClicked: { - proxi.active = (proxiStart.text === "Start" ? true: false); - } - } - - Text { - id: proxitext - height: 30 - verticalAlignment: Text.AlignVCenter - //! [6] - text: "Proximity: " + - (proxi.active ? (proxi.reading.near ? "Near" : "Far") : "Unknown") - //! [6] - } - } - } -} diff --git a/examples/sensors/qmlqtsensors/qmlqtsensors.qrc b/examples/sensors/qmlqtsensors/qmlqtsensors.qrc deleted file mode 100644 index 4ba06dad..00000000 --- a/examples/sensors/qmlqtsensors/qmlqtsensors.qrc +++ /dev/null @@ -1,11 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>qmlqtsensors.qml</file> - <file>components/ApplicationWindow.qml</file> - <file>components/Button.qml</file> - <file>components/images/button_background_disabled.png</file> - <file>components/images/button_background_normal.png</file> - <file>components/images/button_background_pressed.png</file> - <file>components/Divider.qml</file> - </qresource> -</RCC> |