• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KParts

KParts::Part

KParts::Part Class Reference

Base class for parts. More...

#include <part.h>

Inheritance diagram for KParts::Part:
QObject KParts::PartBase KXMLGUIClient KParts::ReadOnlyPart KParts::ReadWritePart

List of all members.

Signals

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

Public Member Functions

virtual void embed (QWidget *parentWidget)
virtual Part * hitTest (QWidget *widget, const QPoint &globalPos)
KIconLoader * iconLoader ()
bool isSelectable () const
PartManager * manager () const
 Part (QObject *parent=0)
void setAutoDeletePart (bool autoDeletePart)
void setAutoDeleteWidget (bool autoDeleteWidget)
virtual void setManager (PartManager *manager)
virtual void setSelectable (bool selectable)
virtual QWidget * widget ()
virtual ~Part ()

Protected Slots

void slotWidgetDestroyed ()

Protected Member Functions

virtual void customEvent (QEvent *event)
virtual void guiActivateEvent (GUIActivateEvent *event)
QWidget * hostContainer (const QString &containerName)
void loadPlugins ()
 Part (PartPrivate &dd, QObject *parent)
virtual void partActivateEvent (PartActivateEvent *event)
virtual void partSelectEvent (PartSelectEvent *event)
virtual void setWidget (QWidget *widget)

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.

Definition at line 215 of file part.h.


Constructor & Destructor Documentation

Part::Part ( QObject *  parent = 0  )  [explicit]

Constructor.

Parameters:
parent Parent object of the part.

Definition at line 177 of file part.cpp.

Part::~Part (  )  [virtual]

Destructor.

Definition at line 189 of file part.cpp.

Part::Part ( PartPrivate &  dd,
QObject *  parent 
) [protected]

Definition at line 183 of file part.cpp.


Member Function Documentation

void Part::customEvent ( QEvent *  event  )  [protected, virtual]

For internal use only.

Definition at line 304 of file part.cpp.

void Part::embed ( QWidget *  parentWidget  )  [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.

Definition at line 214 of file part.cpp.

void Part::guiActivateEvent ( GUIActivateEvent *  event  )  [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.

Reimplemented in KParts::ReadOnlyPart.

Definition at line 335 of file part.cpp.

Part * Part::hitTest ( QWidget *  widget,
const QPoint &  globalPos 
) [virtual]

Returns the part (this, or a child part) at the given global position.

This is called by the part manager to ask whether a part should be activated when clicking somewhere. In most cases the default implementation is enough. Reimplement this if your part has child parts in some areas (like in khtml or koffice)

Parameters:
widget the part widget being clicked - usually the same as widget(), except in koffice.
globalPos the mouse coordinates in global coordinates

Definition at line 270 of file part.cpp.

QWidget * Part::hostContainer ( const QString &  containerName  )  [protected]

Convenience method for KXMLGUIFactory::container.

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

Definition at line 339 of file part.cpp.

KIconLoader * Part::iconLoader (  ) 

Use this icon loader to load any icons that are specific to this part, i.e.

icons installed into this part's own directories as opposed to standard kde icons. Use KIcon("myicon", iconLoader()).

Make sure to call setComponentData before calling iconLoader.

Definition at line 245 of file part.cpp.

bool Part::isSelectable (  )  const

Returns whether the part is selectable or not.

Definition at line 297 of file part.cpp.

void Part::loadPlugins (  )  [protected]

Load this part's plugins now.

Normally you want to call this at the end of the part constructor, if you used setComponentData(componentData, false)

Since:
4.1

Definition at line 358 of file part.cpp.

PartManager * Part::manager (  )  const

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

Definition at line 263 of file part.cpp.

void Part::partActivateEvent ( PartActivateEvent *  event  )  [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.

Definition at line 327 of file part.cpp.

void Part::partSelectEvent ( PartSelectEvent *  event  )  [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.

Definition at line 331 of file part.cpp.

void Part::setAutoDeletePart ( bool  autoDeletePart  ) 

By default, the part deletes itself when its widget is deleted.

The hosting application can call setAutoDeletePart(false) to disable this behavior, to be able to delete the widget and then the part, independently. This is a method for the hosting application only, Part subclasses should never call this.

Definition at line 237 of file part.cpp.

void Part::setAutoDeleteWidget ( bool  autoDeleteWidget  ) 

By default, the widget is deleted by the part when the part is deleted.

The hosting application can call setAutoDeleteWidget(false) to disable this behavior, given that the widget is usually deleted by its parent widget anyway. This is a method for the hosting application only, Part subclasses should never call this.

Definition at line 231 of file part.cpp.

void Part::setManager ( PartManager *  manager  )  [virtual]

For internal use only.

Used by the part manager.

Definition at line 256 of file part.cpp.

void Part::setSelectable ( bool  selectable  )  [virtual]
Parameters:
selectable Indicates whether the part is selectable or not.

Definition at line 290 of file part.cpp.

void KParts::Part::setStatusBarText ( const QString &  text  )  [signal]

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

void Part::setWidget ( QWidget *  widget  )  [protected, virtual]

Set the main widget.

Call this in the Part-inherited class constructor.

Definition at line 280 of file part.cpp.

void KParts::Part::setWindowCaption ( const QString &  caption  )  [signal]

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

void Part::slotWidgetDestroyed (  )  [protected, slot]

For internal use only.

Definition at line 347 of file part.cpp.

QWidget * Part::widget (  )  [virtual]
Returns:
The widget defined by this part, set by setWidget().

Definition at line 224 of file part.cpp.


The documentation for this class was generated from the following files:
  • part.h
  • part.cpp

KParts

Skip menu "KParts"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal