summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.cmake.conf7
-rw-r--r--CMakeLists.txt1
-rw-r--r--LICENSES/Apache-2.0.txt73
-rw-r--r--coin/axivion/ci_config_linux.json44
-rw-r--r--conanfile.py33
-rw-r--r--config.tests/winrt/main.cpp2
-rw-r--r--dependencies.yaml4
-rw-r--r--examples/CMakeLists.txt2
-rw-r--r--examples/sensors/CMakeLists.txt13
-rw-r--r--examples/sensors/accelbubble/CMakeLists.txt64
-rw-r--r--examples/sensors/accelbubble/Info.plist34
-rw-r--r--examples/sensors/accelbubble/accelbubble.pro28
-rw-r--r--examples/sensors/accelbubble/accelbubble.qml86
-rw-r--r--examples/sensors/accelbubble/accelbubble.qrc6
-rw-r--r--examples/sensors/accelbubble/android/AndroidManifest.xml47
-rw-r--r--examples/sensors/accelbubble/content/Bluebubble.svg10
-rw-r--r--examples/sensors/accelbubble/doc/images/accelbubble.pngbin5025 -> 0 bytes
-rw-r--r--examples/sensors/accelbubble/doc/src/accelbubble.qdoc32
-rw-r--r--examples/sensors/accelbubble/main.cpp14
-rw-r--r--examples/sensors/grue/CMakeLists.txt68
-rw-r--r--examples/sensors/grue/console_app/CMakeLists.txt47
-rw-r--r--examples/sensors/grue/console_app/console_app.pro17
-rw-r--r--examples/sensors/grue/console_app/main.cpp52
-rw-r--r--examples/sensors/grue/doc/images/qtsensors-examples-grue.pngbin7511 -> 0 bytes
-rw-r--r--examples/sensors/grue/doc/src/grue.qdoc113
-rw-r--r--examples/sensors/grue/grue.pngbin9319 -> 0 bytes
-rw-r--r--examples/sensors/grue/grue.pro13
-rw-r--r--examples/sensors/grue/grue.qml79
-rw-r--r--examples/sensors/grue/grue.xcfbin23704 -> 0 bytes
-rw-r--r--examples/sensors/grue/grue_plugin_import_custom.cpp5
-rw-r--r--examples/sensors/grue/icon.xcfbin22397 -> 0 bytes
-rw-r--r--examples/sensors/grue/main.cpp14
-rw-r--r--examples/sensors/grue/plugin/CMakeLists.txt64
-rw-r--r--examples/sensors/grue/plugin/gruesensor.cpp112
-rw-r--r--examples/sensors/grue/plugin/gruesensor.h43
-rw-r--r--examples/sensors/grue/plugin/gruesensor_p.h29
-rw-r--r--examples/sensors/grue/plugin/gruesensorimpl.cpp103
-rw-r--r--examples/sensors/grue/plugin/gruesensorimpl.h40
-rw-r--r--examples/sensors/grue/plugin/main.cpp42
-rw-r--r--examples/sensors/grue/plugin/plugin.json1
-rw-r--r--examples/sensors/grue/plugin/plugin.pro27
-rw-r--r--examples/sensors/grue/qml.pro40
-rw-r--r--examples/sensors/grue/qml.qrc6
-rw-r--r--examples/sensors/grue/qmlgruesensor.cpp11
-rw-r--r--examples/sensors/grue/qmlgruesensor.h19
-rw-r--r--examples/sensors/grue/use_grue_static_plugin.pri17
-rw-r--r--examples/sensors/maze/CMakeLists.txt77
-rw-r--r--examples/sensors/maze/Congratulation.qml24
-rw-r--r--examples/sensors/maze/Info.plist32
-rw-r--r--examples/sensors/maze/LabyrinthSquare.qml43
-rw-r--r--examples/sensors/maze/Mouse.qml45
-rw-r--r--examples/sensors/maze/android/AndroidManifest.xml47
-rw-r--r--examples/sensors/maze/components/ApplicationWindow.qml14
-rw-r--r--examples/sensors/maze/components/Button.qml38
-rw-r--r--examples/sensors/maze/components/images/button_background_disabled.pngbin579 -> 0 bytes
-rw-r--r--examples/sensors/maze/components/images/button_background_normal.pngbin901 -> 0 bytes
-rw-r--r--examples/sensors/maze/components/images/button_background_pressed.pngbin228 -> 0 bytes
-rw-r--r--examples/sensors/maze/content/00.pngbin70 -> 0 bytes
-rw-r--r--examples/sensors/maze/content/01.pngbin540 -> 0 bytes
-rw-r--r--examples/sensors/maze/content/cheese.pngbin156 -> 0 bytes
-rw-r--r--examples/sensors/maze/content/cheeseeating.gifbin650 -> 0 bytes
-rw-r--r--examples/sensors/maze/content/congratulations.gifbin10811 -> 0 bytes
-rw-r--r--examples/sensors/maze/content/mouse_down.gifbin974 -> 0 bytes
-rw-r--r--examples/sensors/maze/content/start.pngbin505 -> 0 bytes
-rw-r--r--examples/sensors/maze/doc/src/maze.qdoc41
-rw-r--r--examples/sensors/maze/lib.js264
-rw-r--r--examples/sensors/maze/main.cpp5
-rw-r--r--examples/sensors/maze/maze.pro19
-rw-r--r--examples/sensors/maze/maze.qml251
-rw-r--r--examples/sensors/maze/maze.qrc21
-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/sensor_explorer/CMakeLists.txt44
-rw-r--r--examples/sensors/sensor_explorer/doc/images/qtsensors-examples-sensor-explorer.pngbin47605 -> 0 bytes
-rw-r--r--examples/sensors/sensor_explorer/doc/src/sensor_explorer.qdoc118
-rw-r--r--examples/sensors/sensor_explorer/sensor_explorer.pro22
-rw-r--r--examples/sensors/sensors.pro15
-rw-r--r--examples/sensors/sensorsshowcase/Accelerometer.qml70
-rw-r--r--examples/sensors/sensorsshowcase/CMakeLists.txt74
-rw-r--r--examples/sensors/sensorsshowcase/Compass.qml61
-rw-r--r--examples/sensors/sensorsshowcase/Gyroscope.qml128
-rw-r--r--examples/sensors/sensorsshowcase/Magnetometer.qml68
-rw-r--r--examples/sensors/sensorsshowcase/Main.qml116
-rw-r--r--examples/sensors/sensorsshowcase/ProgressXYZBar.qml45
-rw-r--r--examples/sensors/sensorsshowcase/Proximity.qml55
-rw-r--r--examples/sensors/sensorsshowcase/accelerometer.qml122
-rw-r--r--examples/sensors/sensorsshowcase/android/AndroidManifest.xml26
-rw-r--r--examples/sensors/sensorsshowcase/android/res/drawable-hdpi/icon.pngbin0 -> 1352 bytes
-rw-r--r--examples/sensors/sensorsshowcase/android/res/drawable-ldpi/icon.pngbin0 -> 578 bytes
-rw-r--r--examples/sensors/sensorsshowcase/android/res/drawable-mdpi/icon.pngbin0 -> 962 bytes
-rw-r--r--examples/sensors/sensorsshowcase/android/res/drawable-xhdpi/icon.pngbin0 -> 1944 bytes
-rw-r--r--examples/sensors/sensorsshowcase/android/res/drawable-xxhdpi/icon.pngbin0 -> 3030 bytes
-rw-r--r--examples/sensors/sensorsshowcase/android/res/drawable-xxxhdpi/icon.pngbin0 -> 4290 bytes
-rw-r--r--examples/sensors/sensorsshowcase/compass.qml64
-rw-r--r--examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-gyroscope.pngbin29205 -> 0 bytes
-rw-r--r--examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-gyroscope.webpbin0 -> 11922 bytes
-rw-r--r--examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-mainview.pngbin33722 -> 0 bytes
-rw-r--r--examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-mainview.webpbin0 -> 16784 bytes
-rw-r--r--examples/sensors/sensorsshowcase/doc/src/sensorsshowcase.qdoc27
-rw-r--r--examples/sensors/sensorsshowcase/gyroscope.qml174
-rw-r--r--examples/sensors/sensorsshowcase/images/qt_logo.pngbin6208 -> 14809 bytes
-rw-r--r--examples/sensors/sensorsshowcase/magnetometer.qml103
-rw-r--r--examples/sensors/sensorsshowcase/main.cpp16
-rw-r--r--examples/sensors/sensorsshowcase/proximity.qml71
-rw-r--r--examples/sensors/sensorsshowcase/qmldir9
-rw-r--r--examples/sensors/sensorsshowcase/qtquickcontrols2.conf6
-rw-r--r--examples/sensors/sensorsshowcase/sensorsshowcase.pro53
-rw-r--r--examples/sensors/sensorsshowcase/sensorsshowcase.qml76
-rw-r--r--examples/sensors/sensorsshowcase/sensorsshowcase.qrc13
-rw-r--r--examples/sensors/sensorsshowcase/sensorsupport.h41
-rw-r--r--examples/sensors/stub.h15
-rw-r--r--licenseRule.json94
-rw-r--r--src/plugins/sensors/CMakeLists.txt2
-rw-r--r--src/plugins/sensors/android/androidcompass.cpp20
-rw-r--r--src/plugins/sensors/android/qt_attribution.json12
-rw-r--r--src/plugins/sensors/android/sensormanager.cpp3
-rw-r--r--src/plugins/sensors/iio-sensor-proxy/CMakeLists.txt6
-rw-r--r--src/plugins/sensors/winrt/winrtgyroscope.cpp6
-rw-r--r--src/sensors/CMakeLists.txt2
-rw-r--r--src/sensors/configure.cmake5
-rw-r--r--src/sensors/doc/qtsensors.qdocconf6
-rw-r--r--src/sensors/doc/snippets/sensors/CMakeLists.txt3
-rw-r--r--src/sensors/doc/snippets/sensors/creating.cpp2
-rw-r--r--src/sensors/doc/snippets/sensors/main.cpp2
-rw-r--r--src/sensors/doc/snippets/sensors/mybackend.h2
-rw-r--r--src/sensors/doc/snippets/sensors/plugin.cpp2
-rw-r--r--src/sensors/doc/snippets/sensors/start.cpp42
-rw-r--r--src/sensors/doc/snippets/sensors/tutorial.cpp25
-rw-r--r--src/sensors/doc/src/compatmap.qdoc129
-rw-r--r--src/sensors/doc/src/qtsensors-cpp.qdoc15
-rw-r--r--src/sensors/doc/src/qtsensors-tutorial.qdoc36
-rw-r--r--src/sensors/doc/src/qtsensors.qdoc9
-rw-r--r--src/sensors/doc/src/sensor-examples.qdoc1
-rwxr-xr-xsrc/sensors/make_sensor.pl6
-rw-r--r--src/sensors/qsensor.cpp5
-rw-r--r--src/sensorsquick/CMakeLists.txt1
-rw-r--r--src/sensorsquick/qmlaccelerometer_p.h4
-rw-r--r--src/sensorsquick/qmlambientlightsensor_p.h4
-rw-r--r--src/sensorsquick/qmlambienttemperaturesensor_p.h4
-rw-r--r--src/sensorsquick/qmlcompass_p.h4
-rw-r--r--src/sensorsquick/qmlgyroscope_p.h4
-rw-r--r--src/sensorsquick/qmlhumiditysensor_p.h4
-rw-r--r--src/sensorsquick/qmlirproximitysensor_p.h4
-rw-r--r--src/sensorsquick/qmllidsensor_p.h4
-rw-r--r--src/sensorsquick/qmllightsensor_p.h4
-rw-r--r--src/sensorsquick/qmlmagnetometer_p.h4
-rw-r--r--src/sensorsquick/qmlorientationsensor_p.h4
-rw-r--r--src/sensorsquick/qmlpressuresensor_p.h4
-rw-r--r--src/sensorsquick/qmlproximitysensor_p.h4
-rw-r--r--src/sensorsquick/qmlrotationsensor_p.h4
-rw-r--r--src/sensorsquick/qmlsensor.cpp15
-rw-r--r--src/sensorsquick/qmlsensor_p.h21
-rw-r--r--src/sensorsquick/qmlsensorglobal_p.h2
-rw-r--r--src/sensorsquick/qmlsensorrange_p.h4
-rw-r--r--src/sensorsquick/qmltapsensor_p.h4
-rw-r--r--src/sensorsquick/qmltiltsensor_p.h4
-rw-r--r--src/sensorsquick/qsensorsquickglobal_p.h4
-rw-r--r--sync.profile6
-rw-r--r--tests/auto/common/test_backends.cpp2
-rw-r--r--tests/auto/common/test_backends.h8
-rw-r--r--tests/auto/qml/qml_cpp/tst_sensors_qmlcpp.cpp2
-rw-r--r--tests/auto/qml/qml_quick/tst_sensors_basic.qml24
-rw-r--r--tests/auto/qml/qml_quick/tst_sensors_qmlquick.cpp2
-rw-r--r--tests/auto/qsensor/test_sensor.cpp2
-rw-r--r--tests/auto/qsensor/test_sensor.h2
-rw-r--r--tests/auto/qsensor/test_sensor2.cpp24
-rw-r--r--tests/auto/qsensor/test_sensor2.h34
-rw-r--r--tests/auto/qsensor/test_sensor2_p.h2
-rw-r--r--tests/auto/qsensor/test_sensor2impl.cpp2
-rw-r--r--tests/auto/qsensor/test_sensor2impl.h2
-rw-r--r--tests/auto/qsensor/test_sensor_p.h2
-rw-r--r--tests/auto/qsensor/test_sensorimpl.cpp2
-rw-r--r--tests/auto/qsensor/test_sensorimpl.h2
-rw-r--r--tests/auto/qsensor/test_sensorplugin.cpp2
-rw-r--r--tests/auto/qsensor/tst_qsensor.cpp2
-rw-r--r--tests/manual/CMakeLists.txt3
-rw-r--r--tests/manual/sensor_explorer_qml/CMakeLists.txt32
-rw-r--r--tests/manual/sensor_explorer_qml/main.cpp (renamed from examples/sensors/sensor_explorer/main.cpp)2
-rw-r--r--tests/manual/sensor_explorer_qml/qml.qrc (renamed from examples/sensors/sensor_explorer/qml.qrc)0
-rw-r--r--tests/manual/sensor_explorer_qml/sensor_explorer.qml (renamed from examples/sensors/sensor_explorer/sensor_explorer.qml)10
-rw-r--r--tests/manual/sensor_explorer_qml/sensormodels.cpp (renamed from examples/sensors/sensor_explorer/sensormodels.cpp)8
-rw-r--r--tests/manual/sensor_explorer_qml/sensormodels.h (renamed from examples/sensors/sensor_explorer/sensormodels.h)4
-rw-r--r--tests/manual/sensor_explorer_widgets/CMakeLists.txt (renamed from tests/manual/sensor_explorer/CMakeLists.txt)2
-rw-r--r--tests/manual/sensor_explorer_widgets/explorer.cpp (renamed from tests/manual/sensor_explorer/explorer.cpp)2
-rw-r--r--tests/manual/sensor_explorer_widgets/explorer.h (renamed from tests/manual/sensor_explorer/explorer.h)2
-rw-r--r--tests/manual/sensor_explorer_widgets/explorer.ui (renamed from tests/manual/sensor_explorer/explorer.ui)0
-rw-r--r--tests/manual/sensor_explorer_widgets/main.cpp (renamed from tests/manual/sensor_explorer/main.cpp)2
-rw-r--r--tests/manual/sensorclerk/collector.cpp2
-rw-r--r--tests/manual/sensorclerk/collector.h2
-rw-r--r--tests/manual/sensorclerk/main.cpp2
-rw-r--r--tests/manual/sensorclerk/qml/main.qml2
201 files changed, 1399 insertions, 3777 deletions
diff --git a/.cmake.conf b/.cmake.conf
index 05b80d3a..dc1d7a92 100644
--- a/.cmake.conf
+++ b/.cmake.conf
@@ -1,4 +1,5 @@
-set(QT_REPO_MODULE_VERSION "6.5.0")
+set(QT_REPO_MODULE_VERSION "6.8.0")
set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1")
-# Use cpp-based syncqt
-set(QT_USE_SYNCQT_CPP TRUE)
+set(QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_AS_CONST=1")
+list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_FOREACH=1")
+list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_CONTEXTLESS_CONNECT=1")
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 68a18637..c447bd34 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,5 +17,6 @@ find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Co
find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS
Xml Gui Widgets Quick Qml Svg DBus QuickTest
)
+qt_internal_project_setup()
qt_build_repo()
diff --git a/LICENSES/Apache-2.0.txt b/LICENSES/Apache-2.0.txt
new file mode 100644
index 00000000..137069b8
--- /dev/null
+++ b/LICENSES/Apache-2.0.txt
@@ -0,0 +1,73 @@
+Apache License
+Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/coin/axivion/ci_config_linux.json b/coin/axivion/ci_config_linux.json
new file mode 100644
index 00000000..f806cff6
--- /dev/null
+++ b/coin/axivion/ci_config_linux.json
@@ -0,0 +1,44 @@
+{
+ "Project": {
+ "BuildSystemIntegration": {
+ "child_order": [
+ "GCCSetup",
+ "CMake",
+ "LinkLibraries"
+ ]
+ },
+ "CMake": {
+ "_active": true,
+ "_copy_from": "CMakeIntegration",
+ "build_environment": {},
+ "build_options": "-j4",
+ "generate_options": "--fresh",
+ "generator": "Ninja"
+ },
+ "GCCSetup": {
+ "_active": true,
+ "_copy_from": "Command",
+ "build_command": "gccsetup --cc gcc --cxx g++ --config ../../../axivion/"
+ },
+ "LinkLibraries": {
+ "_active": true,
+ "_copy_from": "AxivionLinker",
+ "input_files": [
+ "build/lib/lib*.so*.ir",
+ "build/qml/*/lib*.so*.ir"
+ ],
+ "ir": "build/$(env:TESTED_MODULE_COIN).ir",
+ "plugin_files": [
+ "build/plugins/*/lib*.so*.ir"
+ ]
+ }
+ },
+ "_Format": "1.0",
+ "_Version": "7.6.2",
+ "_VersionNum": [
+ 7,
+ 6,
+ 2,
+ 12725
+ ]
+}
diff --git a/conanfile.py b/conanfile.py
deleted file mode 100644
index 863f926a..00000000
--- a/conanfile.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (C) 2021 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-
-from conans import ConanFile
-import re
-from pathlib import Path
-
-
-def _parse_qt_version_by_key(key: str) -> str:
- with open(Path(__file__).parent.resolve() / ".cmake.conf") as f:
- m = re.search(fr'{key} .*"(.*)"', f.read())
- return m.group(1) if m else ""
-
-
-def _get_qt_minor_version() -> str:
- return ".".join(_parse_qt_version_by_key("QT_REPO_MODULE_VERSION").split(".")[:2])
-
-
-class QtSensors(ConanFile):
- name = "qtsensors"
- license = "LGPL-3.0, GPL-2.0+, Commercial Qt License Agreement"
- author = "The Qt Company <https://www.qt.io/contact-us>"
- url = "https://code.qt.io/cgit/qt/qtsensors.git"
- description = (
- "The Qt Sensors API provides access to sensor hardware via QML and C++ interfaces. "
- )
- topics = "qt", "qt6", "sensor"
- settings = "os", "compiler", "arch", "build_type"
- # for referencing the version number and prerelease tag and dependencies info
- exports = ".cmake.conf", "dependencies.yaml"
- exports_sources = "*", "!conan*.*"
- python_requires = f"qt-conan-common/{_get_qt_minor_version()}@qt/everywhere"
- python_requires_extend = "qt-conan-common.QtLeafModule"
diff --git a/config.tests/winrt/main.cpp b/config.tests/winrt/main.cpp
index bef9c9d5..556efa61 100644
--- a/config.tests/winrt/main.cpp
+++ b/config.tests/winrt/main.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: BSD-3-Clause
#include <functional>
#include <windows.system.h>
diff --git a/dependencies.yaml b/dependencies.yaml
index 3d9c19e8..45143acb 100644
--- a/dependencies.yaml
+++ b/dependencies.yaml
@@ -1,7 +1,7 @@
dependencies:
../qtbase:
- ref: 33e682f9af81902b36afa1aef1c4ecdcd2ed95a2
+ ref: 4641945e45206508b44678011bb83da7722bad62
required: true
../qtdeclarative:
- ref: 61ea5f96bf3f430116d70bf5b22586f381d74590
+ ref: 828b823938395d4d43f9b7a1b7f53f10a4a6b99b
required: false
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 0e602a2d..1c5447e6 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
qt_examples_build_begin(EXTERNAL_BUILD)
diff --git a/examples/sensors/CMakeLists.txt b/examples/sensors/CMakeLists.txt
index f1b382a6..bf1120c8 100644
--- a/examples/sensors/CMakeLists.txt
+++ b/examples/sensors/CMakeLists.txt
@@ -1,13 +1,6 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-if(TARGET Qt::Quick)
- qt_internal_add_example(grue)
- qt_internal_add_example(maze)
- qt_internal_add_example(qmlqtsensors)
- qt_internal_add_example(sensor_explorer)
- if(TARGET Qt::Svg)
- qt_internal_add_example(accelbubble)
- qt_internal_add_example(sensorsshowcase)
- endif()
+if(TARGET Qt::Quick AND TARGET Qt::Svg)
+ qt_internal_add_example(sensorsshowcase)
endif()
diff --git a/examples/sensors/accelbubble/CMakeLists.txt b/examples/sensors/accelbubble/CMakeLists.txt
deleted file mode 100644
index b5d6507a..00000000
--- a/examples/sensors/accelbubble/CMakeLists.txt
+++ /dev/null
@@ -1,64 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
-
-cmake_minimum_required(VERSION 3.16)
-project(accelbubble LANGUAGES CXX)
-
-set(CMAKE_AUTOMOC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/accelbubble")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick Sensors Svg Xml)
-
-qt_add_executable(accelbubble
- main.cpp
-)
-
-set_target_properties(accelbubble PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-
-if(ANDROID)
- set_property(TARGET accelbubble PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
- ${CMAKE_CURRENT_SOURCE_DIR}/android)
- endif()
-if(APPLE)
- if(IOS)
- set_property(TARGET accelbubble PROPERTY
- MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist"
- )
- endif()
-endif()
-
-target_link_libraries(accelbubble PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Quick
- Qt::Sensors
- Qt::Svg
- Qt::Xml
-)
-
-# Resources:
-set(accelbubble_resource_files
- "accelbubble.qml"
- "content/Bluebubble.svg"
-)
-
-qt6_add_resources(accelbubble "accelbubble"
- PREFIX
- "/"
- FILES
- ${accelbubble_resource_files}
-)
-
-install(TARGETS accelbubble
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/sensors/accelbubble/Info.plist b/examples/sensors/accelbubble/Info.plist
deleted file mode 100644
index 90725455..00000000
--- a/examples/sensors/accelbubble/Info.plist
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDisplayName</key>
- <string>accelbubble</string>
- <key>CFBundleExecutable</key>
- <string>accelbubble</string>
- <key>CFBundleGetInfoString</key>
- <string>Created by Qt/QMake</string>
- <key>CFBundleIdentifier</key>
- <string>com.digia.accelbubble</string>
- <key>CFBundleName</key>
- <string>accelbubble</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleShortVersionString</key>
- <string>1.0</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleVersion</key>
- <string>1.0</string>
- <key>LSRequiresIPhoneOS</key>
- <true/>
- <key>NOTE</key>
- <string>This file was generated by Qt/QMake.</string>
- <key>UILaunchStoryboardName</key>
- <string>LaunchScreen</string>
- <key>UISupportedInterfaceOrientations</key>
- <array>
- <string>UIInterfaceOrientationPortrait</string>
- </array>
-</dict>
-</plist>
diff --git a/examples/sensors/accelbubble/accelbubble.pro b/examples/sensors/accelbubble/accelbubble.pro
deleted file mode 100644
index d3b20a9d..00000000
--- a/examples/sensors/accelbubble/accelbubble.pro
+++ /dev/null
@@ -1,28 +0,0 @@
-TEMPLATE = app
-TARGET = accelbubble
-QT += quick sensors svg xml
-SOURCES = main.cpp
-
-RESOURCES += \
- accelbubble.qrc
-
-OTHER_FILES = \
- $$files(*.qml) \
- content \
- images \
- android/AndroidManifest.xml
-
-target.path = $$[QT_INSTALL_EXAMPLES]/sensors/accelbubble
-INSTALLS += target
-
-ios {
-QMAKE_INFO_PLIST = Info.plist
-
-# manual plugin loading needed with older Qt
-# QTPLUGIN += qsvg qtsensors_ios qtsensors_generic
-}
-
-ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
-
-EXAMPLE_FILES += \
- Info.plist
diff --git a/examples/sensors/accelbubble/accelbubble.qml b/examples/sensors/accelbubble/accelbubble.qml
deleted file mode 100644
index 65901169..00000000
--- a/examples/sensors/accelbubble/accelbubble.qml
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-
-import QtQuick
-import QtQuick.Controls
-
-//! [0]
-import QtSensors
-//! [0]
-
-
-ApplicationWindow {
- title: "Accelerate Bubble"
- id: mainWindow
- width: 320
- height: 480
- visible: true
- readonly property double radians_to_degrees: 180 / Math.PI
-
-//! [1]
- Accelerometer {
- id: accel
- dataRate: 100
-//! [1]
-//! [2]
- active:true
-//! [2]
-
-//! [3]
- onReadingChanged: {
- var newX = (bubble.x + calcRoll(accel.reading.x, accel.reading.y, accel.reading.z) * .1)
- var newY = (bubble.y - calcPitch(accel.reading.x, accel.reading.y, accel.reading.z) * .1)
-
- if (isNaN(newX) || isNaN(newY))
- return;
-
- if (newX < 0)
- newX = 0
-
- if (newX > mainWindow.width - bubble.width)
- newX = mainWindow.width - bubble.width
-
- if (newY < 18)
- newY = 18
-
- if (newY > mainWindow.height - bubble.height)
- newY = mainWindow.height - bubble.height
-
- bubble.x = newX
- bubble.y = newY
- }
-//! [3]
- }
-
- function calcPitch(x,y,z) {
- return -Math.atan2(y, Math.hypot(x, z)) * mainWindow.radians_to_degrees;
- }
- function calcRoll(x,y,z) {
- return -Math.atan2(x, Math.hypot(y, z)) * mainWindow.radians_to_degrees;
- }
-
- Image {
- id: bubble
- source: "content/Bluebubble.svg"
- smooth: true
- property real centerX: mainWindow.width / 2
- property real centerY: mainWindow.height / 2
- property real bubbleCenter: bubble.width / 2
- x: centerX - bubbleCenter
- y: centerY - bubbleCenter
-
- Behavior on y {
- SmoothedAnimation {
- easing.type: Easing.Linear
- duration: 100
- }
- }
- Behavior on x {
- SmoothedAnimation {
- easing.type: Easing.Linear
- duration: 100
- }
- }
- }
-}
diff --git a/examples/sensors/accelbubble/accelbubble.qrc b/examples/sensors/accelbubble/accelbubble.qrc
deleted file mode 100644
index 5cb6945a..00000000
--- a/examples/sensors/accelbubble/accelbubble.qrc
+++ /dev/null
@@ -1,6 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>accelbubble.qml</file>
- <file>content/Bluebubble.svg</file>
- </qresource>
-</RCC>
diff --git a/examples/sensors/accelbubble/android/AndroidManifest.xml b/examples/sensors/accelbubble/android/AndroidManifest.xml
deleted file mode 100644
index 537c705e..00000000
--- a/examples/sensors/accelbubble/android/AndroidManifest.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.qtproject.example.accelbubble"
- android:installLocation="auto"
- android:versionCode="1"
- android:versionName="1.0">
- <!-- The comment below will be replaced with dependencies permissions upon deployment.
- Remove the comment if you do not require these default permissions. -->
- <!-- %%INSERT_PERMISSIONS -->
-
- <!-- The comment below will be replaced with dependencies permissions upon deployment.
- Remove the comment if you do not require these default features. -->
- <!-- %%INSERT_FEATURES -->
-
- <supports-screens
- android:anyDensity="true"
- android:largeScreens="true"
- android:normalScreens="true"
- android:smallScreens="true" />
- <application
- android:name="org.qtproject.qt.android.bindings.QtApplication"
- android:extractNativeLibs="true"
- android:hardwareAccelerated="true"
- android:label="-- %%INSERT_APP_NAME%% --"
- android:requestLegacyExternalStorage="true">
- <activity
- android:name="org.qtproject.qt.android.bindings.QtActivity"
- android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density"
- android:label="-- %%INSERT_APP_NAME%% --"
- android:launchMode="singleTop"
- android:screenOrientation="portrait">
- <intent-filter>
- <action android:name="android.intent.action.MAIN"/>
- <category android:name="android.intent.category.LAUNCHER"/>
- </intent-filter>
- <meta-data
- android:name="android.app.lib_name"
- android:value="-- %%INSERT_APP_LIB_NAME%% --" />
- <meta-data
- android:name="android.app.background_running"
- android:value="false" />
- <meta-data
- android:name="android.app.extract_android_style"
- android:value="minimal" />
- </activity>
- </application>
-</manifest>
diff --git a/examples/sensors/accelbubble/content/Bluebubble.svg b/examples/sensors/accelbubble/content/Bluebubble.svg
deleted file mode 100644
index d9c406c4..00000000
--- a/examples/sensors/accelbubble/content/Bluebubble.svg
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0"?>
-<svg xmlns="http://www.w3.org/2000/svg" version="1.2" baseProfile="tiny">
- <defs>
- <radialGradient id="grad1" cx="0.5" cy="0.7" r="0.7" fx="0.5" fy="0.4">
- <stop offset="0" style="stop-color:rgb(255,255,255)" />
- <stop offset="1.5" style="stop-color:rgb(0,102,153)" />
- </radialGradient>
- </defs>
- <circle cx="100" cy="80" r="42" fill="url(#grad1)"/>
-</svg>
diff --git a/examples/sensors/accelbubble/doc/images/accelbubble.png b/examples/sensors/accelbubble/doc/images/accelbubble.png
deleted file mode 100644
index ad4cfc07..00000000
--- a/examples/sensors/accelbubble/doc/images/accelbubble.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/accelbubble/doc/src/accelbubble.qdoc b/examples/sensors/accelbubble/doc/src/accelbubble.qdoc
deleted file mode 100644
index 527d82fb..00000000
--- a/examples/sensors/accelbubble/doc/src/accelbubble.qdoc
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \example accelbubble
- \title Qt Sensors - Accel Bubble
- \brief The AccelBubble example demonstrates the Accelerometer QML type.
- \ingroup qtsensors-examples
-
- \image accelbubble.png
-
-\section1 Overview
- Writing a QML application that uses the Accelerometer QML sensors type requires the following steps:
-
- Import the Sensors Declarative module.
-
-\snippet accelbubble/accelbubble.qml 0
-
- Add an Accelerometer QML type.
-
-\snippet accelbubble/accelbubble.qml 1
-
- Use the 'active' property to start the sensor
-
-\snippet accelbubble/accelbubble.qml 2
-
- Move the bubble according to a factor of the accelerator sensor
-
-\snippet accelbubble/accelbubble.qml 3
-
-*/
-
diff --git a/examples/sensors/accelbubble/main.cpp b/examples/sensors/accelbubble/main.cpp
deleted file mode 100644
index ad71fc00..00000000
--- a/examples/sensors/accelbubble/main.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-
-#include <QtGui/QGuiApplication>
-#include <QtQml/QQmlApplicationEngine>
-
-int main(int argc, char *argv[])
-{
- QGuiApplication app(argc,argv);
- QQmlApplicationEngine engine(QUrl("qrc:///accelbubble.qml"));
-
- return app.exec();
-}
diff --git a/examples/sensors/grue/CMakeLists.txt b/examples/sensors/grue/CMakeLists.txt
deleted file mode 100644
index acc5da45..00000000
--- a/examples/sensors/grue/CMakeLists.txt
+++ /dev/null
@@ -1,68 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
-
-cmake_minimum_required(VERSION 3.16)
-project(grue_app LANGUAGES CXX)
-
-set(CMAKE_AUTOMOC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/grue")
-
-find_package(Qt6 REQUIRED COMPONENTS Quick Sensors)
-
-qt_add_executable(grue_app
- main.cpp qmlgruesensor.h qmlgruesensor.cpp
-)
-
-set_target_properties(grue_app PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-
-target_link_libraries(grue_app PUBLIC
- Qt::Quick
- Qt::Sensors
-)
-
-qt6_add_qml_module(grue_app
- VERSION 1.0
- URI "QMLGrueSensor"
- QML_FILES
- grue.qml
- RESOURCES
- grue.png
-)
-
-add_subdirectory(plugin)
-
-# Need to link to the plugin manually in a static Qt build.
-if(NOT QT6_IS_SHARED_LIBS_BUILD)
- target_link_libraries(grue_app PRIVATE qtsensors_grue)
- target_sources(grue_app PRIVATE grue_plugin_import_custom.cpp)
-endif()
-
-set(build_console_app TRUE)
-
-# The console app is not a macos bundle, so the shared library plugin wouldn't be found
-if(APPLE AND QT6_IS_SHARED_LIBS_BUILD)
- set(build_console_app FALSE)
-endif()
-
-# Gui-less apps don't make sense for these platforms
-if(IOS OR EMSCRIPTEN OR ANDROID)
- set(build_console_app FALSE)
-endif()
-
-if(build_console_app)
- add_subdirectory(console_app)
-endif()
-
-install(TARGETS grue_app
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/sensors/grue/console_app/CMakeLists.txt b/examples/sensors/grue/console_app/CMakeLists.txt
deleted file mode 100644
index 410de341..00000000
--- a/examples/sensors/grue/console_app/CMakeLists.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
-
-cmake_minimum_required(VERSION 3.16)
-project(detect_grue LANGUAGES CXX)
-
-set(CMAKE_AUTOMOC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/grue")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Sensors)
-
-qt_add_executable(detect_grue
- main.cpp
-)
-
-set_target_properties(detect_grue PROPERTIES
- WIN32_EXECUTABLE FALSE
- MACOSX_BUNDLE FALSE
-)
-
-if(WIN32 OR (UNIX AND NOT APPLE))
- set_target_properties(detect_grue PROPERTIES
- RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/..
- )
-endif()
-
-target_link_libraries(detect_grue PUBLIC
- Qt::Core
- Qt::Sensors
-)
-
-# Need to link to the plugin manually in a static Qt build.
-if(NOT QT6_IS_SHARED_LIBS_BUILD)
- target_link_libraries(detect_grue PRIVATE qtsensors_grue)
- target_sources(detect_grue PRIVATE ../grue_plugin_import_custom.cpp)
-endif()
-
-install(TARGETS detect_grue
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/sensors/grue/console_app/console_app.pro b/examples/sensors/grue/console_app/console_app.pro
deleted file mode 100644
index 97021f1d..00000000
--- a/examples/sensors/grue/console_app/console_app.pro
+++ /dev/null
@@ -1,17 +0,0 @@
-TEMPLATE = app
-TARGET = detect_grue
-CONFIG += console
-CONFIG -= app_bundle
-QT = core sensors
-
-DESTDIR = $$OUT_PWD/..
-
-SOURCES = main.cpp
-
-grue_plugin_base_dir = ..
-include(../use_grue_static_plugin.pri)
-
-target.path = $$[QT_INSTALL_EXAMPLES]/sensors/grue
-INSTALLS += target
-
-CONFIG += install_ok # Do not cargo-cult this!
diff --git a/examples/sensors/grue/console_app/main.cpp b/examples/sensors/grue/console_app/main.cpp
deleted file mode 100644
index 7de66334..00000000
--- a/examples/sensors/grue/console_app/main.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include <QtCore>
-#include <qsensor.h>
-
-class Filter : public QSensorFilter
-{
- int lastPercent;
-public:
- Filter()
- : QSensorFilter()
- , lastPercent(0)
- {
- }
-
- bool filter(QSensorReading *reading) override
- {
- int percent = reading->property("chanceOfBeingEaten").value<int>();
- if (percent == 0) {
- qDebug() << "It is light. You are safe from Grues.";
- } else if (lastPercent == 0) {
- qDebug() << "It is dark. You are likely to be eaten by a Grue.";
- }
- if (percent == 100) {
- qDebug() << "You have been eaten by a Grue!";
- QCoreApplication::instance()->quit();
- } else if (percent)
- qDebug() << "Your chance of being eaten by a Grue:" << percent << "percent.";
- lastPercent = percent;
- return false;
- }
-};
-
-int main(int argc, char **argv)
-{
- QCoreApplication app(argc, argv);
-
- QSensor sensor("GrueSensor");
-
- Filter filter;
- sensor.addFilter(&filter);
- sensor.start();
-
- if (!sensor.isActive()) {
- qWarning("The Grue sensor didn't start. You're on your own!");
- return 1;
- }
-
- return app.exec();
-}
-
diff --git a/examples/sensors/grue/doc/images/qtsensors-examples-grue.png b/examples/sensors/grue/doc/images/qtsensors-examples-grue.png
deleted file mode 100644
index f4348271..00000000
--- a/examples/sensors/grue/doc/images/qtsensors-examples-grue.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/grue/doc/src/grue.qdoc b/examples/sensors/grue/doc/src/grue.qdoc
deleted file mode 100644
index f187865a..00000000
--- a/examples/sensors/grue/doc/src/grue.qdoc
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \example grue
- \title Qt Sensors - Grue Sensor Example
- \brief The Qt Sensors - Grue sensor example demonstrates all the steps from
- creating a new sensor to using it.
- \ingroup qtsensors-examples
-
- \image qtsensors-examples-grue.png
-
- The sensor definition and implementation are in a new sensor plugin that client
- apps can use for detecting Grues (imaginary monsters that live in the dark).
-
- \list
- \li \l{Grue Sensor Plugin}
- \endlist
-
- The sensor plugin can be used by C++ applications as shown in the console
- application example.
-
- \list
- \li \l{Grue Sensor Console Application}
- \endlist
-
- QML applications can use the new sensor by importing the QMLGrueSensor class.
-
- \list
- \li \l{Grue Sensor QML Application}
- \endlist
-
- \section1 Grue Sensor Plugin
-
- The Grue sensor is defined in a new sensor plugin that applications can use.
-
- The plugin provides the sensor reading property that describes your chance of
- being eaten. This chance is increasing in the dark until it is 100% when
- you are eaten by the Grue and at that point the plugin stops further processing.
- In case of the plugin receiving light again before that happens the chance of
- being eaten resets to 0%.
-
- This example was created using the make_sensor.pl script which can be found in
- src/sensors. As such, it contains some generated code that defines the convenience
- classes GrueFilter and GrueSensor.
-
- \section1 Grue Sensor Implementation
-
- The Grue sensor implementation lives in the plugin that is loaded by the Qt
- Sensors library. The source code is available in the \c{grue/plugin} subdirectory.
-
- The Grue sensor needs a backend before it can be used. The backend provided
- is rather basic and it relies on some kind of light sensor to work but it
- gets the job done. If new hardware that can detect the actual presence of Grues
- becomes available a backend could be created that supports this hardware and
- applications using the Grue sensor would be able to use it without any changes.
-
- There are a few mandatory parts to a backend. They are the start and stop methods
- and the setReading call. The start and stop methods are used to start and stop
- any underlying hardware. In the case of this backend they start and stop a
- light sensor. In the start method, the backend should call the \c{sensorStopped()}
- or \c{sensorBusy()} methods if it cannot start.
-
- \snippet grue/plugin/gruesensorimpl.cpp start
-
- The setReading method is needed so that the sensors library knows where the
- readings are coming from. This backend has a local copy of the reading so
- it passes a pointer to the function.
-
- \snippet grue/plugin/gruesensorimpl.cpp setReading
-
- However it is also possible to pass null to the setReading method in which
- case the sensors library will create an instance and return a pointer.
-
- \code
- // Create a reading instance for us to use
- m_reading = setReading<GrueSensorReading>(0);
- \endcode
-
- The Grue sensor backend also supplies some metadata.
-
- The backend checks 2 things, how dark it is and how long you have been in the dark.
- It uses the \c{readingChanged()} signal to know when to check the light sensor's
- value. Once it is dark, it uses a timer to increase your chance of being eaten.
-
- The Grue sensor backend is delivered as a plugin. The plugin has a factory object
- that registers the types available and does the actual instantiation of the backend.
-
- \section1 Grue Sensor Console Application
-
- The Grue sensor console application demonstrates use of the Grue sensor.
- The source code is available in the \c{grue/console_app} subdirectory.
-
- This is a simple commandline application. It demonstrates how to use the generic
- access feature of Qt Sensors to avoid a link-time dependency on a library.
-
- \section1 Grue Sensor C++ Class Registration for QML
-
- The QMLGrueSensor class is registered for QML, so the class name can be used
- as an import and the class properties can be accessed from QML.
-
- \section1 Grue Sensor QML Application
-
- The Grue sensor QML application demonstrates the use of QMLGrueSensor QML type.
-
- The application consists of a single QML file and an image. It is built as an
- executable with C++ code that runs the QML, but it can also be launched directly
- using the \c qmlscene tool.
-
- \code
- qmlscene -I . grue.qml
- \endcode
-*/
diff --git a/examples/sensors/grue/grue.png b/examples/sensors/grue/grue.png
deleted file mode 100644
index 2727d393..00000000
--- a/examples/sensors/grue/grue.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/grue/grue.pro b/examples/sensors/grue/grue.pro
deleted file mode 100644
index cd23d1f4..00000000
--- a/examples/sensors/grue/grue.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += plugin
-
-# Gui-less apps don't make sense for these platforms
-!uikit:!android:!wasm: SUBDIRS += console_app
-
-# There console app is not a macos bundle, so the shared library plugin wouldn't be found
-macos:qtConfig(shared): SUBDIRS -= console_app
-
-qtHaveModule(quick): SUBDIRS += qml.pro
-
-
diff --git a/examples/sensors/grue/grue.qml b/examples/sensors/grue/grue.qml
deleted file mode 100644
index d3a90aa8..00000000
--- a/examples/sensors/grue/grue.qml
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtSensors
-import QtQuick.Layouts
-import QMLGrueSensor
-
-Rectangle {
- id: root
- anchors.fill: parent
- color: "black"
-
- property int percent: -1
- property string text: ""
- property real grueOpacity: 0.0
-
- function updateStatus(newPercent, newOpacity, newText) {
- if (root.percent === newPercent)
- return;
-
- // Delay updating the visual status to prevent flicker
- timer.interval = (newPercent < root.percent) ? 500 : 0;
-
- root.percent = newPercent;
- root.text = newText;
- root.grueOpacity = newOpacity;
-
- timer.start()
- }
-
- Timer {
- id: timer
- running: false
- repeat: false
- onTriggered: {
- text.text = root.text
- grueimg.opacity = root.grueOpacity
- }
- }
-
- QMLGrueSensor {
- id: sensor
- active: true
- onReadingChanged: {
- var percent = reading.chanceOfBeingEaten;
- if (percent === 0) {
- updateStatus(percent, 0.0, "It is light.<br>You are safe from Grues.");
- }
- else if (percent === 100) {
- updateStatus(percent, 1.0, "You have been eaten by a Grue!");
- sensor.active = false;
- }
- else if (percent > 0) {
- updateStatus(percent, 0.05 + (percent * 0.001),
- "It is dark.<br>You are " + percent +" % " +
- "likely to be eaten by a Grue.");
- }
- }
- }
-
- Text {
- id: text
- anchors.fill: parent
- wrapMode: Text.WordWrap
- text: "I can't tell if you're going to be eaten by a Grue or not. You're on your own!"
- font.pixelSize: 30
- color: "lightgray"
- }
-
- Image {
- id: grueimg
- anchors.bottom: parent.bottom
- anchors.horizontalCenter: parent.horizontalCenter
- source: "grue.png"
- opacity: 0.0
- Behavior on opacity { PropertyAnimation { duration: 250 } }
- }
-}
diff --git a/examples/sensors/grue/grue.xcf b/examples/sensors/grue/grue.xcf
deleted file mode 100644
index 2837ed7e..00000000
--- a/examples/sensors/grue/grue.xcf
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/grue/grue_plugin_import_custom.cpp b/examples/sensors/grue/grue_plugin_import_custom.cpp
deleted file mode 100644
index 0dcf6a1a..00000000
--- a/examples/sensors/grue/grue_plugin_import_custom.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include <QtPlugin>
-Q_IMPORT_PLUGIN(GrueSensorPlugin)
diff --git a/examples/sensors/grue/icon.xcf b/examples/sensors/grue/icon.xcf
deleted file mode 100644
index 8416c49f..00000000
--- a/examples/sensors/grue/icon.xcf
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/grue/main.cpp b/examples/sensors/grue/main.cpp
deleted file mode 100644
index af119c5a..00000000
--- a/examples/sensors/grue/main.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include <QGuiApplication>
-#include <QQuickView>
-
-int main(int argc, char **argv)
-{
- QGuiApplication app(argc,argv);
- QQuickView view;
- view.setSource(QUrl("qrc:/QMLGrueSensor/grue.qml"));
- view.show();
- return app.exec();
-}
diff --git a/examples/sensors/grue/plugin/CMakeLists.txt b/examples/sensors/grue/plugin/CMakeLists.txt
deleted file mode 100644
index 11e8aee8..00000000
--- a/examples/sensors/grue/plugin/CMakeLists.txt
+++ /dev/null
@@ -1,64 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
-
-cmake_minimum_required(VERSION 3.16)
-project(qtsensors_grue LANGUAGES CXX)
-
-set(CMAKE_AUTOMOC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/grue/sensors")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Sensors)
-
-qt_add_plugin(qtsensors_grue
- PLUGIN_TYPE sensors
-)
-
-target_sources(qtsensors_grue PRIVATE
- gruesensorimpl.cpp gruesensorimpl.h
- gruesensor.cpp gruesensor.h gruesensor_p.h
- main.cpp
-)
-
-set_target_properties(qtsensors_grue PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-
-if(WIN32 OR (UNIX AND NOT APPLE))
- set_target_properties(qtsensors_grue PROPERTIES
- LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../sensors
- )
-endif()
-
-if(APPLE AND QT6_IS_SHARED_LIBS_BUILD)
- set_target_properties(qtsensors_grue PROPERTIES
- LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../grue_app.app/Contents/Plugins/sensors
- )
-endif()
-
-target_link_libraries(qtsensors_grue PUBLIC
- Qt::Core
- Qt::Sensors
-)
-
-if(ANDROID)
- add_custom_target(gruesensorplugin_android_copy ALL
- COMMAND "${CMAKE_COMMAND}"
- -E copy_if_different
- "$<TARGET_FILE:qtsensors_grue>"
- "${CMAKE_CURRENT_BINARY_DIR}/../android-build/libs/${CMAKE_ANDROID_ARCH_ABI}/$<TARGET_FILE_NAME:qtsensors_grue>"
- COMMENT "Copying sensor plugin lib to grue_app android libs folder.")
-
- add_dependencies(gruesensorplugin_android_copy qtsensors_grue)
-endif()
-
-install(TARGETS qtsensors_grue
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/sensors/grue/plugin/gruesensor.cpp b/examples/sensors/grue/plugin/gruesensor.cpp
deleted file mode 100644
index 9bc3784b..00000000
--- a/examples/sensors/grue/plugin/gruesensor.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "gruesensor.h"
-#include "gruesensor_p.h"
-
-IMPLEMENT_READING(GrueSensorReading)
-
-/*
- \omit
- \class GrueSensorReading
-
- \brief The GrueSensorReading class holds readings from the Grue sensor.
-
- The Grue Sensor informs you of your chance of being eaten by a Grue.
-
- Grues love the dark so as long as your surroundings are relatively light
- you are safe. However the more time you spend in the dark, the higher
- your chances are of being eaten by a Grue.
-*/
-
-/*
- \property GrueSensorReading::chanceOfBeingEaten
- \brief holds your chance of being eaten.
-
- The value is the probability (from 0 to 100) that a Grue will eat you.
- A probability of 100 means you are currently being eaten. The darker
- it is, the more likely you are to be eaten by a Grue. The longer you
- stay in a dark area, the more likely you are to be eaten by a Grue.
- If you are in a lit room, the probability will be 0 as Grues fear light.
- \endomit
-*/
-
-int GrueSensorReading::chanceOfBeingEaten() const
-{
- return d->chanceOfBeingEaten;
-}
-
-void GrueSensorReading::setChanceOfBeingEaten(int chanceOfBeingEaten)
-{
- d->chanceOfBeingEaten = chanceOfBeingEaten;
-}
-
-// =====================================================================
-
-// begin generated code
-
-/*
- \omit
- \class GrueFilter
-
- \brief The GrueFilter class is a convenience wrapper around QSensorFilter.
-
- The only difference is that the filter() method features a pointer to GrueSensorReading
- instead of QSensorReading.
- \endomit
-*/
-
-/*
- \omit
- \fn GrueFilter::filter(GrueSensorReading *reading)
-
- Called when \a reading changes. Returns false to prevent the reading from propagating.
-
- \sa QSensorFilter::filter()
- \endomit
-*/
-
-char const * const GrueSensor::sensorType("GrueSensor");
-
-/*
- \omit
- \class GrueSensor
-
- \brief The GrueSensor class is a convenience wrapper around QSensor.
-
- The only behavioural difference is that this class sets the type properly.
-
- This class also features a reading() function that returns a GrueSensorReading instead of a QSensorReading.
-
- For details about how the sensor works, see \l GrueSensorReading.
-
- \sa GrueSensorReading
- \endomit
-*/
-
-/*
- \omit
- \fn GrueSensor::GrueSensor(QObject *parent)
-
- Construct the sensor as a child of \a parent.
- \endomit
-*/
-
-/*
- \fn GrueSensor::~GrueSensor()
-
- Destroy the sensor. Stops the sensor if it has not already been stopped.
-*/
-
-/*
- \omit
- \fn GrueSensor::reading() const
-
- Returns the reading class for this sensor.
-
- \sa QSensor::reading()
- \endomit
-*/
-// end generated code
-
-#include "moc_gruesensor.cpp"
diff --git a/examples/sensors/grue/plugin/gruesensor.h b/examples/sensors/grue/plugin/gruesensor.h
deleted file mode 100644
index 9677e621..00000000
--- a/examples/sensors/grue/plugin/gruesensor.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#ifndef GRUESENSOR_H
-#define GRUESENSOR_H
-
-#include <qsensor.h>
-
-class GrueSensorReadingPrivate;
-
-class GrueSensorReading : public QSensorReading
-{
- Q_OBJECT
- Q_PROPERTY(int chanceOfBeingEaten READ chanceOfBeingEaten WRITE setChanceOfBeingEaten)
- DECLARE_READING(GrueSensorReading)
-public:
- int chanceOfBeingEaten() const;
- void setChanceOfBeingEaten(int chanceOfBeingEaten);
-};
-
-// begin generated code
-
-class GrueFilter : public QSensorFilter
-{
-public:
- virtual bool filter(GrueSensorReading *reading) = 0;
-private:
- bool filter(QSensorReading *reading) override { return filter(static_cast<GrueSensorReading*>(reading)); }
-};
-
-class GrueSensor : public QSensor
-{
- Q_OBJECT
- Q_PROPERTY(GrueSensorReading* reading READ reading)
-public:
- explicit GrueSensor(QObject *parent = 0) : QSensor(GrueSensor::sensorType, parent) {}
- virtual ~GrueSensor() {}
- GrueSensorReading *reading() const { return static_cast<GrueSensorReading*>(QSensor::reading()); }
- static char const * const sensorType;
-};
-// end generated code
-
-#endif
diff --git a/examples/sensors/grue/plugin/gruesensor_p.h b/examples/sensors/grue/plugin/gruesensor_p.h
deleted file mode 100644
index 4804f8cf..00000000
--- a/examples/sensors/grue/plugin/gruesensor_p.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#ifndef GRUESENSOR_P_H
-#define GRUESENSOR_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-class GrueSensorReadingPrivate
-{
-public:
- GrueSensorReadingPrivate()
- : chanceOfBeingEaten(-1)
- {
- }
-
- int chanceOfBeingEaten;
-};
-
-#endif
diff --git a/examples/sensors/grue/plugin/gruesensorimpl.cpp b/examples/sensors/grue/plugin/gruesensorimpl.cpp
deleted file mode 100644
index 7bfdb092..00000000
--- a/examples/sensors/grue/plugin/gruesensorimpl.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "gruesensorimpl.h"
-#include <QDebug>
-#include <QTimer>
-
-char const * const gruesensorimpl::id("grue.gruesensor");
-
-gruesensorimpl::gruesensorimpl(QSensor *sensor)
- : QSensorBackend(sensor)
- , lightLevel(QAmbientLightReading::Undefined)
-{
- // We need a light sensor
- lightSensor = new QAmbientLightSensor(this);
- connect(lightSensor, SIGNAL(readingChanged()), this, SLOT(lightChanged()));
- lightSensor->connectToBackend();
-
- // We need a timer
- darkTimer = new QTimer(this);
- darkTimer->setInterval(1000);
- connect(darkTimer, SIGNAL(timeout()), this, SLOT(increaseChance()));
-
- // We use this as our timestamp source
- timer.start();
-
-//! [setReading]
- // Register our reading instance
- setReading<GrueSensorReading>(&m_reading);
-//! [setReading]
-
-//! [metadata]
- // Supply metadata
- // We can run as fast as the light sensor does
- setDataRates(lightSensor);
- // Only one output range, 0 to 1 in .1 increments
- addOutputRange(0, 1, 0.1);
- setDescription(QLatin1String("Grue Sensor"));
-//! [metadata]
-}
-
-void gruesensorimpl::start()
-{
-//! [start]
- lightSensor->setDataRate(sensor()->dataRate());
- lightSensor->start();
- // If the light sensor doesn't work we don't work either
- if (!lightSensor->isActive())
- sensorStopped();
- if (lightSensor->isBusy())
- sensorBusy();
-//! [start]
-}
-
-void gruesensorimpl::stop()
-{
- lightSensor->stop();
-}
-
-void gruesensorimpl::lightChanged()
-{
- if (lightLevel == lightSensor->reading()->lightLevel())
- return;
-
- lightLevel = lightSensor->reading()->lightLevel();
-
- int chance = 0;
- darkTimer->stop();
-
- switch (lightSensor->reading()->lightLevel()) {
- case QAmbientLightReading::Dark:
- // It is dark. You are likely to be eaten by a grue.
- chance = 10;
- darkTimer->start();
- break;
- default:
- break;
- }
-
- // Only send an update if the value has changed.
- if (chance != m_reading.chanceOfBeingEaten() || m_reading.timestamp() == 0) {
- m_reading.setTimestamp(timer.elapsed());
- m_reading.setChanceOfBeingEaten(chance);
- newReadingAvailable();
- }
-}
-
-void gruesensorimpl::increaseChance()
-{
- // The longer you stay in the dark, the higher your chance of being eaten
- int chance = m_reading.chanceOfBeingEaten() + 10;
-
- m_reading.setTimestamp(timer.elapsed());
- m_reading.setChanceOfBeingEaten(chance);
-
- newReadingAvailable();
-
- // No point in using the timer anymore if we've hit 100... you can't get more
- // likely to be eaten than 100%
- if (chance >= 100)
- darkTimer->stop();
-}
-
diff --git a/examples/sensors/grue/plugin/gruesensorimpl.h b/examples/sensors/grue/plugin/gruesensorimpl.h
deleted file mode 100644
index 001af4dd..00000000
--- a/examples/sensors/grue/plugin/gruesensorimpl.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#ifndef GRUESENSORIMPL_H
-#define GRUESENSORIMPL_H
-
-#include <qsensorbackend.h>
-#include "gruesensor.h"
-#include <qambientlightsensor.h>
-#include <QElapsedTimer>
-
-QT_BEGIN_NAMESPACE
-class QTimer;
-QT_END_NAMESPACE
-
-class gruesensorimpl : public QSensorBackend
-{
- Q_OBJECT
-public:
- static char const * const id;
-
- gruesensorimpl(QSensor *sensor);
-
- void start() override;
- void stop() override;
-
-private Q_SLOTS:
- void lightChanged();
- void increaseChance();
-
-private:
- GrueSensorReading m_reading;
- QAmbientLightSensor *lightSensor;
- QTimer *darkTimer;
- QElapsedTimer timer;
- QAmbientLightReading::LightLevel lightLevel;
-};
-
-#endif
-
diff --git a/examples/sensors/grue/plugin/main.cpp b/examples/sensors/grue/plugin/main.cpp
deleted file mode 100644
index 39b9a585..00000000
--- a/examples/sensors/grue/plugin/main.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "gruesensorimpl.h"
-#include <qsensorplugin.h>
-#include <qsensorbackend.h>
-#include <qsensormanager.h>
-#include <QFile>
-#include <QDebug>
-
-class GrueSensorPlugin : public QObject, public QSensorPluginInterface, public QSensorChangesInterface, public QSensorBackendFactory
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "com.qt-project.Qt.QSensorPluginInterface/1.0" FILE "plugin.json")
- Q_INTERFACES(QSensorPluginInterface QSensorChangesInterface)
-public:
- void registerSensors() override
- {
- }
-
- void sensorsChanged() override
- {
- if (!QSensor::defaultSensorForType(QAmbientLightSensor::sensorType).isEmpty()) {
- // There is a light sensor available. Register the backend
- if (!QSensorManager::isBackendRegistered(GrueSensor::sensorType, gruesensorimpl::id))
- QSensorManager::registerBackend(GrueSensor::sensorType, gruesensorimpl::id, this);
- } else {
- if (QSensorManager::isBackendRegistered(GrueSensor::sensorType, gruesensorimpl::id))
- QSensorManager::unregisterBackend(GrueSensor::sensorType, gruesensorimpl::id);
- }
- }
-
- QSensorBackend *createBackend(QSensor *sensor) override
- {
- if (sensor->identifier() == gruesensorimpl::id)
- return new gruesensorimpl(sensor);
-
- return 0;
- }
-};
-
-#include "main.moc"
diff --git a/examples/sensors/grue/plugin/plugin.json b/examples/sensors/grue/plugin/plugin.json
deleted file mode 100644
index ab372059..00000000
--- a/examples/sensors/grue/plugin/plugin.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "Keys": [ "grue" ] }
diff --git a/examples/sensors/grue/plugin/plugin.pro b/examples/sensors/grue/plugin/plugin.pro
deleted file mode 100644
index aa03d6c9..00000000
--- a/examples/sensors/grue/plugin/plugin.pro
+++ /dev/null
@@ -1,27 +0,0 @@
-TEMPLATE = lib
-CONFIG += plugin
-TARGET = $$qtLibraryTarget(plugins_sensors_qtsensors_grue)
-PLUGIN_TYPE = sensors
-
-QT = core sensors
-
-macos:!qtConfig(static): DESTDIR = ../grue_app.app/Contents/MacOS/$$PLUGIN_TYPE
-else: DESTDIR = ../$$PLUGIN_TYPE
-
-HEADERS += gruesensorimpl.h \
- gruesensor.h \
- gruesensor_p.h
-
-SOURCES += gruesensorimpl.cpp \
- main.cpp \
- gruesensor.cpp
-
-
-# Install the plugin under Grue example directory
-target.path=$$[QT_INSTALL_EXAMPLES]/sensors/grue/$$PLUGIN_TYPE
-INSTALLS += target
-
-CONFIG += install_ok # Do not cargo-cult this!
-
-OTHER_FILES += \
- plugin.json
diff --git a/examples/sensors/grue/qml.pro b/examples/sensors/grue/qml.pro
deleted file mode 100644
index 6bce739c..00000000
--- a/examples/sensors/grue/qml.pro
+++ /dev/null
@@ -1,40 +0,0 @@
-TEMPLATE = app
-TARGET = grue_app
-QT += qml quick sensors
-
-# Avoid going to release/debug subdirectory
-win32: DESTDIR = ./
-
-SOURCES = main.cpp \
- qmlgruesensor.cpp
-
-HEADERS += \
- qmlgruesensor.h
-
-grue_plugin_base_dir = .
-include(use_grue_static_plugin.pri)
-
-CONFIG += qmltypes
-QML_IMPORT_NAME = QMLGrueSensor
-QML_IMPORT_MAJOR_VERSION = 1
-
-RESOURCES += \
- qml.qrc
-
-OTHER_FILES = \
- $$files(*.qml) \
- grue.png
-
-target.path = $$[QT_INSTALL_EXAMPLES]/sensors/grue
-INSTALLS += target
-
-EXAMPLE_FILES += \
- grue.xcf \
- icon.xcf
-
-android{
- CONFIG += file_copies
- COPIES += androidPluginCopy
- androidPluginCopy.files = $$OUT_PWD/sensors/libplugins_sensors_qtsensors_grue_armeabi-v7a.so
- androidPluginCopy.path = android-build/libs/armeabi-v7a
-}
diff --git a/examples/sensors/grue/qml.qrc b/examples/sensors/grue/qml.qrc
deleted file mode 100644
index 01f4e2bf..00000000
--- a/examples/sensors/grue/qml.qrc
+++ /dev/null
@@ -1,6 +0,0 @@
-<RCC>
- <qresource prefix="/QMLGrueSensor">
- <file>grue.qml</file>
- <file>grue.png</file>
- </qresource>
-</RCC>
diff --git a/examples/sensors/grue/qmlgruesensor.cpp b/examples/sensors/grue/qmlgruesensor.cpp
deleted file mode 100644
index 312b4968..00000000
--- a/examples/sensors/grue/qmlgruesensor.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "qmlgruesensor.h"
-
-
-QMLGrueSensor::QMLGrueSensor():QSensor("GrueSensor") // QLightSensor
-{
- connectToBackend();
- start();
-}
diff --git a/examples/sensors/grue/qmlgruesensor.h b/examples/sensors/grue/qmlgruesensor.h
deleted file mode 100644
index 9ee14568..00000000
--- a/examples/sensors/grue/qmlgruesensor.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#ifndef QMLGRUESENSOR_H
-#define QMLGRUESENSOR_H
-
-#include <QtQml/qqml.h>
-#include <QtSensors/qsensor.h>
-
-class QMLGrueSensor : public QSensor
-{
- Q_OBJECT
- QML_ELEMENT
-
-public:
- QMLGrueSensor();
-};
-
-#endif // QMLGRUESENSOR_H
diff --git a/examples/sensors/grue/use_grue_static_plugin.pri b/examples/sensors/grue/use_grue_static_plugin.pri
deleted file mode 100644
index 6ccee1cd..00000000
--- a/examples/sensors/grue/use_grue_static_plugin.pri
+++ /dev/null
@@ -1,17 +0,0 @@
-# Need to manually link to the plugin when using a static Qt build.
-qtConfig(static) {
- SOURCES += $$grue_plugin_base_dir/grue_plugin_import_custom.cpp
- LIBS += -L$$grue_plugin_base_dir/sensors
- # For iOS, xcode takes care of the debug suffix
- macx-xcode {
- LIBS += -lplugins_sensors_qtsensors_grue$($${QMAKE_XCODE_LIBRARY_SUFFIX_SETTING})
- # For desktop platforms we need to do it per-platform.
- } else {
- lib_to_link = plugins_sensors_qtsensors_grue
- if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
- macos:lib_to_link = $${lib_to_link}_debug
- win32:lib_to_link = $${lib_to_link}d
- }
- LIBS += -l$$lib_to_link
- }
-}
diff --git a/examples/sensors/maze/CMakeLists.txt b/examples/sensors/maze/CMakeLists.txt
deleted file mode 100644
index 258291c4..00000000
--- a/examples/sensors/maze/CMakeLists.txt
+++ /dev/null
@@ -1,77 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
-
-cmake_minimum_required(VERSION 3.16)
-project(maze LANGUAGES CXX)
-
-set(CMAKE_AUTOMOC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/maze")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick Sensors)
-
-qt_add_executable(maze
- main.cpp
-)
-
-set_target_properties(maze PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-
-if(ANDROID)
- set_property(TARGET maze PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
- ${CMAKE_CURRENT_SOURCE_DIR}/android)
- endif()
-if(APPLE)
- if(IOS)
- set_property(TARGET maze PROPERTY
- MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist"
- )
- endif()
-endif()
-
-target_link_libraries(maze PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Quick
- Qt::Sensors
-)
-
-# Resources:
-set(maze_resource_files
- "Congratulation.qml"
- "LabyrinthSquare.qml"
- "Mouse.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"
- "content/00.png"
- "content/01.png"
- "content/cheese.png"
- "content/cheeseeating.gif"
- "content/congratulations.gif"
- "content/mouse_down.gif"
- "content/start.png"
- "lib.js"
- "maze.qml"
-)
-
-qt6_add_resources(maze "maze"
- PREFIX
- "/"
- FILES
- ${maze_resource_files}
-)
-
-install(TARGETS maze
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/sensors/maze/Congratulation.qml b/examples/sensors/maze/Congratulation.qml
deleted file mode 100644
index a1e54ada..00000000
--- a/examples/sensors/maze/Congratulation.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 the declarative plugins
-import QtQuick
-
-//Import the javascript functions for this game
-import "lib.js" as Lib
-
-//Implementation of the Congratulation control
-Item {
- x: Lib.cellDimension
- y: Lib.cellDimension
- width: Lib.cellDimension * (Lib.dimension - 2)
- height: Lib.cellDimension * (Lib.dimension - 2)
-
- //Containing a animated gif image
- AnimatedImage {
- id: img
- anchors.fill: parent
- visible: true
- source: "content/congratulations.gif"
- }
-}
diff --git a/examples/sensors/maze/Info.plist b/examples/sensors/maze/Info.plist
deleted file mode 100644
index 2458247c..00000000
--- a/examples/sensors/maze/Info.plist
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDisplayName</key>
- <string>maze</string>
- <key>CFBundleExecutable</key>
- <string>maze</string>
- <key>CFBundleGetInfoString</key>
- <string>Created by Qt/QMake</string>
- <key>CFBundleIdentifier</key>
- <string>com.qt.sensorsmaze</string>
- <key>CFBundleName</key>
- <string>maze</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleShortVersionString</key>
- <string>1.0</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleVersion</key>
- <string>1.0</string>
- <key>LSRequiresIPhoneOS</key>
- <true/>
- <key>UILaunchStoryboardName</key>
- <string>LaunchScreen</string>
- <key>UISupportedInterfaceOrientations</key>
- <array>
- <string>UIInterfaceOrientationPortrait</string>
- </array>
-</dict>
-</plist>
diff --git a/examples/sensors/maze/LabyrinthSquare.qml b/examples/sensors/maze/LabyrinthSquare.qml
deleted file mode 100644
index d9e72db7..00000000
--- a/examples/sensors/maze/LabyrinthSquare.qml
+++ /dev/null
@@ -1,43 +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
-
-//Import the javascript functions for this game
-import "lib.js" as Lib
-
-//Implementation of the Labyrinth square control.
-Rectangle {
- id: sq
- x: 0
- y: 0
- width: Lib.cellDimension
- height: Lib.cellDimension
- color: "white"
- property int val: 0
- property AnimatedImage picture: img
-
- //Dependent of its position and the labyrinth value a square can be the start, cheese, empty or a wall
- AnimatedImage {
- id: img
- anchors.fill: parent
- source: ""
- }
-
- function updateImage()
- {
- if (sq.val == -1)
- sq.picture.source = "content/start.png";
- else if (sq.val == 3)
- sq.picture.source = "content/cheese.png";
- else if (sq.val == 4){
- sq.picture.source = "content/cheeseeating.gif";
- sq.picture.playing = true;
- }
- else if (sq.val == 1)
- sq.picture.source = "content/01.png";
- else
- sq.picture.source = "content/00.png";
- }
-}
diff --git a/examples/sensors/maze/Mouse.qml b/examples/sensors/maze/Mouse.qml
deleted file mode 100644
index 155f0bd6..00000000
--- a/examples/sensors/maze/Mouse.qml
+++ /dev/null
@@ -1,45 +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
-
-//Import the javascript functions for this game
-import "lib.js" as Lib
-
-//Implementation of the Mouse control.
-Item {
- id: mouse
- x: 0
- y: 0
- width: Lib.cellDimension
- height: Lib.cellDimension
- property int angle
- readonly property double radians_to_degrees: 180 / Math.PI
-
- AnimatedImage {
- id: img
- source: "content/mouse_down.gif"
- anchors.fill: parent
- visible: true
- }
-
- //Function for moving the mouse
- function move(newx, newy)
- {
- if (mouse.x === newx && mouse.y === newy)
- return
- // somehow this actually works
-//! [0]
- var a = newy - mouse.y
- var b = newx - mouse.x
- angle = Math.atan2(-b, a) * mouse.radians_to_degrees
- if (angle < 0)
- angle = 360 + angle
-
- img.rotation = angle
- mouse.x = newx;
- mouse.y = newy;
-//! [0]
- }
-}
diff --git a/examples/sensors/maze/android/AndroidManifest.xml b/examples/sensors/maze/android/AndroidManifest.xml
deleted file mode 100644
index 8efe1ed3..00000000
--- a/examples/sensors/maze/android/AndroidManifest.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.qtproject.example.maze"
- android:installLocation="auto"
- android:versionCode="1"
- android:versionName="1.0">
- <!-- The comment below will be replaced with dependencies permissions upon deployment.
- Remove the comment if you do not require these default permissions. -->
- <!-- %%INSERT_PERMISSIONS -->
-
- <!-- The comment below will be replaced with dependencies permissions upon deployment.
- Remove the comment if you do not require these default features. -->
- <!-- %%INSERT_FEATURES -->
-
- <supports-screens
- android:anyDensity="true"
- android:largeScreens="true"
- android:normalScreens="true"
- android:smallScreens="true" />
- <application
- android:name="org.qtproject.qt.android.bindings.QtApplication"
- android:extractNativeLibs="true"
- android:hardwareAccelerated="true"
- android:label="-- %%INSERT_APP_NAME%% --"
- android:requestLegacyExternalStorage="true">
- <activity
- android:name="org.qtproject.qt.android.bindings.QtActivity"
- android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density"
- android:label="-- %%INSERT_APP_NAME%% --"
- android:launchMode="singleTop"
- android:screenOrientation="portrait">
- <intent-filter>
- <action android:name="android.intent.action.MAIN"/>
- <category android:name="android.intent.category.LAUNCHER"/>
- </intent-filter>
- <meta-data
- android:name="android.app.lib_name"
- android:value="-- %%INSERT_APP_LIB_NAME%% --" />
- <meta-data
- android:name="android.app.background_running"
- android:value="false" />
- <meta-data
- android:name="android.app.extract_android_style"
- android:value="minimal" />
- </activity>
- </application>
-</manifest>
diff --git a/examples/sensors/maze/components/ApplicationWindow.qml b/examples/sensors/maze/components/ApplicationWindow.qml
deleted file mode 100644
index 3f87d724..00000000
--- a/examples/sensors/maze/components/ApplicationWindow.qml
+++ /dev/null
@@ -1,14 +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
- x: 0
- y: 0
- width: 320
- height: 480
- color: "#ececec"
-}
diff --git a/examples/sensors/maze/components/Button.qml b/examples/sensors/maze/components/Button.qml
deleted file mode 100644
index 953424a4..00000000
--- a/examples/sensors/maze/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/maze/components/images/button_background_disabled.png b/examples/sensors/maze/components/images/button_background_disabled.png
deleted file mode 100644
index 62a00b9a..00000000
--- a/examples/sensors/maze/components/images/button_background_disabled.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/components/images/button_background_normal.png b/examples/sensors/maze/components/images/button_background_normal.png
deleted file mode 100644
index 1fecad5b..00000000
--- a/examples/sensors/maze/components/images/button_background_normal.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/components/images/button_background_pressed.png b/examples/sensors/maze/components/images/button_background_pressed.png
deleted file mode 100644
index e0ba0e7a..00000000
--- a/examples/sensors/maze/components/images/button_background_pressed.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/content/00.png b/examples/sensors/maze/content/00.png
deleted file mode 100644
index 2522be5e..00000000
--- a/examples/sensors/maze/content/00.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/content/01.png b/examples/sensors/maze/content/01.png
deleted file mode 100644
index 6146b204..00000000
--- a/examples/sensors/maze/content/01.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/content/cheese.png b/examples/sensors/maze/content/cheese.png
deleted file mode 100644
index c737b9d6..00000000
--- a/examples/sensors/maze/content/cheese.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/content/cheeseeating.gif b/examples/sensors/maze/content/cheeseeating.gif
deleted file mode 100644
index 6b2cb47f..00000000
--- a/examples/sensors/maze/content/cheeseeating.gif
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/content/congratulations.gif b/examples/sensors/maze/content/congratulations.gif
deleted file mode 100644
index 70204176..00000000
--- a/examples/sensors/maze/content/congratulations.gif
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/content/mouse_down.gif b/examples/sensors/maze/content/mouse_down.gif
deleted file mode 100644
index 5491c18f..00000000
--- a/examples/sensors/maze/content/mouse_down.gif
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/content/start.png b/examples/sensors/maze/content/start.png
deleted file mode 100644
index 581b8c9b..00000000
--- a/examples/sensors/maze/content/start.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/maze/doc/src/maze.qdoc b/examples/sensors/maze/doc/src/maze.qdoc
deleted file mode 100644
index a6f132f9..00000000
--- a/examples/sensors/maze/doc/src/maze.qdoc
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \example maze
- \title Qt Sensors - Maze QML Example
- \ingroup qtsensors-examples
- \image maze.png
-
- \section2 Maze in QML
- \brief The Maze example demonstrates the TiltSensor QML type.
-
-
- To write a QML application that will use the TiltSensor QML sensors type
- you need to do the following steps:
-
- To import the Qt Sensors QML types into your application, use the following
- import statement in your .qml file:
-
- \snippet maze/maze.qml 0
-
- Then, add the Sensor QML types into your qml file.
-
- In this example we use the TiltSensor:
-
- \snippet maze/maze.qml 1
-
- The mouse should move by a factor of the tilt value:
-
- \snippet maze/maze.qml 2
-
- The walk direction of the mouse takes into account some collision detection:
-
- \snippet maze/maze.qml 3
-
- The rotation of the mouse image is determined according to the angle that the mouse is moving.
-
- \snippet maze/Mouse.qml 0
-
-*/
-
diff --git a/examples/sensors/maze/lib.js b/examples/sensors/maze/lib.js
deleted file mode 100644
index 3bae6a86..00000000
--- a/examples/sensors/maze/lib.js
+++ /dev/null
@@ -1,264 +0,0 @@
-//global variables
-var labyrinth = null;
-var dimension = 24;
-var cellDimension = 13;
-var won;
-var objectArray = null;
-var sec = 0.0
-
-//Allocate labyrinth arrays and create labyrinth and way reflected in the labyrinth array
-function createLabyrinth()
-{
- won = false;
- //create the labyrinth matrix
- labyrinth = null;
- labyrinth = new Array(dimension);
- for (var x = 0; x < dimension; x++ ){
- labyrinth[x] = new Array(dimension);
- for (var y = 0; y < dimension; y++ ){
- labyrinth[x][y] = 0;
- }
- }
- createWay();
- createLab();
-}
-
-//Create a way where the mouse can reach the cheese
-function createWay()
-{
- //Create rnd way to have at least one solution
- //A way square is marked as a 2 in the labyrinth array
- var x = 0;
- var y = 0;
- var ox = x;
- var oy = y;
- labyrinth[0][0] = 2;
- while (x < dimension && y < dimension){
- var rnd = Math.floor(Math.random()*5);
- if (Math.floor(Math.random()*2) == 1){
- if (rnd == 0) x--;
- if (rnd >= 1) x++;
- if (x < 0) x++;
- if (x >= dimension){
- x = ox;
- break;
- }
- }
- else {
- if (rnd == 0) y--;
- if (rnd >= 1) y++;
- if (y < 0) y++;
- if (y >= dimension){
- y = oy;
- break;
- }
- }
-
- /*avoid to have [2]2|
- |2|2|*/
- if (x < (dimension - 1) && y < (dimension - 1)){
- if (labyrinth[x + 1][y] == 2
- && labyrinth[x][y + 1] == 2
- && labyrinth[x + 1][y + 1] == 2){
- y = oy;
- x = ox;
- continue;
- }
- }
- /*avoid to have |2[2]
- |2|2|*/
- if (x > 0 && y < (dimension - 1)){
- if (labyrinth[x - 1][y] == 2
- && labyrinth[x][y + 1] == 2
- && labyrinth[x - 1][y + 1] == 2){
- y = oy;
- x = ox;
- continue;
- }
- }
- /*avoid to have |2|2|
- [2]2|*/
- if (x < (dimension - 1) && y > 0){
- if (labyrinth[x + 1][y] == 2
- && labyrinth[x][y - 1] == 2
- && labyrinth[x + 1][y - 1] == 2){
- y = oy;
- x = ox;
- continue;
- }
- }
- /*avoid to have |2|2|
- |2[2]*/
- if (x > 0 && y > 0){
- if (labyrinth[x - 1][y] == 2
- && labyrinth[x][y - 1] == 2
- && labyrinth[x - 1][y - 1] == 2){
- y = oy;
- x = ox;
- continue;
- }
- }
-
- labyrinth[x][y] = 2;
- ox = x;
- oy = y;
- }
- //finish way
- while (x < (dimension - 1)){
- labyrinth[x][y] = 2;
- x++;
- }
- while (y < (dimension - 1)){
- labyrinth[x][y] = 2;
- y++;
- }
-}
-
-//Create the labyrinth with rnd values
-function createLab()
-{
- //A wall square is marked as a 1 in the labyrinth array
- //Not a wall square is marked as a 0 in the labyrinth array
- //The Cheese square is marked as a 3 in the labyrinth array
- //The start is marked as a -1 in the labyrinth array
- for (var x = 0; x < dimension; x++ ){
- var rnd = 0;
- for (var y = 0; y < dimension; y++){
- //But don't overwrite the way
- if (labyrinth[x][y] != 2){
- var rnd = Math.floor(Math.random()*2);
- var xy = 0;
- var xxy = 0;
- var xyy = 0;
- var xxyy = 0;
-
- if (x > 0 && y > 0){
- xy = labyrinth[x - 1][y - 1];
- if (xy == 2)
- xy = 0;
-
- xyy = labyrinth[x - 1][y];
- if (xyy == 2)
- xyy = 0;
-
- xxy = labyrinth[x][y - 1];
- if (xxy == 2)
- xxy = 0;
-
- xxyy = rnd;
- if (xxyy == 2)
- xxyy = 0;
-
- //avoid to have to many |0|1| or |1|0| [xy ][xxy ]
- // |1[0] |0[1] [xyy ][xxyy]
- if (xyy == xxy && xy == xxyy && xy != xxy){
- if (rnd == 1)
- rnd = 0;
- else rnd = 1;
- }
-
- //avoid to have to many |1|1| or |0|0|
- // |1[1] |0[0]
- if (xy == xxy && xxy == xxyy && xxyy == xyy){
- if (rnd == 1)
- rnd = 0;
- else rnd = 1;
- }
- }
- else if (x == 0 && y > 0){
- xy = labyrinth[x][y - 1];
- if (xy == 2)
- xy = 0;
-
- xyy = rnd;
- if (xyy == 2)
- xyy = 0;
-
- xxy = labyrinth[x + 1][y - 1];
- if (xxy == 2)
- xxy = 0;
-
- xxyy = labyrinth[x + 1][y];
- if (xxyy == 2)
- xxyy = 0;
-
- //avoid to have to many |1|1| or |0|0|
- // |1[1] |0[0]
- if (xy == xxy && xxy == xxyy && xxyy == xyy){
- if (rnd == 1)
- rnd = 0;
- else rnd = 1;
- }
-
- //avoid to have to many |0|1| or |1|0| [xy ][xxy ]
- // |1[0] |0[1] [xyy ][xxyy]
- if (xyy == xxy && xy == xxyy && xy != xxy){
- if (rnd == 1)
- rnd = 0;
- else rnd = 1;
- }
- }
- labyrinth[x][y] = rnd;
- }
-
- }
- }
- //set start and end
- labyrinth[0][0] = -1;
- labyrinth[0][1] = 0;
- labyrinth[1][0] = 0;
- labyrinth[1][1] = 0;
-
- labyrinth[dimension - 2][dimension - 2] = 0;
- labyrinth[dimension - 2][dimension - 1] = 0;
- labyrinth[dimension - 1][dimension - 2] = 0;
- labyrinth[dimension - 1][dimension - 1] = 3;
-}
-
-//Function that checks if the mouse can be moved in x and y
-function canMove(x, y)
-{
- //Check if movement is allowed
- var xcenter = x + (cellDimension / 2);
- var ycenter = y + (cellDimension / 2);
- //try to get the index
- var idx = Math.floor(xcenter / cellDimension);
- var idy = Math.floor(ycenter / cellDimension);
- var dx = xcenter - (idx * cellDimension + ( cellDimension / 2 ));
- var dy = ycenter - (idy * cellDimension + ( cellDimension / 2 ));
-
- if (dx > 0){
- if (labyrinth[idx][idy] == 1)
- return false;
- }
- if (dx < 0){
- if (labyrinth[idx][idy] == 1)
- return false;
- }
- if (dy > 0){
- if (labyrinth[idx][idy] == 1)
- return false;
- }
- if (dy < 0){
- if (labyrinth[idx][idy] == 1)
- return false;
- }
- //check if won
- if (idx == (dimension - 1) && idy == (dimension - 1))
- won = true;
- return true;
-}
-
-//Function that prints out the labyrith array values in the console
-function printLab()
-{
- //for debug purposes print out lab n console
- var iy = 0;
- for (var y = 0; y < dimension; y++ ){
- var line = "";
- for (var x = 0; x < dimension; x++ ){
- line += labyrinth[x][y];
- }
- console.log(line);
- }
-}
diff --git a/examples/sensors/maze/main.cpp b/examples/sensors/maze/main.cpp
deleted file mode 100644
index 2dbf1aa1..00000000
--- a/examples/sensors/maze/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(maze)
diff --git a/examples/sensors/maze/maze.pro b/examples/sensors/maze/maze.pro
deleted file mode 100644
index f15fa570..00000000
--- a/examples/sensors/maze/maze.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TEMPLATE = app
-TARGET = maze
-QT += quick sensors
-SOURCES = main.cpp
-
-OTHER_FILES = \
- components \
- $$files(*.qml) \
- $$files(*.js) \
- content \
- android/AndroidManifest.xml
-
-target.path = $$[QT_INSTALL_EXAMPLES]/sensors/maze
-INSTALLS += target
-
-RESOURCES += \
- maze.qrc
-
-ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
diff --git a/examples/sensors/maze/maze.qml b/examples/sensors/maze/maze.qml
deleted file mode 100644
index c28e970b..00000000
--- a/examples/sensors/maze/maze.qml
+++ /dev/null
@@ -1,251 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-/* Layout
- mainWnd
- /
-------------------------------/ gameRect
-| /
-|-----------------------------/
-||---------------------------|
-||||M| ||
-||| \ ||
-||| mouseCtrl ||
-||| ||
-||| ||
-||| Labyrinth ||
-||| ||
-||| ||
-||| cheeseSquare ||
-||| \ ||
-||| |C|||
-||---------------------------|
-|-----------------------------
-|
-|-----------------------------
-|| || |
-|-----------------------------
-| \ \
-| \ timePlayingLabel
-| newGameButton
-------------------------------
-
-*/
-//Import the declarative plugins
-import QtQuick
-import "components"
-
-//! [0]
-import QtSensors
-//! [0]
-
-//Import the javascript functions for this game
-import "lib.js" as Lib
-
-ApplicationWindow {
- id: mainWnd
- property bool gameRunning: false
-
- Component.onCompleted: {
- initializeMaze()
- newGame()
- }
-
- function initializeMaze() {
- Lib.objectArray = new Array(Lib.dimension * Lib.dimension);
- Lib.createLabyrinth();
- var idx = 0;
- var component = Qt.createComponent("LabyrinthSquare.qml");
- for (var y = 0; y < Lib.dimension; y++ ) {
- for (var x = 0; x < Lib.dimension; x++ ) {
- var square = component.createObject(gameRect);
- if (!square) {
- console.log("error loading labyrinth square: " + component.errorString())
- return
- }
- square.x = x * square.width;
- square.y = y * square.height;
- square.val = Lib.labyrinth[x][y];
- Lib.objectArray[idx] = square;
- idx++;
- }
- }
- }
-
- function newGame() {
- congratulation.visible = false;
-
- // Reset game time
- timePlayingLabel.text = "--";
- Lib.sec = 0.0;
-
- // Create new labyrinth
- Lib.createLabyrinth();
- // Update maze tiles to match the new labyrinth
- var idx = 0;
- for (var y = 0; y < Lib.dimension; y++ ) {
- for (var x = 0; x < Lib.dimension; x++ ) {
- Lib.objectArray[idx].val = Lib.labyrinth[x][y];
- Lib.objectArray[idx].updateImage();
- idx++;
- }
- }
- // Reset mouse position and start the game
- mouseCtrl.x = 0;
- mouseCtrl.y = 0;
- mainWnd.gameRunning = true;
- }
-
- function gameWon() {
- // Update the cheese square at the bottom right (win animation)
- Lib.objectArray[Lib.dimension * Lib.dimension - 1].val = 4
- Lib.objectArray[Lib.dimension * Lib.dimension - 1].updateImage()
- congratulation.visible = true;
- mainWnd.gameRunning = false;
- }
-
- Rectangle {
- id: gameRect
- x: (mainWnd.width - width) / 2
- y: 5
- width: Lib.dimension * Lib.cellDimension
- height: Lib.dimension * Lib.cellDimension
- color: "transparent"
- border.width: 2
- }
-
- Mouse {
- id: mouseCtrl
- }
-
- Congratulation {
- id: congratulation
- visible: false
- }
-
-//! [1]
- TiltSensor {
- id: tiltSensor
- active: true
- }
-//! [1]
-
- //Timer to read out the x and y rotation of the TiltSensor
- Timer {
- id: tiltTimer
- interval: 50
- repeat: true
- running: tiltSensor.active && mainWnd.gameRunning
-
- onTriggered: {
- // Update the maze unless game is already won
- if (Lib.won === true) {
- gameWon()
- return
- }
- Lib.sec += 0.05;
- timePlayingLabel.text = Math.floor(Lib.sec) + " seconds";
-
- //check if we can move the mouse
- var xval = -1;
- var yval = -1;
-
-//! [2]
- var xstep = 0;
- xstep = tiltSensor.reading.yRotation * 0.1 //acceleration
-
- var ystep = 0;
- ystep = tiltSensor.reading.xRotation * 0.1 //acceleration
-//! [2]
-//! [3]
- if (xstep < 1 && xstep > 0)
- xstep = 0
- else if (xstep > -1 && xstep < 0)
- xstep = 0
-
- if (ystep < 1 && ystep > 0)
- ystep = 0;
- else if (ystep > -1 && ystep < 0)
- ystep = 0;
-
- if ((xstep < 0 && mouseCtrl.x > 0
- && Lib.canMove(mouseCtrl.x + xstep,mouseCtrl.y))) {
- xval = mouseCtrl.x + xstep;
-
- } else if (xstep > 0 && mouseCtrl.x < (Lib.cellDimension * (Lib.dimension - 1))
- && Lib.canMove(mouseCtrl.x + xstep,mouseCtrl.y)) {
- xval = mouseCtrl.x + xstep;
- } else
- xval = mouseCtrl.x;
-
- if (ystep < 0 && mouseCtrl.y > 0
- && Lib.canMove(mouseCtrl.x, mouseCtrl.y + ystep)) {
- yval = mouseCtrl.y + ystep;
- } else if (ystep > 0 && (mouseCtrl.y < (Lib.cellDimension * (Lib.dimension - 1)))
- && Lib.canMove(mouseCtrl.x, mouseCtrl.y + ystep)) {
- yval = mouseCtrl.y + ystep;
- } else
- yval = mouseCtrl.y
- mouseCtrl.move(xval, yval);
-//! [3]
- }
- }
-
- //Button to start a new Game
- Button{
- id: newGameButton
- anchors.left: gameRect.left
- anchors.top: gameRect.bottom
- anchors.topMargin: 5
- height: 30
- width: 100
- text: qsTr("New game")
- onClicked: newGame()
- }
- Button{
- id: calibrateButton
- anchors.left: gameRect.left
- anchors.top: newGameButton.bottom
- anchors.topMargin: 5
- height: 30
- width: 100
- text: qsTr("Calibrate")
- onClicked: tiltSensor.calibrate();
- }
-
- Text {
- id: tiltSensorInfo
- visible: tiltSensor.active
- anchors.left: gameRect.left
- anchors.top: calibrateButton.bottom
- anchors.topMargin: 5
- text: qsTr("Tilt sensor ID: ") + tiltSensor.identifier
- }
-
- //Label to print out the game time
- Text{
- id: timePlayingLabel
- anchors.right: gameRect.right
- anchors.top: gameRect.bottom
- anchors.topMargin: 5
- }
-
- Rectangle {
- id: tiltSensorMissing
- visible: !tiltSensor.active
- anchors.fill: parent
- color: "#AACCCCCC" // slightly transparent
- Text {
- anchors.centerIn: parent
- text: qsTr("Tilt sensor\nnot found")
- font.pixelSize: 24
- font.bold: true
- color: "black"
- }
- MouseArea {
- // prevent interaction with the game
- anchors.fill: parent
- }
- }
-}
-
diff --git a/examples/sensors/maze/maze.qrc b/examples/sensors/maze/maze.qrc
deleted file mode 100644
index 10916193..00000000
--- a/examples/sensors/maze/maze.qrc
+++ /dev/null
@@ -1,21 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>Congratulation.qml</file>
- <file>LabyrinthSquare.qml</file>
- <file>lib.js</file>
- <file>maze.qml</file>
- <file>Mouse.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_pressed.png</file>
- <file>components/images/button_background_normal.png</file>
- <file>content/00.png</file>
- <file>content/start.png</file>
- <file>content/mouse_down.gif</file>
- <file>content/congratulations.gif</file>
- <file>content/cheeseeating.gif</file>
- <file>content/cheese.png</file>
- <file>content/01.png</file>
- </qresource>
-</RCC>
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
--- 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 1fecad5b..00000000
--- 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 e0ba0e7a..00000000
--- 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 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 @@
-<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/sensor_explorer/CMakeLists.txt b/examples/sensors/sensor_explorer/CMakeLists.txt
deleted file mode 100644
index 33fc7ea8..00000000
--- a/examples/sensors/sensor_explorer/CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
-
-cmake_minimum_required(VERSION 3.16)
-project(sensor_explorer LANGUAGES CXX)
-
-set(CMAKE_AUTOMOC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/sensor_explorer")
-
-find_package(Qt6 REQUIRED COMPONENTS Qml Quick Sensors)
-
-qt_add_executable(sensor_explorer
- main.cpp
- sensormodels.cpp sensormodels.h
-)
-
-set_target_properties(sensor_explorer PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-
-target_link_libraries(sensor_explorer PUBLIC
- Qt::Qml
- Qt::Quick
- Qt::Sensors
-)
-
-qt_add_qml_module(sensor_explorer
- URI SensorModels
- VERSION 1.0
- QML_FILES sensor_explorer.qml
- NO_RESOURCE_TARGET_PATH
-)
-
-install(TARGETS sensor_explorer
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/sensors/sensor_explorer/doc/images/qtsensors-examples-sensor-explorer.png b/examples/sensors/sensor_explorer/doc/images/qtsensors-examples-sensor-explorer.png
deleted file mode 100644
index 830f9597..00000000
--- a/examples/sensors/sensor_explorer/doc/images/qtsensors-examples-sensor-explorer.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/sensor_explorer/doc/src/sensor_explorer.qdoc b/examples/sensors/sensor_explorer/doc/src/sensor_explorer.qdoc
deleted file mode 100644
index f4d7c6bc..00000000
--- a/examples/sensors/sensor_explorer/doc/src/sensor_explorer.qdoc
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \example sensor_explorer
- \title Qt Sensors - Explorer QML Example
- \ingroup qtsensors-examples
- \brief Demonstrates how to read the meta-data of available sensors.
-
- \image qtsensors-examples-sensor-explorer.png
-
- The example is implemented as a typical model-view application. The
- models are written with C++ and exposed to QML, and the views are
- implemented as QML types in the QML application.
-
- \section1 Exposing and Importing the Models
-
- The QML models written in C++ are exposed in the project build files
- as a \c SensorModels QML module.
-
- \e CMake:
- \code
- qt_add_qml_module(sensor_explorer
- URI SensorModels
- VERSION 1.0
- )
- \endcode
-
- \e qmake:
- \code
- CONFIG += qmltypes
- QML_IMPORT_NAME = SensorModels
- QML_IMPORT_MAJOR_VERSION = 1
- \endcode
-
- The individual model elements are exposed as part of the model
- code by using the \c QML_ELEMENT macro as illustrated here:
- \snippet sensor_explorer/sensormodels.h 0
-
- To access the models in the QML application, the module is imported
- by the application QML:
- \snippet sensor_explorer/sensor_explorer.qml 0
-
- \section1 Populating the Model of Available Sensors
-
- The \c AvailableSensorsModel is a list model that provides information on
- available sensors on the device. The model is populated once at the
- element's construction time:
-
- \snippet sensor_explorer/sensormodels.cpp 0
-
- The model's \c data() function returns a pointer to the requested sensor
- object.
-
- \snippet sensor_explorer/sensormodels.cpp 1
-
- Since the sensor (QSensor) is a QObject, the QML is then able to directly
- access all metaproperties and -functions directly.
-
- \note It would be possible to refresh the sensor list later at will, but for
- the simplicity of the example such functionality is not exposed to QML.
-
- \section1 Populating the Model of Sensor Properties
-
- The \c SensorPropertyModel is a table model that provides individual
- sensor's property-value pairs as columns. The column \c 0 provides the
- property's name and the column \c 1 provides the property's value. The
- population of the properties is done by reading the metadata of the sensors.
- The model reads both the sensor's metadata as well as the sensor's reading's
- metadata. The code below illustrates the reading of the \c reading metadata:
-
- \snippet sensor_explorer/sensormodels.cpp 2
-
- This metadata access allows providing the model data for all sensors
- without prior compile-time understanding of their properties.
-
- Once the metadata is set, the code then subscribes to the
- QSensor::readingChanged() signal to detect sensor reading changes.
- Upon such changes (for example a rotation value changes), the model data
- is updated accordingly.
-
- \section1 Viewing the Models
-
- The QML application is based on two views. The first view shows the available
- sensors as a selectable list. The second view shows the selected sensor's
- properties and their values. The delegates for viewing the individual items
- are simplistic \e {rectangle and text} items.
-
- Binding the two views functionally together is done by binding the property
- model's \c sensor property to the current selection of the available sensors
- model:
-
- \snippet sensor_explorer/sensor_explorer.qml 1
-
- When the selected sensor changes, the \c sensor of the property model changes
- accordingly.
-
- The following snippet illustrates how the property view is implemented. For
- more details about QML models and views, please see
- \l{Models and Views in Qt Quick}.
-
- \snippet sensor_explorer/sensor_explorer.qml 3
-
- For clarity it should be mentioned that the \c display attribute used by
- the text element refers to the Qt::DisplayRole role of the model, which is
- provided by default by Qt models.
-
- \section1 Activating the Sensors
-
- The example has a button for activating and deactivating the currently
- selected sensor. The button is enabled only if a sensor is currently
- selected, as illustrated below.
-
- \snippet sensor_explorer/sensor_explorer.qml 2
-
- On clicking the button, the sensor's active property is toggled on/off.
-
-*/
diff --git a/examples/sensors/sensor_explorer/sensor_explorer.pro b/examples/sensors/sensor_explorer/sensor_explorer.pro
deleted file mode 100644
index a27681e2..00000000
--- a/examples/sensors/sensor_explorer/sensor_explorer.pro
+++ /dev/null
@@ -1,22 +0,0 @@
-TEMPLATE = app
-TARGET = sensor_explorer
-QT += qml quick sensors
-
-# Avoid going to release/debug subdirectory
-win32: DESTDIR = ./
-
-SOURCES = main.cpp sensormodels.cpp
-HEADERS = sensormodels.h
-
-CONFIG += qmltypes
-QML_IMPORT_NAME = SensorModels
-QML_IMPORT_MAJOR_VERSION = 1
-
-OTHER_FILES = \
- sensor_explorer.qml
-
-target.path = $$[QT_INSTALL_EXAMPLES]/sensors/sensor_explorer
-INSTALLS += target
-
-RESOURCES += \
- qml.qrc
diff --git a/examples/sensors/sensors.pro b/examples/sensors/sensors.pro
index 1b637bac..d304cbd9 100644
--- a/examples/sensors/sensors.pro
+++ b/examples/sensors/sensors.pro
@@ -1,16 +1,5 @@
TEMPLATE = subdirs
-SUBDIRS += grue
-
-qtHaveModule(quick) {
- SUBDIRS += \
- maze \
- qmlqtsensors \
- sensor_explorer
-
- qtHaveModule(svg): SUBDIRS += \
- accelbubble
+qtHaveModule(quick): qtHaveModule(svg): {
+ SUBDIRS += sensorsshowcase
}
-
-EXAMPLE_FILES += \
- stub.h
diff --git a/examples/sensors/sensorsshowcase/Accelerometer.qml b/examples/sensors/sensorsshowcase/Accelerometer.qml
new file mode 100644
index 00000000..a22e1404
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/Accelerometer.qml
@@ -0,0 +1,70 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+pragma ComponentBehavior: Bound
+import QtQuick
+import QtQuick.Layouts
+import QtSensors
+
+Item {
+ id: root
+
+ required property int fontSize
+ required property int imageSize
+
+ //! [0]
+ Accelerometer {
+ id: accelerometer
+
+ property real x: 0
+ property real y: 0
+ property real z: 0
+
+ active: true
+ dataRate: 25
+
+ onReadingChanged: {
+ x = (reading as AccelerometerReading).x
+ y = (reading as AccelerometerReading).y
+ z = (reading as AccelerometerReading).z
+ imageTranslation.x = -x * 10
+ imageTranslation.y = y * 10
+ }
+ }
+ //! [0]
+ ColumnLayout {
+ id: layout
+
+ anchors.fill: parent
+ spacing: 10
+
+ Image {
+ id: image
+
+ Layout.alignment: Qt.AlignCenter
+ Layout.preferredHeight: root.imageSize
+ Layout.preferredWidth: root.imageSize
+ fillMode: Image.PreserveAspectFit
+ source: "images/qt_logo.png"
+
+ transform: [
+ Translate {
+ id: imageTranslation
+
+ x: 0
+ y: 0
+ }
+ ]
+ }
+
+ ProgressXYZBar {
+ Layout.fillWidth: true
+ fontSize: root.fontSize
+ xText: "X: " + accelerometer.x.toFixed(2)
+ xValue: 0.5 + (accelerometer.x / 100)
+ yText: "Y: " + accelerometer.y.toFixed(2)
+ yValue: 0.5 + (accelerometer.y / 100)
+ zText: "Z: " + accelerometer.z.toFixed(2)
+ zValue: 0.5 + (accelerometer.z / 100)
+ }
+ }
+}
diff --git a/examples/sensors/sensorsshowcase/CMakeLists.txt b/examples/sensors/sensorsshowcase/CMakeLists.txt
index eb27f7ef..b949213a 100644
--- a/examples/sensors/sensorsshowcase/CMakeLists.txt
+++ b/examples/sensors/sensorsshowcase/CMakeLists.txt
@@ -1,18 +1,16 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(sensorsshowcase LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sensors/sensorsshowcase")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick Sensors Svg)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick Svg Sensors)
+qt_standard_project_setup(REQUIRES 6.5)
qt_add_executable(sensorsshowcase
main.cpp
@@ -26,43 +24,47 @@ set_target_properties(sensorsshowcase PROPERTIES
if(ANDROID)
set_property(TARGET sensorsshowcase PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
${CMAKE_CURRENT_SOURCE_DIR}/android)
- endif()
-if(APPLE)
- if(IOS)
- set_property(TARGET sensorsshowcase PROPERTY
- MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist"
- )
- endif()
endif()
-target_link_libraries(sensorsshowcase PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Quick
- Qt::Sensors
- Qt::Svg
-)
+if(APPLE AND IOS)
+ set_property(TARGET sensorsshowcase PROPERTY
+ MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist"
+ )
+else()
+ # default search path for the config file is "qrc:/"
+ qt_add_resources(sensorsshowcase "resources"
+ FILES qtquickcontrols2.conf)
+endif()
-# Resources:
-set(sensorsshowcase_resource_files
- "sensorsshowcase.qml"
- "accelerometer.qml"
- "proximity.qml"
- "compass.qml"
- "magnetometer.qml"
- "gyroscope.qml"
- "images/magnet.svg"
- "images/compass.svg"
- "images/qt_logo.png"
+qt_add_qml_module(sensorsshowcase
+ URI SensorShowcaseModule
+ VERSION 1.0
+ QML_FILES
+ "Main.qml"
+ "Accelerometer.qml"
+ "Compass.qml"
+ "Gyroscope.qml"
+ "Magnetometer.qml"
+ "Proximity.qml"
+ "ProgressXYZBar.qml"
+ RESOURCES
+ "images/compass.svg"
+ "images/magnet.svg"
+ "images/qt_logo.png"
+ SOURCES
+ sensorsupport.h
)
-qt6_add_resources(sensorsshowcase "sensorsshowcase"
- PREFIX
- "/"
- FILES
- ${sensorsshowcase_resource_files}
+target_link_libraries(sensorsshowcase
+ PRIVATE
+ Qt::Core
+ Qt::Gui
+ Qt::Quick
+ Qt::Svg
+ Qt::Sensors
)
+
install(TARGETS sensorsshowcase
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/sensors/sensorsshowcase/Compass.qml b/examples/sensors/sensorsshowcase/Compass.qml
new file mode 100644
index 00000000..b4bc5ff1
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/Compass.qml
@@ -0,0 +1,61 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+pragma ComponentBehavior: Bound
+import QtQuick
+import QtQuick.Layouts
+import QtSensors
+
+Item {
+ id: root
+
+ required property int fontSize
+ required property int imageSize
+ property alias isActive: compass.active
+
+ property real azimuth: 30
+
+ Compass {
+ id: compass
+ active: true
+ dataRate: 7
+ onReadingChanged: root.azimuth = -(reading as CompassReading).azimuth
+ }
+
+ ColumnLayout {
+ id: layout
+
+ anchors.fill: parent
+ spacing: 10
+
+ Image {
+ id: arrow
+
+ Layout.alignment: Qt.AlignHCenter
+ Layout.preferredWidth: root.imageSize * 1.25
+ Layout.fillHeight: true
+
+ source: "images/compass.svg"
+ fillMode: Image.PreserveAspectFit
+ rotation: root.azimuth
+ }
+
+ Rectangle {
+ id: separator
+
+ Layout.topMargin: 10
+ Layout.preferredWidth: parent.width * 0.75
+ Layout.preferredHeight: 1
+ Layout.alignment: Qt.AlignHCenter
+ color: "black"
+ }
+
+ Text {
+ id: info
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.topMargin: 10
+ text: "Azimuth: " + root.azimuth.toFixed(2) + "°"
+ font.pixelSize: root.fontSize
+ }
+ }
+}
diff --git a/examples/sensors/sensorsshowcase/Gyroscope.qml b/examples/sensors/sensorsshowcase/Gyroscope.qml
new file mode 100644
index 00000000..9f0ffd2f
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/Gyroscope.qml
@@ -0,0 +1,128 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+pragma ComponentBehavior: Bound
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+import QtSensors
+
+Item {
+ id: root
+
+ required property int fontSize
+ required property int imageSize
+
+ function resetRotations() : void
+ {
+ imageXRotation.angle = 0
+ imageYRotation.angle = 0
+ imageZRotation.angle = 0
+ }
+
+ //! [0]
+ Gyroscope {
+ id: gyroscope
+
+ property var lastTimeStamp: 0
+ property real x: 0
+ property real y: 0
+ property real z: 0
+
+ active: true
+ dataRate: 25
+
+ onReadingChanged: {
+ x = (reading as GyroscopeReading).x
+ y = (reading as GyroscopeReading).y
+ z = (reading as GyroscopeReading).z
+ let firstCall = false
+ if (lastTimeStamp == 0) {
+ firstCall = true
+ }
+ let timeSinceLast = reading.timestamp - lastTimeStamp
+ lastTimeStamp = reading.timestamp
+
+ //Skipping the initial time jump from 0
+ if (firstCall === true)
+ return
+ let normalizedX = x * (timeSinceLast / 1000000)
+ imageXRotation.angle += normalizedX
+ let normalizedY = y * (timeSinceLast / 1000000)
+ imageYRotation.angle -= normalizedY
+ let normalizedZ = z * (timeSinceLast / 1000000)
+ imageZRotation.angle += normalizedZ
+ }
+ }
+ //! [0]
+ ColumnLayout {
+ id: layout
+
+ anchors.fill: parent
+ spacing: 10
+
+ Image {
+ id: image
+
+ Layout.alignment: Qt.AlignHCenter
+ Layout.fillHeight: true
+ Layout.preferredWidth: root.imageSize
+ fillMode: Image.PreserveAspectFit
+ source: "images/qt_logo.png"
+
+ transform: [
+ Rotation {
+ id: imageXRotation
+
+ angle: 0
+ axis.x: 1
+ axis.y: 0
+ axis.z: 0
+ origin.x: layout.width / 2
+ origin.y: layout.height / 3
+ },
+ Rotation {
+ id: imageYRotation
+
+ angle: 0
+ axis.x: 0
+ axis.y: 1
+ axis.z: 0
+ origin.x: layout.width / 2
+ origin.y: layout.height / 3
+ },
+ Rotation {
+ id: imageZRotation
+
+ angle: 0
+ axis.x: 0
+ axis.y: 0
+ axis.z: 1
+ origin.x: layout.width / 2
+ origin.y: layout.height / 3
+ }
+ ]
+ }
+
+ ProgressXYZBar {
+ Layout.fillWidth: true
+ Layout.topMargin: 20
+ fontSize: root.fontSize
+ xText: "X: " + gyroscope.x.toFixed(2)
+ xValue: 0.5 + (gyroscope.x / 1000)
+ yText: "Y: " + gyroscope.y.toFixed(2)
+ yValue: 0.5 + (gyroscope.y / 1000)
+ zText: "Z: " + gyroscope.z.toFixed(2)
+ zValue: 0.5 + (gyroscope.z / 1000)
+ }
+
+ Button {
+ Layout.alignment: Qt.AlignHCenter
+ Layout.topMargin: 20
+ Layout.bottomMargin: 10
+ Layout.preferredWidth: parent.width / 2
+ Layout.preferredHeight: 60
+ onClicked: root.resetRotations()
+ text: "Reset rotation"
+ }
+ }
+}
diff --git a/examples/sensors/sensorsshowcase/Magnetometer.qml b/examples/sensors/sensorsshowcase/Magnetometer.qml
new file mode 100644
index 00000000..551f8627
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/Magnetometer.qml
@@ -0,0 +1,68 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+pragma ComponentBehavior: Bound
+import QtQuick
+import QtQuick.Layouts
+import QtSensors
+
+Item {
+ id: root
+
+ required property int fontSize
+ required property int imageSize
+
+ property real magnetRotation: 40
+ property real magnetometerX: 0
+ property real magnetometerY: 0
+ property real magnetometerZ: 0
+ property int barScaleFactor: 10000
+
+ //! [0]
+ Magnetometer {
+ id: magnetometer
+ active: true
+ dataRate: 25
+ onReadingChanged: {
+ root.magnetometerX = (reading as MagnetometerReading).x
+ root.magnetometerY = (reading as MagnetometerReading).y
+ root.magnetometerZ = (reading as MagnetometerReading).z
+ root.magnetRotation =
+ ((Math.atan2(root.magnetometerX, root.magnetometerY) / Math.PI) * 180)
+ }
+ }
+ //! [0]
+
+ ColumnLayout {
+ id: layout
+
+ anchors.fill: parent
+ spacing: 10
+
+ Image {
+ id: image
+
+ Layout.alignment: Qt.AlignHCenter
+ Layout.bottomMargin: 20
+ Layout.preferredWidth: root.imageSize * 0.9
+ Layout.preferredHeight: root.imageSize * 0.9
+
+ source: "images/magnet.svg"
+ fillMode: Image.PreserveAspectFit
+ rotation: root.magnetRotation
+ }
+
+ ProgressXYZBar {
+ Layout.fillWidth: true
+ fontSize: root.fontSize
+
+ xText: "X: " + root.magnetometerX.toFixed(9)
+ xValue: 0.5 + (root.magnetometerX * root.barScaleFactor)
+
+ yText: "Y: " + root.magnetometerY.toFixed(9)
+ yValue: 0.5 + (root.magnetometerY * root.barScaleFactor)
+
+ zText: "Z: " + root.magnetometerZ.toFixed(9)
+ zValue: 0.5 + (root.magnetometerZ * root.barScaleFactor)
+ }
+ }
+}
diff --git a/examples/sensors/sensorsshowcase/Main.qml b/examples/sensors/sensorsshowcase/Main.qml
new file mode 100644
index 00000000..4587ba21
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/Main.qml
@@ -0,0 +1,116 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+pragma ComponentBehavior: Bound
+
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+ApplicationWindow {
+ id: root
+
+ readonly property int defaultFontSize: 22
+ readonly property int imageSize: width / 2
+
+ width: 420
+ height: 760
+ visible: true
+ title: "Sensors Showcase"
+
+ header : ToolBar {
+ RowLayout {
+ anchors.fill: parent
+ anchors.leftMargin: 10
+ anchors.rightMargin: 10
+ ToolButton {
+ id: back
+ text: qsTr("Back")
+ font.pixelSize: root.defaultFontSize - 4
+ visible: stack.depth > 1
+ onClicked: {
+ stack.pop();
+ heading.text = root.title;
+ }
+ Layout.alignment: Qt.AlignLeft
+ }
+ Label {
+ id: heading
+ text: root.title
+ font.pixelSize: root.defaultFontSize
+ font.weight: Font.Medium
+ verticalAlignment: Qt.AlignVCenter
+ Layout.alignment: Qt.AlignCenter
+ Layout.preferredHeight: 55
+ }
+ Item {
+ visible: back.visible
+ Layout.preferredWidth: back.width
+ }
+ }
+ }
+
+ StackView {
+ id: stack
+
+ // Pushes the object and forwards the properties
+ function pusher(object : string) : void {
+ // Trim the suffix and set it as new heading
+ heading.text = object.split(".")[0]
+ return stack.push(object, {
+ fontSize: root.defaultFontSize,
+ imageSize: root.imageSize
+ })
+ }
+
+ anchors.fill: parent
+ anchors.margins: width / 12
+
+ initialItem: Item {
+ ColumnLayout {
+ id: initialItem
+
+ anchors.fill: parent
+ anchors.topMargin: 20
+ anchors.bottomMargin: 20
+ spacing: 5
+
+ component CustomButton: Button {
+ highlighted: true
+ font.pixelSize: root.defaultFontSize
+ font.letterSpacing: 1.5
+
+ Layout.alignment: Qt.AlignCenter
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ }
+
+ CustomButton {
+ text: "Accelerometer"
+ onClicked: stack.pusher("Accelerometer.qml")
+ enabled: SensorSupport.hasAccelerometer()
+ }
+ CustomButton {
+ text: "Proximity"
+ onClicked: stack.pusher("Proximity.qml")
+ enabled: SensorSupport.hasProximity()
+ }
+ CustomButton {
+ text: "Compass"
+ onClicked: stack.pusher("Compass.qml")
+ enabled: SensorSupport.hasCompass()
+ }
+ CustomButton {
+ text: "Magnetometer"
+ onClicked: stack.pusher("Magnetometer.qml")
+ enabled: SensorSupport.hasMagnetometer()
+ }
+ CustomButton {
+ text: "Gyroscope"
+ onClicked: stack.pusher("Gyroscope.qml")
+ enabled: SensorSupport.hasGyroscope()
+ }
+ }
+ }
+ }
+
+}
diff --git a/examples/sensors/sensorsshowcase/ProgressXYZBar.qml b/examples/sensors/sensorsshowcase/ProgressXYZBar.qml
new file mode 100644
index 00000000..be7bf7ae
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/ProgressXYZBar.qml
@@ -0,0 +1,45 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+pragma ComponentBehavior: Bound
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+ColumnLayout {
+ id: root
+ spacing: 0
+
+ required property int fontSize
+ property alias xText: xBar.text
+ property alias xValue: xBar.value
+ property alias yText: yBar.text
+ property alias yValue: yBar.value
+ property alias zText: zBar.text
+ property alias zValue: zBar.value
+
+ component NamedProgressBar: ColumnLayout {
+ property alias text: axes.text
+ property alias value: bar.value
+ Text {
+ id: axes
+ font.pixelSize: root.fontSize
+ Layout.fillWidth: true
+ }
+ ProgressBar {
+ id: bar
+ Layout.fillWidth: true
+ }
+ }
+
+ NamedProgressBar {
+ id: xBar
+ }
+
+ NamedProgressBar {
+ id: yBar
+ }
+
+ NamedProgressBar {
+ id: zBar
+ }
+}
diff --git a/examples/sensors/sensorsshowcase/Proximity.qml b/examples/sensors/sensorsshowcase/Proximity.qml
new file mode 100644
index 00000000..41121983
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/Proximity.qml
@@ -0,0 +1,55 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+pragma ComponentBehavior: Bound
+import QtQuick
+import QtQuick.Layouts
+import QtSensors
+
+Item {
+ id: root
+
+ required property int imageSize
+ required property int fontSize
+
+ property bool near: false
+
+ ProximitySensor {
+ id: proximity
+ onReadingChanged: root.near = (reading as ProximityReading).near
+ active: true
+ }
+
+ ColumnLayout {
+ id: layout
+
+ anchors.fill: parent
+ spacing: 10
+
+ Image {
+ id: image
+
+ Layout.alignment: Qt.AlignHCenter
+ Layout.preferredWidth: root.near ? root.imageSize : root.imageSize * 0.75
+ Layout.fillHeight: true
+
+ source: "images/qt_logo.png"
+ fillMode: Image.PreserveAspectFit
+ }
+
+ Rectangle {
+ id: separator
+ Layout.topMargin: 10
+ Layout.bottomMargin: 10
+ Layout.preferredWidth: parent.width * 0.75
+ Layout.preferredHeight: 1
+ Layout.alignment: Qt.AlignHCenter
+ color: "black"
+ }
+
+ Text {
+ Layout.fillHeight: true
+ font.pixelSize: root.fontSize
+ text: "Near: " + root.near
+ }
+ }
+}
diff --git a/examples/sensors/sensorsshowcase/accelerometer.qml b/examples/sensors/sensorsshowcase/accelerometer.qml
deleted file mode 100644
index e4f6e39b..00000000
--- a/examples/sensors/sensorsshowcase/accelerometer.qml
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtQuick.Controls
-import QtQuick.Layouts
-import QtSensors
-
-Rectangle {
- id: root
- color: "dimgray"
-
- function resetRotations() {
- imageXRotation.angle = 0
- imageYRotation.angle = 0
- imageZRotation.angle = 0
- }
-
-//! [0]
- Accelerometer {
- id: accelerometer
- active: true
- dataRate: 25
-
- property real x: 0
- property real y: 0
- property real z: 0
-
- onReadingChanged: {
- x = reading.x
- y = reading.y
- z = reading.z
-
- imageTranslation.x = -reading.x * 10
- imageTranslation.y = reading.y * 10
- }
- }
-//! [0]
-
- ColumnLayout {
- anchors.fill: parent
- id: layout
-
- Text {
- Layout.topMargin: titleTopMargin
- Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
- Layout.preferredHeight: textHeight
- color: "White"
- text: "Accelerometer"
- font.pixelSize: titleFontSize
- }
-
- Image {
- id: image
- Layout.alignment: Qt.AlignCenter
- Layout.fillHeight: true
- Layout.preferredWidth: root.width/2
- Layout.preferredHeight: root.height/3
- source: "qrc:/images/qt_logo.png"
- fillMode: Image.PreserveAspectFit
-
- transform: [
- Translate {
- id: imageTranslation
- x: 0
- y: 0
- }
- ]
- }
-
- Text {
- Layout.preferredWidth: root.width
- Layout.preferredHeight: textHeight
- Layout.leftMargin: layout.spacing
- color: "White"
- text: "X: " + accelerometer.x.toFixed(2)
- font.pixelSize: textFontSize
- }
-
- ProgressBar {
- id: xbar
- value: 0.5 + (accelerometer.x / 100)
- Layout.preferredWidth: root.width
- }
-
- Text {
- Layout.preferredWidth: root.width
- Layout.preferredHeight: textHeight
- Layout.leftMargin: layout.spacing
- color: "White"
- text: "Y: " + accelerometer.y.toFixed(2)
- font.pixelSize: textFontSize
- }
- ProgressBar {
- id: ybar
- value: 0.5 + (accelerometer.y / 100)
- Layout.preferredWidth: root.width
- }
- Text {
- Layout.preferredWidth: root.width
- Layout.preferredHeight: textHeight
- Layout.leftMargin: layout.spacing
- color: "White"
- text: "Z: " + accelerometer.z.toFixed(2)
- font.pixelSize: textFontSize
- }
- ProgressBar {
- id: zbar
- value: 0.5 + (accelerometer.z / 100)
- Layout.preferredWidth: root.width
- }
- Button {
- Layout.alignment: Qt.AlignBottom
- Layout.preferredWidth: root.width
- Layout.preferredHeight: buttonHeight
- text:"Back"
- font.pixelSize: buttonFontSize
- onClicked:stack.pop()
- }
- }
-}
-
diff --git a/examples/sensors/sensorsshowcase/android/AndroidManifest.xml b/examples/sensors/sensorsshowcase/android/AndroidManifest.xml
index 3c152a90..359c0114 100644
--- a/examples/sensors/sensorsshowcase/android/AndroidManifest.xml
+++ b/examples/sensors/sensorsshowcase/android/AndroidManifest.xml
@@ -11,7 +11,6 @@
<!-- The comment below will be replaced with dependencies permissions upon deployment.
Remove the comment if you do not require these default features. -->
<!-- %%INSERT_FEATURES -->
-
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
@@ -22,26 +21,37 @@
android:extractNativeLibs="true"
android:hardwareAccelerated="true"
android:label="-- %%INSERT_APP_NAME%% --"
- android:requestLegacyExternalStorage="true">
+ android:requestLegacyExternalStorage="true"
+ android:allowNativeHeapPointerTagging="false"
+ android:allowBackup="true"
+ android:fullBackupOnly="false"
+ android:icon="@drawable/icon">
<activity
android:name="org.qtproject.qt.android.bindings.QtActivity"
android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density"
android:label="-- %%INSERT_APP_NAME%% --"
android:launchMode="singleTop"
- android:screenOrientation="portrait">
+ android:screenOrientation="portrait"
+ android:exported="true">
<intent-filter>
- <action android:name="android.intent.action.MAIN"/>
- <category android:name="android.intent.category.LAUNCHER"/>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
+
<meta-data
android:name="android.app.lib_name"
android:value="-- %%INSERT_APP_LIB_NAME%% --" />
- <meta-data
- android:name="android.app.background_running"
- android:value="false" />
+
+ <meta-data android:name="android.app.arguments"
+ android:value="" />
+
<meta-data
android:name="android.app.extract_android_style"
android:value="minimal" />
+
+ <meta-data
+ android:name="android.app.background_running"
+ android:value="false" />
</activity>
</application>
</manifest>
diff --git a/examples/sensors/sensorsshowcase/android/res/drawable-hdpi/icon.png b/examples/sensors/sensorsshowcase/android/res/drawable-hdpi/icon.png
new file mode 100644
index 00000000..5f61088b
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/android/res/drawable-hdpi/icon.png
Binary files differ
diff --git a/examples/sensors/sensorsshowcase/android/res/drawable-ldpi/icon.png b/examples/sensors/sensorsshowcase/android/res/drawable-ldpi/icon.png
new file mode 100644
index 00000000..605497de
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/android/res/drawable-ldpi/icon.png
Binary files differ
diff --git a/examples/sensors/sensorsshowcase/android/res/drawable-mdpi/icon.png b/examples/sensors/sensorsshowcase/android/res/drawable-mdpi/icon.png
new file mode 100644
index 00000000..3eb10832
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/android/res/drawable-mdpi/icon.png
Binary files differ
diff --git a/examples/sensors/sensorsshowcase/android/res/drawable-xhdpi/icon.png b/examples/sensors/sensorsshowcase/android/res/drawable-xhdpi/icon.png
new file mode 100644
index 00000000..a9e39f88
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/android/res/drawable-xhdpi/icon.png
Binary files differ
diff --git a/examples/sensors/sensorsshowcase/android/res/drawable-xxhdpi/icon.png b/examples/sensors/sensorsshowcase/android/res/drawable-xxhdpi/icon.png
new file mode 100644
index 00000000..b489d81e
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/android/res/drawable-xxhdpi/icon.png
Binary files differ
diff --git a/examples/sensors/sensorsshowcase/android/res/drawable-xxxhdpi/icon.png b/examples/sensors/sensorsshowcase/android/res/drawable-xxxhdpi/icon.png
new file mode 100644
index 00000000..9443da63
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/android/res/drawable-xxxhdpi/icon.png
Binary files differ
diff --git a/examples/sensors/sensorsshowcase/compass.qml b/examples/sensors/sensorsshowcase/compass.qml
deleted file mode 100644
index 65ea3543..00000000
--- a/examples/sensors/sensorsshowcase/compass.qml
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtQuick.Controls
-import QtQuick.Layouts
-import QtSensors
-
-Rectangle {
- id: root
- color: "dimgray"
- property real azimuth: 30
- readonly property real buttonHeight: height/8
-
- Compass {
- id: compass
- active: true
- dataRate: 7
- onReadingChanged: {
- root.azimuth = -reading.azimuth
- }
- }
-
- ColumnLayout {
- anchors.fill: parent
- id: layout
-
- Text {
- Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
- Layout.preferredHeight: titleHeight
- Layout.topMargin: titleTopMargin
- verticalAlignment: Text.AlignVCenter
- color: "White"
- text: "Compass"
- font.pixelSize: titleFontSize
- }
- Image {
- Layout.alignment: Qt.AlignCenter
- Layout.fillHeight: true
- Layout.preferredWidth: root.width
- Layout.preferredHeight: root.height
- id: arrow
- source: "qrc:/images/compass.svg"
- fillMode: Image.PreserveAspectFit
- rotation:root.azimuth
- }
- Text {
- Layout.preferredWidth: root.width
- Layout.preferredHeight: textHeight
- Layout.leftMargin: layout.spacing
- color: "White"
- text: "Azimuth: " + root.azimuth.toFixed(2) + "°"
- font.pixelSize: textFontSize
- }
- Button {
- Layout.alignment: Qt.AlignBottom
- Layout.preferredWidth: root.width
- Layout.preferredHeight: buttonHeight
- text:"Back"
- font.pixelSize: buttonFontSize
- onClicked:stack.pop()
- }
- }
-}
diff --git a/examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-gyroscope.png b/examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-gyroscope.png
deleted file mode 100644
index b26aa459..00000000
--- a/examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-gyroscope.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-gyroscope.webp b/examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-gyroscope.webp
new file mode 100644
index 00000000..0ff45403
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-gyroscope.webp
Binary files differ
diff --git a/examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-mainview.png b/examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-mainview.png
deleted file mode 100644
index 838b39c9..00000000
--- a/examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-mainview.png
+++ /dev/null
Binary files differ
diff --git a/examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-mainview.webp b/examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-mainview.webp
new file mode 100644
index 00000000..b045b7ba
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/doc/images/sensorsshowcase-mainview.webp
Binary files differ
diff --git a/examples/sensors/sensorsshowcase/doc/src/sensorsshowcase.qdoc b/examples/sensors/sensorsshowcase/doc/src/sensorsshowcase.qdoc
index b2971f01..d3d31c34 100644
--- a/examples/sensors/sensorsshowcase/doc/src/sensorsshowcase.qdoc
+++ b/examples/sensors/sensorsshowcase/doc/src/sensorsshowcase.qdoc
@@ -1,13 +1,15 @@
-// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\example sensorsshowcase
- \title Qt Sensors - Sensors Showcase
+ \title Sensors Showcase
\brief The Sensors Showcase example demonstrates sensor usage with visual examples.
+ \meta tag {sensors,quick,mobile}
\ingroup qtsensors-examples
+ \examplecategory {Mobile}
- \image sensorsshowcase-mainview.png
+ \image sensorsshowcase-mainview.webp
\section1 Overview
@@ -17,9 +19,14 @@
\section1 Main Menu
- The main view shows the title with the name of the application and a button for each
- subview laid out evenly by a \c ColumnLayout. The navigation between the subviews
- and the main menu is managed by a \c StackView.
+ The main view shows the title with the name of the application and a button
+ for each subview laid out evenly by a \c ColumnLayout. A \c StackView
+ manages the navigation between the subviews and the main menu. The
+ application checks the availability of the sensors during startup and
+ disables the buttons for the sensors that are not available.
+
+ \note To simplify the example, the sensor availability is checked only once
+ during the startup.
\section1 Accelerometer View
@@ -29,7 +36,7 @@
Moving around the image happens in the accelerometer \c onReadingChanged method.
- \snippet sensorsshowcase/accelerometer.qml 0
+ \snippet sensorsshowcase/Accelerometer.qml 0
Whenever there is a new accelerometer value the image translation coordinates are
updated accordingly.
@@ -52,11 +59,11 @@
case of how the magnetometer readings can be used. Since the magnetometer provides
readings along all three axes, there is more freedom with how these readings can be used.
- \snippet sensorsshowcase/magnetometer.qml 0
+ \snippet sensorsshowcase/Magnetometer.qml 0
\section1 Gyroscope View
- \image sensorsshowcase-gyroscope.png
+ \image sensorsshowcase-gyroscope.webp
The gyroscope view also shows an image that is rotated around three axes with an amount
that is calculated from the gyroscope readings. Since the gyroscope provides relative
@@ -64,7 +71,7 @@
can vary, the time of the readings are stored and the rotational change is normalized
based on the time passed between reading updates.
- \snippet sensorsshowcase/gyroscope.qml 0
+ \snippet sensorsshowcase/Gyroscope.qml 0
By pressing the reset button the image rotation is reset to 0.
*/
diff --git a/examples/sensors/sensorsshowcase/gyroscope.qml b/examples/sensors/sensorsshowcase/gyroscope.qml
deleted file mode 100644
index 39252c0e..00000000
--- a/examples/sensors/sensorsshowcase/gyroscope.qml
+++ /dev/null
@@ -1,174 +0,0 @@
-// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtQuick.Controls
-import QtQuick.Layouts
-import QtSensors
-
-Rectangle {
- id: root
- color: "dimgray"
-
- function resetRotations() {
- imageXRotation.angle = 0
- imageYRotation.angle = 0
- imageZRotation.angle = 0
- }
-
-//! [0]
- Gyroscope {
- id: gyroscope
- active: true
- dataRate: 25
-
- property variant lastTimeStamp: 0
-
- property real x: 0
- property real y: 0
- property real z: 0
-
- onReadingChanged: {
-
- x = reading.x
- y = reading.y
- z = reading.z
-
- var firstCall = false
- if (lastTimeStamp == 0) {
- firstCall = true
- }
-
- var timeSinceLast = reading.timestamp - lastTimeStamp
- lastTimeStamp = reading.timestamp
-
- //Skipping the initial time jump from 0
- if (firstCall === true) return
-
- var normalizedX = reading.x * (timeSinceLast/1000000)
- imageXRotation.angle += normalizedX
-
- var normalizedY = reading.y * (timeSinceLast/1000000)
- imageYRotation.angle -= normalizedY
-
- var normalizedZ = reading.z * (timeSinceLast/1000000)
- imageZRotation.angle += normalizedZ
- }
- }
-//! [0]
-
- ColumnLayout {
- anchors.fill: parent
- id: layout
-
- Text {
- Layout.topMargin: titleTopMargin
- Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
- Layout.preferredHeight: textHeight
- color: "White"
- text: "Gyroscope"
- font.pixelSize: titleFontSize
- }
-
- Image {
- id: image
- Layout.alignment: Qt.AlignCenter
- Layout.fillHeight: true
- Layout.preferredWidth: root.height/3
- Layout.preferredHeight: root.height/3
- source: "qrc:/images/qt_logo.png"
- fillMode: Image.PreserveAspectFit
-
- transform: [
- Rotation {
- id: imageXRotation
- origin.x: layout.width/2
- origin.y: layout.height/3
- axis.x: 1
- axis.y: 0
- axis.z: 0
- angle: 0
- },
- Rotation {
- id: imageYRotation
- origin.x: layout.width/2
- origin.y: layout.height/3
- axis.x: 0
- axis.y: 1
- axis.z: 0
- angle: 0
- },
- Rotation {
- id: imageZRotation
- origin.x: layout.width/2
- origin.y: layout.height/3
- axis.x: 0
- axis.y: 0
- axis.z: 1
- angle: 0
- }
- ]
- }
-
- Text {
- Layout.preferredWidth: root.width
- Layout.preferredHeight: textHeight
- Layout.leftMargin: layout.spacing
- color: "White"
- text: "X: " + gyroscope.x.toFixed(2)
- font.pixelSize: textFontSize
- }
-
- ProgressBar {
- id: xbar
- value: 0.5 + (gyroscope.x / 1000)
- Layout.preferredWidth: root.width
- }
-
- Text {
- Layout.preferredWidth: root.width
- Layout.preferredHeight: textHeight
- Layout.leftMargin: layout.spacing
- color: "White"
- text: "Y: " + gyroscope.y.toFixed(2)
- font.pixelSize: textFontSize
- }
- ProgressBar {
- id: ybar
- value: 0.5 + (gyroscope.y / 1000)
- Layout.preferredWidth: root.width
- }
- Text {
- Layout.preferredWidth: root.width
- Layout.preferredHeight: textHeight
- Layout.leftMargin: layout.spacing
- color: "White"
- text: "Z: " + gyroscope.z.toFixed(2)
- font.pixelSize: textFontSize
- }
- ProgressBar {
- id: zbar
- value: 0.5 + (gyroscope.z / 1000)
- Layout.preferredWidth: root.width
- }
- Button {
- Layout.alignment: Qt.AlignBottom
- Layout.preferredWidth: root.width
- Layout.preferredHeight: buttonHeight
- text:"Reset rotation"
- font.pixelSize: buttonFontSize
- onClicked: {
- resetRotations()
- }
- }
- Button {
- Layout.alignment: Qt.AlignBottom
- Layout.preferredWidth: root.width
- Layout.preferredHeight: buttonHeight
- text:"Back"
- font.pixelSize: buttonFontSize
- onClicked:stack.pop()
- }
- }
-}
-
diff --git a/examples/sensors/sensorsshowcase/images/qt_logo.png b/examples/sensors/sensorsshowcase/images/qt_logo.png
index 30c621c9..3a75e10c 100644
--- a/examples/sensors/sensorsshowcase/images/qt_logo.png
+++ b/examples/sensors/sensorsshowcase/images/qt_logo.png
Binary files differ
diff --git a/examples/sensors/sensorsshowcase/magnetometer.qml b/examples/sensors/sensorsshowcase/magnetometer.qml
deleted file mode 100644
index c40bb867..00000000
--- a/examples/sensors/sensorsshowcase/magnetometer.qml
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtQuick.Controls
-import QtQuick.Layouts
-import QtSensors
-
-Rectangle {
- id: root
- color: "dimgray"
-
- property real magnetRotation: 40
- property real magnetometerX: 0
- property real magnetometerY: 0
- property real magnetometerZ: 0
- property int barScaleFactor: 10000
-
-//! [0]
- Magnetometer {
- id: magnetometer
- active: true
- dataRate: 25
- onReadingChanged: {
- root.magnetometerX = reading.x
- root.magnetometerY = reading.y
- root.magnetometerZ = reading.z
- root.magnetRotation = ((Math.atan2(reading.x, reading.y) / Math.PI) * 180)
- }
- }
-//! [0]
-
- ColumnLayout {
- anchors.fill: parent
- id: layout
-
- Text {
- Layout.topMargin: titleTopMargin
- Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
- Layout.preferredHeight: titleHeight
- verticalAlignment: Text.AlignVCenter
- color: "White"
- text: "Magnetometer"
- font.pixelSize: titleFontSize
- }
- Image {
- Layout.alignment: Qt.AlignCenter
- Layout.fillHeight: true
- Layout.preferredWidth: root.width / 2
- Layout.preferredHeight: root.height / 2
- source: "qrc:/images/magnet.svg"
- fillMode: Image.PreserveAspectFit
- rotation: magnetRotation
- }
- Text {
- Layout.preferredWidth: root.width
- Layout.preferredHeight: textHeight
- Layout.leftMargin: layout.spacing
- color: "White"
- text: "X: " + root.magnetometerX.toFixed(9)
- font.pixelSize: textFontSize
- }
- ProgressBar {
- id: xbar
- value: 0.5 + (root.magnetometerX * barScaleFactor)
- Layout.preferredWidth: root.width
- }
- Text {
- Layout.preferredWidth: root.width
- Layout.preferredHeight: textHeight
- Layout.leftMargin: layout.spacing
- color: "White"
- text: "Y: " + root.magnetometerY.toFixed(9)
- font.pixelSize: textFontSize
- }
- ProgressBar {
- id: ybar
- value: 0.5 + (root.magnetometerY * barScaleFactor)
- Layout.preferredWidth: root.width
- }
- Text {
- Layout.preferredWidth: root.width
- Layout.preferredHeight: textHeight
- Layout.leftMargin: layout.spacing
- color: "White"
- text: "Z: " + root.magnetometerZ.toFixed(9)
- font.pixelSize: textFontSize
- }
- ProgressBar {
- id: zbar
- value: 0.5 + (root.magnetometerZ * barScaleFactor)
- Layout.preferredWidth: root.width
- }
- Button {
- Layout.alignment: Qt.AlignBottom
- Layout.preferredWidth: root.width
- Layout.preferredHeight: buttonHeight
- text:"Back"
- font.pixelSize: buttonFontSize
- onClicked:stack.pop()
- }
- }
-}
diff --git a/examples/sensors/sensorsshowcase/main.cpp b/examples/sensors/sensorsshowcase/main.cpp
index 52e27a06..4a7bd285 100644
--- a/examples/sensors/sensorsshowcase/main.cpp
+++ b/examples/sensors/sensorsshowcase/main.cpp
@@ -1,14 +1,18 @@
-// Copyright (C) 2021 The Qt Company Ltd.
+// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-
-#include <QtGui/QGuiApplication>
-#include <QtQml/QQmlApplicationEngine>
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QGuiApplication app(argc,argv);
- QQmlApplicationEngine engine(QUrl("qrc:///sensorsshowcase.qml"));
+ QGuiApplication::setOrganizationName("QtProject");
+ QGuiApplication::setApplicationName("Sensors Showcase");
+
+ QQmlApplicationEngine engine;
+ engine.loadFromModule("SensorShowcaseModule", "Main");
+ if (engine.rootObjects().isEmpty())
+ return -1;
return app.exec();
}
diff --git a/examples/sensors/sensorsshowcase/proximity.qml b/examples/sensors/sensorsshowcase/proximity.qml
deleted file mode 100644
index 7e4f6486..00000000
--- a/examples/sensors/sensorsshowcase/proximity.qml
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtQuick.Controls
-import QtQuick.Layouts
-import QtSensors
-
-Rectangle {
- id: root
- color: "dimgray"
- property bool near: false
-
- ProximitySensor {
- id: proximity
- active: true
- onReadingChanged: {
- root.near = reading.near
- }
- }
-
- ColumnLayout {
- anchors.fill: parent
- id: layout
-
- Text {
- Layout.topMargin: titleTopMargin
- Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
- Layout.preferredHeight: textHeight
- color: "White"
- text: "Proximity"
- font.pixelSize: titleFontSize
- }
- Image {
- Layout.alignment: Qt.AlignCenter
- Layout.fillHeight: true
- Layout.preferredWidth: root.near ? root.height/3 : root.height/4
- Layout.preferredHeight: root.near ? root.height/3 : root.height/4
- source: "qrc:/images/qt_logo.png"
- fillMode: Image.PreserveAspectFit
- }
- Text {
- visible: !proximity
- Layout.preferredWidth: root.width
- Layout.preferredHeight: textHeight
- Layout.leftMargin: layout.spacing
- font.pixelSize: textFontSize
- verticalAlignment: Text.AlignVCenter
- wrapMode: Text.WordWrap
- color: "White"
- text: "The proximity sensor is not available on this device!"
- }
- Text {
-// visible: typeof proximity.available !== 'undefined'
- Layout.preferredWidth: root.width
- Layout.preferredHeight: textHeight
- Layout.leftMargin: layout.spacing
- color: "White"
- text: "Near: " + root.near
- font.pixelSize: textFontSize
- }
- Button {
- Layout.alignment: Qt.AlignBottom
- Layout.preferredWidth: root.width
- Layout.preferredHeight: buttonHeight
- text:"Back"
- font.pixelSize: buttonFontSize
- onClicked:stack.pop()
- }
- }
-}
diff --git a/examples/sensors/sensorsshowcase/qmldir b/examples/sensors/sensorsshowcase/qmldir
new file mode 100644
index 00000000..76e61cdf
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/qmldir
@@ -0,0 +1,9 @@
+module SensorShowcaseModule
+prefer :/qt/qml/SensorShowcaseModule/
+Main 1.0 Main.qml
+Accelerometer 1.0 Accelerometer.qml
+Compass 1.0 Compass.qml
+Gyroscope 1.0 Gyroscope.qml
+Magnetometer 1.0 Magnetometer.qml
+Proximity 1.0 Proximity.qml
+ProgressXYZBar 1.0 ProgressXYZBar.qml
diff --git a/examples/sensors/sensorsshowcase/qtquickcontrols2.conf b/examples/sensors/sensorsshowcase/qtquickcontrols2.conf
new file mode 100644
index 00000000..76439328
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/qtquickcontrols2.conf
@@ -0,0 +1,6 @@
+[Controls]
+Style=Material
+
+[Material]
+Background=#eafcf3
+Accent=#28c878
diff --git a/examples/sensors/sensorsshowcase/sensorsshowcase.pro b/examples/sensors/sensorsshowcase/sensorsshowcase.pro
index f57733f5..cded9071 100644
--- a/examples/sensors/sensorsshowcase/sensorsshowcase.pro
+++ b/examples/sensors/sensorsshowcase/sensorsshowcase.pro
@@ -1,27 +1,46 @@
-TEMPLATE = app
-TARGET = sensorsshowcase
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
QT += quick sensors svg
+
+TARGET = sensorsshowcase
+TEMPLATE = app
+
SOURCES = main.cpp
-RESOURCES += \
- sensorsshowcase.qrc
+qml_resources.files = \
+ qmldir \
+ Main.qml \
+ Accelerometer.qml \
+ Compass.qml \
+ Gyroscope.qml \
+ Magnetometer.qml \
+ Proximity.qml \
+ ProgressXYZBar.qml \
+ images/compass.svg \
+ images/magnet.svg \
+ images/qt_logo.png
-OTHER_FILES = \
- $$files(*.qml) \
- images \
- android/AndroidManifest.xml
+qml_resources.prefix = /qt/qml/SensorShowcaseModule
-target.path = $$[QT_INSTALL_EXAMPLES]/sensors/sensorsshowcase
-INSTALLS += target
+data_resources.files = \
+ qtquickcontrols2.conf
-ios {
-QMAKE_INFO_PLIST = Info.plist
+data_resources.prefix = /
+
+RESOURCES += \
+ qml_resources \
+ data_resources
-# manual plugin loading needed with older Qt
-# QTPLUGIN += qsvg qtsensors_ios qtsensors_generic
+android {
+ OTHER_FILES = android/AndroidManifest.xml
+ ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
}
-ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
+ios {
+ QMAKE_INFO_PLIST = Info.plist
+ EXAMPLE_FILES += Info.plist
+}
-EXAMPLE_FILES += \
- Info.plist
+target.path = $$[QT_INSTALL_EXAMPLES]/sensors/sensorsshowcase
+INSTALLS += target
diff --git a/examples/sensors/sensorsshowcase/sensorsshowcase.qml b/examples/sensors/sensorsshowcase/sensorsshowcase.qml
deleted file mode 100644
index e0fbd944..00000000
--- a/examples/sensors/sensorsshowcase/sensorsshowcase.qml
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import QtQuick
-import QtQuick.Controls
-import QtQuick.Layouts
-import QtSensors
-
-ApplicationWindow {
- title: "Sensors Showcase"
- id: mainWindow
- width: 540
- height: 1200
- visible: true
- color: "dimgray"
-
- property int titleHeight: height/7
- readonly property real buttonHeight: height/7
- property int textHeight: height/24
- readonly property int buttonFontSize: 30
- readonly property int textFontSize: 20
- readonly property int titleFontSize: 35
- readonly property int titleTopMargin: mainWindow.height/24
-
- StackView {
- id: stack
- anchors.fill: parent
- initialItem: ColumnLayout {
- width: stack.width
- Text {
- Layout.topMargin: mainWindow.height/12
- Layout.alignment: Qt.AlignCenter
- Layout.preferredHeight: titleHeight
- text: "Sensors Showcase"
- color: "White"
- font.pixelSize: titleFontSize
- }
-
- Button {
- Layout.fillHeight: true
- Layout.preferredWidth: stack.width
- text: "Accelerometer"
- font.pixelSize: buttonFontSize
- onClicked: stack.push("qrc:/accelerometer.qml")
- }
- Button {
- Layout.fillHeight: true
- Layout.preferredWidth: stack.width
- text: "Proximity"
- font.pixelSize: buttonFontSize
- onClicked: stack.push("qrc:/proximity.qml")
- }
- Button {
- Layout.fillHeight: true
- Layout.preferredWidth: stack.width
- text: "Compass"
- font.pixelSize: buttonFontSize
- onClicked: stack.push("qrc:/compass.qml")
- }
- Button {
- Layout.fillHeight: true
- Layout.preferredWidth: stack.width
- text: "Magnetometer"
- font.pixelSize: buttonFontSize
- onClicked: stack.push("qrc:/magnetometer.qml")
- }
- Button {
- Layout.fillHeight: true
- Layout.preferredWidth: stack.width
- text: "Gyroscope"
- font.pixelSize: buttonFontSize
- onClicked: stack.push("qrc:/gyroscope.qml")
- }
- }
- }
-}
diff --git a/examples/sensors/sensorsshowcase/sensorsshowcase.qrc b/examples/sensors/sensorsshowcase/sensorsshowcase.qrc
deleted file mode 100644
index e647c384..00000000
--- a/examples/sensors/sensorsshowcase/sensorsshowcase.qrc
+++ /dev/null
@@ -1,13 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>sensorsshowcase.qml</file>
- <file>accelerometer.qml</file>
- <file>proximity.qml</file>
- <file>compass.qml</file>
- <file>magnetometer.qml</file>
- <file>gyroscope.qml</file>
- <file>images/magnet.svg</file>
- <file>images/compass.svg</file>
- <file>images/qt_logo.png</file>
- </qresource>
-</RCC>
diff --git a/examples/sensors/sensorsshowcase/sensorsupport.h b/examples/sensors/sensorsshowcase/sensorsupport.h
new file mode 100644
index 00000000..915157f8
--- /dev/null
+++ b/examples/sensors/sensorsshowcase/sensorsupport.h
@@ -0,0 +1,41 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+#ifndef SENSORSUPPORT_H
+#define SENSORSUPPORT_H
+
+#include <QObject>
+#include <QtQmlIntegration>
+#include <QtSensors/QtSensors>
+
+class SensorSupport : public QObject
+{
+ Q_OBJECT
+ QML_ELEMENT
+ QML_SINGLETON
+ QML_UNCREATABLE("SensorSupport is a utility class")
+public:
+ explicit SensorSupport(QObject *parent = nullptr) : QObject(parent) { }
+
+ Q_INVOKABLE static bool hasAccelerometer()
+ {
+ return !QSensor::sensorsForType(QAccelerometer::sensorType).empty();
+ }
+ Q_INVOKABLE static bool hasCompass()
+ {
+ return !QSensor::sensorsForType(QCompass::sensorType).empty();
+ }
+ Q_INVOKABLE static bool hasGyroscope()
+ {
+ return !QSensor::sensorsForType(QGyroscope::sensorType).empty();
+ }
+ Q_INVOKABLE static bool hasMagnetometer()
+ {
+ return !QSensor::sensorsForType(QMagnetometer::sensorType).empty();
+ }
+ Q_INVOKABLE static bool hasProximity()
+ {
+ return !QSensor::sensorsForType(QProximitySensor::sensorType).empty();
+ }
+};
+
+#endif // SENSORSUPPORT_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 <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();\
-}
diff --git a/licenseRule.json b/licenseRule.json
new file mode 100644
index 00000000..a0afe773
--- /dev/null
+++ b/licenseRule.json
@@ -0,0 +1,94 @@
+[
+ {
+ "comment" : ["file_pattern_ending: strings matched against the end of a file name.",
+ "location keys: regular expression matched against the beginning of",
+ "the file path (relative to the git submodule root).",
+ "spdx: list of SPDX-License-Expression's allowed in the matching files.",
+ "-------------------------------------------------------",
+ "Files with the following endings are Build System licensed,",
+ "unless they are examples",
+ "Files with other endings can also be build system files"
+ ],
+ "file_pattern_ending" : ["CMakeLists.txt", ".cmake", ".pro", ".pri", ".prf",
+ "configure", "configure.bat", "cmake.in", "plist.in", "CMakeLists.txt.in"],
+ "location" : {
+ "" : {
+ "comment" : "Default",
+ "file type" : "build system",
+ "spdx" : ["BSD-3-Clause"]
+ },
+ "(.*)(examples/|snippets/)" : {
+ "comment" : "Example takes precedence",
+ "file type" : "examples and snippets",
+ "spdx" : ["LicenseRef-Qt-Commercial OR BSD-3-Clause"]
+ }
+ }
+ },
+ {
+ "comments" : ["Files with the following endings are Tool licensed,",
+ "unless they are examples.",
+ "Files with other endings can also be tool files."],
+ "file_pattern_ending" : [".sh", ".py", ".pl", ".bat", ".ps1"],
+ "location" :{
+ "" : {
+ "comment" : "Default",
+ "file type" : "tools and utils",
+ "spdx" : ["LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0"]
+ },
+ "(.*)(examples/|snippets/)" : {
+ "comment" : "Example takes precedence",
+ "file type" : "examples and snippets",
+ "spdx" : ["LicenseRef-Qt-Commercial OR BSD-3-Clause"]
+ }
+ }
+ },
+ {
+ "comment" : "Files with the following endings are Documentation licensed.",
+ "file_pattern_ending" : [".qdoc", ".qdocinc" , ".qdocconf", ".txt", "README", "qt_attribution.json"],
+ "location" :{
+ "" : {
+ "comment" : "",
+ "file type" : "documentation",
+ "spdx" : ["LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only"]
+ }
+ }
+ },
+ {
+ "comment" : ["All other files",
+ "The licensing is defined only by the file location in the Qt module repository.",
+ "NO <file_pattern_ending> key for this case!",
+ "This needs to be the last entry of the file."],
+ "location" : {
+ "" : {
+ "comment" : "Default",
+ "file type" : "module and plugin",
+ "spdx" : ["LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only"]
+ },
+ "src/" : {
+ "comment" : "Default",
+ "file type" : "module and plugin",
+ "spdx" : ["LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only"]
+ },
+ "src/plugins/sensors/android/androidcompass.cpp" : {
+ "comment" : "File contains code copied from Android project",
+ "file type" : "module and plugin",
+ "spdx" : ["Apache-2.0"]
+ },
+ "tests/" : {
+ "comment" : "Default",
+ "file type" : "test",
+ "spdx" : ["LicenseRef-Qt-Commercial OR GPL-3.0-only"]
+ },
+ "(.*)(examples/|snippets/)" : {
+ "comment" : "Default",
+ "file type" : "examples and snippets",
+ "spdx" : ["LicenseRef-Qt-Commercial OR BSD-3-Clause"]
+ },
+ "config\\.tests/" : {
+ "comment" : "Default",
+ "file type" : "build system",
+ "spdx" : ["BSD-3-Clause"]
+ }
+ }
+ }
+]
diff --git a/src/plugins/sensors/CMakeLists.txt b/src/plugins/sensors/CMakeLists.txt
index be45afb9..e7527d8f 100644
--- a/src/plugins/sensors/CMakeLists.txt
+++ b/src/plugins/sensors/CMakeLists.txt
@@ -25,6 +25,6 @@ if(LINUX AND TARGET Qt::DBus AND NOT SENSORS_PLUGINS OR "iio-sensor-proxy" IN_LI
add_subdirectory(iio-sensor-proxy)
endif()
-if(NOT SENSORS_PLUGINS OR "dummy" IN_LIST SENSORS_PLUGINS)
+if("dummy" IN_LIST SENSORS_PLUGINS)
add_subdirectory(dummy)
endif()
diff --git a/src/plugins/sensors/android/androidcompass.cpp b/src/plugins/sensors/android/androidcompass.cpp
index d6f4f0f7..9cdea54d 100644
--- a/src/plugins/sensors/android/androidcompass.cpp
+++ b/src/plugins/sensors/android/androidcompass.cpp
@@ -1,22 +1,6 @@
// Copyright (C) 2019 BogDan Vatra <bogdan@kde.org>
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
+// Copyright (C) 2008 The Android Open Source Project
+// SPDX-License-Identifier: Apache-2.0
#include "androidcompass.h"
diff --git a/src/plugins/sensors/android/qt_attribution.json b/src/plugins/sensors/android/qt_attribution.json
new file mode 100644
index 00000000..9599e5bf
--- /dev/null
+++ b/src/plugins/sensors/android/qt_attribution.json
@@ -0,0 +1,12 @@
+{
+ "Id": "android-compass",
+ "Name": "Android getRotationMatrix and getOrientation",
+ "QDocModule": "qtsensors",
+ "Description": "Code to calculate the rotation matrix and orientation of a compass, adopted from Android sources.",
+ "QtUsage": "Used on Android, in the Android Sensor plugin.",
+ "Files": "androidcompass.cpp",
+
+ "License": "Apache License 2.0",
+ "LicenseId": "Apache-2.0",
+ "Copyright": "Copyright (C) 2008 The Android Open Source Project"
+}
diff --git a/src/plugins/sensors/android/sensormanager.cpp b/src/plugins/sensors/android/sensormanager.cpp
index 96d3cf1c..755b6109 100644
--- a/src/plugins/sensors/android/sensormanager.cpp
+++ b/src/plugins/sensors/android/sensormanager.cpp
@@ -3,11 +3,12 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "sensormanager.h"
#include <QtCore/qcoreapplication.h>
+#include <QtCore/qjnitypes.h>
#include <dlfcn.h>
Q_DECLARE_JNI_CLASS(AndroidContext, "android/content/Context")
-Q_DECLARE_JNI_TYPE(Sensor, "Landroid/hardware/Sensor;")
+Q_DECLARE_JNI_CLASS(Sensor, "android/hardware/Sensor")
SensorManager::SensorManager()
{
diff --git a/src/plugins/sensors/iio-sensor-proxy/CMakeLists.txt b/src/plugins/sensors/iio-sensor-proxy/CMakeLists.txt
index 040d2128..83093e11 100644
--- a/src/plugins/sensors/iio-sensor-proxy/CMakeLists.txt
+++ b/src/plugins/sensors/iio-sensor-proxy/CMakeLists.txt
@@ -14,6 +14,12 @@ qt_internal_add_plugin(IIOSensorProxySensorPlugin
iiosensorproxyorientationsensor.cpp iiosensorproxyorientationsensor.h
iiosensorproxysensorbase.cpp iiosensorproxysensorbase.h
main.cpp
+ NO_UNITY_BUILD_SOURCES
+ # Duplicate symbol definition between, iiosensorproxycompass.cpp, and
+ # the followings
+ # TODO: dbusPath() can probably be implemented as a static data member
+ iiosensorproxylightsensor.cpp
+ iiosensorproxyorientationsensor.cpp
DBUS_INTERFACE_SOURCES
org.freedesktop.DBus.Properties.xml
net.hadess.SensorProxy.xml
diff --git a/src/plugins/sensors/winrt/winrtgyroscope.cpp b/src/plugins/sensors/winrt/winrtgyroscope.cpp
index 479e9d89..c5fff500 100644
--- a/src/plugins/sensors/winrt/winrtgyroscope.cpp
+++ b/src/plugins/sensors/winrt/winrtgyroscope.cpp
@@ -14,7 +14,7 @@ using namespace Microsoft::WRL::Wrappers;
using namespace ABI::Windows::Foundation;
using namespace ABI::Windows::Devices::Sensors;
-typedef ITypedEventHandler<Gyrometer *, GyrometerReadingChangedEventArgs *> InclinometerReadingHandler;
+typedef ITypedEventHandler<Gyrometer *, GyrometerReadingChangedEventArgs *> GyrometerReadingHandler;
QT_USE_NAMESPACE
@@ -129,8 +129,8 @@ void WinRtGyroscope::start()
if (d->token.value)
return;
- ComPtr<InclinometerReadingHandler> callback =
- Callback<InclinometerReadingHandler>(d, &WinRtGyroscopePrivate::readingChanged);
+ ComPtr<GyrometerReadingHandler> callback =
+ Callback<GyrometerReadingHandler>(d, &WinRtGyroscopePrivate::readingChanged);
HRESULT hr = d->sensor->add_ReadingChanged(callback.Get(), &d->token);
if (FAILED(hr)) {
diff --git a/src/sensors/CMakeLists.txt b/src/sensors/CMakeLists.txt
index 34f9b976..6d883696 100644
--- a/src/sensors/CMakeLists.txt
+++ b/src/sensors/CMakeLists.txt
@@ -77,7 +77,7 @@ qt_internal_add_module(Sensors
if(ANDROID)
set_property(TARGET Sensors APPEND PROPERTY QT_ANDROID_LIB_DEPENDENCIES
- plugins/sensors/libplugins_sensors_qtsensors_android.so
+ ${INSTALL_PLUGINSDIR}/sensors/libplugins_sensors_qtsensors_android.so
)
endif()
diff --git a/src/sensors/configure.cmake b/src/sensors/configure.cmake
index 1573cca0..04eb0e30 100644
--- a/src/sensors/configure.cmake
+++ b/src/sensors/configure.cmake
@@ -45,7 +45,10 @@ if (LINUX)
# src/plugins/sensors/CMakeLists.txt and fix any potential errors.
qt_configure_add_summary_entry(ARGS "sensorfw")
qt_configure_add_summary_entry(ARGS "sensorfw_enabled_with_cmake")
- qt_configure_add_report(MESSAGE "SensorFW support currently not enabled with cmake")
+ qt_configure_add_report_entry(
+ TYPE WARNING
+ MESSAGE "SensorFW support currently not enabled with cmake"
+ )
endif()
if (WIN32)
diff --git a/src/sensors/doc/qtsensors.qdocconf b/src/sensors/doc/qtsensors.qdocconf
index be4bd6ea..b7569927 100644
--- a/src/sensors/doc/qtsensors.qdocconf
+++ b/src/sensors/doc/qtsensors.qdocconf
@@ -45,9 +45,9 @@ imagedirs += images
depends += qtcore qtdoc qtgui qtquick qtcmake
+# Highlighted examples
+manifestmeta.highlighted.names = "QtSensors/Sensors Showcase"
+
navigation.landingpage = "Qt Sensors"
navigation.cppclassespage = "Qt Sensors C++ Classes"
navigation.qmltypespage = "Qt Sensors QML Types"
-
-# Fail the documentation build if there are more warnings than the limit
-warninglimit = 0
diff --git a/src/sensors/doc/snippets/sensors/CMakeLists.txt b/src/sensors/doc/snippets/sensors/CMakeLists.txt
index 16c4bea1..27480020 100644
--- a/src/sensors/doc/snippets/sensors/CMakeLists.txt
+++ b/src/sensors/doc/snippets/sensors/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(sensorsdocsnippet LANGUAGES CXX)
@@ -17,6 +17,7 @@ qt_add_executable(sensorsdocsnippet
main.cpp
mybackend.h
plugin.cpp
+ start.cpp
)
target_link_libraries(sensorsdocsnippet PUBLIC
diff --git a/src/sensors/doc/snippets/sensors/creating.cpp b/src/sensors/doc/snippets/sensors/creating.cpp
index 09ad9555..4c99066f 100644
--- a/src/sensors/doc/snippets/sensors/creating.cpp
+++ b/src/sensors/doc/snippets/sensors/creating.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QObject>
#include <qaccelerometer.h>
diff --git a/src/sensors/doc/snippets/sensors/main.cpp b/src/sensors/doc/snippets/sensors/main.cpp
index d53eb039..fb6724d5 100644
--- a/src/sensors/doc/snippets/sensors/main.cpp
+++ b/src/sensors/doc/snippets/sensors/main.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
int main(int /*argc*/, char ** /*argv*/)
{
diff --git a/src/sensors/doc/snippets/sensors/mybackend.h b/src/sensors/doc/snippets/sensors/mybackend.h
index befcbc67..b964e747 100644
--- a/src/sensors/doc/snippets/sensors/mybackend.h
+++ b/src/sensors/doc/snippets/sensors/mybackend.h
@@ -1,5 +1,5 @@
// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef MYBACKEND_H
#define MYBACKEND_H
diff --git a/src/sensors/doc/snippets/sensors/plugin.cpp b/src/sensors/doc/snippets/sensors/plugin.cpp
index e8611176..27f50d72 100644
--- a/src/sensors/doc/snippets/sensors/plugin.cpp
+++ b/src/sensors/doc/snippets/sensors/plugin.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "mybackend.h"
#include <qsensorplugin.h>
diff --git a/src/sensors/doc/snippets/sensors/start.cpp b/src/sensors/doc/snippets/sensors/start.cpp
index 2ff9c89c..18c87d06 100644
--- a/src/sensors/doc/snippets/sensors/start.cpp
+++ b/src/sensors/doc/snippets/sensors/start.cpp
@@ -1,7 +1,9 @@
// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-#include <qsensor.h>
+#include <QtSensors/qsensor.h>
+#include <QtCore/QMetaObject>
+#include <QtCore/QMetaproperty>
void start()
{
@@ -19,3 +21,39 @@ qreal y = reading->value(1).value<qreal>();
Q_UNUSED(x);
Q_UNUSED(y);
}
+
+class MyObject : public QObject
+{
+ void findSensors()
+ {
+ //! [Find sensors]
+ QList<QSensor*> mySensorList;
+ for (const QByteArray &type : QSensor::sensorTypes()) {
+ qDebug() << "Found a sensor type:" << type;
+ for (const QByteArray &identifier : QSensor::sensorsForType(type)) {
+ qDebug() << " " << "Found a sensor of that type:" << identifier;
+ QSensor* sensor = new QSensor(type, this);
+ sensor->setIdentifier(identifier);
+ mySensorList.append(sensor);
+ }
+ }
+ //! [Find sensors]
+ //! [Print reading properties]
+ for (QSensor* sensor : mySensorList) {
+ const int firstProperty = QSensorReading::staticMetaObject.propertyOffset();
+ // Connect to backend first in case start() hasn't been called yet
+ if (!sensor->connectToBackend())
+ continue;
+ qDebug() << "Sensor" << sensor->identifier() << "reading properties:";
+ QSensorReading *reading = sensor->reading();
+ if (reading) {
+ const QMetaObject *mo = reading->metaObject();
+ for (int i = firstProperty; i < mo->propertyCount(); ++i) {
+ QByteArray name = mo->property(i).name();
+ qDebug() << " " << name << reading->property(name).toByteArray();
+ }
+ }
+ }
+ //! [Print reading properties]
+ }
+};
diff --git a/src/sensors/doc/snippets/sensors/tutorial.cpp b/src/sensors/doc/snippets/sensors/tutorial.cpp
new file mode 100644
index 00000000..e8714961
--- /dev/null
+++ b/src/sensors/doc/snippets/sensors/tutorial.cpp
@@ -0,0 +1,25 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+//! [MySensor]
+class MyReadingPrivate;
+
+class MyReading : public QSensorReading
+ {
+ Q_OBJECT
+ Q_PROPERTY(qreal myprop READ myprop)
+ DECLARE_READING(MyReading)
+public:
+ qreal myprop() const;
+ void setMyprop(qreal myprop);
+ };
+
+class MySensor : public QSensor
+{
+ Q_OBJECT
+public:
+ explicit MySensor(QObject *parent = 0);
+ MyReading *reading() const;
+ static char const * const sensorType;
+ };
+//! [MySensor]
diff --git a/src/sensors/doc/src/compatmap.qdoc b/src/sensors/doc/src/compatmap.qdoc
index 1f90d1ee..41f91a73 100644
--- a/src/sensors/doc/src/compatmap.qdoc
+++ b/src/sensors/doc/src/compatmap.qdoc
@@ -136,6 +136,135 @@
\endraw
+ \raw DocBook
+<db:informaltable cellpadding="2" cellspacing="1" border="1" width="90%">
+ <db:tbody>
+ <db:tr>
+ <db:td>Color</db:td>
+ <db:td>Explanation</db:td>
+ </db:tr>
+ <db:tr>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td>The sensor is supported.</db:td>
+ </db:tr>
+ <db:tr>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td>The sensor is not supported.</db:td>
+ </db:tr>
+ </db:tbody>
+ </db:informaltable>
+
+
+ <db:informaltable cellpadding="2" cellspacing="1" border="1" rules="all" width="90%">
+ <db:tbody>
+ <db:tr>
+ <db:td><db:emphasis role="bold">Feature</db:emphasis></db:td>
+ <db:td><db:emphasis role="bold">Android</db:emphasis></db:td>
+ <db:td><db:emphasis role="bold">Linux</db:emphasis></db:td>
+ <db:td><db:emphasis role="bold">iOS</db:emphasis></db:td>
+ <db:td><db:emphasis role="bold">Windows</db:emphasis></db:td>
+ <db:td><db:emphasis role="bold">Generic</db:emphasis></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Accelerometer</db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Ambient Light Sensor</db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Ambient Temperature Sensor</db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Compass</db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Gyroscope</db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Light Sensor</db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Magnetometer</db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Orientation Sensor</db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Pressure Sensor</db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Proximity Sensor</db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Rotation Sensor</db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ </db:tr>
+ <db:tr>
+ <db:td>Tilt Sensor</db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ <db:td class="bgcolor-gray" ><?dbhtml bgcolor="gray" ?><?dbfo bgcolor="gray" ?></db:td>
+ <db:td class="bgcolor-green" ><?dbhtml bgcolor="green" ?><?dbfo bgcolor="green" ?></db:td>
+ </db:tr>
+ </db:tbody>
+ </db:informaltable>
+ \endraw
+
In addition to the table above, each sensor type might support specific features. For example,
a magnetometer might support returning geo values. See QSensor::isFeatureSupported() for
additional details.
diff --git a/src/sensors/doc/src/qtsensors-cpp.qdoc b/src/sensors/doc/src/qtsensors-cpp.qdoc
index 2251289c..b70f8276 100644
--- a/src/sensors/doc/src/qtsensors-cpp.qdoc
+++ b/src/sensors/doc/src/qtsensors-cpp.qdoc
@@ -5,6 +5,7 @@
\page qtsensors-cpp.html
\title Qt Sensors C++ Overview
\brief Explains how to use the Qt Sensors C++ API.
+\ingroup explanation
\tableofcontents
@@ -79,8 +80,18 @@ This code does not require any compile-time links to \l QAccelerometer or
\snippet sensors/start.cpp Starting a sensor
-You can discover all of this information at runtime too. The sensor_explorer example
-shows you information about available sensors.
+You can discover all of this information at runtime too.
+
+\section1 Discovering Sensors And Reading Properties At Runtime
+
+Sometimes it may be that the available sensors are not known at development time.
+It is possible to find out which sensors are available as illustrated below:
+
+\snippet sensors/start.cpp Find sensors
+
+Furthermore it is possible to discover the reading details for these sensors, as illustrated below:
+
+\snippet sensors/start.cpp Print reading properties
\section1 Front End, Back End
diff --git a/src/sensors/doc/src/qtsensors-tutorial.qdoc b/src/sensors/doc/src/qtsensors-tutorial.qdoc
new file mode 100644
index 00000000..147b8504
--- /dev/null
+++ b/src/sensors/doc/src/qtsensors-tutorial.qdoc
@@ -0,0 +1,36 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \page qtsensors-tutorial.html
+ \title How to create your own Sensor
+ \brief Steps for creating your own sensors
+
+ The Qt Sensors module provides access to sensor hardware via QML and C++
+ interfaces.
+
+ The API is supported on \l{Qt for Android}{Android}, \l{Qt for iOS}{iOS}, and
+ \l {Qt for Windows}{Windows (MSVC)}.
+
+ \section1 Creating your own sensor using C++ API
+
+ Using a Qt module's C++ API requires linking against the module library, either
+ directly or through other dependencies.
+ \section2 Creating a sensor
+
+ To create your own sensor you can use the following steps:
+
+ \list
+ \li Create your own MySensor and MySensorReading classes
+ \snippet sensors/tutorial.cpp MySensor
+ \li Create a MySensorBackend by inheriting from QSensorBackend
+ \li Create MySensorBackendFactory factory class for instantiating that
+ backend by inheriting a class QSensorBackendFactory
+ \li Register the backend factory by calling
+ QSensorManager::registerBackend ("MySensorType", "MySensorId", &myfactory)
+ \li Instantiate the new MySensor and start using it
+ \endlist
+
+ As an another option the sensors are put into a \l {Creating a sensor plugin}
+ that you can use on demand.
+*/
diff --git a/src/sensors/doc/src/qtsensors.qdoc b/src/sensors/doc/src/qtsensors.qdoc
index 8ff6c2e0..c25349fd 100644
--- a/src/sensors/doc/src/qtsensors.qdoc
+++ b/src/sensors/doc/src/qtsensors.qdoc
@@ -38,13 +38,13 @@
\li \l {Generic Backend} {Generic Backend}
\li \l {Qt Sensors Backend}
\li \l {Compatibility Map} {Compatibility Map}
+ \li \l {How to create your own Sensor}
\endlist
\section1 Examples
\list
\li \l {Qt Sensors Examples} {Examples}
- \li \l {Qt Sensors - Grue Sensor Example}
\endlist
\section1 API Reference
@@ -58,11 +58,16 @@
\l{Changes to Qt Sensors} lists important changes in the module API
and functionality that were made for the Qt 6 series of Qt.
- \section1 Licenses
+ \section1 Licenses and Attributions
The Qt Sensors module is available under commercial licenses from
\l{The Qt Company}. In addition, it is available under free software licenses:
The \l{GNU Lesser General Public License, version 3}, or
the \l{GNU General Public License, version 2}.
See \l{Qt Licensing} for further details.
+
+ Furthermore, Qt Sensors in Qt \QtVersion may contain third-party
+ modules under following permissive licenses:
+
+ \generatelist{groupsbymodule attributions-qtsensors}
*/
diff --git a/src/sensors/doc/src/sensor-examples.qdoc b/src/sensors/doc/src/sensor-examples.qdoc
index a3d56ffe..8e8d8d75 100644
--- a/src/sensors/doc/src/sensor-examples.qdoc
+++ b/src/sensors/doc/src/sensor-examples.qdoc
@@ -5,7 +5,6 @@
\group qtsensors-examples
\title Qt Sensors Examples
\brief Examples for the Qt Sensors module
- \ingroup all-examples
These are the Qt Sensors examples.
diff --git a/src/sensors/make_sensor.pl b/src/sensors/make_sensor.pl
index c314c1bd..74213f09 100755
--- a/src/sensors/make_sensor.pl
+++ b/src/sensors/make_sensor.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
# Copyright (C) 2021 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
# About this script
#
@@ -82,7 +82,7 @@ QT_BEGIN_NAMESPACE
class '.$sensor.';
-class Q_SENSORSQUICK_PRIVATE_EXPORT '.$qmlsensor.' : public QmlSensor
+class Q_SENSORSQUICK_EXPORT '.$qmlsensor.' : public QmlSensor
{
Q_OBJECT
QML_NAMED_ELEMENT('.$no_q_sensor.')
@@ -99,7 +99,7 @@ private:
'.$sensor.' *m_sensor;
};
-class Q_SENSORSQUICK_PRIVATE_EXPORT '.$qmlreading.' : public QmlSensorReading
+class Q_SENSORSQUICK_EXPORT '.$qmlreading.' : public QmlSensorReading
{
Q_OBJECT
Q_PROPERTY(qreal myprop READ myprop NOTIFY mypropChanged BINDABLE bindableMyprop)
diff --git a/src/sensors/qsensor.cpp b/src/sensors/qsensor.cpp
index fbd94e76..72c58fe8 100644
--- a/src/sensors/qsensor.cpp
+++ b/src/sensors/qsensor.cpp
@@ -244,7 +244,7 @@ void QSensorPrivate::init(const QByteArray &sensorType)
Only use this constructor if there is no derived sensor class available. Note that all
built-in sensors have a derived class, so using this constructor should only be necessary
- when implementing custom sensors, like in the \l {Qt Sensors - Grue Sensor Example}{Grue sensor example}.
+ when implementing custom sensors.
*/
QSensor::QSensor(const QByteArray &type, QObject *parent)
: QObject(*new QSensorPrivate, parent)
@@ -527,9 +527,6 @@ void QSensor::setSkipDuplicates(bool skipDuplicates)
continuous range of rates.
A discrete rate is noted by having both values the same.
- See the sensor_explorer example for an example of how to interpret and use
- this information.
-
Note that this information is not mandatory as not all sensors have a rate at which
they run. In such cases, the list will be empty.
diff --git a/src/sensorsquick/CMakeLists.txt b/src/sensorsquick/CMakeLists.txt
index 29552a81..b8ae9f57 100644
--- a/src/sensorsquick/CMakeLists.txt
+++ b/src/sensorsquick/CMakeLists.txt
@@ -36,5 +36,4 @@ qt_internal_add_qml_module(SensorsQuick
LIBRARIES
Qt::CorePrivate
GENERATE_CPP_EXPORTS
- GENERATE_PRIVATE_CPP_EXPORTS
)
diff --git a/src/sensorsquick/qmlaccelerometer_p.h b/src/sensorsquick/qmlaccelerometer_p.h
index 862aadde..aae90879 100644
--- a/src/sensorsquick/qmlaccelerometer_p.h
+++ b/src/sensorsquick/qmlaccelerometer_p.h
@@ -21,7 +21,7 @@ QT_BEGIN_NAMESPACE
class QAccelerometer;
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlAccelerometer : public QmlSensor
+class Q_SENSORSQUICK_EXPORT QmlAccelerometer : public QmlSensor
{
Q_OBJECT
Q_PROPERTY(AccelerationMode accelerationMode READ accelerationMode WRITE setAccelerationMode
@@ -53,7 +53,7 @@ private:
QmlSensorReading *createReading() const override;
};
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlAccelerometerReading : public QmlSensorReading
+class Q_SENSORSQUICK_EXPORT QmlAccelerometerReading : public QmlSensorReading
{
Q_OBJECT
Q_PROPERTY(qreal x READ x NOTIFY xChanged BINDABLE bindableX)
diff --git a/src/sensorsquick/qmlambientlightsensor_p.h b/src/sensorsquick/qmlambientlightsensor_p.h
index 5c41f56b..83bcd60c 100644
--- a/src/sensorsquick/qmlambientlightsensor_p.h
+++ b/src/sensorsquick/qmlambientlightsensor_p.h
@@ -22,7 +22,7 @@ QT_BEGIN_NAMESPACE
class QAmbientLightSensor;
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlAmbientLightSensor : public QmlSensor
+class Q_SENSORSQUICK_EXPORT QmlAmbientLightSensor : public QmlSensor
{
Q_OBJECT
QML_NAMED_ELEMENT(AmbientLightSensor)
@@ -39,7 +39,7 @@ private:
};
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlAmbientLightSensorReading : public QmlSensorReading
+class Q_SENSORSQUICK_EXPORT QmlAmbientLightSensorReading : public QmlSensorReading
{
Q_OBJECT
Q_PROPERTY(QAmbientLightReading::LightLevel lightLevel READ lightLevel
diff --git a/src/sensorsquick/qmlambienttemperaturesensor_p.h b/src/sensorsquick/qmlambienttemperaturesensor_p.h
index 9d17983a..898c0617 100644
--- a/src/sensorsquick/qmlambienttemperaturesensor_p.h
+++ b/src/sensorsquick/qmlambienttemperaturesensor_p.h
@@ -20,7 +20,7 @@ QT_BEGIN_NAMESPACE
class QAmbientTemperatureSensor;
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlAmbientTemperatureSensor : public QmlSensor
+class Q_SENSORSQUICK_EXPORT QmlAmbientTemperatureSensor : public QmlSensor
{
Q_OBJECT
QML_NAMED_ELEMENT(AmbientTemperatureSensor)
@@ -37,7 +37,7 @@ private:
QAmbientTemperatureSensor *m_sensor;
};
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlAmbientTemperatureReading : public QmlSensorReading
+class Q_SENSORSQUICK_EXPORT QmlAmbientTemperatureReading : public QmlSensorReading
{
Q_OBJECT
Q_PROPERTY(qreal temperature READ temperature
diff --git a/src/sensorsquick/qmlcompass_p.h b/src/sensorsquick/qmlcompass_p.h
index 77f401ef..312bf13c 100644
--- a/src/sensorsquick/qmlcompass_p.h
+++ b/src/sensorsquick/qmlcompass_p.h
@@ -21,7 +21,7 @@ QT_BEGIN_NAMESPACE
class QCompass;
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlCompass : public QmlSensor
+class Q_SENSORSQUICK_EXPORT QmlCompass : public QmlSensor
{
Q_OBJECT
QML_NAMED_ELEMENT(Compass)
@@ -37,7 +37,7 @@ private:
QmlSensorReading *createReading() const override;
};
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlCompassReading : public QmlSensorReading
+class Q_SENSORSQUICK_EXPORT QmlCompassReading : public QmlSensorReading
{
Q_OBJECT
Q_PROPERTY(qreal azimuth READ azimuth NOTIFY azimuthChanged BINDABLE bindableAzimuth)
diff --git a/src/sensorsquick/qmlgyroscope_p.h b/src/sensorsquick/qmlgyroscope_p.h
index b4e508cf..02697718 100644
--- a/src/sensorsquick/qmlgyroscope_p.h
+++ b/src/sensorsquick/qmlgyroscope_p.h
@@ -21,7 +21,7 @@ QT_BEGIN_NAMESPACE
class QGyroscope;
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlGyroscope : public QmlSensor
+class Q_SENSORSQUICK_EXPORT QmlGyroscope : public QmlSensor
{
Q_OBJECT
QML_NAMED_ELEMENT(Gyroscope)
@@ -37,7 +37,7 @@ private:
QmlSensorReading *createReading() const override;
};
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlGyroscopeReading : public QmlSensorReading
+class Q_SENSORSQUICK_EXPORT QmlGyroscopeReading : public QmlSensorReading
{
Q_OBJECT
Q_PROPERTY(qreal x READ x NOTIFY xChanged BINDABLE bindableX)
diff --git a/src/sensorsquick/qmlhumiditysensor_p.h b/src/sensorsquick/qmlhumiditysensor_p.h
index c4f57152..e01b0dc3 100644
--- a/src/sensorsquick/qmlhumiditysensor_p.h
+++ b/src/sensorsquick/qmlhumiditysensor_p.h
@@ -21,7 +21,7 @@ QT_BEGIN_NAMESPACE
class QHumiditySensor;
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlHumiditySensor : public QmlSensor
+class Q_SENSORSQUICK_EXPORT QmlHumiditySensor : public QmlSensor
{
Q_OBJECT
@@ -39,7 +39,7 @@ private:
QHumiditySensor *m_sensor;
};
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlHumidityReading : public QmlSensorReading
+class Q_SENSORSQUICK_EXPORT QmlHumidityReading : public QmlSensorReading
{
Q_OBJECT
Q_PROPERTY(qreal relativeHumidity READ relativeHumidity
diff --git a/src/sensorsquick/qmlirproximitysensor_p.h b/src/sensorsquick/qmlirproximitysensor_p.h
index 5684641e..b1f97d5d 100644
--- a/src/sensorsquick/qmlirproximitysensor_p.h
+++ b/src/sensorsquick/qmlirproximitysensor_p.h
@@ -21,7 +21,7 @@ QT_BEGIN_NAMESPACE
class QIRProximitySensor;
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlIRProximitySensor : public QmlSensor
+class Q_SENSORSQUICK_EXPORT QmlIRProximitySensor : public QmlSensor
{
Q_OBJECT
QML_NAMED_ELEMENT(IRProximitySensor)
@@ -37,7 +37,7 @@ private:
QmlSensorReading *createReading() const override;
};
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlIRProximitySensorReading : public QmlSensorReading
+class Q_SENSORSQUICK_EXPORT QmlIRProximitySensorReading : public QmlSensorReading
{
Q_OBJECT
Q_PROPERTY(qreal reflectance READ reflectance
diff --git a/src/sensorsquick/qmllidsensor_p.h b/src/sensorsquick/qmllidsensor_p.h
index 2453ac43..1ddf60a9 100644
--- a/src/sensorsquick/qmllidsensor_p.h
+++ b/src/sensorsquick/qmllidsensor_p.h
@@ -20,7 +20,7 @@ QT_BEGIN_NAMESPACE
class QLidSensor;
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlLidSensor : public QmlSensor
+class Q_SENSORSQUICK_EXPORT QmlLidSensor : public QmlSensor
{
Q_OBJECT
QML_NAMED_ELEMENT(LidSensor)
@@ -37,7 +37,7 @@ private:
QLidSensor *m_sensor;
};
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlLidReading : public QmlSensorReading
+class Q_SENSORSQUICK_EXPORT QmlLidReading : public QmlSensorReading
{
Q_OBJECT
Q_PROPERTY(bool backLidClosed READ backLidClosed
diff --git a/src/sensorsquick/qmllightsensor_p.h b/src/sensorsquick/qmllightsensor_p.h
index b9c27fb6..6758ffba 100644
--- a/src/sensorsquick/qmllightsensor_p.h
+++ b/src/sensorsquick/qmllightsensor_p.h
@@ -21,7 +21,7 @@ QT_BEGIN_NAMESPACE
class QLightSensor;
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlLightSensor : public QmlSensor
+class Q_SENSORSQUICK_EXPORT QmlLightSensor : public QmlSensor
{
Q_OBJECT
Q_PROPERTY(qreal fieldOfView READ fieldOfView NOTIFY fieldOfViewChanged)
@@ -42,7 +42,7 @@ private:
QmlSensorReading *createReading() const override;
};
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlLightSensorReading : public QmlSensorReading
+class Q_SENSORSQUICK_EXPORT QmlLightSensorReading : public QmlSensorReading
{
Q_OBJECT
Q_PROPERTY(qreal illuminance READ illuminance
diff --git a/src/sensorsquick/qmlmagnetometer_p.h b/src/sensorsquick/qmlmagnetometer_p.h
index ffd65825..9080f3e7 100644
--- a/src/sensorsquick/qmlmagnetometer_p.h
+++ b/src/sensorsquick/qmlmagnetometer_p.h
@@ -21,7 +21,7 @@ QT_BEGIN_NAMESPACE
class QMagnetometer;
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlMagnetometer : public QmlSensor
+class Q_SENSORSQUICK_EXPORT QmlMagnetometer : public QmlSensor
{
Q_OBJECT
Q_PROPERTY(bool returnGeoValues READ returnGeoValues WRITE setReturnGeoValues NOTIFY returnGeoValuesChanged)
@@ -44,7 +44,7 @@ private:
QmlSensorReading *createReading() const override;
};
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlMagnetometerReading : public QmlSensorReading
+class Q_SENSORSQUICK_EXPORT QmlMagnetometerReading : public QmlSensorReading
{
Q_OBJECT
Q_PROPERTY(qreal x READ x NOTIFY xChanged BINDABLE bindableX)
diff --git a/src/sensorsquick/qmlorientationsensor_p.h b/src/sensorsquick/qmlorientationsensor_p.h
index 3097c448..9be7b7e5 100644
--- a/src/sensorsquick/qmlorientationsensor_p.h
+++ b/src/sensorsquick/qmlorientationsensor_p.h
@@ -22,7 +22,7 @@ QT_BEGIN_NAMESPACE
class QOrientationSensor;
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlOrientationSensor : public QmlSensor
+class Q_SENSORSQUICK_EXPORT QmlOrientationSensor : public QmlSensor
{
Q_OBJECT
QML_NAMED_ELEMENT(OrientationSensor)
@@ -38,7 +38,7 @@ private:
QmlSensorReading *createReading() const override;
};
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlOrientationSensorReading : public QmlSensorReading
+class Q_SENSORSQUICK_EXPORT QmlOrientationSensorReading : public QmlSensorReading
{
Q_OBJECT
Q_PROPERTY(QOrientationReading::Orientation orientation READ orientation
diff --git a/src/sensorsquick/qmlpressuresensor_p.h b/src/sensorsquick/qmlpressuresensor_p.h
index 5c94cf47..8b531fba 100644
--- a/src/sensorsquick/qmlpressuresensor_p.h
+++ b/src/sensorsquick/qmlpressuresensor_p.h
@@ -20,7 +20,7 @@ QT_BEGIN_NAMESPACE
class QPressureSensor;
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlPressureSensor : public QmlSensor
+class Q_SENSORSQUICK_EXPORT QmlPressureSensor : public QmlSensor
{
Q_OBJECT
QML_NAMED_ELEMENT(PressureSensor)
@@ -37,7 +37,7 @@ private:
QPressureSensor *m_sensor;
};
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlPressureReading : public QmlSensorReading
+class Q_SENSORSQUICK_EXPORT QmlPressureReading : public QmlSensorReading
{
Q_OBJECT
Q_PROPERTY(qreal pressure READ pressure NOTIFY pressureChanged BINDABLE bindablePressure)
diff --git a/src/sensorsquick/qmlproximitysensor_p.h b/src/sensorsquick/qmlproximitysensor_p.h
index 570d24c5..8ce4fdb8 100644
--- a/src/sensorsquick/qmlproximitysensor_p.h
+++ b/src/sensorsquick/qmlproximitysensor_p.h
@@ -23,7 +23,7 @@ QT_BEGIN_NAMESPACE
class QProximitySensor;
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlProximitySensor : public QmlSensor
+class Q_SENSORSQUICK_EXPORT QmlProximitySensor : public QmlSensor
{
Q_OBJECT
QML_NAMED_ELEMENT(ProximitySensor)
@@ -39,7 +39,7 @@ private:
QmlSensorReading *createReading() const override;
};
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlProximitySensorReading : public QmlSensorReading
+class Q_SENSORSQUICK_EXPORT QmlProximitySensorReading : public QmlSensorReading
{
Q_OBJECT
Q_PROPERTY(bool near READ near NOTIFY nearChanged BINDABLE bindableNear)
diff --git a/src/sensorsquick/qmlrotationsensor_p.h b/src/sensorsquick/qmlrotationsensor_p.h
index 6699ec17..1ef008b8 100644
--- a/src/sensorsquick/qmlrotationsensor_p.h
+++ b/src/sensorsquick/qmlrotationsensor_p.h
@@ -21,7 +21,7 @@ QT_BEGIN_NAMESPACE
class QRotationSensor;
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlRotationSensor : public QmlSensor
+class Q_SENSORSQUICK_EXPORT QmlRotationSensor : public QmlSensor
{
Q_OBJECT
Q_PROPERTY(bool hasZ READ hasZ NOTIFY hasZChanged)
@@ -42,7 +42,7 @@ private:
QmlSensorReading *createReading() const override;
};
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlRotationSensorReading : public QmlSensorReading
+class Q_SENSORSQUICK_EXPORT QmlRotationSensorReading : public QmlSensorReading
{
Q_OBJECT
Q_PROPERTY(qreal x READ x NOTIFY xChanged BINDABLE bindableX)
diff --git a/src/sensorsquick/qmlsensor.cpp b/src/sensorsquick/qmlsensor.cpp
index 1e375415..d507e919 100644
--- a/src/sensorsquick/qmlsensor.cpp
+++ b/src/sensorsquick/qmlsensor.cpp
@@ -277,6 +277,21 @@ QBindable<QmlSensorReading*> QmlSensor::bindableReading() const
}
/*!
+ \qmlmethod bool Sensor::isFeatureSupported(feature)
+ \since QtSensors 6.7
+ Checks if a specific feature is supported by the backend.
+ Returns \c true if the \a feature is supported, and \c false otherwise.
+ For feature descriptions see \l {QSensor::Feature}.
+
+ Please see QSensor::isFeatureSupported for information.
+*/
+
+bool QmlSensor::isFeatureSupported(Feature feature) const
+{
+ return sensor()->isFeatureSupported(static_cast<QSensor::Feature>(feature));
+}
+
+/*!
\qmlproperty Sensor::AxesOrientationMode Sensor::axesOrientationMode
\since QtSensors 5.1
This property holds the mode that affects how the screen orientation changes reading values.
diff --git a/src/sensorsquick/qmlsensor_p.h b/src/sensorsquick/qmlsensor_p.h
index 6e1460a4..d08d797f 100644
--- a/src/sensorsquick/qmlsensor_p.h
+++ b/src/sensorsquick/qmlsensor_p.h
@@ -22,6 +22,8 @@
#include <QQmlParserStatus>
#include <QtQml/qqml.h>
#include <QQmlListProperty>
+#include <QtSensors/QSensor>
+
#include "qmlsensorrange_p.h"
QT_BEGIN_NAMESPACE
@@ -32,7 +34,7 @@ class QSensorReading;
class QmlSensorReading;
class QmlSensorPrivate;
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlSensor : public QObject, public QQmlParserStatus
+class Q_SENSORSQUICK_EXPORT QmlSensor : public QObject, public QQmlParserStatus
{
Q_OBJECT
Q_DECLARE_PRIVATE(QmlSensor)
@@ -62,6 +64,19 @@ class Q_SENSORSQUICK_PRIVATE_EXPORT QmlSensor : public QObject, public QQmlParse
QML_UNCREATABLE("Cannot create Sensor")
QML_ADDED_IN_VERSION(5,0)
public:
+ // Keep in sync with QSensor::Feature
+ enum Feature : int {
+ Buffering = QSensor::Buffering,
+ AlwaysOn = QSensor::AlwaysOn,
+ GeoValues = QSensor::GeoValues,
+ FieldOfView = QSensor::FieldOfView,
+ AccelerationMode = QSensor::AccelerationMode,
+ SkipDuplicates = QSensor::SkipDuplicates,
+ AxesOrientation = QSensor::AxesOrientation,
+ PressureSensorTemperature = QSensor::PressureSensorTemperature
+ };
+ Q_ENUM(Feature)
+
// Keep in sync with QSensor::AxesOrientationMode
enum AxesOrientationMode {
FixedOrientation,
@@ -105,6 +120,8 @@ public:
QmlSensorReading *reading() const;
QBindable<QmlSensorReading*> bindableReading() const;
+ Q_INVOKABLE Q_REVISION(6, 7) bool isFeatureSupported(Feature feature) const;
+
AxesOrientationMode axesOrientationMode() const;
void setAxesOrientationMode(AxesOrientationMode axesOrientationMode);
@@ -163,7 +180,7 @@ private:
m_reading, nullptr)
};
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlSensorReading : public QObject
+class Q_SENSORSQUICK_EXPORT QmlSensorReading : public QObject
{
Q_OBJECT
Q_PROPERTY(quint64 timestamp READ timestamp NOTIFY timestampChanged BINDABLE bindableTimestamp)
diff --git a/src/sensorsquick/qmlsensorglobal_p.h b/src/sensorsquick/qmlsensorglobal_p.h
index 007a8f2a..8b5214a2 100644
--- a/src/sensorsquick/qmlsensorglobal_p.h
+++ b/src/sensorsquick/qmlsensorglobal_p.h
@@ -24,7 +24,7 @@ QT_BEGIN_NAMESPACE
class QSensor;
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlSensorGlobal : public QObject
+class Q_SENSORSQUICK_EXPORT QmlSensorGlobal : public QObject
{
Q_OBJECT
public:
diff --git a/src/sensorsquick/qmlsensorrange_p.h b/src/sensorsquick/qmlsensorrange_p.h
index e03f9f67..324c24db 100644
--- a/src/sensorsquick/qmlsensorrange_p.h
+++ b/src/sensorsquick/qmlsensorrange_p.h
@@ -21,7 +21,7 @@
QT_BEGIN_NAMESPACE
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlSensorRange : public QObject
+class Q_SENSORSQUICK_EXPORT QmlSensorRange : public QObject
{
Q_OBJECT
Q_PROPERTY(int minimum READ minimum)
@@ -45,7 +45,7 @@ private:
int max;
};
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlSensorOutputRange : public QObject
+class Q_SENSORSQUICK_EXPORT QmlSensorOutputRange : public QObject
{
Q_OBJECT
Q_PROPERTY(qreal minimum READ minimum)
diff --git a/src/sensorsquick/qmltapsensor_p.h b/src/sensorsquick/qmltapsensor_p.h
index 3bb25812..7537c5db 100644
--- a/src/sensorsquick/qmltapsensor_p.h
+++ b/src/sensorsquick/qmltapsensor_p.h
@@ -22,7 +22,7 @@ QT_BEGIN_NAMESPACE
class QTapSensor;
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlTapSensor : public QmlSensor
+class Q_SENSORSQUICK_EXPORT QmlTapSensor : public QmlSensor
{
Q_OBJECT
Q_PROPERTY(bool returnDoubleTapEvents READ returnDoubleTapEvents WRITE setReturnDoubleTapEvents NOTIFY returnDoubleTapEventsChanged)
@@ -45,7 +45,7 @@ private:
QmlSensorReading *createReading() const override;
};
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlTapSensorReading : public QmlSensorReading
+class Q_SENSORSQUICK_EXPORT QmlTapSensorReading : public QmlSensorReading
{
Q_OBJECT
Q_PROPERTY(QTapReading::TapDirection tapDirection READ tapDirection
diff --git a/src/sensorsquick/qmltiltsensor_p.h b/src/sensorsquick/qmltiltsensor_p.h
index c86866a3..d660229d 100644
--- a/src/sensorsquick/qmltiltsensor_p.h
+++ b/src/sensorsquick/qmltiltsensor_p.h
@@ -22,7 +22,7 @@ QT_BEGIN_NAMESPACE
class QTiltSensor;
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlTiltSensor : public QmlSensor
+class Q_SENSORSQUICK_EXPORT QmlTiltSensor : public QmlSensor
{
Q_OBJECT
QML_NAMED_ELEMENT(TiltSensor)
@@ -40,7 +40,7 @@ private:
QmlSensorReading *createReading() const override;
};
-class Q_SENSORSQUICK_PRIVATE_EXPORT QmlTiltSensorReading : public QmlSensorReading
+class Q_SENSORSQUICK_EXPORT QmlTiltSensorReading : public QmlSensorReading
{
Q_OBJECT
Q_PROPERTY(qreal yRotation READ yRotation NOTIFY yRotationChanged BINDABLE bindableYRotation)
diff --git a/src/sensorsquick/qsensorsquickglobal_p.h b/src/sensorsquick/qsensorsquickglobal_p.h
index 91c41c54..4826ed82 100644
--- a/src/sensorsquick/qsensorsquickglobal_p.h
+++ b/src/sensorsquick/qsensorsquickglobal_p.h
@@ -16,8 +16,8 @@
//
#include <QtCore/qglobal.h>
-#include <QtSensorsQuick/private/qtsensorsquickexports_p.h>
+#include <QtSensorsQuick/qtsensorsquickexports.h>
-void Q_SENSORSQUICK_PRIVATE_EXPORT qml_register_types_QtSensors();
+void Q_SENSORSQUICK_EXPORT qml_register_types_QtSensors();
#endif // QSENSORSQUICKGLOBALS_P_H
diff --git a/sync.profile b/sync.profile
deleted file mode 100644
index 2839a357..00000000
--- a/sync.profile
+++ /dev/null
@@ -1,6 +0,0 @@
-%modules = ( # path to module name map
- "QtSensors" => "$basedir/src/sensors",
- "QtSensorsQuick" => "$basedir/src/sensorsquick",
-);
-%moduleheaders = ( # restrict the module headers to those found in relative path
-);
diff --git a/tests/auto/common/test_backends.cpp b/tests/auto/common/test_backends.cpp
index ca8be3d8..92e69bb3 100644
--- a/tests/auto/common/test_backends.cpp
+++ b/tests/auto/common/test_backends.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore/QList>
#include <QtCore/QMap>
diff --git a/tests/auto/common/test_backends.h b/tests/auto/common/test_backends.h
index 1aff64e5..06d827b7 100644
--- a/tests/auto/common/test_backends.h
+++ b/tests/auto/common/test_backends.h
@@ -1,5 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TEST_BACKENDS_H
#define TEST_BACKENDS_H
@@ -36,6 +36,7 @@ void set_test_backend_busy(QSensor* sensor, bool busy);
SensorClass ## _impl(QSensor *sensor);\
void start() override;\
void stop() override;\
+ bool isFeatureSupported(QSensor::Feature feature) const override;\
};\
class SensorClass ## _testfilter : public FilterClass { bool filter(ReadingClass *) override; };
@@ -47,6 +48,11 @@ void set_test_backend_busy(QSensor* sensor, bool busy);
newReadingAvailable();\
}\
void SensorClass ##_impl::stop() {}\
+ bool SensorClass ##_impl::isFeatureSupported(QSensor::Feature feature) const { \
+ if (feature == QSensor::Feature::SkipDuplicates) \
+ return true; \
+ return false; \
+ } \
bool SensorClass ## _testfilter::filter(ReadingClass *) { return true; }\
static QSensorBackend *create_ ## SensorClass ## _impl(QSensor *sensor) { return new SensorClass ## _impl(sensor); }\
static bool registered_ ## SensorClass = registerTestBackend(#SensorClass, create_ ## SensorClass ## _impl);
diff --git a/tests/auto/qml/qml_cpp/tst_sensors_qmlcpp.cpp b/tests/auto/qml/qml_cpp/tst_sensors_qmlcpp.cpp
index 9a6fdf35..32d82348 100644
--- a/tests/auto/qml/qml_cpp/tst_sensors_qmlcpp.cpp
+++ b/tests/auto/qml/qml_cpp/tst_sensors_qmlcpp.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtTest/QtTest>
#include <QtTest/QSignalSpy>
diff --git a/tests/auto/qml/qml_quick/tst_sensors_basic.qml b/tests/auto/qml/qml_quick/tst_sensors_basic.qml
index 687382ee..bcb21232 100644
--- a/tests/auto/qml/qml_quick/tst_sensors_basic.qml
+++ b/tests/auto/qml/qml_quick/tst_sensors_basic.qml
@@ -1,5 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtTest
import QtSensors
@@ -201,4 +201,26 @@ TestCase {
{tag: "IRProximitySensor", initialReading: {reflectance: 0.5}, newReading: {reflectance: 0.6}}
];
}
+
+ function test_SupportedFeatures()
+ {
+ var sensor = Qt.createQmlObject("import QtSensors; Accelerometer \
+ {identifier: \"QAccelerometer\"}",
+ testCase);
+ verify(sensor.start())
+ verify(sensor.connectedToBackend)
+
+ // According to isFeatureSupported() override implementation in test_backends.h,
+ // only SkipDuplicates should be supported afterwards
+ verify(!sensor.isFeatureSupported(Sensor.Buffering))
+ verify(!sensor.isFeatureSupported(Sensor.AlwaysOn))
+ verify(!sensor.isFeatureSupported(Sensor.GeoValues))
+ verify(!sensor.isFeatureSupported(Sensor.FieldOfView))
+ verify(!sensor.isFeatureSupported(Sensor.AccelerationMode))
+ verify(sensor.isFeatureSupported(Sensor.SkipDuplicates))
+ verify(!sensor.isFeatureSupported(Sensor.AxesOrientation))
+ verify(!sensor.isFeatureSupported(Sensor.PressureSensorTemperature))
+
+ sensor.destroy()
+ }
}
diff --git a/tests/auto/qml/qml_quick/tst_sensors_qmlquick.cpp b/tests/auto/qml/qml_quick/tst_sensors_qmlquick.cpp
index 302843fb..08bba9a5 100644
--- a/tests/auto/qml/qml_quick/tst_sensors_qmlquick.cpp
+++ b/tests/auto/qml/qml_quick/tst_sensors_qmlquick.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtQuickTest>
#include <QtQml/QQmlEngine>
diff --git a/tests/auto/qsensor/test_sensor.cpp b/tests/auto/qsensor/test_sensor.cpp
index 30e390f6..3c36b595 100644
--- a/tests/auto/qsensor/test_sensor.cpp
+++ b/tests/auto/qsensor/test_sensor.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "test_sensor.h"
#include "test_sensor_p.h"
diff --git a/tests/auto/qsensor/test_sensor.h b/tests/auto/qsensor/test_sensor.h
index ed5a7482..f75db083 100644
--- a/tests/auto/qsensor/test_sensor.h
+++ b/tests/auto/qsensor/test_sensor.h
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TEST_SENSOR_H
#define TEST_SENSOR_H
diff --git a/tests/auto/qsensor/test_sensor2.cpp b/tests/auto/qsensor/test_sensor2.cpp
index 6c1b2e0a..e72c62d2 100644
--- a/tests/auto/qsensor/test_sensor2.cpp
+++ b/tests/auto/qsensor/test_sensor2.cpp
@@ -1,31 +1,9 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "test_sensor2.h"
#include "test_sensor2_p.h"
-#undef IMPLEMENT_READING
-#undef IMPLEMENT_READING_D
-
-#define IMPLEMENT_READING(classname)\
- IMPLEMENT_READING_D(classname, classname ## Private)
-
-#define IMPLEMENT_READING_D(classname, pclassname)\
- classname::classname(QObject *parent)\
- : QSensorReading(parent, new pclassname)\
- , d(d_ptr())\
- {}\
- classname::~classname() {}\
- void classname::copyValuesFrom(QSensorReading *_other)\
- {\
- /* No need to verify types, only called by QSensorBackend */\
- classname *other = static_cast<classname *>(_other);\
- pclassname *my_ptr = static_cast<pclassname*>(d_ptr()->data());\
- pclassname *other_ptr = static_cast<pclassname*>(other->d_ptr()->data());\
- /* Do a direct copy of the private class */\
- *(my_ptr) = *(other_ptr);\
- }
-
IMPLEMENT_READING(TestSensor2Reading)
int TestSensor2Reading::test() const
diff --git a/tests/auto/qsensor/test_sensor2.h b/tests/auto/qsensor/test_sensor2.h
index 83d1926f..c5716001 100644
--- a/tests/auto/qsensor/test_sensor2.h
+++ b/tests/auto/qsensor/test_sensor2.h
@@ -1,43 +1,11 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TEST_SENSOR2_H
#define TEST_SENSOR2_H
#include "qsensor.h"
-#undef DECLARE_READING
-#undef DECLARE_READING_D
-
-template <typename T>
-class qTypedWrapper
-{
-public:
- qTypedWrapper(QScopedPointer<QSensorReadingPrivate> *_ptr)
- : ptr(_ptr)
- {
- }
-
- T *operator->() const
- {
- return static_cast<T*>(ptr->data());
- }
-
-private:
- QScopedPointer<QSensorReadingPrivate> *ptr;
-};
-
-#define DECLARE_READING(classname)\
- DECLARE_READING_D(classname, classname ## Private)
-
-#define DECLARE_READING_D(classname, pclassname)\
- public:\
- classname(QObject *parent = 0);\
- virtual ~classname();\
- void copyValuesFrom(QSensorReading *other) override;\
- private:\
- qTypedWrapper<pclassname> d;
-
class TestSensor2ReadingPrivate;
class TestSensor2Reading : public QSensorReading
diff --git a/tests/auto/qsensor/test_sensor2_p.h b/tests/auto/qsensor/test_sensor2_p.h
index 31f10eb3..8ad4e495 100644
--- a/tests/auto/qsensor/test_sensor2_p.h
+++ b/tests/auto/qsensor/test_sensor2_p.h
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TEST_SENSOR2_P_H
#define TEST_SENSOR2_P_H
diff --git a/tests/auto/qsensor/test_sensor2impl.cpp b/tests/auto/qsensor/test_sensor2impl.cpp
index 10b0a04b..795b1a00 100644
--- a/tests/auto/qsensor/test_sensor2impl.cpp
+++ b/tests/auto/qsensor/test_sensor2impl.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "test_sensor2impl.h"
#include <qaccelerometer.h>
diff --git a/tests/auto/qsensor/test_sensor2impl.h b/tests/auto/qsensor/test_sensor2impl.h
index 80711470..269d1184 100644
--- a/tests/auto/qsensor/test_sensor2impl.h
+++ b/tests/auto/qsensor/test_sensor2impl.h
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TEST_SENSOR2IMPL_H
#define TEST_SENSOR2IMPL_H
diff --git a/tests/auto/qsensor/test_sensor_p.h b/tests/auto/qsensor/test_sensor_p.h
index 0ab4268a..9737e292 100644
--- a/tests/auto/qsensor/test_sensor_p.h
+++ b/tests/auto/qsensor/test_sensor_p.h
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TEST_SENSOR_P_H
#define TEST_SENSOR_P_H
diff --git a/tests/auto/qsensor/test_sensorimpl.cpp b/tests/auto/qsensor/test_sensorimpl.cpp
index 8e8e33f9..206b1786 100644
--- a/tests/auto/qsensor/test_sensorimpl.cpp
+++ b/tests/auto/qsensor/test_sensorimpl.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "test_sensorimpl.h"
#include <QDebug>
diff --git a/tests/auto/qsensor/test_sensorimpl.h b/tests/auto/qsensor/test_sensorimpl.h
index ed353e7d..9d52e33f 100644
--- a/tests/auto/qsensor/test_sensorimpl.h
+++ b/tests/auto/qsensor/test_sensorimpl.h
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef TEST_SENSORIMPL_H
#define TEST_SENSORIMPL_H
diff --git a/tests/auto/qsensor/test_sensorplugin.cpp b/tests/auto/qsensor/test_sensorplugin.cpp
index dd5a4466..1734d3a9 100644
--- a/tests/auto/qsensor/test_sensorplugin.cpp
+++ b/tests/auto/qsensor/test_sensorplugin.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "test_sensorimpl.h"
#include "test_sensor2impl.h"
diff --git a/tests/auto/qsensor/tst_qsensor.cpp b/tests/auto/qsensor/tst_qsensor.cpp
index 528fca31..261f81f9 100644
--- a/tests/auto/qsensor/tst_qsensor.cpp
+++ b/tests/auto/qsensor/tst_qsensor.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
//TESTED_COMPONENT=src/sensors
diff --git a/tests/manual/CMakeLists.txt b/tests/manual/CMakeLists.txt
index a23fbcd8..8686f854 100644
--- a/tests/manual/CMakeLists.txt
+++ b/tests/manual/CMakeLists.txt
@@ -2,8 +2,9 @@
# SPDX-License-Identifier: BSD-3-Clause
if(TARGET Qt::Widgets)
- add_subdirectory(sensor_explorer)
+ add_subdirectory(sensor_explorer_widgets)
endif()
if (TARGET Qt::Quick)
add_subdirectory(sensorclerk)
+ add_subdirectory(sensor_explorer_qml)
endif()
diff --git a/tests/manual/sensor_explorer_qml/CMakeLists.txt b/tests/manual/sensor_explorer_qml/CMakeLists.txt
new file mode 100644
index 00000000..e68fce62
--- /dev/null
+++ b/tests/manual/sensor_explorer_qml/CMakeLists.txt
@@ -0,0 +1,32 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(tst_manual_sensor_explorer_qml LANGUAGES CXX)
+
+set(CMAKE_AUTOMOC ON)
+
+find_package(Qt6 REQUIRED COMPONENTS Qml Quick Sensors)
+
+qt_add_executable(tst_manual_sensor_explorer_qml
+ main.cpp
+ sensormodels.cpp sensormodels.h
+)
+
+set_target_properties(tst_manual_sensor_explorer_qml PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(tst_manual_sensor_explorer_qml PUBLIC
+ Qt::Qml
+ Qt::Quick
+ Qt::Sensors
+)
+
+qt_add_qml_module(tst_manual_sensor_explorer_qml
+ URI SensorModels
+ VERSION 1.0
+ QML_FILES sensor_explorer.qml
+ NO_RESOURCE_TARGET_PATH
+)
diff --git a/examples/sensors/sensor_explorer/main.cpp b/tests/manual/sensor_explorer_qml/main.cpp
index 4eeaa147..604a6d36 100644
--- a/examples/sensors/sensor_explorer/main.cpp
+++ b/tests/manual/sensor_explorer_qml/main.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtQml>
#include <QtQuick/QQuickWindow>
diff --git a/examples/sensors/sensor_explorer/qml.qrc b/tests/manual/sensor_explorer_qml/qml.qrc
index df6160ae..df6160ae 100644
--- a/examples/sensors/sensor_explorer/qml.qrc
+++ b/tests/manual/sensor_explorer_qml/qml.qrc
diff --git a/examples/sensors/sensor_explorer/sensor_explorer.qml b/tests/manual/sensor_explorer_qml/sensor_explorer.qml
index 9fe59baa..e80fb0a4 100644
--- a/examples/sensors/sensor_explorer/sensor_explorer.qml
+++ b/tests/manual/sensor_explorer_qml/sensor_explorer.qml
@@ -1,14 +1,12 @@
// Copyright (C) 2021 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.Window
import QtQuick.Controls
import QtQuick.Layouts
-//! [0]
import SensorModels
-//! [0]
Window {
id: window
@@ -74,14 +72,11 @@ Window {
}
}
- //! [1]
SensorPropertyModel {
id: propertyModel
sensor: availableSensorsModel.get(sensorsView.currentIndex)
}
- //! [1]
- //! [2]
Button {
id: activateButton
Layout.preferredHeight: 30
@@ -92,7 +87,6 @@ Window {
: qsTr("Activate sensor"))
onClicked: propertyModel.sensor.active = !propertyModel.sensor.active
}
- //! [2]
GroupBox {
title: qsTr("Selected sensor's properties")
@@ -101,7 +95,6 @@ Window {
Layout.margins: 2
enabled: sensorsView.currentIndex != -1
- //! [3]
TableView {
id: propertyView
anchors.fill: parent
@@ -121,7 +114,6 @@ Window {
}
}
}
- //! [3]
}
}
}
diff --git a/examples/sensors/sensor_explorer/sensormodels.cpp b/tests/manual/sensor_explorer_qml/sensormodels.cpp
index f9ed4d90..36de4412 100644
--- a/examples/sensors/sensor_explorer/sensormodels.cpp
+++ b/tests/manual/sensor_explorer_qml/sensormodels.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "sensormodels.h"
#include "qsensor.h"
@@ -51,7 +51,6 @@ AvailableSensorsModel::AvailableSensorsModel(QObject* parent) : QAbstractListMod
*/
void AvailableSensorsModel::loadSensors()
{
- //! [0]
beginResetModel();
m_availableSensors.clear();
@@ -66,7 +65,6 @@ void AvailableSensorsModel::loadSensors()
}
}
endResetModel();
- //! [0]
}
int AvailableSensorsModel::rowCount(const QModelIndex&) const
@@ -74,14 +72,12 @@ int AvailableSensorsModel::rowCount(const QModelIndex&) const
return m_availableSensors.size();
}
-//! [1]
QVariant AvailableSensorsModel::data(const QModelIndex &index, int role) const
{
if (role != Qt::DisplayRole)
return QVariant();
return QVariant::fromValue<QSensor*>(m_availableSensors.at(index.row()));
}
-//! [1]
QSensor* AvailableSensorsModel::get(int index) const
{
@@ -134,7 +130,6 @@ void SensorPropertyModel::setSensor(QSensor *sensor)
// available sensors without knowing their properties in advance / compile-time.
// 1. Read properties of the 'reading' object if available
- //! [2]
int firstProperty = QSensorReading::staticMetaObject.propertyOffset();
QSensorReading *reading = m_sensor->reading();
if (reading) {
@@ -145,7 +140,6 @@ void SensorPropertyModel::setSensor(QSensor *sensor)
(name, reading->property(name).toByteArray()));
}
}
- //! [2]
// 2. Read properties of the 'sensor' object
const QMetaObject *mo1 = m_sensor->metaObject();
diff --git a/examples/sensors/sensor_explorer/sensormodels.h b/tests/manual/sensor_explorer_qml/sensormodels.h
index 02de2a8e..4f16d6fd 100644
--- a/examples/sensors/sensor_explorer/sensormodels.h
+++ b/tests/manual/sensor_explorer_qml/sensormodels.h
@@ -1,5 +1,5 @@
// Copyright (C) 2017 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QSEONSOREXPLORER_H
#define QSEONSOREXPLORER_H
@@ -12,12 +12,10 @@
QT_BEGIN_NAMESPACE
-//! [0]
class AvailableSensorsModel: public QAbstractListModel
{
Q_OBJECT
QML_ELEMENT
-//! [0]
public:
explicit AvailableSensorsModel(QObject* parent = nullptr);
int rowCount(const QModelIndex & = QModelIndex()) const override;
diff --git a/tests/manual/sensor_explorer/CMakeLists.txt b/tests/manual/sensor_explorer_widgets/CMakeLists.txt
index 2f32dc91..357eb02e 100644
--- a/tests/manual/sensor_explorer/CMakeLists.txt
+++ b/tests/manual/sensor_explorer_widgets/CMakeLists.txt
@@ -5,7 +5,7 @@
## sensor_explorer Binary:
#####################################################################
-qt_internal_add_manual_test(tst_manual_sensor_explorer
+qt_internal_add_manual_test(tst_manual_sensor_explorer_widgets
GUI
SOURCES
explorer.cpp explorer.h explorer.ui
diff --git a/tests/manual/sensor_explorer/explorer.cpp b/tests/manual/sensor_explorer_widgets/explorer.cpp
index e6353c01..16a4582b 100644
--- a/tests/manual/sensor_explorer/explorer.cpp
+++ b/tests/manual/sensor_explorer_widgets/explorer.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "explorer.h"
#include <QTimer>
diff --git a/tests/manual/sensor_explorer/explorer.h b/tests/manual/sensor_explorer_widgets/explorer.h
index 92aa6f47..05e200f3 100644
--- a/tests/manual/sensor_explorer/explorer.h
+++ b/tests/manual/sensor_explorer_widgets/explorer.h
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef EXPLORER_H
#define EXPLORER_H
diff --git a/tests/manual/sensor_explorer/explorer.ui b/tests/manual/sensor_explorer_widgets/explorer.ui
index 166e9c36..166e9c36 100644
--- a/tests/manual/sensor_explorer/explorer.ui
+++ b/tests/manual/sensor_explorer_widgets/explorer.ui
diff --git a/tests/manual/sensor_explorer/main.cpp b/tests/manual/sensor_explorer_widgets/main.cpp
index 0e2ea93d..005ec17d 100644
--- a/tests/manual/sensor_explorer/main.cpp
+++ b/tests/manual/sensor_explorer_widgets/main.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include "explorer.h"
diff --git a/tests/manual/sensorclerk/collector.cpp b/tests/manual/sensorclerk/collector.cpp
index 1a8ab457..4ebc7203 100644
--- a/tests/manual/sensorclerk/collector.cpp
+++ b/tests/manual/sensorclerk/collector.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2017 Lorn Potter.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtQml/qqml.h>
#include <QtCore/QFile>
diff --git a/tests/manual/sensorclerk/collector.h b/tests/manual/sensorclerk/collector.h
index 25cd2373..0f1098c9 100644
--- a/tests/manual/sensorclerk/collector.h
+++ b/tests/manual/sensorclerk/collector.h
@@ -1,5 +1,5 @@
// Copyright (C) 2017 Lorn Potter.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef COLLECTOR_H
#define COLLECTOR_H
diff --git a/tests/manual/sensorclerk/main.cpp b/tests/manual/sensorclerk/main.cpp
index 19028e9f..468f1d88 100644
--- a/tests/manual/sensorclerk/main.cpp
+++ b/tests/manual/sensorclerk/main.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2017 Lorn Potter.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QGuiApplication>
#include <QtQuick/QQuickView>
diff --git a/tests/manual/sensorclerk/qml/main.qml b/tests/manual/sensorclerk/qml/main.qml
index a7c5cd88..0853599c 100644
--- a/tests/manual/sensorclerk/qml/main.qml
+++ b/tests/manual/sensorclerk/qml/main.qml
@@ -1,5 +1,5 @@
// Copyright (C) 2017 Lorn Potter.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.Controls
import Collector