https://www.cnblogs.com/xiaqiuchu/p/16724571.html
adb 截图和下载2条命令需要同步等待,不然会报错adb仍然在运行。
waitForStarted(),waitForFinished() 两个都要写,不然下面语句仍然会运行。
void MainWindow::capture()
{
QString command = "adb shell screencap -p /sdcard/screen.png";
QProcess *process = new QProcess;
process->start(command);
process->waitForStarted();
process->waitForFinished();
command = "adb pull /sdcard/screen.png";
QProcess *process1 = new QProcess;
process1->setWorkingDirectory(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation));
process1->start(command);
}