Obsolete Members for QProcess

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

Public Functions

(obsolete) QStringList environment() const
(obsolete) Q_PID pid() const
(obsolete) QProcess::ProcessChannelMode readChannelMode() const
(obsolete) void setEnvironment(const QStringList &environment)
(obsolete) void setReadChannelMode(QProcess::ProcessChannelMode mode)

Signals

(obsolete) void error(QProcess::ProcessError error)

Member Function Documentation

[signal] void QProcess::error(QProcess::ProcessError error)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use errorOccurred() instead.

Note: Signal error is overloaded in this class. To connect to this signal by using the function pointer syntax, Qt provides a convenient helper for obtaining the function pointer as shown in this example:

connect(process, QOverload<QProcess::ProcessError>::of(&QProcess::error),
    [=](QProcess::ProcessError error){ /* ... */ });

QStringList QProcess::environment() const

This function is obsolete. It is provided to keep old source code working. 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().

Q_PID QProcess::pid() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use processId() instead.

Returns the native process identifier for the running process, if available. If no process is currently running, 0 is returned.

Note: Unlike processId(), pid() returns an integer on Unix and a pointer on Windows.

See also Q_PID and processId().

QProcess::ProcessChannelMode QProcess::readChannelMode() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Returns the read channel mode of the QProcess. This function is equivalent to processChannelMode()

See also setReadChannelMode() and processChannelMode().

void QProcess::setEnvironment(const QStringList &environment)

This function is obsolete. It is provided to keep old source code working. 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().

void QProcess::setReadChannelMode(QProcess::ProcessChannelMode mode)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use setProcessChannelMode(mode) instead.

See also readChannelMode() and setProcessChannelMode().

© 2020 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.