<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html><head><title>QProcessEnvironment Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } td.postheader { font-family: sans-serif } tr.address { font-family: sans-serif } body { background: #ffffff; color: black; } </style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QProcessEnvironment Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QProcessEnvironment class holds the environment variables that can be passed to a program. <a href="#details">More...</a></p> <h3>Methods</h3><ul><li><div class="fn" /><b><a href="qprocessenvironment.html#QProcessEnvironment">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprocessenvironment.html#QProcessEnvironment-2">__init__</a></b> (<i>self</i>, QProcessEnvironment <i>other</i>)</li><li><div class="fn" /><b><a href="qprocessenvironment.html#clear">clear</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qprocessenvironment.html#contains">contains</a></b> (<i>self</i>, QString <i>name</i>)</li><li><div class="fn" /><b><a href="qprocessenvironment.html#insert">insert</a></b> (<i>self</i>, QString <i>name</i>, QString <i>value</i>)</li><li><div class="fn" /><b><a href="qprocessenvironment.html#insert-2">insert</a></b> (<i>self</i>, QProcessEnvironment <i>e</i>)</li><li><div class="fn" />bool <b><a href="qprocessenvironment.html#isEmpty">isEmpty</a></b> (<i>self</i>)</li><li><div class="fn" />QStringList <b><a href="qprocessenvironment.html#keys">keys</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qprocessenvironment.html#remove">remove</a></b> (<i>self</i>, QString <i>name</i>)</li><li><div class="fn" />QStringList <b><a href="qprocessenvironment.html#toStringList">toStringList</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qprocessenvironment.html#value">value</a></b> (<i>self</i>, QString <i>name</i>, QString <i>defaultValue</i> = QString())</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QProcessEnvironment <b><a href="qprocessenvironment.html#systemEnvironment">systemEnvironment</a></b> ()</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qprocessenvironment.html#__eq__">__eq__</a></b> (<i>self</i>, QProcessEnvironment <i>other</i>)</li><li><div class="fn" />bool <b><a href="qprocessenvironment.html#__ne__">__ne__</a></b> (<i>self</i>, QProcessEnvironment <i>other</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QProcessEnvironment class holds the environment variables that can be passed to a program.</p> <p>A process's environment is composed of a set of key=value pairs known as environment variables. The QProcessEnvironment class wraps that concept and allows easy manipulation of those variables. It's meant to be used along with <a href="qprocess.html">QProcess</a>, to set the environment for child processes. It cannot be used to change the current process's environment.</p> <p>The environment of the calling process can be obtained using <a href="qprocessenvironment.html#systemEnvironment">QProcessEnvironment.systemEnvironment</a>().</p> <p>On Unix systems, the variable names are case-sensitive. For that reason, this class will not touch the names of the variables. Note as well that Unix environment allows both variable names and contents to contain arbitrary binary data (except for the NUL character), but this is not supported by QProcessEnvironment. This class only supports names and values that are encodable by the current locale settings (see QTextCodec.codecForLocale).</p> <p>On Windows, the variable names are case-insensitive. Therefore, QProcessEnvironment will always uppercase the names and do case-insensitive comparisons.</p> <p>On Windows CE, the concept of environment does not exist. This class will keep the values set for compatibility with other platforms, but the values set will have no effect on the processes being created.</p> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QProcessEnvironment" />QProcessEnvironment.__init__ (<i>self</i>)</h3><p>Creates a new <a href="qprocessenvironment.html">QProcessEnvironment</a> object. This constructor creates an empty environment. If set on a <a href="qprocess.html">QProcess</a>, this will cause the current environment variables to be removed.</p> <h3 class="fn"><a name="QProcessEnvironment-2" />QProcessEnvironment.__init__ (<i>self</i>, <a href="qprocessenvironment.html">QProcessEnvironment</a> <i>other</i>)</h3><p>Creates a <a href="qprocessenvironment.html">QProcessEnvironment</a> object that is a copy of <i>other</i>.</p> <h3 class="fn"><a name="clear" />QProcessEnvironment.clear (<i>self</i>)</h3><p>Removes all key=value pairs from this <a href="qprocessenvironment.html">QProcessEnvironment</a> object, making it empty.</p> <p><b>See also</b> <a href="qprocessenvironment.html#isEmpty">isEmpty</a>() and <a href="qprocessenvironment.html#systemEnvironment">systemEnvironment</a>().</p> <h3 class="fn"><a name="contains" />bool QProcessEnvironment.contains (<i>self</i>, QString <i>name</i>)</h3><p>Returns true if the environment variable of name <i>name</i> is found in this <a href="qprocessenvironment.html">QProcessEnvironment</a> object.</p> <p>On Windows, variable names are case-insensitive, so the key is converted to uppercase before searching. On other systems, names are case-sensitive so no trasformation is applied.</p> <p><b>See also</b> <a href="qprocessenvironment.html#insert">insert</a>() and <a href="qprocessenvironment.html#value">value</a>().</p> <h3 class="fn"><a name="insert" />QProcessEnvironment.insert (<i>self</i>, QString <i>name</i>, QString <i>value</i>)</h3><p>Inserts the environment variable of name <i>name</i> and contents <i>value</i> into this <a href="qprocessenvironment.html">QProcessEnvironment</a> object. If that variable already existed, it is replaced by the new value.</p> <p>On Windows, variable names are case-insensitive, so this function always uppercases the variable name before inserting. On other systems, names are case-sensitive, so no transformation is applied.</p> <p>On most systems, inserting a variable with no contents will have the same effect for applications as if the variable had not been set at all. However, to guarantee that there are no incompatibilities, to remove a variable, please use the <a href="qprocessenvironment.html#remove">remove</a>() function.</p> <p><b>See also</b> <a href="qprocessenvironment.html#contains">contains</a>(), <a href="qprocessenvironment.html#remove">remove</a>(), and <a href="qprocessenvironment.html#value">value</a>().</p> <h3 class="fn"><a name="insert-2" />QProcessEnvironment.insert (<i>self</i>, <a href="qprocessenvironment.html">QProcessEnvironment</a> <i>e</i>)</h3><p>This is an overloaded function.</p> <p>Inserts the contents of <i>e</i> in this <a href="qprocessenvironment.html">QProcessEnvironment</a> object. Variables in this object that also exist in <i>e</i> will be overwritten.</p> <p>This function was introduced in Qt 4.8.</p> <h3 class="fn"><a name="isEmpty" />bool QProcessEnvironment.isEmpty (<i>self</i>)</h3><p>Returns true if this <a href="qprocessenvironment.html">QProcessEnvironment</a> object is empty: that is there are no key=value pairs set.</p> <p><b>See also</b> <a href="qprocessenvironment.html#clear">clear</a>(), <a href="qprocessenvironment.html#systemEnvironment">systemEnvironment</a>(), and <a href="qprocessenvironment.html#insert">insert</a>().</p> <h3 class="fn"><a name="keys" />QStringList QProcessEnvironment.keys (<i>self</i>)</h3><p>Returns a list containing all the variable names in this <a href="qprocessenvironment.html">QProcessEnvironment</a> object.</p> <p>This function was introduced in Qt 4.8.</p> <h3 class="fn"><a name="remove" />QProcessEnvironment.remove (<i>self</i>, QString <i>name</i>)</h3><p>Removes the environment variable identified by <i>name</i> from this <a href="qprocessenvironment.html">QProcessEnvironment</a> object. If that variable did not exist before, nothing happens.</p> <p>On Windows, variable names are case-insensitive, so the key is converted to uppercase before searching. On other systems, names are case-sensitive so no trasformation is applied.</p> <p><b>See also</b> <a href="qprocessenvironment.html#contains">contains</a>(), <a href="qprocessenvironment.html#insert">insert</a>(), and <a href="qprocessenvironment.html#value">value</a>().</p> <h3 class="fn"><a name="systemEnvironment" /><a href="qprocessenvironment.html">QProcessEnvironment</a> QProcessEnvironment.systemEnvironment ()</h3><p>The systemEnvironment function returns the environment of the calling process.</p> <p>It is returned as a <a href="qprocessenvironment.html">QProcessEnvironment</a>. This function does not cache the system environment. Therefore, it's possible to obtain an updated version of the environment if low-level C library functions like <tt>setenv</tt> ot <tt>putenv</tt> have been called.</p> <p>However, note that repeated calls to this function will recreate the <a href="qprocessenvironment.html">QProcessEnvironment</a> object, which is a non-trivial operation.</p> <p>This function was introduced in Qt 4.6.</p> <p><b>See also</b> <a href="qprocess.html#systemEnvironment">QProcess.systemEnvironment</a>().</p> <h3 class="fn"><a name="toStringList" />QStringList QProcessEnvironment.toStringList (<i>self</i>)</h3><p>Converts this <a href="qprocessenvironment.html">QProcessEnvironment</a> object into a list of strings, one for each environment variable that is set. The environment variable's name and its value are separated by an equal character ('=').</p> <p>The <a href="qstringlist.html">QStringList</a> contents returned by this function are suitable for use with the QProcess.setEnvironment function. However, it is recommended to use QProcess.setProcessEnvironment instead since that will avoid unnecessary copying of the data.</p> <p><b>See also</b> <a href="qprocessenvironment.html#systemEnvironment">systemEnvironment</a>(), <a href="qprocess.html#systemEnvironment">QProcess.systemEnvironment</a>(), <a href="qprocess.html#environment">QProcess.environment</a>(), and <a href="qprocess.html#setEnvironment">QProcess.setEnvironment</a>().</p> <h3 class="fn"><a name="value" />QString QProcessEnvironment.value (<i>self</i>, QString <i>name</i>, QString <i>defaultValue</i> = QString())</h3><p>Searches this <a href="qprocessenvironment.html">QProcessEnvironment</a> object for a variable identified by <i>name</i> and returns its value. If the variable is not found in this object, then <i>defaultValue</i> is returned instead.</p> <p>On Windows, variable names are case-insensitive, so the key is converted to uppercase before searching. On other systems, names are case-sensitive so no trasformation is applied.</p> <p><b>See also</b> <a href="qprocessenvironment.html#contains">contains</a>(), <a href="qprocessenvironment.html#insert">insert</a>(), and <a href="qprocessenvironment.html#remove">remove</a>().</p> <h3 class="fn"><a name="__eq__" />bool QProcessEnvironment.__eq__ (<i>self</i>, <a href="qprocessenvironment.html">QProcessEnvironment</a> <i>other</i>)</h3><h3 class="fn"><a name="__ne__" />bool QProcessEnvironment.__ne__ (<i>self</i>, <a href="qprocessenvironment.html">QProcessEnvironment</a> <i>other</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>