1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
  
     | 
    
      <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qx11embed_x11.cpp -->
  <title>Qt 4.8: QX11EmbedWidget Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="content"> 
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
  </div>
  <div class="breadcrumb toolblock">
    <ul>
      <li class="first"><a href="index.html">Home</a></li>
      <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QX11EmbedWidget</li>
    </ul>
  </div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#protected-functions">Protected Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QX11EmbedWidget Class Reference</h1>
<!-- $$$QX11EmbedWidget-brief -->
<p>The QX11EmbedWidget class provides an XEmbed client widget. <a href="#details">More...</a></p>
<!-- @@@QX11EmbedWidget -->
<pre class="cpp"> <span class="preprocessor">#include <QX11EmbedWidget></span></pre><p><b>Inherits: </b><a href="qwidget.html">QWidget</a>.</p>
<ul>
<li><a href="qx11embedwidget-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qx11embedwidget.html#Error-enum">Error</a></b> { Unknown, InvalidWindowID }</td></tr>
</table>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qx11embedwidget.html#QX11EmbedWidget">QX11EmbedWidget</a></b> ( QWidget * <i>parent</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qx11embedwidget.html#dtor.QX11EmbedWidget">~QX11EmbedWidget</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> WId </td><td class="memItemRight bottomAlign"><b><a href="qx11embedwidget.html#containerWinId">containerWinId</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qx11embedwidget.html#embedInto">embedInto</a></b> ( WId <i>id</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Error </td><td class="memItemRight bottomAlign"><b><a href="qx11embedwidget.html#error">error</a></b> () const</td></tr>
</table>
<ul>
<li class="fn">221 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
<li class="fn">29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
<li class="fn">13 public functions inherited from <a href="qpaintdevice.html#public-functions">QPaintDevice</a></li>
</ul>
<a name="signals"></a>
<h2>Signals</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qx11embedwidget.html#containerClosed">containerClosed</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qx11embedwidget.html#embedded">embedded</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qx11embedwidget.html#error-2">error</a></b> ( QX11EmbedWidget::Error <i>error</i> )</td></tr>
</table>
<ul>
<li class="fn">1 signal inherited from <a href="qwidget.html#signals">QWidget</a></li>
<li class="fn">1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
</ul>
<a name="reimplemented-protected-functions"></a>
<h2>Reimplemented Protected Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qx11embedwidget.html#event">event</a></b> ( QEvent * <i>event</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qx11embedwidget.html#resizeEvent">resizeEvent</a></b> ( QResizeEvent * <i>event</i> )</td></tr>
</table>
<ul>
<li class="fn">37 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
<li class="fn">1 protected function inherited from <a href="qpaintdevice.html#protected-functions">QPaintDevice</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">58 properties inherited from <a href="qwidget.html#properties">QWidget</a></li>
<li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li class="fn">19 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li>
<li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li class="fn">4 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
<li class="fn">7 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li class="fn">37 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
<li class="fn">8 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
<li class="fn">1 protected function inherited from <a href="qpaintdevice.html#protected-functions">QPaintDevice</a></li>
<li class="fn">1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li>
</ul>
<a name="details"></a>
<!-- $$$QX11EmbedWidget-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QX11EmbedWidget class provides an XEmbed client 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>client widget</i> is a window that is embedded into a <i>container</i>. A container is the graphical location that embeds (or <i>swallows</i>) an external application.</p>
<p>QX11EmbedWidget is a widget used for writing XEmbed applets or plugins. When it 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>The widget and container can both initiate the embedding. If the widget is the initiator, the X11 window ID of the container that it wants to embed itself into must be passed to <a href="qx11embedwidget.html#embedInto">embedInto</a>().</p>
<p>If the container initiates the embedding, the window ID of the embedded widget must be known. The container calls embed(), passing the window ID.</p>
<p>This example shows an application that embeds a QX11EmbedWidget subclass into the window whose ID is passed as a command-line argument:</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="qtglobal.html#qFatal">qFatal</a>(<span class="string">"Error - expected window id as argument"</span>);
         <span class="keyword">return</span> <span class="number">1</span>;
     }
     <span class="type"><a href="qstring.html">QString</a></span> windowId(app<span class="operator">.</span>arguments()<span class="operator">[</span><span class="number">1</span><span class="operator">]</span>);
     EmbedWidget window;
     window<span class="operator">.</span>embedInto(windowId<span class="operator">.</span>toULong());
     window<span class="operator">.</span>show();
     <span class="keyword">return</span> app<span class="operator">.</span>exec();
 }</pre>
