android - Qt/C++: interrupt QProcess arbitrarily with button (simulate ^c) -
so need make qt application (with gui) executes "adb logcat" command (it's log keeps being generated until ^c pressed). need gui button make process stop , pass output text browser. code use qprocess output:
qprocess process; process.start("adb logcat"); process.waitforfinished(-1); qbytearray logcatout = process.readallstandardoutput(); ui->devicesoutput->settext(logcatout);
thank you
process.waitforfinished(-1);
would prevent program of being executed further, till process "adb" has finished. gui frozen.
you should define qprocess process class variable. use qprocess *process; instead of creating on stack. (best practice qobject derivates)
declare slot handles clicked-signal of button.
call process->terminate() in slot.
Comments
Post a Comment