Qt 为什么我能';t从QProcess获取值使用ReadyReadStandard输出信号

Qt 为什么我能';t从QProcess获取值使用ReadyReadStandard输出信号,qt,console,qprocess,Qt,Console,Qprocess,我正在使用clientupdate.exe更新我的客户端,因此有一个func“getVersion”来获取最新版本号: Execute::Execute(QObject *parent) : QObject(parent) { f=Father::GetInstance(); ftp=new FtpProvider(this); connect(ftp,SIGNAL(getVersionFinished(QString)),SLOT(handGetversionF

我正在使用clientupdate.exe更新我的客户端,因此有一个func“getVersion”来获取最新版本号:

Execute::Execute(QObject *parent) :
    QObject(parent)
{
    f=Father::GetInstance();
    ftp=new FtpProvider(this);
    connect(ftp,SIGNAL(getVersionFinished(QString)),SLOT(handGetversionFinished(QString)));
}

void Execute::getVersion()
{
    ftp->isAutoDownloadFolder=false;
    ftp->getVersion();
}
void Execute::handGetversionFinished(QString version)
{
    f->mkinfo(Q_FUNC_INFO,QString("The lasest version num is:%1").arg(version));
    QTextStream out(stdout);
    out<<version;
    std::cout<<version.data();
    std::cout.flush();
Execute::Execute(QObject*父对象):
QObject(父对象)
{
f=父::GetInstance();
ftp=新的FtpProvider(本);
连接(ftp,信号(getVersionFinished(QString)),插槽(handGetversionFinished(QString));
}
void Execute::getVersion()
{
ftp->isAutoDownloadFolder=false;
ftp->getVersion();
}
void Execute::handGetversionFinished(QString版本)
{
f->mkinfo(Q_FUNC_INFO,QString(“最新版本号为:%1”).arg(版本));
QTextStream out(标准输出);

Out您可能需要使用
QProcess::readAllStandardOutput
?您能将此作为答案发布并接受它,让人们看到此问题不再需要答案吗?(stackoverflow.com/help/self-answer)
void MainWindow::on_checkUpdateAct_triggered()
{
    QString filepath=Paths::currentExeFilePath();
    QStringList args;
    args<<"getversion"<<filepath;
    f->mkinfo(Q_FUNC_INFO,QString("start to check version"));
    connect(&reStartProcess,SIGNAL(readyRead()),SLOT(handUpdateEXEReadyRead()));
    connect(&reStartProcess,SIGNAL(readyReadStandardOutput()),SLOT(handUpdateEXEReadyRead()));
    connect(&reStartProcess,SIGNAL(finished(int,QProcess::ExitStatus)),SLOT(handReStartFinished(int,QProcess::ExitStatus)));
    reStartProcess.start("ClientUpdate.exe",args);
}

void MainWindow::handUpdateEXEReadyRead()
{
    QString version=reStartProcess.readAll();
    reStartProcess.terminate();
    f->mkinfo(Q_FUNC_INFO,QString("The lasest version num is:%1").arg(version));

     if(currentVersion>=version.toFloat())
     {
         f->msg->info("Update Client","Your client is the latest version");
     }
     else
     {
         if(f->msg->ask("Update Client?",QString("The latest version is:%1,Your version is:%2.\nUpdate?").arg(version).arg(currentVersion))==QMessageBox::Yes)
             sendUpdateCommand();
     }

}