Obsolete Members for QProcess
QProcess 类的以下成员已被废弃。提供这些成员是为了确保旧源代码能够继续运行。我们强烈建议不要在新代码中使用它们。
公共函数
(deprecated in 4.6) QStringList | environment() const |
(deprecated in 4.6) void | setEnvironment(const QStringList &environment) |
成员函数文档
[deprecated in 4.6] QStringList QProcess::environment() const
自 4.6 版起,此函数已被废弃。我们强烈建议不要在新代码中使用它。
返回QProcess 将传递给其子进程的环境,或者如果未通过setEnvironment()设置环境,则返回空的QStringList 。如果未设置环境,则使用调用进程的环境。
另请参阅 processEnvironment()、setEnvironment() 和systemEnvironment()。
[deprecated in 4.6] void QProcess::setEnvironment(const QStringList &environment)
自 4.6 版起,此函数已被废弃。我们强烈建议不要在新代码中使用它。
设置 `QProcess ` 将传递给子进程的环境变量。参数 `environment ` 是一个键值对列表。
例如,以下代码添加了环境变量TMPDIR :
QProcess process;
QStringList env = QProcess::systemEnvironment();
env << "TMPDIR=C:\\MyApp\\temp"; // Add an environment variable
process.setEnvironment(env);
process.start("myapp");注意:此函数的 效率低于setProcessEnvironment() 函数。
另请参阅 environment()、setProcessEnvironment() 和systemEnvironment()。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.