Add waitforfinished for QProcess

This commit is contained in:
chenlelin 2020-12-16 09:21:21 +08:00
parent a41f4cba26
commit 52333cacf0
2 changed files with 11 additions and 0 deletions

View File

@ -46,6 +46,8 @@ void KSimpleNM::execGetLanList()
type = 0;
runShellProcess->start("nmcli -f type,uuid,name connection show");
runShellProcess->waitForStarted(-1);
runShellProcess->waitForFinished(-1);
}
//获取无线网络列表数据
@ -54,7 +56,10 @@ void KSimpleNM::execGetWifiList()
isExecutingGetWifiList = true;
shellOutput = "";
type = 1;
runShellProcess->start("nmcli -f signal,security,freq,ssid device wifi");
runShellProcess->waitForStarted(-1);
runShellProcess->waitForFinished(-1);
}
//读取获取到的结果

View File

@ -1322,6 +1322,12 @@ void MainWindow::on_btnWifiList_clicked()
// 获取lan列表回调
void MainWindow::getLanListDone(QStringList slist)
{
qDebug() << " ";
foreach (QString sss, slist) {
qDebug() <<sss;
}
qDebug() << " ";
//要求使用上一次获取到的列表
if (this->ksnm->isUseOldLanSlist) {
slist = oldLanSlist;