qt - Why i can't get value form QProcess use readyReadStandardOutput signal -
i working clientupdate.exe update client,so there func "getversion" latest version number:
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();
//* can version num here. }
in client program try version number; this
void mainwindow::on_checkupdateact_triggered() { qstring filepath=paths::currentexefilepath(); qstringlist args; args<<"getversion"<<filepath; f->mkinfo(q_func_info,qstring("start 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 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(); } }
but nothing in handupdateexereadyread func, why why why
Comments
Post a Comment