Sophie

Sophie

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

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" />
<!-- plugins-howto.qdoc -->
  <title>Qt 4.8: How to Create Qt Plugins</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>How to Create Qt Plugins</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="#the-higher-level-api-writing-qt-extensions">The Higher-Level API: Writing Qt Extensions</a></li>
<li class="level1"><a href="#the-lower-level-api-extending-qt-applications">The Lower-Level API: Extending Qt Applications</a></li>
<li class="level1"><a href="#locating-plugins">Locating Plugins</a></li>
<li class="level1"><a href="#static-plugins">Static Plugins</a></li>
<li class="level1"><a href="#deploying-and-debugging-plugins">Deploying and Debugging Plugins</a></li>
</ul>
</div>
<h1 class="title">How to Create Qt Plugins</h1>
<span class="subtitle"></span>
<!-- $$$plugins-howto.html-description -->
<div class="descr"> <a name="details"></a>
<a name="qt-debug-plugins"></a><a name="qt-no-plugin-check"></a><p>Qt provides two APIs for creating plugins:</p>
<ul>
<li>A higher-level API for writing extensions to Qt itself: custom database drivers, image formats, text codecs, custom styles, etc.</li>
<li>A lower-level API for extending Qt applications.</li>
</ul>
<p>For example, if you want to write a custom <a href="qstyle.html">QStyle</a> subclass and have Qt applications load it dynamically, you would use the higher-level API.</p>
<p>Since the higher-level API is built on top of the lower-level API, some issues are common to both.</p>
<p>If you want to provide plugins for use with <i>Qt Designer</i>, see the <a href="qtdesigner.html">QtDesigner</a> module documentation.</p>
<p>Topics:</p>
<a name="the-higher-level-api-writing-qt-extensions"></a>
<h2>The Higher-Level API: Writing Qt Extensions</h2>
<p>Writing a plugin that extends Qt itself is achieved by subclassing the appropriate plugin base class, implementing a few functions, and adding a macro.</p>
<p>There are several plugin base classes. Derived plugins are stored by default in sub-directories of the standard plugin directory. Qt will not find plugins if they are not stored in the right directory.</p>
<table class="generic">
<thead><tr class="qt-style"><th >Base Class</th><th >Directory Name</th><th >Key Case Sensitivity</th></tr></thead>
<tr valign="top" class="odd"><td ><a href="qaccessiblebridgeplugin.html">QAccessibleBridgePlugin</a></td><td ><tt>accessiblebridge</tt></td><td >Case Sensitive</td></tr>
<tr valign="top" class="even"><td ><a href="qaccessibleplugin.html">QAccessiblePlugin</a></td><td ><tt>accessible</tt></td><td >Case Sensitive</td></tr>
<tr valign="top" class="odd"><td ><a href="qdecorationplugin.html">QDecorationPlugin</a></td><td ><tt>decorations</tt></td><td >Case Insensitive</td></tr>
<tr valign="top" class="even"><td ><a href="qfontengineplugin.html">QFontEnginePlugin</a></td><td ><tt>fontengines</tt></td><td >Case Insensitive</td></tr>
<tr valign="top" class="odd"><td ><a href="qiconengineplugin.html">QIconEnginePlugin</a></td><td ><tt>iconengines</tt></td><td >Case Insensitive</td></tr>
<tr valign="top" class="even"><td ><a href="qimageioplugin.html">QImageIOPlugin</a></td><td ><tt>imageformats</tt></td><td >Case Sensitive</td></tr>
<tr valign="top" class="odd"><td ><a href="qinputcontextplugin.html">QInputContextPlugin</a></td><td ><tt>inputmethods</tt></td><td >Case Sensitive</td></tr>
<tr valign="top" class="even"><td ><a href="qkbddriverplugin.html">QKbdDriverPlugin</a></td><td ><tt>kbddrivers</tt></td><td >Case Insensitive</td></tr>
<tr valign="top" class="odd"><td ><a href="qmousedriverplugin.html">QMouseDriverPlugin</a></td><td ><tt>mousedrivers</tt></td><td >Case Insensitive</td></tr>
<tr valign="top" class="even"><td ><a href="qscreendriverplugin.html">QScreenDriverPlugin</a></td><td ><tt>gfxdrivers</tt></td><td >Case Insensitive</td></tr>
<tr valign="top" class="odd"><td ><a href="qscriptextensionplugin.html">QScriptExtensionPlugin</a></td><td ><tt>script</tt></td><td >Case Sensitive</td></tr>
<tr valign="top" class="even"><td ><a href="qsqldriverplugin.html">QSqlDriverPlugin</a></td><td ><tt>sqldrivers</tt></td><td >Case Sensitive</td></tr>
<tr valign="top" class="odd"><td ><a href="qstyleplugin.html">QStylePlugin</a></td><td ><tt>styles</tt></td><td >Case Insensitive</td></tr>
<tr valign="top" class="even"><td ><a href="qtextcodecplugin.html">QTextCodecPlugin</a></td><td ><tt>codecs</tt></td><td >Case Sensitive</td></tr>
</table>
<p>Suppose that you have a new style class called <tt>MyStyle</tt> that you want to make available as a plugin. The required code is straightforward, here is the class definition (<tt>mystyleplugin.h</tt>):</p>
<pre class="cpp"> <span class="keyword">class</span> MyStylePlugin : <span class="keyword">public</span> <span class="type"><a href="qstyleplugin.html">QStylePlugin</a></span>
 {
 <span class="keyword">public</span>:
     <span class="type"><a href="qstringlist.html">QStringList</a></span> keys() <span class="keyword">const</span>;
     <span class="type"><a href="qstyle.html">QStyle</a></span> <span class="operator">*</span>create(<span class="keyword">const</span> <span class="type"><a href="qstring.html">QString</a></span> <span class="operator">&amp;</span>key);
 };</pre>
