QProcess not running command correctly & freezing gui
-
Hey,
I know the basics of C++ but am a total QT noob so please treat me accordingly.
This is the code in question:@void gamemode::on_gamemodeoff_clicked()
{
QProcess startagain;
QString startCommand;
startCommand = ("easystroke & synapse"); // for launching easystroke and synapse (2 programs)startagain.start(startCommand, QIODevice::ReadOnly); startagain.waitForFinished(-1);
}
@
Whenever i run this and press the button my program only launches easystroke then freezes and doesn't launch synapse, what am i doing wrong? -
Hi,
Try ; instead of &. Because I think the second program won't launch until first completes. I'm not sure though.
-
Hi,
Another way would be this
@
QProcess startagain;
QString startCommand;
startCommand = "easystroke";
startagain.startDetached(startCommand);
startCommand = "synapse";
startagain.startDetached(startCommand);
@This will work but there must be more elegant way.