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"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { 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 Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main 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 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 <qstring.h>
|
---|
68 | #include <qptrlist.h>
|
---|
69 | #include <qimage.h>
|
---|
70 | #include <qpixmap.h>
|
---|
71 | #include <qvaluelist.h>
|
---|
72 | #include <qmap.h>
|
---|
73 | #include <qaction.h>
|
---|
74 | #endif // QT_H
|
---|
75 |
|
---|
76 | class QDomDocument;
|
---|
77 | class QDomElement;
|
---|
78 | class QLayout;
|
---|
79 | class QListView;
|
---|
80 | class QListViewItem;
|
---|
81 | class QMenuBar;
|
---|
82 | class QTable;
|
---|
83 | class QWidget;
|
---|
84 | class QWidgetFactoryPrivate;
|
---|
85 | class UibStrTable;
|
---|
86 |
|
---|
87 | class QWidgetFactory
|
---|
88 | {
|
---|
89 | public:
|
---|
90 | QWidgetFactory();
|
---|
91 | virtual ~QWidgetFactory();
|
---|
92 |
|
---|
93 | static QWidget *create( const QString &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 &dir );
|
---|
97 |
|
---|
98 | virtual QWidget *createWidget( const QString &className, QWidget *parent, const char *name ) const;
|
---|
99 | static QStringList widgets();
|
---|
100 | static bool supportsWidget( const QString &widget );
|
---|
101 |
|
---|
102 | private:
|
---|
103 | enum LayoutType { HBox, VBox, Grid, NoLayout };
|
---|
104 | void loadImageCollection( const QDomElement &e );
|
---|
105 | void loadConnections( const QDomElement &e, QObject *connector );
|
---|
106 | void loadTabOrder( const QDomElement &e );
|
---|
107 | QWidget *createWidgetInternal( const QDomElement &e, QWidget *parent, QLayout* layout, const QString &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 &prop, QVariant value );
|
---|
111 | void setProperty( QObject* widget, const QString &prop, const QDomElement &e );
|
---|
112 | void createSpacer( const QDomElement &e, QLayout *layout );
|
---|
113 | QImage loadFromCollection( const QString &name );
|
---|
114 | QPixmap loadPixmap( const QString &name );
|
---|
115 | QPixmap loadPixmap( const QDomElement &e );
|
---|
116 | QColorGroup loadColorGroup( const QDomElement &e );
|
---|
117 | void createListViewColumn( QListView *lv, const QString& txt,
|
---|
118 | const QPixmap& pix, bool clickable,
|
---|
119 | bool resizable );
|
---|
120 | #ifndef QT_NO_TABLE
|
---|
121 | void createTableColumnOrRow( QTable *table, const QString& txt,
|
---|
122 | const QPixmap& pix, const QString& field,
|
---|
123 | bool isRow );
|
---|
124 | #endif
|
---|
125 | void createColumn( const QDomElement &e, QWidget *widget );
|
---|
126 | void loadItem( const QDomElement &e, QPixmap &pix, QString &txt, bool &hasPixmap );
|
---|
127 | void createItem( const QDomElement &e, QWidget *widget, QListViewItem *i = 0 );
|
---|
128 | void loadChildAction( QObject *parent, const QDomElement &e );
|
---|
129 | void loadActions( const QDomElement &e );
|
---|
130 | void loadToolBars( const QDomElement &e );
|
---|
131 | void loadMenuBar( const QDomElement &e );
|
---|
132 | void loadPopupMenu( QPopupMenu *p, const QDomElement &e );
|
---|
133 | void loadFunctions( const QDomElement &e );
|
---|
134 | QAction *findAction( const QString &name );
|
---|
135 | void loadExtraSource();
|
---|
136 | QString translate( const char *sourceText, const char *comment = "" );
|
---|
137 | QString translate( const QString& sourceText, const QString& comment = QString::null );
|
---|
138 |
|
---|
139 | void unpackUInt16( QDataStream& in, Q_UINT16& n );
|
---|
140 | void unpackUInt32( QDataStream& in, Q_UINT32& n );
|
---|
141 | void unpackByteArray( QDataStream& in, QByteArray& array );
|
---|
142 | void unpackCString( const UibStrTable& strings, QDataStream& in,
|
---|
143 | QCString& cstr );
|
---|
144 | void unpackString( const UibStrTable& strings, QDataStream& in,
|
---|
145 | QString& str );
|
---|
146 | void unpackStringSplit( const UibStrTable& strings, QDataStream& in,
|
---|
147 | QString& str );
|
---|
148 | void unpackVariant( const UibStrTable& strings, QDataStream& in,
|
---|
149 | QVariant& value );
|
---|
150 | void inputSpacer( const UibStrTable& strings, QDataStream& in,
|
---|
151 | QLayout *parent );
|
---|
152 | void inputColumnOrRow( const UibStrTable& strings, QDataStream& in,
|
---|
153 | QObject *parent, bool isRow );
|
---|
154 | void inputItem( const UibStrTable& strings, QDataStream& in,
|
---|
155 | QObject *parent, QListViewItem *parentItem = 0 );
|
---|
156 | void inputMenuItem( QObject **objects, const UibStrTable& strings,
|
---|
157 | QDataStream& in, QMenuBar *menuBar );
|
---|
158 | QObject *inputObject( QObject **objects, int& numObjects,
|
---|
159 | const UibStrTable& strings, QDataStream& 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& in, QObject *connector,
|
---|
165 | QWidget *parent, const char *name );
|
---|
166 |
|
---|
167 | private:
|
---|
168 | struct Image {
|
---|
169 | QImage img;
|
---|
170 | QString name;
|
---|
171 | bool operator==( const Image &i ) const {
|
---|
172 | return ( i.name == name &&
|
---|
173 | i.img == img );
|
---|
174 | }
|
---|
175 | };
|
---|
176 |
|
---|
177 | struct Field
|
---|
178 | {
|
---|
179 | Field() {}
|
---|
180 | Field( const QString &s1, const QPixmap &p, const QString &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 &c, const QString &t )
|
---|
191 | : conn( c ), table( t ), dbControls( new QMap<QString, QString>() ) {}
|
---|
192 | QString conn;
|
---|
193 | QString table;
|
---|
194 | QMap<QString, QString> *dbControls;
|
---|
195 | Q_DUMMY_COMPARISON_OPERATOR( SqlWidgetConnection )
|
---|
196 | };
|
---|
197 |
|
---|
198 | QValueList<Image> images;
|
---|
199 | QWidget *toplevel;
|
---|
200 | QWidgetFactoryPrivate *d;
|
---|
201 | QMap<QString, QString> *dbControls;
|
---|
202 | QMap<QString, QStringList> dbTables;
|
---|
203 | QMap<QWidget*, SqlWidgetConnection> sqlWidgetConnections;
|
---|
204 | QMap<QString, QString> buddies;
|
---|
205 | QMap<QTable*, QValueList<Field> > fieldMaps;
|
---|
206 | QPtrList<QAction> actionList;
|
---|
207 | QMap<QString, QString> 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 © 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>
|
---|