分布式网站架构,深圳网站建设外包,网站报错 自动404,wordpress登陆logo简介
● Qt中的类QProcess支持在程序中另外开辟线程 ● 其中start方法支持以字符串为参数执行命令
以Linux平台为例#xff1a;
方式一#xff08;后台执行#xff09;
///
/// \brief MainWindow::cmdLine run a linux command with string format in the bash
/// \pa…简介
● Qt中的类QProcess支持在程序中另外开辟线程 ● 其中start方法支持以字符串为参数执行命令
以Linux平台为例
方式一后台执行
///
/// \brief MainWindow::cmdLine run a linux command with string format in the bash
/// \param strCmd linux command in string format
///
void MainWindow::cmdLine(QString strCmd)
{QProcess process;process.start(bash,QStringList() -c strCmd);process.waitForFinished();process.close();
}但该命令看不到执行过程。
方式二 (终端执行)
● 可以下述方式调用该函数新建终端执行脚本
QString strCmd QString(gnome-terminal -x bash -c \sh Run.sh run %1 %2 %3;\).arg(this-vecPoint.size()).arg((int)(this-raleMapWidth)).arg((int)(this-raleMapHeight));
this-cmdLine(strCmd);即运行时会弹出终端窗口查看脚本的标准输出。