source: trunk/doc/html/qwidgetfactory-h.html@ 190

Last change on this file since 190 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 9.0 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qwidgetfactory.h:1 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>qwidgetfactory.h Include File</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<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>
33
34<p>This is the verbatim text of the qwidgetfactory.h include file. It is provided only for illustration; the copyright remains with Trolltech.
35<hr>
36<pre>
37/**********************************************************************
38** Copyright (C) 2005-2007 Trolltech ASA. All rights reserved.
39**
40** This file is part of Qt Designer.
41**
42** This file may be distributed and/or modified under the terms of the
43** GNU General Public License version 2 as published by the Free Software
44** Foundation and appearing in the file LICENSE.GPL included in the
45** packaging of this file.
46**
47** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
48** licenses may use this file in accordance with the Qt Commercial License
49** Agreement provided with the Software.
50**
51** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
52** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
53**
54** See http://www.trolltech.com/gpl/ for GPL licensing information.
55** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
56** information about Qt Commercial License Agreements.
57**
58** Contact info@trolltech.com if any conditions of this licensing are
59** not clear to you.
60**
61**********************************************************************/
62
63#ifndef QWIDGETFACTORY_H
64#define QWIDGETFACTORY_H
65
66#ifndef QT_H
67#include &lt;qstring.h&gt;
68#include &lt;qptrlist.h&gt;
69#include &lt;qimage.h&gt;
70#include &lt;qpixmap.h&gt;
71#include &lt;qvaluelist.h&gt;
72#include &lt;qmap.h&gt;
73#include &lt;qaction.h&gt;
74#endif // QT_H
75
76class QDomDocument;
77class QDomElement;
78class QLayout;
79class QListView;
80class QListViewItem;
81class QMenuBar;
82class QTable;
83class QWidget;
84class QWidgetFactoryPrivate;
85class UibStrTable;
86
87class QWidgetFactory
88{
89public:
90 QWidgetFactory();
91 virtual ~QWidgetFactory();
92
93 static QWidget *create( const QString &amp;uiFile, QObject *connector = 0, QWidget *parent = 0, const char *name = 0 );
94 static QWidget *create( QIODevice *dev, QObject *connector = 0, QWidget *parent = 0, const char *name = 0 );
95 static void addWidgetFactory( QWidgetFactory *factory );
96 static void loadImages( const QString &amp;dir );
97
98 virtual QWidget *createWidget( const QString &amp;className, QWidget *parent, const char *name ) const;
99 static QStringList widgets();
100 static bool supportsWidget( const QString &amp;widget );
101
102private:
103 enum LayoutType { HBox, VBox, Grid, NoLayout };
104 void loadImageCollection( const QDomElement &amp;e );
105 void loadConnections( const QDomElement &amp;e, QObject *connector );
106 void loadTabOrder( const QDomElement &amp;e );
107 QWidget *createWidgetInternal( const QDomElement &amp;e, QWidget *parent, QLayout* layout, const QString &amp;classNameArg );
108 QLayout *createLayout( QWidget *widget, QLayout* layout, LayoutType type, bool isQLayoutWidget = FALSE );
109 LayoutType layoutType( QLayout *l ) const;
110 void setProperty( QObject* widget, const QString &amp;prop, QVariant value );
111 void setProperty( QObject* widget, const QString &amp;prop, const QDomElement &amp;e );
112 void createSpacer( const QDomElement &amp;e, QLayout *layout );
113 QImage loadFromCollection( const QString &amp;name );
114 QPixmap loadPixmap( const QString &amp;name );
115 QPixmap loadPixmap( const QDomElement &amp;e );
116 QColorGroup loadColorGroup( const QDomElement &amp;e );
117 void createListViewColumn( QListView *lv, const QString&amp; txt,
118 const QPixmap&amp; pix, bool clickable,
119 bool resizable );
120#ifndef QT_NO_TABLE
121 void createTableColumnOrRow( QTable *table, const QString&amp; txt,
122 const QPixmap&amp; pix, const QString&amp; field,
123 bool isRow );
124#endif
125 void createColumn( const QDomElement &amp;e, QWidget *widget );
126 void loadItem( const QDomElement &amp;e, QPixmap &amp;pix, QString &amp;txt, bool &amp;hasPixmap );
127 void createItem( const QDomElement &amp;e, QWidget *widget, QListViewItem *i = 0 );
128 void loadChildAction( QObject *parent, const QDomElement &amp;e );
129 void loadActions( const QDomElement &amp;e );
130 void loadToolBars( const QDomElement &amp;e );
131 void loadMenuBar( const QDomElement &amp;e );
132 void loadPopupMenu( QPopupMenu *p, const QDomElement &amp;e );
133 void loadFunctions( const QDomElement &amp;e );
134 QAction *findAction( const QString &amp;name );
135 void loadExtraSource();
136 QString translate( const char *sourceText, const char *comment = "" );
137 QString translate( const QString&amp; sourceText, const QString&amp; comment = QString::null );
138
139 void unpackUInt16( QDataStream&amp; in, Q_UINT16&amp; n );
140 void unpackUInt32( QDataStream&amp; in, Q_UINT32&amp; n );
141 void unpackByteArray( QDataStream&amp; in, QByteArray&amp; array );
142 void unpackCString( const UibStrTable&amp; strings, QDataStream&amp; in,
143 QCString&amp; cstr );
144 void unpackString( const UibStrTable&amp; strings, QDataStream&amp; in,
145 QString&amp; str );
146 void unpackStringSplit( const UibStrTable&amp; strings, QDataStream&amp; in,
147 QString&amp; str );
148 void unpackVariant( const UibStrTable&amp; strings, QDataStream&amp; in,
149 QVariant&amp; value );
150 void inputSpacer( const UibStrTable&amp; strings, QDataStream&amp; in,
151 QLayout *parent );
152 void inputColumnOrRow( const UibStrTable&amp; strings, QDataStream&amp; in,
153 QObject *parent, bool isRow );
154 void inputItem( const UibStrTable&amp; strings, QDataStream&amp; in,
155 QObject *parent, QListViewItem *parentItem = 0 );
156 void inputMenuItem( QObject **objects, const UibStrTable&amp; strings,
157 QDataStream&amp; in, QMenuBar *menuBar );
158 QObject *inputObject( QObject **objects, int&amp; numObjects,
159 const UibStrTable&amp; strings, QDataStream&amp; in,
160 QWidget *ancestorWidget, QObject *parent,
161 QCString className = "" );
162 QWidget *createFromUiFile( QDomDocument doc, QObject *connector,
163 QWidget *parent, const char *name );
164 QWidget *createFromUibFile( QDataStream&amp; in, QObject *connector,
165 QWidget *parent, const char *name );
166
167private:
168 struct Image {
169 QImage img;
170 QString name;
171 bool operator==( const Image &amp;i ) const {
172 return ( i.name == name &amp;&amp;
173 i.img == img );
174 }
175 };
176
177 struct Field
178 {
179 Field() {}
180 Field( const QString &amp;s1, const QPixmap &amp;p, const QString &amp;s2 ) : name( s1 ), pix( p ), field( s2 ) {}
181 QString name;
182 QPixmap pix;
183 QString field;
184 Q_DUMMY_COMPARISON_OPERATOR( Field )
185 };
186
187 struct SqlWidgetConnection
188 {
189 SqlWidgetConnection() {}
190 SqlWidgetConnection( const QString &amp;c, const QString &amp;t )
191 : conn( c ), table( t ), dbControls( new QMap&lt;QString, QString&gt;() ) {}
192 QString conn;
193 QString table;
194 QMap&lt;QString, QString&gt; *dbControls;
195 Q_DUMMY_COMPARISON_OPERATOR( SqlWidgetConnection )
196 };
197
198 QValueList&lt;Image&gt; images;
199 QWidget *toplevel;
200 QWidgetFactoryPrivate *d;
201 QMap&lt;QString, QString&gt; *dbControls;
202 QMap&lt;QString, QStringList&gt; dbTables;
203 QMap&lt;QWidget*, SqlWidgetConnection&gt; sqlWidgetConnections;
204 QMap&lt;QString, QString&gt; buddies;
205 QMap&lt;QTable*, QValueList&lt;Field&gt; &gt; fieldMaps;
206 QPtrList&lt;QAction&gt; actionList;
207 QMap&lt;QString, QString&gt; languageSlots;
208 QStringList noDatabaseWidgets;
209 bool usePixmapCollection;
210 int defMargin;
211 int defSpacing;
212 QString code;
213 QString uiFileVersion;
214};
215
216#endif
217</pre>
218<!-- eof -->
219<p><address><hr><div align=center>
220<table width=100% cellspacing=0 border=0><tr>
221<td>Copyright &copy; 2007
222<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
223<td align=right><div align=right>Qt 3.3.8</div>
224</table></div></address></body>
225</html>
Note: See TracBrowser for help on using the repository browser.