summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/doc/snippets/qprocess-environment/main.cpp2
-rw-r--r--src/corelib/io/qprocess.cpp17
2 files changed, 7 insertions, 12 deletions
diff --git a/src/corelib/doc/snippets/qprocess-environment/main.cpp b/src/corelib/doc/snippets/qprocess-environment/main.cpp
index d858746889..2e078eea6d 100644
--- a/src/corelib/doc/snippets/qprocess-environment/main.cpp
+++ b/src/corelib/doc/snippets/qprocess-environment/main.cpp
@@ -47,7 +47,6 @@ void startProcess()
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");
//! [0]
@@ -58,7 +57,6 @@ process.start("myapp");
QProcess process;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("TMPDIR", "C:\\MyApp\\temp"); // Add an environment variable
-env.insert("PATH", env.value("Path") + ";C:\\Bin");
process.setProcessEnvironment(env);
process.start("myapp");
//! [1]
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index ecb97ef3e9..e009191be9 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1659,11 +1659,10 @@ QProcess::ProcessState QProcess::state() const
/*!
\deprecated
- Sets the environment that QProcess will use when starting a process to the
- \a environment specified which consists of a list of key=value pairs.
+ Sets the environment that QProcess will pass to the child process.
+ The parameter \a environment is a list of key=value pairs.
- For example, the following code adds the \c{C:\\BIN} directory to the list of
- executable paths (\c{PATHS}) on Windows:
+ For example, the following code adds the environment variable \c{TMPDIR}:
\snippet qprocess-environment/main.cpp 0
@@ -1679,7 +1678,7 @@ void QProcess::setEnvironment(const QStringList &environment)
/*!
\deprecated
- Returns the environment that QProcess will use when starting a
+ 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.
@@ -1697,11 +1696,9 @@ QStringList QProcess::environment() const
/*!
\since 4.6
- Sets the environment that QProcess will use when starting a process to the
- \a environment object.
+ Sets the \a environment that QProcess will pass to the child process.
- For example, the following code adds the \c{C:\\BIN} directory to the list of
- executable paths (\c{PATHS}) on Windows and sets \c{TMPDIR}:
+ For example, the following code adds the environment variable \c{TMPDIR}:
\snippet qprocess-environment/main.cpp 1
@@ -1717,7 +1714,7 @@ void QProcess::setProcessEnvironment(const QProcessEnvironment &environment)
/*!
\since 4.6
- Returns the environment that QProcess will use when starting a
+ Returns the environment that QProcess will pass to its child
process, or an empty object if no environment has been set using
setEnvironment() or setProcessEnvironment(). If no environment has
been set, the environment of the calling process will be used.