#include <QFutureWatcher>
#include <QtConcurrentRun>
#include <QtConcurrentMap>
#include <QFuture>
QString TestExecDosCmd()
{
QProcess p(0);
p.start("cmd", QStringList()<<"/c"<<"ping -n 20 10.19.250.79");
p.waitForStarted();
p.waitForFinished();
QString strTemp=QString::fromLocal8Bit(p.readAllStandardOutput());
QStringList str= strTemp.split("%",QString::KeepEmptyParts,Qt::CaseSensitive);
QString numFind=str[0].at(str[0].count()-1);
return numFind;
}
QFuture<QString> future = QtConcurrent::run(TestExecDosCmd);
QString result = future.result();
ui.label->show();
ui.label->setText(result);