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 <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2017-11-11 22:12:21 +01:00 committed by Lubomir I. Ivanov
parent b32251a5a8
commit 6addfe1660
2 changed files with 3 additions and 4 deletions

View file

@ -152,7 +152,7 @@ void BtDeviceSelectionDialog::on_save_clicked()
QBluetoothDeviceInfo remoteDeviceInfo = currentItem->data(Qt::UserRole).value<QBluetoothDeviceInfo>();
// Save the selected device
selectedRemoteDeviceInfo = QSharedPointer<QBluetoothDeviceInfo>(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();
}

View file

@ -83,7 +83,7 @@ private:
QBluetoothLocalDevice *localDevice;
QBluetoothDeviceDiscoveryAgent *remoteDeviceDiscoveryAgent;
#endif
QSharedPointer<QBluetoothDeviceInfo> selectedRemoteDeviceInfo;
QScopedPointer<QBluetoothDeviceInfo> selectedRemoteDeviceInfo;
void updateLocalDeviceInformation();
void initializeDeviceDiscoveryAgent();