TQSqlEditorFactory Class

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

# TQSqlEditorFactory Class Reference
[sql module]

The TQSqlEditorFactory class is used to create the editors used by TQDataTable and TQSqlForm. More...

`#include <ntqsqleditorfactory.h>`

Inherits TQEditorFactory.

List of all member functions.

## Public Members

- TQSqlEditorFactory ( TQObject * parent = 0, const char * name = 0 )
- ~TQSqlEditorFactory ()
- virtual TQWidget * createEditor ( TQWidget * parent, const TQVariant & variant )
- virtual TQWidget * createEditor ( TQWidget * parent, const TQSqlField * field )

## Static Public Members

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

## Detailed Description

The TQSqlEditorFactory class is used to create the editors used by TQDataTable and TQSqlForm.

TQSqlEditorFactory is used by TQDataTable and TQSqlForm to automatically create appropriate editors for a given TQSqlField. For example if the field is a TQVariant::String a TQLineEdit would be the default editor, whereas a TQVariant::Int's default editor would be a TQSpinBox.

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

See also TQDataTable, TQSqlForm, and Database Classes.

## Member Function Documentation

### TQSqlEditorFactory::TQSqlEditorFactory ( TQObject * parent = 0, const char * name = 0 )

Constructs a SQL editor factory with parent parent, called name.

### TQSqlEditorFactory::~TQSqlEditorFactory ()

Destroys the object and frees any allocated resources.

### TQWidget * TQSqlEditorFactory::createEditor ( TQWidget * parent, const TQVariant & variant )`[virtual]`

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

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

Reimplemented from TQEditorFactory.

### TQWidget * TQSqlEditorFactory::createEditor ( TQWidget * parent, const TQSqlField * 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 TQSqlField field.

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

Returns an instance of a default editor factory.

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

Replaces the default editor factory with factory. All TQDataTable and TQSqlForm instantiations will use this new factory for creating field editors. TQSqlEditorFactory takes ownership of \a factory, and destroys it when it is no longer needed.

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