以下成員源於類 QProcess 被棄用。 提供它們是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它們。
(棄用)
QStringList
|
environment () const |
(棄用)
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 ().