IDevice: Replace QSharedPointer with std::shared_ptr

According to https://wiki.qt.io/Things_To_Look_Out_For_In_Reviews
QSharedPointer impl is poor and it's going to be removed from Qt 7.

Replace QWeakPointer with std::weak_ptr.
Replace QEnableSharedFromThis with std::enable_shared_from_this.
Use std::static_pointer_cast and std::dynamic_pointer_cast
for casts used with QSharedPointer before.

Change-Id: If255a100c790860934f36d52906b93f33c31cfe8
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2024-02-01 20:09:12 +01:00
parent 9fe7922d3b
commit 656a30b407
42 changed files with 112 additions and 125 deletions

View File

@@ -177,13 +177,13 @@ Tasks QmlProject::projectIssues(const Kit *k) const
result.append(createProjectTask(Task::TaskType::Warning, Tr::tr("No Qt version set in kit.")));
IDevice::ConstPtr dev = DeviceKitAspect::device(k);
if (dev.isNull())
if (!dev)
result.append(createProjectTask(Task::TaskType::Error, Tr::tr("Kit has no device.")));
if (version && version->qtVersion() < QVersionNumber(5, 0, 0))
result.append(createProjectTask(Task::TaskType::Error, Tr::tr("Qt version is too old.")));
if (dev.isNull() || !version)
if (!dev || !version)
return result; // No need to check deeper than this
if (dev->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {