TQWidgetPlugin Class

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

# TQWidgetPlugin Class Reference

The TQWidgetPlugin class provides an abstract base for custom TQWidget plugins. More...

`#include <ntqwidgetplugin.h>`

List of all member functions.

## Public Members

- TQWidgetPlugin ()
- ~TQWidgetPlugin ()
- virtual TQStringList keys () const = 0
- virtual TQWidget * create ( const TQString & key, TQWidget * parent = 0, const char * name = 0 ) = 0
- virtual TQString group ( const TQString & key ) const
- virtual TQIconSet iconSet ( const TQString & key ) const
- virtual TQString includeFile ( const TQString & key ) const
- virtual TQString toolTip ( const TQString & key ) const
- virtual TQString whatsThis ( const TQString & key ) const
- virtual bool isContainer ( const TQString & key ) const

## Detailed Description

The TQWidgetPlugin class provides an abstract base for custom TQWidget plugins.

The widget plugin is a simple plugin interface that makes it easy to create custom widgets that can be included in forms using TQt 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 `TQ_EXPORT_PLUGIN` macro.

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

See also the Plugins documentation and the TQWidgetFactory class that is supplied with TQt Designer.

See also Plugins.

## Member Function Documentation

### TQWidgetPlugin::TQWidgetPlugin ()

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

### TQWidgetPlugin::~TQWidgetPlugin ()

Destroys the widget plugin.

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

### TQWidget * TQWidgetPlugin::create ( const TQString & key, TQWidget * parent = 0, const char * name = 0 )`[pure virtual]`

Creates and returns a TQWidget 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().

### TQString TQWidgetPlugin::group ( const TQString & key ) const`[virtual]`

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

The default implementation returns TQString::null.

### TQIconSet TQWidgetPlugin::iconSet ( const TQString & key ) const`[virtual]`

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

The default implementation returns an null iconset.

### TQString TQWidgetPlugin::includeFile ( const TQString & key ) const`[virtual]`

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

The default implementation returns TQString::null.

### bool TQWidgetPlugin::isContainer ( const TQString & key ) const`[virtual]`

Returns true if the custom widget of class key can contain other widgets, e.g. like TQFrame; otherwise returns false.

The default implementation returns false.

### TQStringList TQWidgetPlugin::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().

### TQString TQWidgetPlugin::toolTip ( const TQString & key ) const`[virtual]`

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

The default implementation returns TQString::null.

### TQString TQWidgetPlugin::whatsThis ( const TQString & key ) const`[virtual]`

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

The default implementation returns TQString::null.

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