Dynamically creating widgets from TQt Designer user interface description files. You can do this using the static function TQWidgetFactory::create(). This function also performs signal and slot connections, tab ordering, etc., as defined in the .ui file, and returns the top-level widget in the .ui file. After creating the widget you can use TQObject::child() and TQObject::queryList() to access child widgets of this returned widget.
This class is not included in the TQt library itself. To use it you must link against \fClibtqui.so\fR (Unix) or \fCtqui.lib\fR (Windows), which is built into \fCINSTALL/lib\fR if you built \fIQt Designer\fR (\fCINSTALL\fR is the directory where TQt is installed ).
If you create a TQMainWindow using a TQWidgetFactory, be aware that it already has a central widget. Therefore, you need to delete this one before setting another one.
See the "Creating Dynamic Dialogs from .ui Files" section of the TQt Designer manual for an example. See also the TQWidgetPlugin class and the Plugins documentation.
Installs a widget factory \fIfactory\fR, which normally contains additional widgets that can then be created using a TQWidgetFactory. See createWidget() for further details.
Loads the \fIQt Designer\fR user interface description file \fIuiFile\fR and returns the top-level widget in that description. \fIparent\fR and \fIname\fR are passed to the constructor of the top-level widget.
This function also performs signal and slot connections, tab ordering, etc., as described in the .ui file. In \fIQt Designer\fR it is possible to add custom slots to a form and connect to them. If you want these connections to be made, you must create a class derived from TQObject, which implements all these slots. Then pass an instance of the object as \fIconnector\fR to this function. If you do this, the connections to the custom slots will be done using the \fIconnector\fR as slot.
If \fIclassName\fR is a widget in the TQt library, it is directly created by this function. If the widget isn't in the TQt library, each of the installed widget plugins is asked, in turn, to create the widget. As soon as a plugin says it can create the widget it is asked to do so. It may occur that none of the plugins can create the widget, in which case each installed widget factory is asked to create the widget (see addWidgetFactory()). If the widget cannot be created by any of these means, 0 is returned.
Write a widget plugin. This allows you to use the widget in \fIQt Designer\fR and in this TQWidgetFactory. See the widget plugin documentation for further details. (See the "Creating Custom Widgets with Plugins" section of the TQt Designer manual for an example.
Subclass TQWidgetFactory. Then reimplement this function to create and return an instance of your custom widget if \fIclassName\fR equals the name of your widget, otherwise return 0. Then at the beginning of your program where you want to use the widget factory to create widgets do a:
If you use a pixmap collection (which is the default for new projects) rather than saving the pixmaps within the .ui XML file, you must load the pixmap collection. TQWidgetFactory looks in the default TQMimeSourceFactory for the pixmaps. Either add it there manually, or call this function and specify the directory where the images can be found, as \fIdir\fR. This is normally the directory called \fCimages\fR in the project's directory.