From 6addfe16605b0257f6c42b0adb75c8ae157626f5 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 11 Nov 2017 22:12:21 +0100 Subject: Trivial: Replace a QSharedPointer by a QScopedPointer Since the QSharedPointer is never passed or copied, reference counting is certainly not needed. Signed-off-by: Berthold Stoeger --- desktop-widgets/btdeviceselectiondialog.cpp | 5 ++--- desktop-widgets/btdeviceselectiondialog.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/btdeviceselectiondialog.cpp b/desktop-widgets/btdeviceselectiondialog.cpp index c036fc3b7..1b43c8471 100644 --- a/desktop-widgets/btdeviceselectiondialog.cpp +++ b/desktop-widgets/btdeviceselectiondialog.cpp @@ -152,7 +152,7 @@ void BtDeviceSelectionDialog::on_save_clicked() QBluetoothDeviceInfo remoteDeviceInfo = currentItem->data(Qt::UserRole).value(); // Save the selected device - selectedRemoteDeviceInfo = QSharedPointer(new QBluetoothDeviceInfo(remoteDeviceInfo)); + selectedRemoteDeviceInfo.reset(new QBluetoothDeviceInfo(remoteDeviceInfo)); QString address = remoteDeviceInfo.address().isNull() ? remoteDeviceInfo.deviceUuid().toString() : remoteDeviceInfo.address().toString(); saveBtDeviceInfo(address.toUtf8().constData(), remoteDeviceInfo); @@ -460,9 +460,8 @@ QString BtDeviceSelectionDialog::getSelectedDeviceAddress() QString BtDeviceSelectionDialog::getSelectedDeviceName() { - if (selectedRemoteDeviceInfo) { + if (selectedRemoteDeviceInfo) return selectedRemoteDeviceInfo.data()->name(); - } return QString(); } diff --git a/desktop-widgets/btdeviceselectiondialog.h b/desktop-widgets/btdeviceselectiondialog.h index 448404843..e883278ce 100644 --- a/desktop-widgets/btdeviceselectiondialog.h +++ b/desktop-widgets/btdeviceselectiondialog.h @@ -83,7 +83,7 @@ private: QBluetoothLocalDevice *localDevice; QBluetoothDeviceDiscoveryAgent *remoteDeviceDiscoveryAgent; #endif - QSharedPointer selectedRemoteDeviceInfo; + QScopedPointer selectedRemoteDeviceInfo; void updateLocalDeviceInformation(); void initializeDeviceDiscoveryAgent(); -- cgit v1.2.3-70-g09d2