KDE 4.9 PyKDE API Reference
  • KDE's Python API
  • Overview
  • PyKDE Home
  • Sitemap
  • Contact Us
 

MdiContainer Class Reference

from PyKDE4.ktexteditor import *

Namespace: KTextEditor

Detailed Description

A container for MDI-capable kpart hosts.

The kpart container for the KTextEditor interface may have different capabilities. For example, inside KDevelop or Kate, the container can manage multiple views and multiple documents. However, if the kpart text is used inside konqueror as a replacement of the text entry in html forms, the container will only support one view with one document.

This class allows the kpart component to create and delete views, create and delete documents, fetch and set the current view. Note that the ktexteditor framework already supports multiple document and views and that the kpart host can create them and delete them as it wishes. What this class provides is the ability for the <i>kpart component</i> being hosted to do the same.

An instance of this extension should be set with ContainerInterface.setContainerExtension().Check ContainerInterface() to see how to obtain an instance of ContainerInterface. The instance should inherit QObject, inherit MdiContainer, declare the Q_OBJECT macro and declare a Q_INTERFACES(KTextEditor.MdiContainer) .

Code example to support MdiContainer (in the kpart host):

 class MyMdiContainer : public QObject,
                        public MdiContainer
 {
   Q_OBJECT
   Q_INTERFACES( KTextEditor.MdiContainer )

   public:
     // ...
 }

To check if the kpart hosts supports the MDI container:

 Editor * editor = KTextEditor.EditorChooser.editor();
 ContainerInterface * iface = qobject_cast<ContainerInterface *>( editor );
 if (iface) {
   MdiContainer * mdiContainer = qobject_cast<MdiContainer *>( iface->container() );
   if (MdiContainer != NULL ) {
    // great, I can create additional views
    // ...
   }
 }


Methods

 __init__ (self)
KTextEditor.View activeView (self)
bool closeDocument (self, KTextEditor.Document doc)
bool closeView (self, KTextEditor.View view)
KTextEditor.Document createDocument (self)
KTextEditor.View createView (self, KTextEditor.Document doc)
 setActiveView (self, KTextEditor.View view)

Method Documentation

__init__ (   self )

Constructor

KTextEditor.View activeView (   self )
Abstract method:
This method is abstract and can be overridden but not called directly.

Get the current activew view.

Returns:
the active view.

\sa setActiveView

bool closeDocument (  self,
KTextEditor.Document  doc
)
Abstract method:
This method is abstract and can be overridden but not called directly.

Closes of document doc .

The document is about to be closed but is still valid when this call is made. The Document does not contain any view when this call is made (closeView() has been called on all the views of the document previously).

The signal aboutToClose() is emitted before this method is called.

Returns:
true if the removal is authorized and acted, or false if removing documents by the kpart is not supported by the container.

bool closeView (  self,
KTextEditor.View  view
)
Abstract method:
This method is abstract and can be overridden but not called directly.

Closes the View view .

The view is still valid when this call is made but will be deleted shortly after.

Returns:
true if the removal is authorized and acted, or false if the container does not support view removing from the kpart, or

KTextEditor.Document createDocument (   self )
Abstract method:
This method is abstract and can be overridden but not called directly.

Create a new Document and return it to the kpart.

Canonical implementation is:

 Document * createDocument()
 {
     Document * doc;
     // set parentQObject to relevant value
     doc = editor->createDocument( parentQObject );
     // integrate the new document in the document list of the
     // container, ...
     return doc;
 }

The signal documentCreated() will be emitted during the creation.

Returns:
a pointer to the new Document object.

KTextEditor.View createView (  self,
KTextEditor.Document  doc
)
Abstract method:
This method is abstract and can be overridden but not called directly.

Creates a new View and return it to the kpart.

Canonical implementation is:

 View * createView( Document * doc )
 {
     // set parentWidget to relevant value
     return doc->createView( parentWidget );
 }

The signal viewCreated() will be emitted during the createView() call.

Returns:
a pointer to the new View created.

setActiveView (  self,
KTextEditor.View  view
)
Abstract method:
This method is abstract and can be overridden but not called directly.

Set the view requested by the part as the active view.

\sa activeView

  • Full Index

Modules

  • akonadi
  • dnssd
  • kdecore
  • kdeui
  • khtml
  • kio
  • knewstuff
  • kparts
  • kutils
  • nepomuk
  • phonon
  • plasma
  • polkitqt
  • solid
  • soprano
This documentation is maintained by Simon Edwards.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal