Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 6612

qt4-doc-4.8.7-26.2.mga7.noarch.rpm

<?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" />
<!-- emb-architecture.qdoc -->
  <title>Qt 4.8: Qt for Embedded Linux Architecture</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li>Qt for Embedded Linux Architecture</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#client-server-communication">Client/Server Communication</a></li>
<li class="level1"><a href="#pointer-handling-layer">Pointer Handling Layer</a></li>
<li class="level1"><a href="#character-input-layer">Character Input Layer</a></li>
<li class="level1"><a href="#graphics-rendering">Graphics Rendering</a></li>
<li class="level1"><a href="#drawing-on-screen">Drawing on Screen</a></li>
</ul>
</div>
<h1 class="title">Qt for Embedded Linux Architecture</h1>
<span class="subtitle"></span>
<!-- $$$qt-embedded-architecture.html-description -->
<div class="descr"> <a name="details"></a>
<p>A <a href="qt-embedded-linux.html">Qt for Embedded Linux</a> application requires a server application to be running, or to be the server application itself. Any <a href="qt-embedded-linux.html">Qt for Embedded Linux</a> application can act as the server. When more than one application is running, the subsequent applications connect to the existing server application as clients.</p>
<p>The server and client processes have different responsibilities: The server process manages pointer handling, character input, and screen output. In addition, the server controls the appearance of the screen cursor and the screen saver. The client process performs all application specific operations.</p>
<p>The server application is represented by an instance of the <a href="qwsserver.html">QWSServer</a> class, while the client applications are represented by instances of the <a href="qwsclient.html">QWSClient</a> class. On each side, there are several classes performing the various operations.</p>
<p class="centerAlign"><img src="images/qt-embedded-architecture2.png" alt="" /></p><p>All system generated events, including keyboard and mouse events, are passed to the server application which then propagates the event to the appropriate client.</p>
<p>When rendering, the default behavior is for each client to render its widgets into memory while the server is responsible for putting the contents of the memory onto the screen. But when the hardware is known and well defined, as is often the case with software for embedded devices, it may be useful for the clients to manipulate and control the underlying hardware directly. <a href="qt-embedded-linux.html">Qt for Embedded Linux</a> provides two different approaches to achieve this behavior, see the graphics rendering section below for details.</p>
<a name="client-server-communication"></a>
<h2>Client/Server Communication</h2>
<p>The running applications continuously alter the appearance of the screen by adding and removing widgets. The server maintains information about each top-level window in a corresponding <a href="qwswindow.html">QWSWindow</a> object.</p>
<p>Whenever the server receives an event, it queries its stack of top-level windows to find the window containing the event's position. Each window can identify the client application that created it, and returns its ID to the server upon request. Finally, the server forwards the event, encapsulated by an instance of the <a href="qwsevent.html">QWSEvent</a> class, to the appropriate client.</p>
<p class="centerAlign"><img src="images/qt-embedded-clientservercommunication.png" alt="" /></p><p>If an input method is installed, it is used as a filter between the server and the client application. Derive from the <a href="qwsinputmethod.html">QWSInputMethod</a> class to implement custom input methods, and use the server's <a href="qwsserver.html#setCurrentInputMethod">setCurrentInputMethod()</a> function to install it. In addition, it is possible to implement global, low-level filters on key events using the <a href="qwsserver-keyboardfilter.html">QWSServer::KeyboardFilter</a> class; this can be used to implement things like advanced power management suspended from a button without having to filter for it in all applications.</p>
<table class="generic" width="100%">
 <thead><tr class="qt-style"><th >UNIX Domain Socket</th></tr></thead>
