Why doesn't Qprocess::start work for me?
-
I'm doing:
@
QProcess starter;
starter.setWorkingDirectory("C:/folder/");
starter.start("C:/1.exe");@And it doesn't launch the C:/1.exe file, which exists and launches fine with @QDesktopServices::openUrl(QUrl::fromLocalFile("C:/1.exe"));@
The latter doesn't allow for working dir customization, so I really need QProcess to work. Advices?
P. S. This is on Windows. -
Hi,
Where do you use the QProcess code ?
if it's something like this:
@
void MyWidget::myFunc()
{
QProcess starter;
starter.setWorkingDirectory("C:/folder/");
starter.start("C:/1.exe");
}
@start will get destroyed because it gets out of scope. So 1.exe will get killed.
Have a looked at the QProcess documentation, the different methods are explained.