# class Part | Base class for parts. More...
Full name | `KParts::Part`
Definition | `#include <part.h>`
Inherits | KParts::PartBase [public ], QObject (qt) [public ]
Inherited by | ReadOnlyPart, ReadWritePart
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- Part ( QObject *parent = 0, const char* name = 0 )
- virtual ~Part ()
- virtual void embed ( QWidget * parentWidget )
- virtual QWidget * widget ()
- virtual void setManager ( PartManager * manager )
- PartManager * manager ()
- virtual Part * hitTest ( QWidget *widget, const QPoint &globalPos )
- virtual void setSelectable ( bool selectable )
- virtual bool isSelectable () const

#### Signals

- void setWindowCaption ( const QString & caption )
- void setStatusBarText ( const QString & text )

#### Protected Methods

- virtual void setWidget ( QWidget * widget )
- virtual bool event ( QEvent *event )
- virtual void partActivateEvent ( PartActivateEvent *event )
- virtual void partSelectEvent ( PartSelectEvent *event )
- virtual void guiActivateEvent ( GUIActivateEvent *event )
- QWidget * hostContainer ( const QString &containerName )

## Detailed Description

Base class for parts.

A "part" is a GUI component, featuring:

- A widget embeddedable in any application.
- GUI elements that will be merged in the "host" user interface (menubars, toolbars... ).

### About the widget Note that KParts::Part does not inherit QWidget. This is due to the fact that the "visual representation" will probably not be a mere QWidget, but an elaborate one. That's why when implementing your KParts::Part (or derived) you should call KParts::Part::setWidget() in your constructor.

### About the GUI elements Those elements trigger actions, defined by the part (action()). The layout of the actions in the GUI is defined by an XML file (setXMLFile()).

See also ReadOnlyPart and ReadWritePart, which define the framework for a "viewer" part and for an "editor"-like part. Use Part directly only if your part doesn't fit into those.

Part ( QObject *parent = 0, const char* name = 0 ) | ### Part

Contructor.

Parameters:

parent | Parent object of the part.
name | QT-internal name of the part.

~Part () | ### ~Part

[virtual]

Destructor.

void embed ( QWidget * parentWidget ) | ### embed

[virtual]

Embed this part into a host widget.

You don't need to do this if you created the widget with the correct parent widget - this is just a QWidget::reparent(). Note that the Part is still the holder of the QWidget, meaning that if you delete the Part, then the widget gets destroyed as well, and vice-versa. This method is not recommended since creating the widget with the correct parent is simpler anyway.

QWidget * widget () | ### widget

[virtual]

Returns: The widget defined by this part, set by setWidget().

void setManager ( PartManager * manager ) | ### setManager

[virtual]

Used by the part manager.

PartManager * manager () | ### manager

Returns the part manager handling this part, if any (0L otherwise).

Part * hitTest ( QWidget *widget, const QPoint &globalPos ) | ### hitTest

[virtual]

void setSelectable ( bool selectable ) | ### setSelectable

[virtual]

Parameters:

selectable | Indicates whether the part is selectable or not.

bool isSelectable () | ### isSelectable

[const virtual]

Returns whether the part is selectable or not.

void setWindowCaption ( const QString & caption ) | ### setWindowCaption

[signal]

Emitted by the part, to set the caption of the window(s) hosting this part

void setStatusBarText ( const QString & text ) | ### setStatusBarText

[signal]

Emited by the part, to set a text in the statusbar of the window(s) hosting this part

void setWidget ( QWidget * widget ) | ### setWidget

[protected virtual]

Set the main widget.

Call this in the Part-inherited class constructor.

bool event ( QEvent *event ) | ### event

[protected virtual]

Reimplemented from QObject.

void partActivateEvent ( PartActivateEvent *event ) | ### partActivateEvent

[protected virtual]

Convenience method which is called when the Part received a PartActivateEvent . Reimplement this if you don't want to reimplement event and test for the event yourself or even install an event filter.

void partSelectEvent ( PartSelectEvent *event ) | ### partSelectEvent

[protected virtual]

Convenience method which is called when the Part received a PartSelectEvent . Reimplement this if you don't want to reimplement event and test for the event yourself or even install an event filter.

void guiActivateEvent ( GUIActivateEvent *event ) | ### guiActivateEvent

[protected virtual]

Convenience method which is called when the Part received a GUIActivateEvent . Reimplement this if you don't want to reimplement event and test for the event yourself or even install an event filter.

QWidget * hostContainer ( const QString &containerName ) | ### hostContainer

[protected]

Convenience method for KXMLGUIFactory::container.

Returns: a container widget owned by the Part's GUI.

Generated by: root@i386.ports.openbsd.org on Wed Apr 25 13:58:48 2001, using kdoc 2.0a53.