<p>The problem of obtaining the window IDs is often solved by the container invoking the application that provides the widget as a separate process (as a panel invokes a docked applet), passing its window ID to the new process as a command-line argument. The new process can then call <a href="qx11embedwidget.html#embedInto">embedInto</a>() with the container's window ID, as shown in the example code above. Similarly, the new process can report its window ID to the container through IPC, in which case the container can embed the widget.</p>
<p>When the widget has been embedded, it emits the signal <a href="qx11embedwidget.html#embedded">embedded</a>(). If it is closed by the container, the widget emits <a href="qx11embedwidget.html#containerClosed">containerClosed</a>(). If an error occurs when embedding, <a href="qx11embedwidget.html#error">error</a>() is emitted.</p>
<p>There are XEmbed widgets available for KDE and GTK+. The GTK+ equivalent of QX11EmbedWidget is GtkPlug. The corresponding KDE 3 widget is called QXEmbed.</p>
</div>
<p><b>See also </b><a href="qx11embedcontainer.html">QX11EmbedContainer</a> and <a href="http://www.freedesktop.org/Standards/xembed-spec">XEmbed Specification</a>.</p>
<!-- @@@QX11EmbedWidget -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$Error$$$Unknown$$$Internal$$$InvalidWindowID -->
<h3 class="fn"><a name="Error-enum"></a>enum QX11EmbedWidget::<span class="name">Error</span></h3>
<table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><tt>QX11EmbedWidget::Unknown</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">An unrecognized error occurred.</td></tr>
<tr><td class="topAlign"><tt>QX11EmbedWidget::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 <a href="qx11embedwidget.html#embedInto">embedInto</a>().</td></tr>
</table>
<!-- @@@Error -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QX11EmbedWidget[overload1]$$$QX11EmbedWidgetQWidget* -->
<h3 class="fn"><a name="QX11EmbedWidget"></a>QX11EmbedWidget::<span class="name">QX11EmbedWidget</span> ( <span class="type"><a href="qwidget.html">QWidget</a></span> * <i>parent</i> = 0 )</h3>
<p>Constructs a <a href="qx11embedwidget.html">QX11EmbedWidget</a> object with the given <i>parent</i>.</p>
<!-- @@@QX11EmbedWidget -->
<!-- $$$~QX11EmbedWidget[overload1]$$$~QX11EmbedWidget -->
<h3 class="fn"><a name="dtor.QX11EmbedWidget"></a>QX11EmbedWidget::<span class="name">~QX11EmbedWidget</span> ()</h3>
<p>Destructs the <a href="qx11embedwidget.html">QX11EmbedWidget</a> object. If the widget is embedded when deleted, it is hidden and then detached from its container, so that the container is free to embed a new widget.</p>
<!-- @@@~QX11EmbedWidget -->
<!-- $$$containerClosed[overload1]$$$containerClosed -->
<h3 class="fn"><a name="containerClosed"></a><span class="type">void</span> QX11EmbedWidget::<span class="name">containerClosed</span> ()<tt> [signal]</tt></h3>
<p>This signal is emitted by the client widget when the container closes the widget. This can happen if the container itself closes, or if the widget is rejected.</p>
<p>The container can reject a widget for any reason, but the most common cause of a rejection is when an attempt is made to embed a widget into a container that already has an embedded widget.</p>
<!-- @@@containerClosed -->
<!-- $$$containerWinId[overload1]$$$containerWinId -->
<h3 class="fn"><a name="containerWinId"></a><span class="type"><a href="qwidget.html#WId-typedef">WId</a></span> QX11EmbedWidget::<span class="name">containerWinId</span> () const</h3>
<p>If the widget is embedded, returns the window ID of the container; otherwize returns 0.</p>
<!-- @@@containerWinId -->
<!-- $$$embedInto[overload1]$$$embedIntoWId -->
<h3 class="fn"><a name="embedInto"></a><span class="type">void</span> QX11EmbedWidget::<span class="name">embedInto</span> ( <span class="type"><a href="qwidget.html#WId-typedef">WId</a></span> <i>id</i> )</h3>
<p>When this function is called, the widget embeds itself into the container whose window ID is <i>id</i>.</p>
<p>If <i>id</i> is <i>not</i> the window ID of a container this function will behave unpredictably.</p>
<!-- @@@embedInto -->
<!-- $$$embedded[overload1]$$$embedded -->
<h3 class="fn"><a name="embedded"></a><span class="type">void</span> QX11EmbedWidget::<span class="name">embedded</span> ()<tt> [signal]</tt></h3>
<p>This signal is emitted by the widget that has been embedded by an XEmbed container.</p>
<!-- @@@embedded -->
<!-- $$$error[overload1]$$$error -->
<h3 class="fn"><a name="error"></a><span class="type"><a href="qx11embedwidget.html#Error-enum">Error</a></span> QX11EmbedWidget::<span class="name">error</span> () const</h3>
<p>Returns the type of error that occurred last. This is the same error code that is emitted by the error() signal.</p>
<p><b>See also </b><a href="qx11embedwidget.html#Error-enum">Error</a>.</p>
<!-- @@@error -->
<!-- $$$error$$$errorQX11EmbedWidget::Error -->
<h3 class="fn"><a name="error-2"></a><span class="type">void</span> QX11EmbedWidget::<span class="name">error</span> ( <span class="type"><a href="qx11embedwidget.html#Error-enum">QX11EmbedWidget::Error</a></span> <i>error</i> )<tt> [signal]</tt></h3>
<p>This signal is emitted if an error occurred as a result of embedding into or communicating with a container. The specified <i>error</i> describes the problem that occurred.</p>
<p><b>See also </b><a href="qx11embedwidget.html#Error-enum">QX11EmbedWidget::Error</a>.</p>
<!-- @@@error -->
<!-- $$$event[overload1]$$$eventQEvent* -->
<h3 class="fn"><a name="event"></a><span class="type">bool</span> QX11EmbedWidget::<span class="name">event</span> ( <span class="type"><a href="qevent.html">QEvent</a></span> * <i>event</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qobject.html#event">QObject::event</a>().</p>
<!-- @@@event -->
<!-- $$$resizeEvent[overload1]$$$resizeEventQResizeEvent* -->
<h3 class="fn"><a name="resizeEvent"></a><span class="type">void</span> QX11EmbedWidget::<span class="name">resizeEvent</span> ( <span class="type"><a href="qresizeevent.html">QResizeEvent</a></span> * <i>event</i> )<tt> [virtual protected]</tt></h3>
<p>Reimplemented from <a href="qwidget.html#resizeEvent">QWidget::resizeEvent</a>().</p>
<!-- @@@resizeEvent -->
</div>
  <div class="ft">
    <span></span>
  </div>
</div> 
<div class="footer">
    <p>
      <acronym title="Copyright">©</acronym> 2012 Nokia Corporation and/or its
      subsidiaries. Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Nokia, Qt and their respective logos are trademarks of Nokia Corporation 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>
 
     |