<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qwidgetfactory.h:1 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>qwidgetfactory.h Include File</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qwidgetfactory.h</h1>

<p>This is the verbatim text of the qwidgetfactory.h include file. It is provided only for illustration; the copyright remains with Trolltech.
<hr>
<pre>
/**********************************************************************
** Copyright (C) 2005-2007 Trolltech ASA.  All rights reserved.
**
** This file is part of Qt Designer.
**
** This file may be used under the terms of the GNU General Public
** License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Alternatively you may (at your option) use any
** later version of the GNU General Public License if such license has
** been publicly approved by Trolltech ASA (or its successors, if any)
** and the KDE Free Qt Foundation.
**
** Please review the following information to ensure GNU General
** Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/.
** If you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with
** the Software.
**
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
** herein.
**
**********************************************************************/

#ifndef QWIDGETFACTORY_H
#define QWIDGETFACTORY_H

#ifndef QT_H
#include &lt;qstring.h&gt;
#include &lt;qptrlist.h&gt;
#include &lt;qimage.h&gt;
#include &lt;qpixmap.h&gt;
#include &lt;qvaluelist.h&gt;
#include &lt;qmap.h&gt;
#include &lt;qaction.h&gt;
#endif // QT_H

class QDomDocument;
class QDomElement;
class QLayout;
class QListView;
class QListViewItem;
class QMenuBar;
class QTable;
class QWidget;
class QWidgetFactoryPrivate;
class UibStrTable;

class QWidgetFactory
{
public:
    QWidgetFactory();
    virtual ~QWidgetFactory();

    static QWidget *create( const QString &amp;uiFile, QObject *connector = 0, QWidget *parent = 0, const char *name = 0 );
    static QWidget *create( QIODevice *dev, QObject *connector = 0, QWidget *parent = 0, const char *name = 0 );
    static void addWidgetFactory( QWidgetFactory *factory );
    static void loadImages( const QString &amp;dir );

    virtual QWidget *createWidget( const QString &amp;className, QWidget *parent, const char *name ) const;
    static QStringList widgets();
    static bool supportsWidget( const QString &amp;widget );

private:
    enum LayoutType { HBox, VBox, Grid, NoLayout };
    void loadImageCollection( const QDomElement &amp;e );
    void loadConnections( const QDomElement &amp;e, QObject *connector );
    void loadTabOrder( const QDomElement &amp;e );
    QWidget *createWidgetInternal( const QDomElement &amp;e, QWidget *parent, QLayout* layout, const QString &amp;classNameArg );
    QLayout *createLayout( QWidget *widget, QLayout*  layout, LayoutType type, bool isQLayoutWidget = FALSE );
    LayoutType layoutType( QLayout *l ) const;
    void setProperty( QObject* widget, const QString &amp;prop, QVariant value );
    void setProperty( QObject* widget, const QString &amp;prop, const QDomElement &amp;e );
    void createSpacer( const QDomElement &amp;e, QLayout *layout );
    QImage loadFromCollection( const QString &amp;name );
    QPixmap loadPixmap( const QString &amp;name );
    QPixmap loadPixmap( const QDomElement &amp;e );
    QColorGroup loadColorGroup( const QDomElement &amp;e );
    void createListViewColumn( QListView *lv, const QString&amp; txt,
			       const QPixmap&amp; pix, bool clickable,
			       bool resizable );
#ifndef QT_NO_TABLE
    void createTableColumnOrRow( QTable *table, const QString&amp; txt,
				 const QPixmap&amp; pix, const QString&amp; field,
				 bool isRow );
#endif
    void createColumn( const QDomElement &amp;e, QWidget *widget );
    void loadItem( const QDomElement &amp;e, QPixmap &amp;pix, QString &amp;txt, bool &amp;hasPixmap );
    void createItem( const QDomElement &amp;e, QWidget *widget, QListViewItem *i = 0 );
    void loadChildAction( QObject *parent, const QDomElement &amp;e );
    void loadActions( const QDomElement &amp;e );
    void loadToolBars( const QDomElement &amp;e );
    void loadMenuBar( const QDomElement &amp;e );
    void loadPopupMenu( QPopupMenu *p, const QDomElement &amp;e );
    void loadFunctions( const QDomElement &amp;e );
    QAction *findAction( const QString &amp;name );
    void loadExtraSource();
    QString translate( const char *sourceText, const char *comment = "" );
    QString translate( const QString&amp; sourceText, const QString&amp; comment = QString::null );