<p>Ensure that the class implementation is located in a <tt>.cpp</tt> file (including the class definition):</p>
<pre class="cpp"> <span class="preprocessor">#include &quot;mystyleplugin.h&quot;</span>

 <span class="type"><a href="qstringlist.html">QStringList</a></span> MyStylePlugin<span class="operator">::</span>keys() <span class="keyword">const</span>
 {
     <span class="keyword">return</span> <span class="type"><a href="qstringlist.html">QStringList</a></span>() <span class="operator">&lt;</span><span class="operator">&lt;</span> <span class="string">&quot;MyStyle&quot;</span>;
 }

 <span class="type"><a href="qstyle.html">QStyle</a></span> <span class="operator">*</span>MyStylePlugin<span class="operator">::</span>create(<span class="keyword">const</span> <span class="type"><a href="qstring.html">QString</a></span> <span class="operator">&amp;</span>key)
 {
     <span class="keyword">if</span> (key<span class="operator">.</span>toLower() <span class="operator">=</span><span class="operator">=</span> <span class="string">&quot;mystyle&quot;</span>)
         <span class="keyword">return</span> <span class="keyword">new</span> MyStyle;
     <span class="keyword">return</span> <span class="number">0</span>;
 }

 <a href="qtplugin.html#Q_EXPORT_PLUGIN2">Q_EXPORT_PLUGIN2</a>(pnp_mystyleplugin<span class="operator">,</span> MyStylePlugin)</pre>
