diff options
author | Marc Mutz <marc.mutz@qt.io> | 2023-08-11 15:36:59 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-08-17 13:02:52 +0000 |
commit | 1cea6020ebd3395f227ae085a3712dbc171dd983 (patch) | |
tree | dbe62b8f61d3313f57138293330f5f27345531db /src | |
parent | e166658ce46bb534472d321dc6cbd6b74a7359f3 (diff) |
QBluetoothUuid: inline converting ctor from QUuid
It really shouldn't be out-of-line. We should allow the compiler to
see it as the no-op that it is.
As a drive-by, pre-program the signature to pass by value come Qt 7,
fixing a Clazy warning. We could already do it now, but since T and
const T& don't overload, we'd have to take out the QT6_NEW_OVERLOAD
bazooka, and it's not really worth it. When the code is inline, the
compiler can see through the pass-by-reference overhead and avoid
allocating the argument on the stack.
Change-Id: Ic708bb9b2cacd4df22313b704de557dbda4d28fa
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 6bbf186d135e731e3c7b84a0c3cf9e74c946d32d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/bluetooth/qbluetoothuuid.cpp | 6 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothuuid.h | 11 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/bluetooth/qbluetoothuuid.cpp b/src/bluetooth/qbluetoothuuid.cpp index 608658ef..4f7f8b93 100644 --- a/src/bluetooth/qbluetoothuuid.cpp +++ b/src/bluetooth/qbluetoothuuid.cpp @@ -592,12 +592,10 @@ QBluetoothUuid::QBluetoothUuid(const QString &uuid) } /*! + \fn QBluetoothUuid::QBluetoothUuid(const QUuid &uuid) + Constructs a new Bluetooth UUID that is a copy of \a uuid. */ -QBluetoothUuid::QBluetoothUuid(const QUuid &uuid) -: QUuid(uuid) -{ -} /*! Returns the minimum size in bytes that this UUID can be represented in. For non-null UUIDs 2, diff --git a/src/bluetooth/qbluetoothuuid.h b/src/bluetooth/qbluetoothuuid.h index 9e087d76..1eaf7808 100644 --- a/src/bluetooth/qbluetoothuuid.h +++ b/src/bluetooth/qbluetoothuuid.h @@ -360,7 +360,8 @@ public: : QUuid(uuid, order) {}; explicit QBluetoothUuid(const QString &uuid); QBluetoothUuid(const QBluetoothUuid &uuid) = default; - QBluetoothUuid(const QUuid &uuid); + QT_BLUETOOTH_INLINE_SINCE(6, 6) + QBluetoothUuid(QUuid QT6_ONLY(const &)uuid); ~QBluetoothUuid() = default; QBluetoothUuid &operator=(const QBluetoothUuid &other) = default; @@ -399,6 +400,14 @@ public: static QString descriptorToString(DescriptorType uuid); }; +#if QT_BLUETOOTH_INLINE_IMPL_SINCE(6, 6) +QBluetoothUuid::QBluetoothUuid(QUuid QT6_ONLY(const &)uuid) + : QUuid(uuid) +{ +} +#endif + + #ifndef QT_NO_DATASTREAM inline QDataStream &operator<<(QDataStream &s, const QBluetoothUuid &uuid) { |