ProjectExplorer: Use a lambda for DeviceFactory::create()

Somewhat slimmer interface on the user code side and follows
existing practice.

Change-Id: I20ed8f5a00591265d32ea9ce93e1f1bbc76d2437
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2022-01-26 09:05:35 +01:00
parent f6cb638345
commit 2b6f26dee2
20 changed files with 96 additions and 125 deletions

View File

@@ -172,22 +172,19 @@ DeviceProcessSignalOperation::Ptr QnxDevice::signalOperation() const
// Factory
QnxDeviceFactory::QnxDeviceFactory()
: ProjectExplorer::IDeviceFactory(Constants::QNX_QNX_OS_TYPE)
QnxDeviceFactory::QnxDeviceFactory() : IDeviceFactory(Constants::QNX_QNX_OS_TYPE)
{
setDisplayName(QnxDevice::tr("QNX Device"));
setCombinedIcon(":/qnx/images/qnxdevicesmall.png",
":/qnx/images/qnxdevice.png");
setCanCreate(true);
setConstructionFunction(&QnxDevice::create);
}
ProjectExplorer::IDevice::Ptr QnxDeviceFactory::create() const
{
QnxDeviceWizard wizard;
if (wizard.exec() != QDialog::Accepted)
return ProjectExplorer::IDevice::Ptr();
return wizard.device();
setCanCreate(true);
setCreator([] {
QnxDeviceWizard wizard;
if (wizard.exec() != QDialog::Accepted)
return IDevice::Ptr();
return wizard.device();
});
}
} // namespace Internal