Classes - Annotated - Tree - Functions - Home - Structure

QWidgetFactory Class Reference

A class to dynamically create widgets from Qt Designer user interface description files. More...

#include <qwidgetfactory.h>

List of all member functions.

Public Members

Static Public Members


Detailed Description

A class to dynamically create widgets from Qt Designer user interface description files

This class basically offers two things:


Member Function Documentation

QWidgetFactory::QWidgetFactory ()

Constructs a QWidgetFactory.

void QWidgetFactory::addWidgetFactory ( QWidgetFactory * factory ) [static]

Installs a widget factory factory, which normally contains additional widgets that can be created using a QWidgetFactory then. See createWidget() for further details.

QWidget * QWidgetFactory::create ( const QString & uiFile, QObject * connector = 0, QWidget * parent = 0, const char * name = 0 ) [static]

Loads the Qt Designer user interface description file uiFile and returns the toplevel widget of that description. parent and name are passed to the constructor of the toplevel widget.

This function also performs signal and slot connections, tab ordering, etc. as described in the ui file. In the Qt Designer it is possible to add custom slots to a form and connect to them. If you want that these connections are performed as well, you have to create a class derived from QObject, which implementes all these slots. Then pass an instance of it as connector to this function. This way these connections to custom slots will be done using the connector as slot.

If something fails, 0 is returned.

The ownership of the returned widget is passed to the caller.

QWidget * QWidgetFactory::create ( QIODevice * dev, QObject * connector = 0, QWidget * parent = 0, const char * name = 0 ) [static]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

QWidget * QWidgetFactory::createWidget ( const QString & className, QWidget * parent, const char * name ) const [virtual]

Creates the widget of the type className passing parent and name to its constructor. If className is a widget of the Qt library, it is directly created in this function. if this fails, all installed widget plugins are asked to create that widget. If this fails all installed widget factories are asked to create it (see addWidgetFactory()). If this fails as well, 0 is returned.

If you have a custom widget, and want it to be created using the widget factory, you have two possibilities to add it:


Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):


This file is part of the Qt toolkit, copyright © 1995-2001 Trolltech, all rights reserved.


Copyright © 2001 TrolltechTrademarks
Qt version 3.0.0-beta1-beta1