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.
公有函数
(obsolete) QStringList | environment() const |
(obsolete) Q_PID | pid() const |
(obsolete) ProcessChannelMode | readChannelMode() const |
(obsolete) void | setEnvironment(const QStringList &environment) |
(obsolete) void | setReadChannelMode(ProcessChannelMode mode) |
- 2 个公有函数继承自 QObject
Signals
成员函数
QStringList QProcess::environment() const
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.
参见 processEnvironment(), setEnvironment(), and systemEnvironment().
[signal]
void QProcess::error(QProcess::ProcessError error)
Use errorOccurred() instead.
Note: Signal error is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:
connect(process, static_cast<void(QProcess::*)(QProcess::ProcessError)>(&QProcess::error), [=](QProcess::ProcessError error){ /* ... */ });
[signal]
void QProcess::finished(int exitCode)
This is an overloaded function.
Use finished(int exitCode, QProcess::ExitStatus status) instead.
Note: Signal finished is overloaded in this class. To connect to this one using the function pointer syntax, you must specify the signal type in a static cast, as shown in this example:
connect(process, static_cast<void(QProcess::*)(int)>(&QProcess::finished), [=](int exitCode){ /* ... */ });
Q_PID QProcess::pid() const
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.
ProcessChannelMode QProcess::readChannelMode() const
Returns the read channel mode of the QProcess. This function is equivalent to processChannelMode()
参见 setReadChannelMode() and processChannelMode().
void QProcess::setEnvironment(const QStringList &environment)
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.
参见 environment(), setProcessEnvironment(), and systemEnvironment().
void QProcess::setReadChannelMode(ProcessChannelMode mode)
Use setProcessChannelMode(mode) instead.
参见 readChannelMode() and setProcessChannelMode().