diff options
author | Juha Vuolle <juha.vuolle@insta.fi> | 2021-01-05 14:27:16 +0200 |
---|---|---|
committer | Juha Vuolle <juha.vuolle@insta.fi> | 2021-04-19 13:29:44 +0300 |
commit | 5a8aa096dc61336ac95734e8cc61f106e359c865 (patch) | |
tree | 20b1c3f3932b48bb6020a3d40d0dacf1abc6be2d /src/sensors | |
parent | 7dbb79c428f813e32986ccfe09a42f7d61a4c005 (diff) |
Base commit to make QtSensors runnable on Windows
Fair amount of work remains after the commit still, but this should
allow further development as a compilable baseline: code compiles,
autotests pass, and most example applications at least start.
The changes:
-Change examples to use QtQuickControls 2 as per removal of v1
-Fix ambiguous conditional expression compilation error
-Link against runtimeobject library (previously part of winrt QPA?)
-Change the .pro file rule to win32 as winrt moniker does not exist anymore
-Remove references to deleted winrt event dispatcher
-Fix error handling: getdefault may be successful even if there is no default sensor
-Fix QCOMPARE failure output (toString has changed in Qt6)
-Remove qtimestamp alias which was deprecated already in Qt5
-Remove unit test hook that does not seem to be used anywhere
-From typedef to ‘using’ for readability
-Q_ENUMS -> Q_ENUM as the former has been obsoleted by the latter
-Add qt6 changes qdoc page
Task-number: QTBUG-88616
Change-Id: I92c168228ba76106b2c636c88f54331c76c3d2e6
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/sensors')
-rw-r--r-- | src/sensors/doc/src/qt6-changes.qdoc | 55 | ||||
-rw-r--r-- | src/sensors/qsensor.h | 14 | ||||
-rw-r--r-- | src/sensors/qsensor_p.h | 2 |
3 files changed, 62 insertions, 9 deletions
diff --git a/src/sensors/doc/src/qt6-changes.qdoc b/src/sensors/doc/src/qt6-changes.qdoc new file mode 100644 index 00000000..e4447a2f --- /dev/null +++ b/src/sensors/doc/src/qt6-changes.qdoc @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \page qtsensors-changes-qt6.html + \title Changes to Qt Sensors + \ingroup changes-qt-5-to-6 + \brief Migrate Qt Sensors to Qt 6. + + Qt 6 is a result of the conscious effort to make the framework more + efficient and easy to use. + + We try to maintain binary and source compatibility for all the public + APIs in each release. But some changes were inevitable in an effort to + make Qt a better framework. + + In this topic we summarize those changes in Qt Sensors, and provide + guidance to handle them. + + \section1 Platform notes + + On Windows the Qt6 does not support the UWP (Universal Windows Platform) + any longer. As such the QtSensors now builds on the Win32 + + \section1 API changes + + \section2 Deleted typedef for qtimestamp + + The typedef for the historical, QtMobility-era, 'qtimestamp' has been + removed. Use the actual type 'quint64' directly. +*/ diff --git a/src/sensors/qsensor.h b/src/sensors/qsensor.h index 7dd7ea19..c988a661 100644 --- a/src/sensors/qsensor.h +++ b/src/sensors/qsensor.h @@ -56,26 +56,22 @@ class QSensorReading; class QSensorReadingPrivate; class QSensorFilter; -// This type is no longer used in the API but third party apps may be using it -typedef quint64 qtimestamp; +using qrange = QPair<int,int>; +using qrangelist = QList<qrange>; -typedef QPair<int,int> qrange; -typedef QList<qrange> qrangelist; struct qoutputrange { qreal minimum; qreal maximum; qreal accuracy; }; -typedef QList<qoutputrange> qoutputrangelist; + +using qoutputrangelist = QList<qoutputrange>; class Q_SENSORS_EXPORT QSensor : public QObject { friend class QSensorBackend; - Q_OBJECT - Q_ENUMS(Feature) - Q_ENUMS(AxesOrientationMode) Q_PROPERTY(QByteArray identifier READ identifier WRITE setIdentifier) Q_PROPERTY(QByteArray type READ type) Q_PROPERTY(bool connectedToBackend READ isConnectedToBackend) @@ -108,6 +104,7 @@ public: PressureSensorTemperature, Reserved = 257 // Make sure at least 2 bytes are used for the enum to avoid breaking BC later }; + Q_ENUM(Feature) // Keep in sync with QmlSensor::AxesOrientationMode enum AxesOrientationMode { @@ -115,6 +112,7 @@ public: AutomaticOrientation, UserOrientation }; + Q_ENUM(AxesOrientationMode) explicit QSensor(const QByteArray &type, QObject *parent = Q_NULLPTR); virtual ~QSensor(); diff --git a/src/sensors/qsensor_p.h b/src/sensors/qsensor_p.h index f3e41e4d..5d4fff0f 100644 --- a/src/sensors/qsensor_p.h +++ b/src/sensors/qsensor_p.h @@ -77,7 +77,7 @@ public: , error(0) , alwaysOn(false) , skipDuplicates(false) - , axesOrientationMode(QSensor::FixedOrientation) + , axesOrientationMode(QSensor::AxesOrientationMode::FixedOrientation) , currentOrientation(0) , userOrientation(0) , bufferSize(1) |