From 849519a842cf34527f4532837dcf84ec6bb28108 Mon Sep 17 00:00:00 2001 From: Juha Vuolle Date: Fri, 17 Feb 2023 12:34:02 +0200 Subject: 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 --- examples/sensors/CMakeLists.txt | 1 - examples/sensors/qmlqtsensors/CMakeLists.txt | 54 ------ .../qmlqtsensors/components/ApplicationWindow.qml | 12 -- .../sensors/qmlqtsensors/components/Button.qml | 38 ---- .../sensors/qmlqtsensors/components/Divider.qml | 24 --- .../images/button_background_disabled.png | Bin 579 -> 0 bytes .../components/images/button_background_normal.png | Bin 901 -> 0 bytes .../images/button_background_pressed.png | Bin 228 -> 0 bytes .../sensors/qmlqtsensors/doc/src/qmlqtsensors.qdoc | 46 ----- examples/sensors/qmlqtsensors/main.cpp | 5 - examples/sensors/qmlqtsensors/qmlqtsensors.pro | 16 -- examples/sensors/qmlqtsensors/qmlqtsensors.qml | 212 --------------------- examples/sensors/qmlqtsensors/qmlqtsensors.qrc | 11 -- examples/sensors/sensors.pro | 4 - examples/sensors/stub.h | 15 -- 15 files changed, 438 deletions(-) delete mode 100644 examples/sensors/qmlqtsensors/CMakeLists.txt delete mode 100644 examples/sensors/qmlqtsensors/components/ApplicationWindow.qml delete mode 100644 examples/sensors/qmlqtsensors/components/Button.qml delete mode 100644 examples/sensors/qmlqtsensors/components/Divider.qml delete mode 100644 examples/sensors/qmlqtsensors/components/images/button_background_disabled.png delete mode 100644 examples/sensors/qmlqtsensors/components/images/button_background_normal.png delete mode 100644 examples/sensors/qmlqtsensors/components/images/button_background_pressed.png delete mode 100644 examples/sensors/qmlqtsensors/doc/src/qmlqtsensors.qdoc delete mode 100644 examples/sensors/qmlqtsensors/main.cpp delete mode 100644 examples/sensors/qmlqtsensors/qmlqtsensors.pro delete mode 100644 examples/sensors/qmlqtsensors/qmlqtsensors.qml delete mode 100644 examples/sensors/qmlqtsensors/qmlqtsensors.qrc delete mode 100644 examples/sensors/stub.h (limited to 'examples') diff --git a/examples/sensors/CMakeLists.txt b/examples/sensors/CMakeLists.txt index 9bc70568..7a0ee23a 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 9c1146cf..00000000 --- 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 a2e90655..00000000 --- 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 953424a4..00000000 --- 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 4856d665..00000000 --- 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 62a00b9a..00000000 Binary files a/examples/sensors/qmlqtsensors/components/images/button_background_disabled.png and /dev/null 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 1fecad5b..00000000 Binary files a/examples/sensors/qmlqtsensors/components/images/button_background_normal.png and /dev/null 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 e0ba0e7a..00000000 Binary files a/examples/sensors/qmlqtsensors/components/images/button_background_pressed.png and /dev/null differ diff --git a/examples/sensors/qmlqtsensors/doc/src/qmlqtsensors.qdoc b/examples/sensors/qmlqtsensors/doc/src/qmlqtsensors.qdoc deleted file mode 100644 index 410fb2c1..00000000 --- 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 48705436..00000000 --- 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 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 43bf140a..00000000 --- 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 4ba06dad..00000000 --- a/examples/sensors/qmlqtsensors/qmlqtsensors.qrc +++ /dev/null @@ -1,11 +0,0 @@ - - - qmlqtsensors.qml - components/ApplicationWindow.qml - components/Button.qml - components/images/button_background_disabled.png - components/images/button_background_normal.png - components/images/button_background_pressed.png - components/Divider.qml - - diff --git a/examples/sensors/sensors.pro b/examples/sensors/sensors.pro index 86d029b2..8f5f6c6f 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 0bee2026..00000000 --- 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 -#include -#include - -#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();\ -} -- cgit v1.2.3