以下例子QEventLoop可以防止QProcess运行外部程序使得界面阻塞
QProcess process
;
process
.start(QString(cmd
));
QEventLoop loop
;
connect(&process
,static_cast<void(QProcess
::*)(int,QProcess
::ExitStatus
)>(&QProcess
::finished
),
[=]()
{
loop
.quit();
}
);
loop
.exec(QEventLoop
::ExcludeUserInputEvents
);
转载请注明原文地址:https://blackberry.8miu.com/read-571.html