Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# QSqlEditorFactory Class Reference
[sql module]

The QSqlEditorFactory class is used to create the editors used by QDataTable and QSqlForm. More...

`#include <qsqleditorfactory.h>`

Inherits QEditorFactory.

List of all member functions.

## Public Members

- QSqlEditorFactory ( QObject * parent = 0, const char * name = 0 )
- ~QSqlEditorFactory ()
- virtual QWidget * createEditor ( QWidget * parent, const QVariant & variant )
- virtual QWidget * createEditor ( QWidget * parent, const QSqlField * field )

## Static Public Members

- QSqlEditorFactory * defaultFactory ()
- void installDefaultFactory ( QSqlEditorFactory * factory )

## Detailed Description

The QSqlEditorFactory class is used to create the editors used by QDataTable and QSqlForm.

QSqlEditorFactory is used by QDataTable and QSqlForm to automatically create appropriate editors for a given QSqlField. For example if the field is a QVariant::String a QLineEdit would be the default editor, whereas a QVariant::Int's default editor would be a QSpinBox.

If you want to create different editors for fields with the same data type, subclass QSqlEditorFactory and reimplement the createEditor() function.

See also QDataTable, QSqlForm and Database Classes.

## Member Function Documentation

### QSqlEditorFactory::QSqlEditorFactory ( QObject * parent = 0, const char * name = 0 )

Constructs a SQL editor factory with parent parent and name name.

### QSqlEditorFactory::~QSqlEditorFactory ()

Destroys the object and frees any allocated resources.

### QWidget * QSqlEditorFactory::createEditor ( QWidget * parent, const QVariant & variant )`[virtual]`

Creates and returns the appropriate editor widget for the QVariant variant.

The widget that is returned has the parent parent (which may be zero). If variant is invalid, 0 is returned.

Reimplemented from QEditorFactory.

### QWidget * QSqlEditorFactory::createEditor ( QWidget * parent, const QSqlField * field )`[virtual]`

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

Creates and returns the appropriate editor for the QSqlField field.

### QSqlEditorFactory * QSqlEditorFactory::defaultFactory ()`[static]`

Returns an instance of a default editor factory.

### void QSqlEditorFactory::installDefaultFactory ( QSqlEditorFactory * factory )`[static]`

Replaces the default editor factory with factory. All QDataTable and QSqlForm instantiations will use this new factory for creating field editors. QSqlEditorFactory takes ownership of factory, and destroys it when it is no longer needed.

This file is part of the Qt toolkit. Copyright © 1995-2002 Trolltech. All Rights Reserved.