Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > e63754dc5af9f9ec95223fcea9485104 > files > 1443

python3-PyQt4-devel-4.8.3-2.fc14.x86_64.rpm

<?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>QDesignerCustomWidgetCollectionInterface 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">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QDesignerCustomWidgetCollectionInterface Class Reference<br /><sup><sup>[<a href="qtdesigner.html">QtDesigner</a> module]</sup></sup></h1><p>The QDesignerCustomWidgetCollectionInterface class allows you to
include several custom widgets in one single library. <a href="#details">More...</a></p>

<p>Inherited by <a href="qpydesignercustomwidgetcollectionplugin.html">QPyDesignerCustomWidgetCollectionPlugin</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdesignercustomwidgetcollectioninterface.html#QDesignerCustomWidgetCollectionInterface">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdesignercustomwidgetcollectioninterface.html#QDesignerCustomWidgetCollectionInterface-2">__init__</a></b> (<i>self</i>, QDesignerCustomWidgetCollectionInterface)</li><li><div class="fn" />list-of-QDesignerCustomWidgetInterface <b><a href="qdesignercustomwidgetcollectioninterface.html#customWidgets">customWidgets</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDesignerCustomWidgetCollectionInterface class allows you to
include several custom widgets in one single library.</p>
<p>When implementing a custom widget plugin, you build it as a
separate library. If you want to include several custom widget
plugins in the same library, you must in addition subclass
QDesignerCustomWidgetCollectionInterface.</p>
<p>QDesignerCustomWidgetCollectionInterface contains one single
function returning a list of the collection's <a href="qdesignercustomwidgetinterface.html">QDesignerCustomWidgetInterface</a>
objects. For example, if you have several custom widgets
<tt>CustomWidgetOne</tt>, <tt>CustomWidgetTwo</tt> and
<tt>CustomWidgetThree</tt>, the class definition may look like
this:</p>
<pre class="highlightedCode brush: cpp">
 #include customwidgetoneinterface.h
 #include customwidgettwointerface.h
 #include customwidgetthreeinterface.h

 #include &lt;QtDesigner/QtDesigner&gt;
 #include &lt;QtCore/qplugin.h&gt;

 class MyCustomWidgets: public QObject, public QDesignerCustomWidgetCollectionInterface
 {
     Q_OBJECT
     Q_INTERFACES(QDesignerCustomWidgetCollectionInterface)

 public:
     MyCustomWidgets(QObject *parent = 0);

     virtual QList&lt;QDesignerCustomWidgetInterface*&gt; customWidgets() const;

 private:
     QList&lt;QDesignerCustomWidgetInterface*&gt; widgets;
 };
</pre>
<p>In the class constructor you add the interfaces to your custom
widgets to the list which you return in the <a href="qdesignercustomwidgetcollectioninterface.html#customWidgets">customWidgets</a>()
function:</p>
<pre class="highlightedCode brush: cpp">
 MyCustomWidgets.MyCustomWidgets(QObject *parent)
         : QObject(parent)
 {
     widgets.append(new CustomWidgetOneInterface(this));
     widgets.append(new CustomWidgetTwoInterface(this));
     widgets.append(new CustomWidgetThreeInterface(this));
 }

 QList&lt;QDesignerCustomWidgetInterface*&gt; MyCustomWidgets.customWidgets() const
 {
     return widgets;
 }

 Q_EXPORT_PLUGIN2(customwidgetsplugin, MyCustomWidgets)
</pre>
<p>Note that instead of exporting each custom widget plugin using
the <a href="qtplugin.html#Q_EXPORT_PLUGIN2">Q_EXPORT_PLUGIN2</a>()
macro, you export the entire collection. The <a href="qtplugin.html#Q_EXPORT_PLUGIN2">Q_EXPORT_PLUGIN2</a>() macro
ensures that <i>Qt Designer</i> can access and construct the custom
widgets. Without this macro, there is no way for <i>Qt Designer</i>
to use them.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDesignerCustomWidgetCollectionInterface" />QDesignerCustomWidgetCollectionInterface.__init__ (<i>self</i>)</h3><h3 class="fn"><a name="QDesignerCustomWidgetCollectionInterface-2" />QDesignerCustomWidgetCollectionInterface.__init__ (<i>self</i>, <a href="qdesignercustomwidgetcollectioninterface.html">QDesignerCustomWidgetCollectionInterface</a>)</h3><h3 class="fn"><a name="customWidgets" />list-of-QDesignerCustomWidgetInterface QDesignerCustomWidgetCollectionInterface.customWidgets (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns a list of interfaces to the collection's custom
widgets.</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.8.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.7.1</td></tr></table></div></address></body></html>