<p>(Note that <a href="qstyleplugin.html">QStylePlugin</a> is case insensitive, and the lower-case version of the key is used in our <a href="qstyleplugin.html#create">create()</a> implementation; most other plugins are case sensitive.)</p>
<p>For database drivers, image formats, text codecs, and most other plugin types, no explicit object creation is required. Qt will find and create them as required. Styles are an exception, since you might want to set a style explicitly in code. To apply a style, use code like this:</p>
<pre class="cpp"> <span class="type"><a href="qapplication.html">QApplication</a></span><span class="operator">::</span>setStyle(<span class="type"><a href="qstylefactory.html">QStyleFactory</a></span><span class="operator">::</span>create(<span class="string">&quot;MyStyle&quot;</span>));</pre>
<p>Some plugin classes require additional functions to be implemented. See the class documentation for details of the virtual functions that must be reimplemented for each type of plugin.</p>
<p>The <a href="tools-styleplugin.html">Style Plugin Example</a> shows how to implement a plugin that extends the <a href="qstyleplugin.html">QStylePlugin</a> base class.</p>
<a name="the-lower-level-api-extending-qt-applications"></a>
<h2>The Lower-Level API: Extending Qt Applications</h2>
<p>Not only Qt itself but also Qt application can be extended through plugins. This requires the application to detect and load plugins using <a href="qpluginloader.html">QPluginLoader</a>. In that context, plugins may provide arbitrary functionality and are not limited to database drivers, image formats, text codecs, styles, and the other types of plugin that extend Qt's functionality.</p>
<p>Making an application extensible through plugins involves the following steps:</p>
<ol class="1">
<li>Define a set of interfaces (classes with only pure virtual functions) used to talk to the plugins.</li>
<li>Use the <a href="qtplugin.html#Q_DECLARE_INTERFACE">Q_DECLARE_INTERFACE</a>() macro to tell Qt's <a href="metaobjects.html#meta-object-system">meta-object system</a> about the interface.</li>
<li>Use <a href="qpluginloader.html">QPluginLoader</a> in the application to load the plugins.</li>
<li>Use <a href="qobject.html#qobject_cast">qobject_cast</a>() to test whether a plugin implements a given interface.</li>
</ol>
<p>Writing a plugin involves these steps:</p>
<ol class="1">
<li>Declare a plugin class that inherits from <a href="qobject.html">QObject</a> and from the interfaces that the plugin wants to provide.</li>
<li>Use the <a href="qobject.html#Q_INTERFACES">Q_INTERFACES</a>() macro to tell Qt's <a href="metaobjects.html#meta-object-system">meta-object system</a> about the interfaces.</li>
<li>Export the plugin using the <a href="qtplugin.html#Q_EXPORT_PLUGIN2">Q_EXPORT_PLUGIN2</a>() macro.</li>
<li>Build the plugin using a suitable <tt>.pro</tt> file.</li>
</ol>
<p>For example, here's the definition of an interface class:</p>
<pre class="cpp"> <span class="keyword">class</span> FilterInterface
 {
 <span class="keyword">public</span>:
     <span class="keyword">virtual</span> <span class="operator">~</span>FilterInterface() {}

     <span class="keyword">virtual</span> <span class="type"><a href="qstringlist.html">QStringList</a></span> filters() <span class="keyword">const</span> <span class="operator">=</span> <span class="number">0</span>;
     <span class="keyword">virtual</span> <span class="type"><a href="qimage.html">QImage</a></span> filterImage(<span class="keyword">const</span> <span class="type"><a href="qstring.html">QString</a></span> <span class="operator">&amp;</span>filter<span class="operator">,</span> <span class="keyword">const</span> <span class="type"><a href="qimage.html">QImage</a></span> <span class="operator">&amp;</span>image<span class="operator">,</span>
                                <span class="type"><a href="qwidget.html">QWidget</a></span> <span class="operator">*</span>parent) <span class="operator">=</span> <span class="number">0</span>;
 };</pre>
<p>Here's the definition of a plugin class that implements that interface:</p>
<pre class="cpp"> <span class="preprocessor">#include &lt;QObject&gt;</span>
 <span class="preprocessor">#include &lt;QStringList&gt;</span>
 <span class="preprocessor">#include &lt;QImage&gt;</span>

 <span class="preprocessor">#include &lt;plugandpaint/interfaces.h&gt;</span>

 <span class="keyword">class</span> ExtraFiltersPlugin : <span class="keyword">public</span> <span class="type"><a href="qobject.html">QObject</a></span><span class="operator">,</span> <span class="keyword">public</span> FilterInterface
 {
     Q_OBJECT
     Q_INTERFACES(FilterInterface)

 <span class="keyword">public</span>:
     <span class="type"><a href="qstringlist.html">QStringList</a></span> filters() <span class="keyword">const</span>;
     <span class="type"><a href="qimage.html">QImage</a></span> filterImage(<span class="keyword">const</span> <span class="type"><a href="qstring.html">QString</a></span> <span class="operator">&amp;</span>filter<span class="operator">,</span> <span class="keyword">const</span> <span class="type"><a href="qimage.html">QImage</a></span> <span class="operator">&amp;</span>image<span class="operator">,</span>
                        <span class="type"><a href="qwidget.html">QWidget</a></span> <span class="operator">*</span>parent);
 };</pre>