<tr valign="top" class="odd"><td ><p class="centerAlign"><img src="images/qt-embedded-client.png" alt="" /></p><p>The server communicates with the client applications over the UNIX domain socket. You can retrieve direct access to all the events a client receives from the server, by reimplementing <a href="qapplication.html">QApplication</a>'s <a href="qapplication.html#qwsEventFilter">qwsEventFilter()</a> function.</p>
</td></tr>
</table>
<p>The clients (and the server) communicate with each other using the <a href="qcopchannel.html">QCopChannel</a> class. QCOP is a many-to-many communication protocol for transferring messages on various channels. A channel is identified by a name, and anyone who wants to can listen to it. The QCOP protocol allows clients to communicate both within the same address space and between different processes.</p>
<a name="pointer-handling-layer"></a>
<h2>Pointer Handling Layer</h2>
<ul>
<li><a href="qwsmousehandler.html">QWSMouseHandler</a></li>
<li><a href="qmousedriverplugin.html">QMouseDriverPlugin</a></li>
<li><a href="qmousedriverfactory.html">QMouseDriverFactory</a></li>
</ul>
<p>The mouse driver (represented by an instance of the <a href="qwsmousehandler.html">QWSMouseHandler</a> class) is loaded by the server application when it starts running, using Qt's <a href="plugins-howto.html">plugin system</a>.</p>
<p class="centerAlign"><img src="images/qt-embedded-pointerhandlinglayer.png" alt="" /></p><p>A mouse driver receives mouse events from the device and encapsulates each event with an instance of the <a href="qwsevent.html">QWSEvent</a> class which it then passes to the server.</p>
<p><a href="qt-embedded-linux.html">Qt for Embedded Linux</a> provides ready-made drivers for several mouse protocols, see the <a href="qt-embedded-pointer.html">pointer handling</a> documentation for details. Custom mouse drivers can be implemented by subclassing the <a href="qwsmousehandler.html">QWSMouseHandler</a> class and creating a mouse driver plugin. The default implementation of the <a href="qmousedriverfactory.html">QMouseDriverFactory</a> class will automatically detect the plugin, loading the driver into the server application at runtime.</p>
<p>In addition to the generic mouse handler, <a href="qt-embedded-linux.html">Qt for Embedded Linux</a> provides a calibrated mouse handler. Use the <a href="qwscalibratedmousehandler.html">QWSCalibratedMouseHandler</a> class as the base class when the system device does not have a fixed mapping between device and screen coordinates and/or produces noisy events, e.g&#x2e; a touchscreen.</p>
<p>See also: <a href="qt-embedded-pointer.html">Qt for Embedded Linux Pointer Handling</a> and <a href="plugins-howto.html">How to Create Qt Plugins</a>.</p>
<a name="character-input-layer"></a>
<h2>Character Input Layer</h2>
<ul>
<li><a href="qwskeyboardhandler.html">QWSKeyboardHandler</a></li>
<li><a href="qkbddriverplugin.html">QKbdDriverPlugin</a></li>
<li><a href="qkbddriverfactory.html">QKbdDriverFactory</a></li>
</ul>
<p>The keyboard driver (represented by an instance of the <a href="qwskeyboardhandler.html">QWSKeyboardHandler</a> class) is loaded by the server application when it starts running, using Qt's <a href="plugins-howto.html">plugin system</a>.</p>
<p class="centerAlign"><img src="images/qt-embedded-characterinputlayer.png" alt="" /></p><p>A keyboard driver receives keyboard events from the device and encapsulates each event with an instance of the <a href="qwsevent.html">QWSEvent</a> class which it then passes to the server.</p>
<p><a href="qt-embedded-linux.html">Qt for Embedded Linux</a> provides ready-made drivers for several keyboard protocols, see the <a href="qt-embedded-charinput.html">character input</a> documentation for details. Custom keyboard drivers can be implemented by subclassing the <a href="qwskeyboardhandler.html">QWSKeyboardHandler</a> class and creating a keyboard driver plugin. The default implementation of the <a href="qkbddriverfactory.html">QKbdDriverFactory</a> class will automatically detect the plugin, loading the driver into the server application at run-time.</p>
<p>See also: <a href="qt-embedded-charinput.html">Qt for Embedded Linux Character Input</a> and <a href="plugins-howto.html">How to Create Qt Plugins</a>.</p>
<a name="graphics-rendering"></a>
<h2>Graphics Rendering</h2>
<ul>
<li><a href="qapplication.html">QApplication</a></li>
<li><a href="qdecoration.html">QDecoration</a></li>
<li><a href="qdecorationplugin.html">QDecorationPlugin</a></li>
<li><a href="qdecorationfactory.html">QDecorationFactory</a></li>
</ul>
<p>The default behavior is for each client to render its widgets as well as its decorations into memory, while the server copies the memory content to the device's framebuffer.</p>
<p>Whenever a client receives an event that alters any of its widgets, the application updates the relevant parts of its memory buffer:</p>
<p class="centerAlign"><img src="images/qt-embedded-clientrendering.png" alt="" /></p><p>The decoration is loaded by the client application when it starts running (using Qt's <a href="plugins-howto.html">plugin system</a>), and can be customized by deriving from the <a href="qdecoration.html">QDecoration</a> class and creating a decoration plugin. The default implementation of the <a href="qdecorationfactory.html">QDecorationFactory</a> class will automatically detect the plugin, loading the decoration into the application at runtime. Call the <a href="qapplication.html#qwsSetDecoration">QApplication::qwsSetDecoration</a>() function to actually apply the given decoration to an application.</p>
<table class="generic" width="100%">
 <thead><tr class="qt-style"><th >Direct Painting <a name="direct-painting"></a></th></tr></thead>
<tr valign="top" class="odd"><td >It is possible for the clients to manipulate and control the underlying hardware directly. There are two ways of achieving this: The first approach is to set the <a href="qt.html#WidgetAttribute-enum">Qt::WA_PaintOnScreen</a> window attribute for each widget, the other is to use the <a href="qdirectpainter.html">QDirectPainter</a> class to reserve a region of the framebuffer.<p class="centerAlign"><img src="images/qt-embedded-setwindowattribute.png" alt="" /></p><p>By setting the <a href="qt.html#WidgetAttribute-enum">Qt::WA_PaintOnScreen</a> attribute, the application renders the widget directly onto the screen and the affected region will not be modified by the screen driver <i>unless</i> another window with a higher focus requests (parts of) the same region. Note that if you want to render all of an application's widgets directly on screen, it might be easier to set the <a href="qt-embedded-envvars.html#qt-onscreen-paint">QT_ONSCREEN_PAINT</a> environment variable.</p>
<p class="centerAlign"><img src="images/qt-embedded-reserveregion.png" alt="" /></p><p>Using <a href="qdirectpainter.html">QDirectPainter</a>, on the other hand, provides a complete control over the reserved region, i.e&#x2e;, the screen driver will never modify the given region.</p>
<p>To draw on a region reserved by a <a href="qdirectpainter.html">QDirectPainter</a> instance, the application must get hold of a pointer to the framebuffer. In general, a pointer to the framebuffer can be retrieved using the <a href="qdirectpainter.html#frameBuffer">QDirectPainter::frameBuffer</a>() function. But note that if the current screen has subscreens, you must query the screen driver instead to identify the correct subscreen. A pointer to the current screen driver can always be retrieved using the static <a href="qscreen.html#instance">QScreen::instance</a>() function. Then use <a href="qscreen.html">QScreen</a>'s <a href="qscreen.html#subScreenIndexAt">subScreenIndexAt()</a> and <a href="qscreen.html#subScreens">subScreens()</a> functions to access the correct subscreen, and the subscreen's <a href="qscreen.html#base">base()</a> function to retrieve a pointer to the framebuffer.</p>
<p>Note that <a href="qt-embedded-linux.html">Qt for Embedded Linux</a> also provides the <a href="qwsembedwidget.html">QWSEmbedWidget</a> class, making it possible to embed the reserved region (i.e&#x2e;, the <a href="qdirectpainter.html">QDirectPainter</a> object) in a regular widget.</p>
</td></tr>
</table>
<a name="drawing-on-screen"></a>
<h2>Drawing on Screen</h2>
<ul>
<li><a href="qscreen.html">QScreen</a></li>
<li><a href="qscreendriverplugin.html">QScreenDriverPlugin</a></li>
<li><a href="qscreendriverfactory.html">QScreenDriverFactory</a></li>
</ul>
<p>When a screen update is required, the server runs through all the top-level windows that intersect with the region that is about to be updated, and ensures that the associated clients have updated their memory buffer. Then the server uses the screen driver (represented by an instance of the <a href="qscreen.html">QScreen</a> class) to copy the content of the memory to the screen.</p>
<p>The screen driver is loaded by the server application when it starts running, using Qt's plugin system. <a href="qt-embedded-linux.html">Qt for Embedded Linux</a> provides ready-made drivers for several screen protocols, see the <a href="qt-embedded-displaymanagement.html">display management</a> documentation for details. Custom screen drivers can be implemented by subclassing the <a href="qscreen.html">QScreen</a> class and creating a screen driver plugin. The default implementation of the <a href="qscreendriverfactory.html">QScreenDriverFactory</a> class will automatically detect the plugin, loading the driver into the server application at run-time.</p>
<p class="centerAlign"><img src="images/qt-embedded-drawingonscreen.png" alt="" /></p><p>To locate the relevant parts of memory, the driver is provided with the list of top-level windows that intersect with the given region. Associated with each of the top-level windows there is an instance of the QWSWindowSurface class representing the drawing area of the window. The driver uses these objects to retrieve pointers to the various memory blocks. Finally, the screen driver composes the surface images before copying the updated region to the framebuffer.</p>
<table class="generic" width="100%">
 <thead><tr class="qt-style"><th >Accelerated Graphics</th></tr></thead>
<tr valign="top" class="odd"><td >In <a href="qt-embedded-linux.html">Qt for Embedded Linux</a>, painting is a pure software implementation, but (starting with Qt 4.2) it is possible to add an accelerated graphics driver to take advantage of available hardware resources.<p class="centerAlign"><img src="images/qt-embedded-accelerateddriver.png" alt="" /></p><p>The clients render each window onto a corresponding window surface object using Qt's paint system, and then store the surface in memory. The screen driver accesses the memory and composes the surface images before it copies them to the screen as explained above.</p>
<p>To add an accelerated graphics driver you must create a custom screen and implement a custom raster paint engine (<a href="qt-embedded-linux.html">Qt for Embedded Linux</a> uses a raster-based paint engine to implement the painting operations). Then you must create a custom paint device that is aware of your paint engine, a custom window surface that knows about your paint device, and make your screen able to recognize your window surface.</p>
<p>See the <a href="qt-embedded-accel.html">accelerated graphics driver</a> documentation for details.</p>
</td></tr>
</table>
<p>See also: <a href="qt-embedded-displaymanagement.html">Qt for Embedded Linux Display Management</a> and <a href="plugins-howto.html">How to Create Qt Plugins</a>.</p>
</div>
<!-- @@@qt-embedded-architecture.html -->
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
      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>
      Qt and respective logos are trademarks of The Qt Company Ltd 
      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>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>