• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

KTextEditor

  • KTextEditor
  • ContainerInterface
Public Member Functions | List of all members
KTextEditor::ContainerInterface Class Referenceabstract
Editor Extension Interfaces

#include <containerinterface.h>

Public Member Functions

 ContainerInterface ()
 
virtual ~ContainerInterface ()
 
virtual QObject * container ()=0
 
virtual void setContainer (QObject *container)=0
 

Detailed Description

Class that allows the kpart host to provide some extensions.

The KTextEditor framework allows the kpart host to provide additional services to the kpart. Those services are provided through the ContainerInterface class.

If the container supports those specific services, it should set an instance of the service class with ContainerInterface::setContainer(). That instance should inherit QObject, have the Q_OBJECT macro and declare a Q_INTERFACES(), in order for the qobject_cast mechanism to work.

To obtain a ContainerInterface, in order to set a specific container extension, the kpart host should do:

// inside the kpart host
Editor * editor = KTextEditor::EditorChooser::editor();
ContainerInterface * iface = qobject_cast<ContainerInterface *>( editor );
if (iface != NULL) {
iface->setContainer( myContainerExtension );
} else {
// the kpart does not support ContainerInterface.
}

It is then up to the kpart to use it.

Definition at line 65 of file containerinterface.h.

Constructor & Destructor Documentation

ContainerInterface::ContainerInterface ( )

Constructor.

Definition at line 228 of file ktexteditor.cpp.

ContainerInterface::~ContainerInterface ( )
virtual

Virtual Destructor.

Definition at line 231 of file ktexteditor.cpp.

Member Function Documentation

virtual QObject* KTextEditor::ContainerInterface::container ( )
pure virtual

Fetch the container extension.

This method is used by the KTextEditor component to know which extensions are supported by the KTextEditor host.

The kpart will cast the result with qobject_cast() to the right container extension to see if that particular extension is supported:

Example:

// inside the kpart
Editor * editor = KTextEditor::EditorChooser::editor();
ContainerInterface * iface = qobject_cast<ConainterInterace *>( editor );
SomeContainerExtension * myExt =
qobject_cast<SomeContainerExtension *>( iface->container() );
if (myExt) {
// do some stuff with the specific container extension
// ...
} else {
// too bad, that extension is not supported.
}
See also
setContainer
virtual void KTextEditor::ContainerInterface::setContainer ( QObject *  container)
pure virtual

Set the KTextEditor container.

This method is used by the KTextEditor host to set an instance of a class providing optional container extensions.

See also
container

The documentation for this class was generated from the following files:
  • containerinterface.h
  • ktexteditor.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:48 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KTextEditor

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

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal