Is this an efficient use of QProcess?
-
QProcess::execute(file1, args1);
-
Did you read the documentation of the function ?
execute
runs the command and waits for it to finish. The returned value indicates what happened. -
What do you want to deal with ? In the code you shown until now, what you are doing with your QProcess objects is already done "internally" by
execute
. -
@SGaist never mind, I misunderstood because I'm not used to dealing with these. I was concerned that the subsequent processes could be started before the previous one finished, however execute is not asynchronous like start() is if I understood the documentation correctly.
-
It is indeed not asynchronous.
-
If in a fashion similar to
execute
see the Synchronous Process API in QProcess's documentation. -
@graniteDev said in Is this an efficient use of QProcess?:
If I may though, for my future reference, if I needed to actually use a QProcess *process = new QProcess(this); to run multiple things, how would I go about it?
Exactly as per your original code, except change
execute()
tostart()
.