KParts::Part

Search for usage in LXR

#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
 
KPluginMetaData metaData () 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 QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, 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 (const QObject *object)
 
qobject_cast (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 ()
 
 ~PartBase () override
 
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

KPARTS_NO_EXPORT Part (PartPrivate &dd, QObject *parent)
 
void customEvent (QEvent *event) override
 
virtual void guiActivateEvent (GUIActivateEvent *event)
 
QWidgethostContainer (const QString &containerName)
 
void loadPlugins ()
 
void loadPlugins (QObject *parent, KXMLGUIClient *parentGUIClient, const KAboutData &aboutData)
 
void loadPlugins (QObject *parent, KXMLGUIClient *parentGUIClient, const QString &parentInstanceName)
 
virtual void partActivateEvent (PartActivateEvent *event)
 
virtual void partSelectEvent (PartSelectEvent *event)
 
void setMetaData (const KPluginMetaData &metaData)
 
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
KPARTS_NO_EXPORT PartBase (PartBasePrivate &dd)
 
void loadPlugins (QObject *parent, KXMLGUIClient *parentGUIClient, const KAboutData &aboutData)
 
void loadPlugins (QObject *parent, KXMLGUIClient *parentGUIClient, const QString &parentInstanceName)
 
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 *context, Functor functor, 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)
 
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, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Static Public Member Functions inherited from KXMLGUIClient
static QString findVersionNumber (const QString &xml)
 
- 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
const std::unique_ptr< 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 62 of file part.h.

Constructor & Destructor Documentation

◆ Part()

Part::Part ( QObject parent = nullptr)
explicit

Constructor.

Parameters
parentParent object of the part.

Definition at line 27 of file part.cpp.

◆ ~Part()

Part::~Part ( )
override

Destructor.

Definition at line 41 of file part.cpp.

Member Function Documentation

◆ customEvent()

void Part::customEvent ( QEvent event)
overrideprotectedvirtual

Reimplemented from QObject.

Definition at line 161 of file part.cpp.

◆ embed()

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.

Deprecated:
Since 5.77, for lack of usage.

Definition at line 65 of file part.cpp.

◆ guiActivateEvent()

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

Definition at line 193 of file part.cpp.

◆ hitTest()

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

◆ hostContainer()

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

◆ iconLoader()

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 setMetaData (or deprecated setComponentData) before calling iconLoader.

Deprecated:
since 5.82, use QIcon::fromTheme() and set QIcon::setThemeSearchPaths() or QIcon::setFallbackSearchPaths appropriately.

Definition at line 95 of file part.cpp.

◆ isSelectable()

bool Part::isSelectable ( ) const

Returns whether the part is selectable or not.

Deprecated:
Since 5.72, for lack of usage.

Definition at line 153 of file part.cpp.

◆ loadPlugins() [1/3]

void Part::loadPlugins ( )
protected

Load this part's plugins now.

Call this at the end of the part constructor, unless you are still using the deprecated setComponentData(componentData, true)).

Since
4.1
Deprecated:
Since 5.90, the concept of KPart plugins is deprecated, see docs of KParts::Plugin class

Definition at line 218 of file part.cpp.

◆ loadPlugins() [2/3]

void PartBase::loadPlugins
protected

Load the Plugins honoring the PluginLoadingMode.

If you call this method in an already constructed GUI (like when the user has changed which plugins are enabled) you need to add the new plugins to the KXMLGUIFactory:

if( factory() )
{
for (auto *plugin : plugins) {
factory()->addClient(plugin);
}
}
Deprecated:
Since 5.77, use loadPlugins(QObject *parent, KXMLGUIClient *, const QString &) instead.

Definition at line 82 of file partbase.cpp.

◆ loadPlugins() [3/3]

void PartBase::loadPlugins
protected

Load the Plugins honoring the PluginLoadingMode.

If you call this method in an already constructed GUI (like when the user has changed which plugins are enabled) you need to add the new plugins to the KXMLGUIFactory:

if( factory() )
{
for (auto *plugin : plugins) {
factory()->addClient(plugin);
}
}
Since
5.77
Deprecated:
Since 5.90, the concept of KPart plugins is deprecated, see docs of KParts::Plugin class

Definition at line 89 of file partbase.cpp.

◆ manager()

PartManager * Part::manager ( ) const

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

Definition at line 120 of file part.cpp.

◆ metaData()

KPluginMetaData Part::metaData ( ) const
Since
5.77

Definition at line 106 of file part.cpp.

◆ partActivateEvent()

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

◆ partSelectEvent()

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

◆ setAutoDeletePart()

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

◆ setAutoDeleteWidget()

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

◆ setManager()

void Part::setManager ( PartManager manager)
virtual

Used by the part manager.

Definition at line 113 of file part.cpp.

◆ setMetaData()

void Part::setMetaData ( const KPluginMetaData metaData)
protected

Set the meta data for this part.

Call this at the begin of the part constructor.

Since
5.77

Definition at line 226 of file part.cpp.

◆ setSelectable()

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

◆ setStatusBarText

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.

◆ setWidget()

void Part::setWidget ( QWidget widget)
protectedvirtual

Set the main widget.

Call this in the Part-inherited class constructor.

Definition at line 138 of file part.cpp.

◆ setWindowCaption

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

◆ slotWidgetDestroyed

void Part::slotWidgetDestroyed ( )
protectedslot

Definition at line 206 of file part.cpp.

◆ widget()

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

Definition at line 75 of file part.cpp.


The documentation for this class was generated from the following files:
static QList< Plugin * > pluginObjects(QObject *parent)
Returns a list of plugin objects loaded for parent.
Definition: plugin.cpp:171
KXMLGUIFactory * factory() const
void addClient(KXMLGUIClient *client)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:53:51 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.