KParts::Part

#include <KParts/Part>

Inheritance diagram for KParts::Part:

Signals

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

Public Member Functions

 Part (QObject *parent=nullptr)
 
 ~Part () override
 
virtual void embed (QWidget *parentWidget)
 
virtual ParthitTest (QWidget *widget, const QPoint &globalPos)
 
KIconLoadericonLoader ()
 
bool isSelectable () const
 
PartManagermanager () const
 
void setAutoDeletePart (bool autoDeletePart)
 
void setAutoDeleteWidget (bool autoDeleteWidget)
 
virtual void setManager (PartManager *manager)
 
virtual void setSelectable (bool selectable)
 
virtual QWidgetwidget ()
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 
- Public Member Functions inherited from KParts::PartBase
 PartBase ()
 
virtual ~PartBase ()
 
KAboutData componentData () const
 
QObjectpartObject () const
 
void setPartObject (QObject *object)
 
- Public Member Functions inherited from KXMLGUIClient
 KXMLGUIClient (KXMLGUIClient *parent)
 
QActionaction (const char *name) const
 
virtual QActionaction (const QDomElement &element) const
 
virtual KActionCollectionactionCollection () const
 
QList< KXMLGUIClient * > childClients ()
 
KXMLGUIBuilderclientBuilder () const
 
virtual QString componentName () const
 
virtual QDomDocument domDocument () const
 
KXMLGUIFactoryfactory () const
 
void insertChildClient (KXMLGUIClient *child)
 
KXMLGUIClientparentClient () const
 
void plugActionList (const QString &name, const QList< QAction * > &actionList)
 
void reloadXML ()
 
void removeChildClient (KXMLGUIClient *child)
 
void replaceXMLFile (const QString &xmlfile, const QString &localxmlfile, bool merge=false)
 
void setClientBuilder (KXMLGUIBuilder *builder)
 
void setFactory (KXMLGUIFactory *factory)
 
void setXMLGUIBuildDocument (const QDomDocument &doc)
 
void unplugActionList (const QString &name)
 
virtual QString xmlFile () const
 
QDomDocument xmlguiBuildDocument () const
 

Protected Slots

void slotWidgetDestroyed ()
 

Protected Member Functions

 Part (PartPrivate &dd, QObject *parent)
 
void customEvent (QEvent *event) override
 
virtual void guiActivateEvent (GUIActivateEvent *event)
 
QWidgethostContainer (const QString &containerName)
 
void loadPlugins ()
 
virtual void partActivateEvent (PartActivateEvent *event)
 
virtual void partSelectEvent (PartSelectEvent *event)
 
virtual void setWidget (QWidget *widget)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 
- Protected Member Functions inherited from KParts::PartBase
 PartBase (PartBasePrivate &dd)
 
void loadPlugins (QObject *parent, KXMLGUIClient *parentGUIClient, const KAboutData &aboutData)
 
virtual void setComponentData (const KAboutData &componentData)
 
virtual void setComponentData (const KAboutData &pluginData, bool loadPlugins)
 
void setPluginInterfaceVersion (int version)
 
void setPluginLoadingMode (PluginLoadingMode loadingMode)
 
- Protected Member Functions inherited from KXMLGUIClient
void loadStandardsXmlFile ()
 
virtual void setComponentName (const QString &componentName, const QString &componentDisplayName)
 
virtual void setDOMDocument (const QDomDocument &document, bool merge=false)
 
virtual void setLocalXMLFile (const QString &file)
 
virtual void setXML (const QString &document, bool merge=false)
 
virtual void setXMLFile (const QString &file, bool merge=false, bool setXMLDoc=true)
 
virtual void stateChanged (const QString &newstate, ReverseStateChange reverse=StateNoReverse)
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Types inherited from KParts::PartBase
enum  PluginLoadingMode { DoNotLoadPlugins = 0, LoadPlugins = 1, LoadPluginsIfEnabled = 2 }
 
- Static Protected Member Functions inherited from KXMLGUIClient
static QString standardsXmlFileLocation ()
 
- Protected Attributes inherited from KParts::PartBase
PartBasePrivate * d_ptr
 

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 75 of file part.h.

Constructor & Destructor Documentation

Part::Part ( QObject parent = nullptr)
explicit

Constructor.

Parameters
parentParent object of the part.

Definition at line 40 of file part.cpp.

Part::~Part ( )
override

Destructor.

Definition at line 52 of file part.cpp.

Member Function Documentation

void Part::customEvent ( QEvent event)
overrideprotectedvirtual

Reimplemented from QObject.

Definition at line 163 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 76 of file part.cpp.

void Part::guiActivateEvent ( GUIActivateEvent event)
protectedvirtual

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, and KHTMLPart.

Definition at line 195 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
widgetthe part widget being clicked - usually the same as widget(), except in koffice.
globalPosthe mouse coordinates in global coordinates

Definition at line 128 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 199 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.

Make sure to call setComponentData before calling iconLoader.

Definition at line 104 of file part.cpp.

bool Part::isSelectable ( ) const

Returns whether the part is selectable or not.

Deprecated:
Since 5.72, for lack of usage.

Definition at line 155 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 219 of file part.cpp.

PartManager * Part::manager ( ) const

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

Definition at line 121 of file part.cpp.

void Part::partActivateEvent ( PartActivateEvent event)
protectedvirtual

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 185 of file part.cpp.

void Part::partSelectEvent ( PartSelectEvent event)
protectedvirtual

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.

Deprecated:
Since 5.72, for lack of usage.

Definition at line 190 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 98 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 92 of file part.cpp.

void Part::setManager ( PartManager manager)
virtual

Used by the part manager.

Definition at line 114 of file part.cpp.

void Part::setSelectable ( bool  selectable)
virtual
Parameters
selectableIndicates whether the part is selectable or not.
Deprecated:
Since 5.72, for lack of usage.

Definition at line 148 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)
protectedvirtual

Set the main widget.

Call this in the Part-inherited class constructor.

Definition at line 139 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.

Note
this signal has only an effect on the window title if window title handling is enabled
See also
KParts::MainWindow::setWindowTitleHandling
void Part::slotWidgetDestroyed ( )
protectedslot

Definition at line 208 of file part.cpp.

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

Definition at line 85 of file part.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Jul 8 2020 22:53:14 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.