forked from qt-creator/qt-creator
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:
@@ -51,20 +51,18 @@ TestLinuxDeviceFactory::TestLinuxDeviceFactory()
|
||||
{
|
||||
setDisplayName("Generic Linux Device");
|
||||
setIcon(QIcon());
|
||||
setCanCreate(true);
|
||||
setConstructionFunction(&LinuxDevice::create);
|
||||
}
|
||||
|
||||
IDevice::Ptr TestLinuxDeviceFactory::create() const
|
||||
{
|
||||
LinuxDevice::Ptr newDev = LinuxDevice::create();
|
||||
qDebug() << "device : " << newDev->type();
|
||||
newDev->setType("test");
|
||||
QSsh::SshConnectionParameters sshParams = newDev->sshParameters();
|
||||
sshParams.setHost(TEST_IP);
|
||||
sshParams.setPort(22);
|
||||
newDev->setSshParameters(sshParams);
|
||||
return newDev;
|
||||
setCanCreate(true);
|
||||
setCreator([] {
|
||||
LinuxDevice::Ptr newDev = LinuxDevice::create();
|
||||
qDebug() << "device : " << newDev->type();
|
||||
newDev->setType("test");
|
||||
QSsh::SshConnectionParameters sshParams = newDev->sshParameters();
|
||||
sshParams.setHost(TEST_IP);
|
||||
sshParams.setPort(22);
|
||||
newDev->setSshParameters(sshParams);
|
||||
return newDev;
|
||||
});
|
||||
}
|
||||
|
||||
FilePath createFile(const QString &name)
|
||||
|
||||
Reference in New Issue
Block a user