Obsolete Members for QProcess
类QProcess 的以下成员已被弃用。提供这些成员是为了保持旧源代码的正常运行。我们强烈建议不要在新代码中使用它们。
公共函数
(deprecated) QStringList | environment() const |
(deprecated) void | setEnvironment(const QStringList &environment) |
成员函数文档
[deprecated]
QStringList QProcess::environment() const
该函数已被弃用。我们强烈建议不要在新代码中使用它。
返回QProcess 将传递给子进程的环境,如果没有使用setEnvironment() 设置环境,则返回空的QStringList 。如果没有设置环境,则使用调用进程的环境。
另请参阅 processEnvironment()、setEnvironment() 和systemEnvironment()。
[deprecated]
void QProcess::setEnvironment(const QStringList &environment)
该函数已被弃用。我们强烈建议不要在新代码中使用它。
设置QProcess 将传递给子进程的环境。参数environment 是一个 key=value 对的列表。
例如,以下代码添加了环境变量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()。
© 2025 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.