二、启动之前需要做的工作: To
start a process, pass the name and command line arguments of the program you want to run as arguments to start(). Arguments are supplied as individual strings in a QStringList.
启动一个外部程序,需要传递外部程序的路径和执行参数,参数用QStringList来带入。 (1)设置路径:
void QProcess::setProgram(const
QString & program) (2)设置参数[可选]: void QProcess:: setArguments(const
QStringList & arguments) (3)启动: void
QProcess::start(OpenMode mode = ReadWrite)
Qt官方自带的例子:
QObject *parent;
...
QString program ="./path/to/Qt/examples/widgets/analogclock";