    void unpackUInt16( QDataStream&amp; in, Q_UINT16&amp; n );
    void unpackUInt32( QDataStream&amp; in, Q_UINT32&amp; n );
    void unpackByteArray( QDataStream&amp; in, QByteArray&amp; array );
    void unpackCString( const UibStrTable&amp; strings, QDataStream&amp; in,
			QCString&amp; cstr );
    void unpackString( const UibStrTable&amp; strings, QDataStream&amp; in,
		       QString&amp; str );
    void unpackStringSplit( const UibStrTable&amp; strings, QDataStream&amp; in,
			    QString&amp; str );
    void unpackVariant( const UibStrTable&amp; strings, QDataStream&amp; in,
			QVariant&amp; value );
    void inputSpacer( const UibStrTable&amp; strings, QDataStream&amp; in,
		      QLayout *parent );
    void inputColumnOrRow( const UibStrTable&amp; strings, QDataStream&amp; in,
			   QObject *parent, bool isRow );
    void inputItem( const UibStrTable&amp; strings, QDataStream&amp; in,
		    QObject *parent, QListViewItem *parentItem = 0 );
    void inputMenuItem( QObject **objects, const UibStrTable&amp; strings,
			QDataStream&amp; in, QMenuBar *menuBar );
    QObject *inputObject( QObject **objects, int&amp; numObjects,
			  const UibStrTable&amp; strings, QDataStream&amp; in,
			  QWidget *ancestorWidget, QObject *parent,
			  QCString className = "" );
    QWidget *createFromUiFile( QDomDocument doc, QObject *connector,
			       QWidget *parent, const char *name );
    QWidget *createFromUibFile( QDataStream&amp; in, QObject *connector,
				QWidget *parent, const char *name );

private:
    struct Image {
	QImage img;
	QString name;
	bool operator==(  const Image &amp;i ) const {
	    return ( i.name == name &amp;&amp;
		     i.img == img );
	}
    };

    struct Field
    {
	Field() {}
	Field( const QString &amp;s1, const QPixmap &amp;p, const QString &amp;s2 ) : name( s1 ), pix( p ), field( s2 ) {}
	QString name;
	QPixmap pix;
	QString field;
	Q_DUMMY_COMPARISON_OPERATOR( Field )
    };

    struct SqlWidgetConnection
    {
	SqlWidgetConnection() {}
	SqlWidgetConnection( const QString &amp;c, const QString &amp;t )
	    : conn( c ), table( t ), dbControls( new QMap&lt;QString, QString&gt;() ) {}
	QString conn;
	QString table;
	QMap&lt;QString, QString&gt; *dbControls;
	Q_DUMMY_COMPARISON_OPERATOR( SqlWidgetConnection )
    };

    QValueList&lt;Image&gt; images;
    QWidget *toplevel;
    QWidgetFactoryPrivate *d;
    QMap&lt;QString, QString&gt; *dbControls;
    QMap&lt;QString, QStringList&gt; dbTables;
    QMap&lt;QWidget*, SqlWidgetConnection&gt; sqlWidgetConnections;
    QMap&lt;QString, QString&gt; buddies;
    QMap&lt;QTable*, QValueList&lt;Field&gt; &gt; fieldMaps;
    QPtrList&lt;QAction&gt; actionList;
    QMap&lt;QString, QString&gt; languageSlots;
    QStringList noDatabaseWidgets;
    bool usePixmapCollection;
    int defMargin;
    int defSpacing;
    QString code;
    QString uiFileVersion;
};

#endif
</pre>
<!-- eof -->
<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>