Obsolete Members for QProcess

以下成员源于类 QProcess 已过时。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。

公共函数

(obsolete) QStringList environment () const
(obsolete) ProcessChannelMode readChannelMode () const
(obsolete) void setEnvironment (const QStringList & environment )
(obsolete) void setReadChannelMode (ProcessChannelMode mode )

信号

(obsolete) void finished (int exitCode )

成员函数文档编制

QStringList QProcess:: environment () const

返回环境从 QProcess will use when starting a process, or an empty QStringList if no environment has been set using setEnvironment () or setEnvironmentHash(). If no environment has been set, the environment of the calling process will be used.

注意: The environment settings are ignored on Windows CE and Symbian, as there is no concept of an environment.

另请参阅 processEnvironment (), setEnvironment (),和 systemEnvironment ().

[signal] void QProcess:: finished ( int exitCode )

这是重载函数。

Use finished(int exitCode , QProcess::ExitStatus status) instead.

注意: 信号 finished 在此类中是重载。要使用函数指针句法连接到此信号,必须在静态铸造中指定信号类型,如此范例所示:

connect(process, static_cast<void(QProcess::*)(int)>(&QProcess::finished),
    [=](int exitCode){ /* ... */ });
					

ProcessChannelMode QProcess:: readChannelMode () const

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

另请参阅 setReadChannelMode () 和 processChannelMode ().

void QProcess:: setEnvironment (const QStringList & environment )

Sets the environment that QProcess will use when starting a process to the environment specified which consists of a list of key=value pairs.

For example, the following code adds the C:\\BIN directory to the list of executable paths ( PATHS ) on Windows:

QProcess process;
QStringList env = QProcess::systemEnvironment();
env << "TMPDIR=C:\\MyApp\\temp"; // Add an environment variable
env.replaceInStrings(QRegExp("^PATH=(.*)", Qt::CaseInsensitive), "PATH=\\1;C:\\Bin");
process.setEnvironment(env);
process.start("myapp");
					

注意: This function is less efficient than the setProcessEnvironment () 函数。

另请参阅 environment (), setProcessEnvironment (),和 systemEnvironment ().

void QProcess:: setReadChannelMode ( ProcessChannelMode mode )

使用 setProcessChannelMode ( mode ) 代替。

另请参阅 readChannelMode () 和 setProcessChannelMode ().