<p>The <a href="tools-plugandpaint.html">Plug &amp; Paint</a> example documentation explains this process in detail. See also <a href="designer-creating-custom-widgets.html">Creating Custom Widgets for Qt Designer</a> for information about issues that are specific to <i>Qt Designer</i>. You can also take a look at the <a href="tools-echoplugin.html">Echo Plugin Example</a> is a more trivial example on how to implement a plugin that extends Qt applications. Please note that a <a href="qcoreapplication.html">QCoreApplication</a> must have been initialized before plugins can be loaded.</p>
<a name="locating-plugins"></a>
<h2>Locating Plugins</h2>
<p>Qt applications automatically know which plugins are available, because plugins are stored in the standard plugin subdirectories. Because of this applications don't require any code to find and load plugins, since Qt handles them automatically.</p>
<p>During development, the directory for plugins is <tt>QTDIR/plugins</tt> (where <tt>QTDIR</tt> is the directory where Qt is installed), with each type of plugin in a subdirectory for that type, e.g&#x2e; <tt>styles</tt>. If you want your applications to use plugins and you don't want to use the standard plugins path, have your installation process determine the path you want to use for the plugins, and save the path, e.g&#x2e; using <a href="qsettings.html">QSettings</a>, for the application to read when it runs. The application can then call <a href="qcoreapplication.html#addLibraryPath">QCoreApplication::addLibraryPath</a>() with this path and your plugins will be available to the application. Note that the final part of the path (e.g&#x2e;, <tt>styles</tt>) cannot be changed.</p>
<p>If you want the plugin to be loadable then one approach is to create a subdirectory under the application and place the plugin in that directory. If you distribute any of the plugins that come with Qt (the ones located in the <tt>plugins</tt> directory), you must copy the sub-directory under <tt>plugins</tt> where the plugin is located to your applications root folder (i.e&#x2e;, do not include the <tt>plugins</tt> directory).</p>
<p><b>Note:</b> In Symbian all binaries must be located in the directory \sys\bin, so each Qt plugin has a stub with the same basename as the plugin dll and suffix &quot;.qtplugin&quot; to make Qt extension plugins work similarly to other platforms. When trying to locate the plugin, Qt actually looks for the stub instead of the plugin binary. While plugin stub files have the suffix &quot;.qtplugin&quot;, they can still be loaded also by specifying a filename with the normal library suffix &quot;.dll&quot; for <a href="qpluginloader.html">QPluginLoader</a>, so normally application developer doesn't need to care about the different suffix of the stub. Because of the way applications can be installed on ROM or various other drives in Symbian, Qt looks for the stub from the same directory on all available drives if it is not located in the given directory when loading a plugin.</p>
<p>For more information about deployment, see the <a href="deployment.html">Deploying Qt Applications</a> and <a href="deployment-plugins.html">Deploying Plugins</a> documentation.</p>
<a name="static-plugins"></a>
<h2>Static Plugins</h2>
<p>The normal and most flexible way to include a plugin with an application is to compile it into a dynamic library that is shipped separately, and detected and loaded at runtime.</p>
<p>Plugins can be linked statically against your application. If you build the static version of Qt, this is the only option for including Qt's predefined plugins. Using static plugins makes the deployment less error-prone, but has the disadvantage that no functionality from plugins can be added without a complete rebuild and redistribution of the application.</p>
<p>When compiled as a static library, Qt provides the following static plugins:</p>
<table class="generic">
<thead><tr class="qt-style"><th >Plugin name</th><th >Type</th><th >Description</th></tr></thead>
<tr valign="top" class="odd"><td ><tt>qtaccessiblecompatwidgets</tt></td><td >Accessibility</td><td >Accessibility for Qt 3 support widgets</td></tr>
<tr valign="top" class="even"><td ><tt>qtaccessiblewidgets</tt></td><td >Accessibility</td><td >Accessibility for Qt widgets</td></tr>
<tr valign="top" class="odd"><td ><tt>qdecorationdefault</tt></td><td >Decorations (Qt Extended)</td><td >Default style</td></tr>
<tr valign="top" class="even"><td ><tt>qdecorationwindows</tt></td><td >Decorations (Qt Extended)</td><td >Windows style</td></tr>
<tr valign="top" class="odd"><td ><tt>qgif</tt></td><td >Image formats</td><td >GIF</td></tr>
<tr valign="top" class="even"><td ><tt>qjpeg</tt></td><td >Image formats</td><td >JPEG</td></tr>
<tr valign="top" class="odd"><td ><tt>qmng</tt></td><td >Image formats</td><td >MNG</td></tr>
<tr valign="top" class="even"><td ><tt>qico</tt></td><td >Image formats</td><td >ICO</td></tr>
<tr valign="top" class="odd"><td ><tt>qsvg</tt></td><td >Image formats</td><td >SVG</td></tr>
<tr valign="top" class="even"><td ><tt>qtiff</tt></td><td >Image formats</td><td >TIFF</td></tr>
<tr valign="top" class="odd"><td ><tt>qimsw_multi</tt></td><td >Input methods (Qt Extended)</td><td >Input Method Switcher</td></tr>
<tr valign="top" class="even"><td ><tt>qwstslibmousehandler</tt></td><td >Mouse drivers (Qt Extended)</td><td ><tt>tslib</tt> mouse</td></tr>
<tr valign="top" class="odd"><td ><tt>qgfxtransformed</tt></td><td >Graphic drivers (Qt Extended)</td><td >Transformed screen</td></tr>
<tr valign="top" class="even"><td ><tt>qgfxvnc</tt></td><td >Graphic drivers (Qt Extended)</td><td >VNC</td></tr>
<tr valign="top" class="odd"><td ><tt>qscreenvfb</tt></td><td >Graphic drivers (Qt Extended)</td><td >Virtual frame buffer</td></tr>
<tr valign="top" class="even"><td ><tt>qsqldb2</tt></td><td >SQL driver</td><td >IBM DB2</td></tr>
<tr valign="top" class="odd"><td ><tt>qsqlibase</tt></td><td >SQL driver</td><td >Borland InterBase</td></tr>
<tr valign="top" class="even"><td ><tt>qsqlite</tt></td><td >SQL driver</td><td >SQLite version 3</td></tr>
<tr valign="top" class="odd"><td ><tt>qsqlite2</tt></td><td >SQL driver</td><td >SQLite version 2</td></tr>
<tr valign="top" class="even"><td ><tt>qsqlmysql</tt></td><td >SQL driver</td><td >MySQL</td></tr>
<tr valign="top" class="odd"><td ><tt>qsqloci</tt></td><td >SQL driver</td><td >Oracle (OCI)</td></tr>
<tr valign="top" class="even"><td ><tt>qsqlodbc</tt></td><td >SQL driver</td><td >Open Database Connectivity (ODBC)</td></tr>
<tr valign="top" class="odd"><td ><tt>qsqlpsql</tt></td><td >SQL driver</td><td >PostgreSQL</td></tr>
<tr valign="top" class="even"><td ><tt>qsqltds</tt></td><td >SQL driver</td><td >Sybase Adaptive Server (TDS)</td></tr>
<tr valign="top" class="odd"><td ><tt>qcncodecs</tt></td><td >Text codecs</td><td >Simplified Chinese (People's Republic of China)</td></tr>
<tr valign="top" class="even"><td ><tt>qjpcodecs</tt></td><td >Text codecs</td><td >Japanese</td></tr>
<tr valign="top" class="odd"><td ><tt>qkrcodecs</tt></td><td >Text codecs</td><td >Korean</td></tr>
<tr valign="top" class="even"><td ><tt>qtwcodecs</tt></td><td >Text codecs</td><td >Traditional Chinese (Taiwan)</td></tr>
</table>
<p>To link statically against those plugins, you need to use the <a href="qtplugin.html#Q_IMPORT_PLUGIN">Q_IMPORT_PLUGIN</a>() macro in your application and you need to add the required plugins to your build using <tt>QTPLUGIN</tt>. For example, in your <tt>main.cpp</tt>:</p>
<pre class="cpp"> <span class="preprocessor">#include &lt;QApplication&gt;</span>
 <span class="preprocessor">#include &lt;QtPlugin&gt;</span>

 <a href="qtplugin.html#Q_IMPORT_PLUGIN">Q_IMPORT_PLUGIN</a>(qjpeg)
 <a href="qtplugin.html#Q_IMPORT_PLUGIN">Q_IMPORT_PLUGIN</a>(qgif)
 <a href="qtplugin.html#Q_IMPORT_PLUGIN">Q_IMPORT_PLUGIN</a>(qkrcodecs)

 <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="operator">.</span><span class="operator">.</span><span class="operator">.</span>
     <span class="keyword">return</span> app<span class="operator">.</span>exec();
 }</pre>
<p>In the <tt>.pro</tt> file for your application, you need the following entry:</p>
<pre class="cpp"> QTPLUGIN     += qjpeg \
                 qgif \
                 qkrcodecs</pre>
<p>It is also possible to create your own static plugins, by following these steps:</p>
<ol class="1">
<li>Add <tt>CONFIG += static</tt> to your plugin's <tt>.pro</tt> file.</li>
<li>Use the <a href="qtplugin.html#Q_IMPORT_PLUGIN">Q_IMPORT_PLUGIN</a>() macro in your application.</li>
<li>Link your application with your plugin library using <tt>LIBS</tt> in the <tt>.pro</tt> file.</li>
</ol>
<p>See the <a href="tools-plugandpaint.html">Plug &amp; Paint</a> example and the associated <a href="tools-plugandpaintplugins-basictools.html">Basic Tools</a> plugin for details on how to do this.</p>
<p><b>Note:</b> If you are not using qmake to build your application you need to make sure that the <tt>QT_STATICPLUGIN</tt> preprocessor macro is defined.</p>
<a name="deploying-and-debugging-plugins"></a>
<h2>Deploying and Debugging Plugins</h2>
<p>The <a href="deployment-plugins.html">Deploying Plugins</a> document covers the process of deploying plugins with applications and debugging them when problems arise.</p>
</div>
<p><b>See also </b><a href="qpluginloader.html">QPluginLoader</a>, <a href="qlibrary.html">QLibrary</a>, and <a href="tools-plugandpaint.html">Plug &amp; Paint Example</a>.</p>
<!-- @@@plugins-howto.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>