<?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>QX11EmbedContainer 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">QX11EmbedContainer Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QX11EmbedContainer class provides an XEmbed container widget. <a href="#details">More...</a></p> <p>Inherits <a href="qwidget.html">QWidget</a>.</p><h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qx11embedcontainer.html#Error-enum">Error</a></b> { Unknown, Internal, InvalidWindowID }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qx11embedcontainer.html#QX11EmbedContainer">__init__</a></b> (<i>self</i>, QWidget <i>parent</i> = None)</li><li><div class="fn" />int <b><a href="qx11embedcontainer.html#clientWinId">clientWinId</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qx11embedcontainer.html#discardClient">discardClient</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qx11embedcontainer.html#embedClient">embedClient</a></b> (<i>self</i>, int <i>id</i>)</li><li><div class="fn" />Error <b><a href="qx11embedcontainer.html#error">error</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qx11embedcontainer.html#event">event</a></b> (<i>self</i>, QEvent)</li><li><div class="fn" />bool <b><a href="qx11embedcontainer.html#eventFilter">eventFilter</a></b> (<i>self</i>, QObject, QEvent)</li><li><div class="fn" /><b><a href="qx11embedcontainer.html#hideEvent">hideEvent</a></b> (<i>self</i>, QHideEvent)</li><li><div class="fn" />QSize <b><a href="qx11embedcontainer.html#minimumSizeHint">minimumSizeHint</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qx11embedcontainer.html#paintEvent">paintEvent</a></b> (<i>self</i>, QPaintEvent <i>e</i>)</li><li><div class="fn" /><b><a href="qx11embedcontainer.html#resizeEvent">resizeEvent</a></b> (<i>self</i>, QResizeEvent)</li><li><div class="fn" /><b><a href="qx11embedcontainer.html#showEvent">showEvent</a></b> (<i>self</i>, QShowEvent)</li></ul><h3>Qt Signals</h3><ul><li><div class="fn" />void <b><a href="qx11embedcontainer.html#clientClosed">clientClosed</a></b> ()</li><li><div class="fn" />void <b><a href="qx11embedcontainer.html#clientIsEmbedded">clientIsEmbedded</a></b> ()</li><li><div class="fn" />void <b><a href="qx11embedcontainer.html#error-2">error</a></b> (QX11EmbedContainer::Error)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QX11EmbedContainer class provides an XEmbed container widget.</p> <p>XEmbed is an X11 protocol that supports the embedding of a widget from one application into another application.</p> <p>An XEmbed <i>container</i> is the graphical location that embeds an external <i>client widget</i>. A client widget is a window that is embedded into a container.</p> <p>When a widget has been embedded and the container receives tab focus, focus is passed on to the widget. When the widget reaches the end of its focus chain, focus is passed back to the container. Window activation, accelerator support, modality and drag and drop (XDND) are also handled.</p> <p>QX11EmbedContainer is commonly used for writing panels or toolbars that hold applets, or for <i>swallowing</i> X11 applications. When writing a panel application, one container widget is created on the toolbar, and it can then either swallow another widget using embed(), or allow an XEmbed widget to be embedded into itself. The container's X11 window ID, which is retrieved with <a href="qwidget.html#winId">winId</a>(), must then be known to the client widget. After embedding, the client's window ID can be retrieved with <a href="qx11embedcontainer.html#clientWinId">clientWinId</a>().</p> <p>In the following example, a container widget is created as the main widget. It then invokes an application called "playmovie", passing its window ID as a command line argument. The "playmovie" program is an XEmbed client widget. The widget embeds itself into the container using the container's window ID.</p> <pre class="cpp"> <span class="type">int</span> main(<span class="type">int</span> argc<span class="operator">,</span> <span class="type">char</span> <span class="operator">*</span>argv<span class="operator">[</span><span class="operator">]</span>) { <span class="type"><a href="qapplication.html">QApplication</a></span> app(argc<span class="operator">,</span> argv); <span class="keyword">if</span> (app<span class="operator">.</span>arguments()<span class="operator">.</span>count() <span class="operator">!</span><span class="operator">=</span> <span class="number">2</span>) { <a href="qtcore.html#qFatal">qFatal</a>(<span class="string">"Error - expected executable path as argument"</span>); <span class="keyword">return</span> <span class="number">1</span>; } QX11EmbedContainer container; container<span class="operator">.</span>show(); <span class="type"><a href="qprocess.html">QProcess</a></span> process(<span class="operator">&</span>container); <span class="type"><a href="qstring.html">QString</a></span> executable(app<span class="operator">.</span>arguments()<span class="operator">[</span><span class="number">1</span><span class="operator">]</span>); <span class="type"><a href="qstringlist.html">QStringList</a></span> arguments; arguments <span class="operator"><</span><span class="operator"><</span> <span class="type"><a href="qstring.html">QString</a></span><span class="operator">.</span>number(container<span class="operator">.</span>winId()); process<span class="operator">.</span>start(executable<span class="operator">,</span> arguments); <span class="type">int</span> status <span class="operator">=</span> app<span class="operator">.</span>exec(); process<span class="operator">.</span>close(); <span class="keyword">return</span> status; } </pre> <p>When the client widget is embedded, the container emits the signal <a href="qx11embedcontainer.html#clientIsEmbedded">clientIsEmbedded</a>(). The signal <a href="qx11embedcontainer.html#clientClosed">clientClosed</a>() is emitted when a widget is closed.</p> <p>It is possible for QX11EmbedContainer to embed XEmbed widgets from toolkits other than Qt, such as GTK+. Arbitrary (non-XEmbed) X11 widgets can also be embedded, but the XEmbed-specific features such as window activation and focus handling are then lost.</p> <p>The GTK+ equivalent of QX11EmbedContainer is GtkSocket. The corresponding KDE 3 widget is called QXEmbed.</p> <hr /><h2>Type Documentation</h2><h3 class="fn"><a name="Error-enum" />QX11EmbedContainer.Error</h3><table class="valuelist"> <tr class="odd" valign="top"> <th class="tblConst">Constant</th> <th class="tblval">Value</th> <th class="tbldscr">Description</th> </tr> <tr> <td class="topAlign"><tt>QX11EmbedContainer.Unknown</tt></td> <td class="topAlign"><tt>0</tt></td> <td class="topAlign">An unrecognized error occurred.</td> </tr> <tr> <td class="topAlign"> <tt>QX11EmbedContainer.InvalidWindowID</tt></td> <td class="topAlign"><tt>2</tt></td> <td class="topAlign">The X11 window ID of the container was invalid. This error is usually triggered by passing an invalid window ID to embed().</td> </tr> </table> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QX11EmbedContainer" />QX11EmbedContainer.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a> <i>parent</i> = None)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Creates a <a href="qx11embedcontainer.html">QX11EmbedContainer</a> object with the given <i>parent</i>.</p> <h3 class="fn"><a name="clientWinId" />int QX11EmbedContainer.clientWinId (<i>self</i>)</h3><p>If the container has an embedded widget, this function returns the X11 window ID of the client; otherwise it returns 0.</p> <h3 class="fn"><a name="discardClient" />QX11EmbedContainer.discardClient (<i>self</i>)</h3><p>Detaches the client from the embedder. The client will appear as a standalone window on the desktop.</p> <h3 class="fn"><a name="embedClient" />QX11EmbedContainer.embedClient (<i>self</i>, int <i>id</i>)</h3><p>Instructs the container to embed the X11 window with window ID <i>id</i>. The client widget will then move on top of the container window and be resized to fit into the container.</p> <p>The <i>id</i> should be the ID of a window controlled by an XEmbed enabled application, but this is not mandatory. If <i>id</i> does not belong to an XEmbed client widget, then focus handling, activation, accelerators and other features will not work properly.</p> <h3 class="fn"><a name="error" /><a href="qx11embedcontainer.html#Error-enum">Error</a> QX11EmbedContainer.error (<i>self</i>)</h3><p>Returns the last error that occurred.</p> <h3 class="fn"><a name="event" />bool QX11EmbedContainer.event (<i>self</i>, <a href="qevent.html">QEvent</a>)</h3><p>Reimplemented from <a href="qobject.html#event">QObject.event</a>().</p> <h3 class="fn"><a name="eventFilter" />bool QX11EmbedContainer.eventFilter (<i>self</i>, <a href="qobject.html">QObject</a>, <a href="qevent.html">QEvent</a>)</h3><h3 class="fn"><a name="hideEvent" />QX11EmbedContainer.hideEvent (<i>self</i>, <a href="qhideevent.html">QHideEvent</a>)</h3><h3 class="fn"><a name="minimumSizeHint" /><a href="qsize.html">QSize</a> QX11EmbedContainer.minimumSizeHint (<i>self</i>)</h3><h3 class="fn"><a name="paintEvent" />QX11EmbedContainer.paintEvent (<i>self</i>, <a href="qpaintevent.html">QPaintEvent</a> <i>e</i>)</h3><p>Reimplemented from <a href="qwidget.html#paintEvent">QWidget.paintEvent</a>().</p> <h3 class="fn"><a name="resizeEvent" />QX11EmbedContainer.resizeEvent (<i>self</i>, <a href="qresizeevent.html">QResizeEvent</a>)</h3><h3 class="fn"><a name="showEvent" />QX11EmbedContainer.showEvent (<i>self</i>, <a href="qshowevent.html">QShowEvent</a>)</h3><hr /><h2>Qt Signal Documentation</h2><h3 class="fn"><a name="clientClosed" />void clientClosed ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted by the container when the client widget closes.</p> <h3 class="fn"><a name="clientIsEmbedded" />void clientIsEmbedded ()</h3><p>This is the default overload of this signal.</p><p>This signal is emitted by the container when a client widget has been embedded.</p> <h3 class="fn"><a name="error-2" />void error (QX11EmbedContainer::Error)</h3><p>This is the default overload of this signal.</p><p>This signal is emitted if an error occurred when embedding or communicating with a client. The specified <i>error</i> describes the problem that occurred.</p> <p><b>See also</b> <a href="qx11embedcontainer.html#Error-enum">QX11EmbedContainer.Error</a>.</p> <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>