以下成员源于类 QProcess 被弃用。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。
(deprecated)
QStringList
|
environment () const |
(deprecated)
void
|
setEnvironment (const QStringList & environment ) |
This function is deprecated. We strongly advise against using it in new code.
返回环境从 QProcess will pass to its child process, or an empty QStringList if no environment has been set using setEnvironment ()。若没有设置环境,将使用调用进程的环境。
另请参阅 processEnvironment (), setEnvironment (),和 systemEnvironment ().
This function is deprecated. We strongly advise against using it in new code.
Sets the environment that QProcess will pass to the child process. The parameter environment is a list of key=value pairs.
例如,以下代码添加环境变量
TMPDIR
:
QProcess process; QStringList env = QProcess::systemEnvironment(); env << "TMPDIR=C:\\MyApp\\temp"; // Add an environment variable process.setEnvironment(env); process.start("myapp");
注意: This function is less efficient than the setProcessEnvironment () 函数。
另请参阅 environment (), setProcessEnvironment (),和 systemEnvironment ().