Q3EditorFactory Class

The Q3EditorFactory class is used to create editor widgets for QVariant 数据类型。 更多...

头: #include <Q3EditorFactory>
继承: QObject
继承者: Q3SqlEditorFactory

公共函数

Q3EditorFactory (QObject * parent = 0)
~Q3EditorFactory ()
virtual QWidget * createEditor (QWidget * parent , const QVariant & v )

静态公共成员

Q3EditorFactory * defaultFactory ()
void installDefaultFactory (Q3EditorFactory * factory )

额外继承成员

详细描述

The Q3EditorFactory class is used to create editor widgets for QVariant 数据类型。

Each editor factory provides the createEditor () function which given a QVariant will create and return a QWidget that can edit that QVariant . For example if you have a QVariant::String 类型, QLineEdit would be the default editor returned, 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 Q3EditorFactory 并重实现 createEditor () 函数。

成员函数文档编制

Q3EditorFactory:: Q3EditorFactory ( QObject * parent = 0)

Constructs an editor factory with parent parent .

Q3EditorFactory:: ~Q3EditorFactory ()

销毁对象并释放任何分配资源。

[虚拟] QWidget * Q3EditorFactory:: createEditor ( QWidget * parent , const QVariant & v )

Creates and returns the appropriate editor for the QVariant v 。若 QVariant is invalid, 0 is returned. The parent is passed to the appropriate editor's constructor.

[static] Q3EditorFactory * Q3EditorFactory:: defaultFactory ()

Returns an instance of a default editor factory.

[static] void Q3EditorFactory:: installDefaultFactory ( Q3EditorFactory * factory )

Replaces the default editor factory with factory . Q3EditorFactory takes ownership of factory, and destroys it when it is no longer needed.