- Qt 6.9
- Qt Core
- C++ Classes
- QProcess
- Qt 6.9.3 Reference Documentation

# Obsolete Members for QProcess

The following members of class QProcess are deprecated. They are provided to keep old source code working. We strongly advise against using them in new code.

## Public Functions

`(deprecated)` QStringList | environment() const
`(deprecated)` void | setEnvironment(const QStringList &environment)

## Member Function Documentation

### `[deprecated]` QStringList QProcess::environment() const

This function is deprecated. We strongly advise against using it in new code.

Returns the environment that QProcess will pass to its child process, or an empty QStringList if no environment has been set using setEnvironment(). If no environment has been set, the environment of the calling process will be used.

See also processEnvironment(), setEnvironment(), and systemEnvironment().

### `[deprecated]` void QProcess::setEnvironment(const QStringList &environment)

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.

For example, the following code adds the environment variable `TMPDIR`:

     QProcess process;
     QStringList env = QProcess::systemEnvironment();
     env << "TMPDIR=C:\\MyApp\\temp"; // Add an environment variable
     process.setEnvironment(env);
     process.start("myapp");

Note: This function is less efficient than the setProcessEnvironment() function.

See also environment(), setProcessEnvironment(), and systemEnvironment().