summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2023-05-22 10:09:51 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2023-05-23 08:46:24 +0200
commit03e3391929a7d754c57f2ed0e8e5941946827932 (patch)
tree24d10afa53c79413accbb92985317199159fd417 /src
parent2254bb455f90351e59ebad7ee41a2b83b88fd223 (diff)
Follow up on change to QUuid in qtbase
The unit test fails to build without allowing a QBluetoothUuid to be created explicitly from an 128-bit integer. Since the constructor taking a quint128 has been removed from Qt 6.6, and since the constructor from QUuid is explicit, we need to add a constructor from the QUuid::Id128Bytes union type. To avoid that QtCore/qtypes.h declares the quint128 typedef we have to include all the headers that qtypes.h includes into removed_api.cpp before undefining the __SIZEOF_INT128__ symbol. Change-Id: If857faefc253dbbe6cf91bd13bdc31f31cdfb54e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/bluetooth/qbluetoothuuid.cpp7
-rw-r--r--src/bluetooth/qbluetoothuuid.h2
-rw-r--r--src/bluetooth/removed_api.cpp4
3 files changed, 12 insertions, 1 deletions
diff --git a/src/bluetooth/qbluetoothuuid.cpp b/src/bluetooth/qbluetoothuuid.cpp
index 8286f86b..47761e52 100644
--- a/src/bluetooth/qbluetoothuuid.cpp
+++ b/src/bluetooth/qbluetoothuuid.cpp
@@ -525,6 +525,13 @@ Q_CONSTRUCTOR_FUNCTION(registerQBluetoothUuid)
*/
/*!
+ \fn QBluetoothUuid::QBluetoothUuid(QUuid::Id128Bytes uuid)
+
+ Constructs a new Bluetooth UUID from the 128 bit \a uuid represented
+ by \l QUuid::Id128Bytes struct.
+*/
+
+/*!
Creates a QBluetoothUuid object from the string \a uuid,
which must be formatted as five hex fields separated by '-',
e.g., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where 'x' is a hex digit.
diff --git a/src/bluetooth/qbluetoothuuid.h b/src/bluetooth/qbluetoothuuid.h
index 0978780d..43fbff5c 100644
--- a/src/bluetooth/qbluetoothuuid.h
+++ b/src/bluetooth/qbluetoothuuid.h
@@ -351,6 +351,8 @@ public:
explicit constexpr QBluetoothUuid(quint32 uuid) noexcept
: QUuid(uuid, 0x0, 0x1000, 0x80, 0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb) {};
+ explicit QBluetoothUuid(QUuid::Id128Bytes uuid) noexcept
+ : QUuid(uuid) {};
explicit QBluetoothUuid(const QString &uuid);
QBluetoothUuid(const QBluetoothUuid &uuid) = default;
QBluetoothUuid(const QUuid &uuid);
diff --git a/src/bluetooth/removed_api.cpp b/src/bluetooth/removed_api.cpp
index a71b3912..96aa8ef1 100644
--- a/src/bluetooth/removed_api.cpp
+++ b/src/bluetooth/removed_api.cpp
@@ -2,7 +2,9 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#define QT_BLUETOOTH_BUILD_REMOVED_API
-#include <stddef.h> // before we undef __SIZEOF_INT128__
+// before we undef __SIZEOF_INT128__
+#include <cstddef>
+#include <cstdint>
#ifdef __SIZEOF_INT128__
// ensure QtCore/qtypes.h doesn't define quint128