返回介绍

QEditorFactory Class

发布于 2019-10-04 15:00:02 字数 2318 浏览 1028 评论 0 收藏 0

The QEditorFactory class is used to create editor widgets for QVariant data types. More...

#include <qeditorfactory.h>

Inherits QObject.

Inherited by QSqlEditorFactory.

List of all member functions.

Public Members

  • QEditorFactory ( QObject*parent = 0, constchar*name = 0 )
  • ~QEditorFactory ()
  • virtual QWidget * createEditor ( QWidget*parent, constQVariant&v )

Static Public Members

  • QEditorFactory * defaultFactory ()
  • void installDefaultFactory ( QEditorFactory*factory )

Detailed Description

The QEditorFactory class is used to create editor widgets for QVariant data types.

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 type, a 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 QEditorFactory and reimplement the createEditor() function.

See also Advanced Widgets.


Member Function Documentation

QEditorFactory::QEditorFactory ( QObject*parent = 0, constchar*name = 0 )

Constructs an editor factory with parent parent and name name.

QEditorFactory::~QEditorFactory ()

Destroys the object and frees any allocated resources.

QWidget* QEditorFactory::createEditor ( QWidget*parent, constQVariant&v ) [virtual]

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

Reimplemented in QSqlEditorFactory.

QEditorFactory* QEditorFactory::defaultFactory () [static]

Returns an instance of a default editor factory.

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文