1 void CallExe::on_pushButton_clicked() 2 { 3 QProcess *process=new QProcess(this); 4 connect(process, &QProcess::readyReadStandardOutput, 5 [=] 6 { 7 QString str=process->readAllStandardOutput(); 8 ui.label->setText(str); 9 }); 10 11 //out.exe 每秒输出一个数字到控制台。现在将值输出到label上 12 process->start("../../out/Win32/Debug/out.exe"); 13 }