void AssistantMainInterface::onMeetingClicked()
{
QString strPassword = LoginManager::getInstance()->getPassword();
QString username = LoginManager::getInstance()->getUserName();
QString speechPath = QApplication::applicationDirPath() + QString::fromLocal8Bit("/metting/meeting.exe");
QStringList args;
args.append(QString("username=%1").arg(username));
args.append(QString("password=%1").arg(strPassword));
QProcess *openProcess=new QProcess(this);//新建一个process进程
//绑定process进程完成信号,垃圾回收
connect(openProcess, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
[openProcess](int exitCode, QProcess::ExitStatus exitStatus){
Q_UNUSED(exitCode);
Q_UNUSED(exitStatus);
openProcess->close();
openProcess->kill();
openProcess->deleteLater();
});
//开始执行
openProcess->start(speechPath,args);
//等待系统调度
openProcess->waitForStarted();
}
Qt QProcess 打开外部程序并传参
最新推荐文章于 2023-12-02 22:18:17 发布