summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@qt.io>2023-02-17 12:34:02 +0200
committerJuha Vuolle <juha.vuolle@qt.io>2023-02-22 08:37:54 +0200
commit849519a842cf34527f4532837dcf84ec6bb28108 (patch)
tree34973b19a083d0fb5cf0f74d6e6f6eeead97214b
parentc908718f86dd409f0f2d3757057d797b2f5ff83a (diff)
downloadqtsensors-849519a842cf34527f4532837dcf84ec6bb28108.tar.gz
Remove sensors qmlqtsensors example
The example doesn't add much demonstration value in comparison to sensorsshowcase example. The one unique thing it does demonstrate is ambient light sensor. That sensor can be added to the sensorsshowcase too; but OTOH it is in some sense just 'a' sensor among the sensors, and there is probably no need to use all of them in the examples. Task-number: QTBUG-110939 Pick-to: 6.5 Change-Id: I5d0ba59d969b532689e23388cbdda42884838fca Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
-rw-r--r--examples/sensors/CMakeLists.txt1
-rw-r--r--examples/sensors/qmlqtsensors/CMakeLists.txt54
-rw-r--r--examples/sensors/qmlqtsensors/components/ApplicationWindow.qml12
-rw-r--r--examples/sensors/qmlqtsensors/components/Button.qml38
-rw-r--r--examples/sensors/qmlqtsensors/components/Divider.qml24
-rw-r--r--examples/sensors/qmlqtsensors/components/images/button_background_disabled.pngbin579 -> 0 bytes
-rw-r--r--examples/sensors/qmlqtsensors/components/images/button_background_normal.pngbin901 -> 0 bytes
-rw-r--r--examples/sensors/qmlqtsensors/components/images/button_background_pressed.pngbin228 -> 0 bytes
-rw-r--r--examples/sensors/qmlqtsensors/doc/src/qmlqtsensors.qdoc46
-rw-r--r--examples/sensors/qmlqtsensors/main.cpp5
-rw-r--r--examples/sensors/qmlqtsensors/qmlqtsensors.pro16
-rw-r--r--examples/sensors/qmlqtsensors/qmlqtsensors.qml212
-rw-r--r--examples/sensors/qmlqtsensors/qmlqtsensors.qrc11
-rw-r--r--examples/sensors/sensors.pro4
-rw-r--r--examples/sensors/stub.h15
15 files changed, 0 insertions, 438 deletions
diff --git a/examples/sensors/CMakeLists.txt b/examples/sensors/CMakeLists.txt
index 9bc7056..7a0ee23 100644
--- a/examples/sensors/CMakeLists.txt
+++ b/examples/sensors/CMakeLists.txt
@@ -3,7 +3,6 @@
if(TARGET Qt::Quick)
qt_internal_add_example(grue)
- qt_internal_add_example(qmlqtsensors)
qt_internal_add_example(sensor_explorer)
if(TARGET Qt::Svg)
qt_internal_add_example(sensorsshowcase)
diff --git a/examples/sensors/qmlqtsensors/CMakeLists.txt b/examples/sensors/qmlqtsensors/CMakeLists.txt
deleted file mode 100644
index 9c1146c..0000000
--- a/examples/sensors/qmlqtsensors/CMakeLists.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
-
-cmake_minimum_required(VERSION 3.16)
-project(qmlqtsensors LANGUAGES CXX)
-
-set(CMAKE_AUTOMOC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/qmlqtsensors")
-
-find_package(Qt6 REQUIRED 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 a2e9065..0000000
--- a/examples/sensors/qmlqtsensors/components/ApplicationWindow.qml
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-//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 953424a..0000000
--- a/examples/sensors/qmlqtsensors/components/Button.qml
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-//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 4856d66..0000000
--- a/examples/sensors/qmlqtsensors/components/Divider.qml
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-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
deleted file mode 100644
index 62a00b9..0000000
--- a/examples/sensors/qmlqtsensors/components/images/button_background_disabled.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/qmlqtsensors/components/images/button_background_normal.png b/examples/sensors/qmlqtsensors/components/images/button_background_normal.png
deleted file mode 100644
index 1fecad5..0000000
--- a/examples/sensors/qmlqtsensors/components/images/button_background_normal.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/qmlqtsensors/components/images/button_background_pressed.png b/examples/sensors/qmlqtsensors/components/images/button_background_pressed.png
deleted file mode 100644
index e0ba0e7..0000000
--- a/examples/sensors/qmlqtsensors/components/images/button_background_pressed.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/qmlqtsensors/doc/src/qmlqtsensors.qdoc b/examples/sensors/qmlqtsensors/doc/src/qmlqtsensors.qdoc
deleted file mode 100644
index 410fb2c..0000000
--- a/examples/sensors/qmlqtsensors/doc/src/qmlqtsensors.qdoc
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \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 4870543..0000000
--- a/examples/sensors/qmlqtsensors/main.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#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 4c8e83b..0000000
--- 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 43bf140..0000000
--- a/examples/sensors/qmlqtsensors/qmlqtsensors.qml
+++ /dev/null
@@ -1,212 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-/* 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 4ba06da..0000000
--- 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>
diff --git a/examples/sensors/sensors.pro b/examples/sensors/sensors.pro
index 86d029b..8f5f6c6 100644
--- a/examples/sensors/sensors.pro
+++ b/examples/sensors/sensors.pro
@@ -4,9 +4,5 @@ SUBDIRS += grue
qtHaveModule(quick) {
SUBDIRS += \
- qmlqtsensors \
sensor_explorer
}
-
-EXAMPLE_FILES += \
- stub.h
diff --git a/examples/sensors/stub.h b/examples/sensors/stub.h
deleted file mode 100644
index 0bee202..0000000
--- a/examples/sensors/stub.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include <QGuiApplication>
-#include <QQuickView>
-#include <QLoggingCategory>
-
-#define SENSORS_EXAMPLE_MAIN(NAME) int main(int argc, char **argv) \
-{\
- QGuiApplication app(argc,argv);\
- QQuickView view;\
- view.setSource(QUrl("qrc:///" #NAME ".qml"));\
- view.show();\
- return app.exec();\
-}