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

# QSqlEditorFactory Class Reference

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

    #include <QSqlEditorFactory>

This class is part of the Qt 3 compatibility library. It is provided to keep old source code working. We strongly advise against using it in new code.

Inherits QEditorFactory.

- List of all members, including inherited members

### Writable Properties

- 1 writable property inherited from QObject

### Public Functions

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

- 1 public function inherited from QEditorFactory
- 24 public functions inherited from QObject

### Public Slots

- 1 public slot inherited from QObject

### Signals

- 1 signal inherited from QObject

### Static Public Members

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

- 2 static public members inherited from QEditorFactory
- 4 static public members inherited from QObject

### Protected Functions

- 9 protected functions inherited from QObject

## 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 and QSqlForm.

## Member Function Documentation

### QSqlEditorFactory::QSqlEditorFactory ( QObject * parent = 0 )

Constructs a SQL editor factory with parent parent.

### 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.