Calling a command line from a Qt application without freezing?

In my GUI GUI application, I invoke the command line via:

system("lots.exe & of.exe && commands.exe");

It opens the command line (as I want), but freezes the Qt GUI application until the command line is closed. Is there any way to prevent this? I saw that there is a QProcess class, but I can not get it to call the command line.

Any help would be greatly appreciated!

+5
source share
3 answers

QProcess- this is really the answer. If you want to use something like system()that, you will either have to put the call in another thread, or use popensomething similar to your platforms.

QProcess setReadChannel, .

+7

.

+1

If you don't need any output, the easiest way would be to use QProcess :: startDetached ().

http://doc.qt.io/archives/4.6/qprocess.html#startDetached

If you need output, QtConcurrent :: run with a future containing output will have less overhead / work than getting QThread.

+1
source

All Articles