QWidgetPlugin(3qt)
π QWidgetPlugin π β the qwidgetplugin page from the Qt 3 manual (3qt), bestie edition
Okay so real talk, this one is the blueprint. It's giving "abstract base class that runs the whole custom-widget plugin game." Let's get into it. π¦
β¨ NAME β¨
QWidgetPlugin β the abstract base for custom QWidget plugins. Yes queen, abstract. You don't instantiate her, you inherit from her. π
πΈ SYNOPSIS πΈ
#include <qwidgetplugin.h>
π Public Members π
QWidgetPlugin ()~QWidgetPlugin ()virtual QStringList keys () const = 0virtual QWidget * create ( const QString & key, QWidget * parent = 0, const char * name = 0 ) = 0virtual QString group ( const QString & key ) constvirtual QIconSet iconSet ( const QString & key ) constvirtual QString includeFile ( const QString & key ) constvirtual QString toolTip ( const QString & key ) constvirtual QString whatsThis ( const QString & key ) constvirtual bool isContainer ( const QString & key ) const
π DESCRIPTION π
So the QWidgetPlugin class is an abstract base for custom QWidget plugins. Abstract base, meaning she's the vibe, not the instance. π«Ά
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. It's giving "your widget, but famous, and in the toolbar." β¨
Writing a widget plugin is achieved by:
- subclassing this base class,
- reimplementing the pure virtual functions
keys(),create(),group(),iconSet(),includeFile(),toolTip(),whatsThis()andisContainer(), and - exporting the class with the
Q_EXPORT_PLUGINmacro.
Not me reminding you that those first two are = 0 in the synopsis. They're pure virtual. You have to implement them. No skipping. Periodt. π
See the Qt Designer manual's, 'Creating Custom Widgets' section in the 'Creating Custom Widgets' chapter, for a complete example of a QWidgetPlugin. (Yes, that's the same title twice. The manpage said it, so I'm saying it. iykyk. π)
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. So like, you don't call her, she arrives. Main character energy. π
QWidgetPlugin::~QWidgetPlugin ()
Destroys the widget plugin. π
You never have to call this explicitly. Qt destroys a plugin automatically when it is no longer used.
So don't be out here manually deleting plugins, bestie. Qt handles her own cleanup. Trust. π
QWidget * QWidgetPlugin::create ( const QString & key, QWidget * parent = 0, const char * 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 ( const QString & key ) const [virtual]
Returns the group (toolbar name) that the custom widget of class key should be part of when Qt Designer loads it. Grouping the girlies together on the toolbar, as she deserves. π
The default implementation returns QString::null.
QIconSet QWidgetPlugin::iconSet ( const QString & key ) const [virtual]
Returns the iconset that Qt Designer should use to represent the custom widget of class key in the toolbar. This is her little face. Her brand. β¨
The default implementation returns an null iconset.
QString QWidgetPlugin::includeFile ( const QString & 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 QString::null.
bool QWidgetPlugin::isContainer ( const QString & 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.
So by default your widget is not a container. If she's meant to hold other widgets inside her, you have to say so yourself. No assumptions here. π
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 ( const QString & key ) const [virtual]
Returns the text of the tooltip that Qt Designer should use for the custom widget of class key's toolbar button. Hover text. The little whisper. π¦
The default implementation returns QString::null.
QString QWidgetPlugin::whatsThis ( const QString & 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 QString::null.
π SEE ALSO π
π COPYRIGHT π
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.
β AUTHOR β
Generated automatically from the source code. (Not a human girlie. A script. Still iconic tho.)
π BUGS π
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. π«Ά
The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.
If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qwidgetplugin.3qt) and the Qt version (3.3.8).
Fr fr, include the page name and the version. Bug reports without them are giving chaos. π
That's the whole page, bestie. Shoutout to Trolltech AS, dated 2 February 2007, from the Qt 3.3.8 era β she's vintage, she's abstract, she's still the blueprint for every custom widget that ever slid into Qt Designer's toolbar. Slay. ππβ¨
π¦ where this page comes from
- fedora 43: qt3-devel-docs 3.3.8b-102.fc43 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- fedora 44: qt3-devel-docs 3.3.8b-103.fc44 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms