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

KTextEditor

KTextEditor::Factory

KTextEditor::Factory Class Reference

Accessor to the Editor implementation. More...

#include <factory.h>

Inheritance diagram for KTextEditor::Factory:

Inheritance graph
[legend]

List of all members.


Public Member Functions

virtual Editor * editor ()=0
 Factory (QObject *parent)
virtual ~Factory ()

Detailed Description

Accessor to the Editor implementation.

Topics:

  • Introduction
  • Creating an Editor Part
  • Notes

Introduction

The Factory provides access to the chosen Editor (selected with KTextEditor::EditorChooser). The Editor itself then provides methods to handle documents and config options.

To access the Editor use editor().

Each KTextEditor implementation must reimplement this factory to allow access to the editor object.

Creating an Editor Part

To get a kate part the following code snippet can be used:
 KLibFactory* factory = KLibLoader::self()->factory("katepart");
 KTextEditor::Factory* kte_factory =
     qobject_cast<KTextEditor::Factory*>(factory);

 if(kte_factory) {
     // valid editor factory, it is possible to access the editor now
     KTextEditor::Editor* editor = kte_factory->editor();
 } else {
     // error
 }
If another editor part is desired substitue the string "katepart" with the corresponding library name.

However, if you are only interested in getting the editor part (which is usually the case) a simple call of

 KTextEditor::Editor* editor = KTextEditor::editor("katepart");
is enough.

Notes

It is recommend to use the EditorChooser to get the used editor part. This way the user can choose the editor implementation. The Factory itself is not needed to get the Editor with the help of the EditorChooser.

See also:
KParts::Factory, KTextEditor::Editor
Author:
Christoph Cullmann <cullmann@kde.org>

Definition at line 89 of file factory.h.


Constructor & Destructor Documentation

Factory::Factory ( QObject *  parent  ) 

Constructor.

Create a new Factory with parent.

Parameters:
parent parent object

Definition at line 69 of file ktexteditor.cpp.

Factory::~Factory (  )  [virtual]

Virtual destructor.

Definition at line 75 of file ktexteditor.cpp.


Member Function Documentation

virtual Editor* KTextEditor::Factory::editor (  )  [pure virtual]

Get the global Editor object.

The editor part implementation must ensure that this object lives as long as any factory or document object exists.

Returns:
global KTextEditor::Editor object


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

KTextEditor

Skip menu "KTextEditor"
  • Main Page
  • Modules
  • 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
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
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