diff options
-rw-r--r-- | src/bluetooth/qbluetoothlocaldevice_p.cpp | 6 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothlocaldevice_p.h | 29 | ||||
-rw-r--r-- | tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp | 4 |
3 files changed, 12 insertions, 27 deletions
diff --git a/src/bluetooth/qbluetoothlocaldevice_p.cpp b/src/bluetooth/qbluetoothlocaldevice_p.cpp index b93de6a9..793a8311 100644 --- a/src/bluetooth/qbluetoothlocaldevice_p.cpp +++ b/src/bluetooth/qbluetoothlocaldevice_p.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent) : QObject(parent), - d_ptr(nullptr) + d_ptr(new QBluetoothLocalDevicePrivate(this, QBluetoothAddress())) { #if !defined(QT_IOS_BLUETOOTH) && !defined(QT_WINRT_BLUETOOTH) printDummyWarning(); @@ -57,9 +57,9 @@ QBluetoothLocalDevice::QBluetoothLocalDevice(QObject *parent) : registerQBluetoothLocalDeviceMetaType(); } -QBluetoothLocalDevice::QBluetoothLocalDevice(const QBluetoothAddress &, QObject *parent) : +QBluetoothLocalDevice::QBluetoothLocalDevice(const QBluetoothAddress &address, QObject *parent) : QObject(parent), - d_ptr(nullptr) + d_ptr(new QBluetoothLocalDevicePrivate(this, address)) { registerQBluetoothLocalDeviceMetaType(); } diff --git a/src/bluetooth/qbluetoothlocaldevice_p.h b/src/bluetooth/qbluetoothlocaldevice_p.h index 89dbf9a3..98c62151 100644 --- a/src/bluetooth/qbluetoothlocaldevice_p.h +++ b/src/bluetooth/qbluetoothlocaldevice_p.h @@ -208,37 +208,22 @@ private: void initializeAdapter(); void initializeAdapterBluez5(); }; -#elif defined(QT_WINRT_BLUETOOTH) +#elif !defined(QT_OSX_BLUETOOTH) // winrt and dummy backend class QBluetoothLocalDevicePrivate : public QObject { public: - QBluetoothLocalDevicePrivate(QBluetoothLocalDevice *q, - QBluetoothAddress localAddress = QBluetoothAddress()) - : q_ptr(q) - { - Q_UNUSED(localAddress); - } - - ~QBluetoothLocalDevicePrivate() - { - } - - - bool isValid() const + QBluetoothLocalDevicePrivate(QBluetoothLocalDevice * = nullptr, + QBluetoothAddress = QBluetoothAddress()) { - return true; } -private: - QBluetoothLocalDevice *q_ptr; -}; -#elif !defined(QT_OSX_BLUETOOTH) -class QBluetoothLocalDevicePrivate : public QObject -{ -public: bool isValid() const { +#ifndef QT_WINRT_BLUETOOTH return false; +#else + return true; +#endif } }; #endif diff --git a/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp b/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp index acc498cc..4564cf4d 100644 --- a/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp +++ b/tests/auto/qbluetoothserver/tst_qbluetoothserver.cpp @@ -185,11 +185,11 @@ void tst_QBluetoothServer::tst_receive() bool localDeviceAvailable = localDev.isValid(); if (localDeviceAvailable) { - // setHostMode is noop on OS X. + // setHostMode is noop on OS X and winrt. setHostMode(address, hostmode); if (hostmode == QBluetoothLocalDevice::HostPoweredOff) { -#ifndef Q_OS_OSX +#if !defined(Q_OS_OSX) && !QT_CONFIG(winrt_bt) QCOMPARE(localDevice.hostMode(), hostmode); #endif } else { |