返回介绍

QWidgetPlugin Class

发布于 2019-10-04 15:03:58 字数 4523 浏览 980 评论 0 收藏 0

The QWidgetPlugin class provides an abstract base for custom QWidget plugins. More...

#include <qwidgetplugin.h>

List of all member functions.

Public Members

  • QWidgetPlugin ()
  • ~QWidgetPlugin ()
  • virtual QStringList keys () const = 0
  • virtual QWidget * create ( constQString&key, QWidget*parent = 0, constchar*name = 0 ) = 0
  • virtual QString group ( constQString&key ) const
  • virtual QIconSet iconSet ( constQString&key ) const
  • virtual QString includeFile ( constQString&key ) const
  • virtual QString toolTip ( constQString&key ) const
  • virtual QString whatsThis ( constQString&key ) const
  • virtual bool isContainer ( constQString&key ) const

Detailed Description

The QWidgetPlugin class provides an abstract base for custom QWidget plugins.

The widget plugin is a simple plugin interface that makes it easy to create custom widgets that can be included in forms using Qt Designer and used by applications.

Writing a widget plugin is achieved by subclassing this base class, reimplementing the pure virtual functions keys(), create(), group(), iconSet(), includeFile(), toolTip(), whatsThis() and isContainer(), and exporting the class with the Q_EXPORT_PLUGIN macro.

See the Qt Designer manual's, 'Creating Custom Widgets' section in the 'Creating Custom Widgets' chapter, for a complete example of a QWidgetPlugin.

See also the Plugins documentation and the QWidgetFactory class that is supplied with Qt Designer.

See also Plugins.


Member Function Documentation

QWidgetPlugin::QWidgetPlugin ()

Constructs a widget plugin. This is invoked automatically by the Q_EXPORT_PLUGIN macro.

QWidgetPlugin::~QWidgetPlugin ()

Destroys the widget plugin.

You never have to call this explicitly. Qt destroys a plugin automatically when it is no longer used.

QWidget* QWidgetPlugin::create ( constQString&key, QWidget*parent = 0, constchar*name = 0 ) [pure virtual]

Creates and returns a QWidget object for the widget key key. The widget key is the class name of the required widget. The name and parent arguments are passed to the custom widget's constructor.

See also keys().

QString QWidgetPlugin::group ( constQString&key ) const [virtual]

Returns the group (toolbar name) that the custom widget of class key should be part of when Qt Designer loads it.

The default implementation returns a null string.

QIconSet QWidgetPlugin::iconSet ( constQString&key ) const [virtual]

Returns the iconset that Qt Designer should use to represent the custom widget of class key in the toolbar.

The default implementation returns an null iconset.

QString QWidgetPlugin::includeFile ( constQString&key ) const [virtual]

Returns the name of the include file that Qt Designer and uic should use to include the custom widget of class key in generated code.

The default implementation returns a null string.

bool QWidgetPlugin::isContainer ( constQString&key ) const [virtual]

Returns TRUE if the custom widget of class key can contain other widgets, e.g. like QFrame; otherwise returns FALSE.

The default implementation returns FALSE.

QStringList QWidgetPlugin::keys () const [pure virtual]

Returns the list of widget keys this plugin supports.

These keys must be the class names of the custom widgets that are implemented in the plugin.

See also create().

QString QWidgetPlugin::toolTip ( constQString&key ) const [virtual]

Returns the text of the tooltip that Qt Designer should use for the custom widget of class key's toolbar button.

The default implementation returns a null string.

QString QWidgetPlugin::whatsThis ( constQString&key ) const [virtual]

Returns the text of the whatsThis text that Qt Designer should use when the user requests whatsThis help for the custom widget of class key.

The default implementation returns a null string.

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

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

发布评论

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