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

KTextEditor

  • KTextEditor
  • Editor
Signals | Public Member Functions | Protected Member Functions | List of all members
KTextEditor::Editor Class Referenceabstract

#include <editor.h>

Inheritance diagram for KTextEditor::Editor:
Inheritance graph
[legend]

Signals

void documentCreated (KTextEditor::Editor *editor, KTextEditor::Document *document)
 

Public Member Functions

 Editor (QObject *parent)
 
virtual ~Editor ()
 
virtual const KAboutData * aboutData () const =0
 
virtual void configDialog (QWidget *parent)=0
 
virtual bool configDialogSupported () const =0
 
virtual ConfigPage * configPage (int number, QWidget *parent)=0
 
virtual QString configPageFullName (int number) const =0
 
virtual KIcon configPageIcon (int number) const =0
 
virtual QString configPageName (int number) const =0
 
virtual int configPages () const =0
 
virtual Document * createDocument (QObject *parent)=0
 
const QString & defaultEncoding () const
 
virtual const QList< Document * > & documents ()=0
 
virtual void readConfig (KConfig *config=0)=0
 
void setSimpleMode (bool on)
 
bool simpleMode () const
 
virtual void writeConfig (KConfig *config=0)=0
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () const
 

Protected Member Functions

void setDefaultEncoding (const QString &defaultEncoding)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
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)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Accessor interface for Editor part.

Topics:

  • Introduction
  • Editor Configuration
  • Implementation Notes
  • Editor Extension Interfaces

Introduction

The Editor part can be accessed via the KTextEditor::Factory or the KTextEditor::EditorChooser and provides general information and configuration methods for the Editor implementation, for example KAboutData by using aboutData().

The Editor implementation has a list of all opened documents. Get this list with documents(). To create a new Document call createDocument(). The signal documentCreated() is emitted whenever the Editor created a new document.

Editor Configuration

If the Editor implementation supports a config dialog configDialogSupported() returns true, then the config dialog can be shown with configDialog(). Instead of using the config dialog, the config pages can be embedded into the application's config dialog. To do this, configPages() returns the number of config pages the Editor implementation provides and configPage() returns the requested page. Further, a config page has a short descriptive name, get it with configPageName(). You can get more detailed name by using configPageFullName(). Also every config page has a pixmap, get it with configPagePixmap(). The configuration can be saved and loaded with readConfig() and writeConfig().

Note
We recommend to embedd the config pages into the main application's config dialog instead of using a separate config dialog, if the config dialog does not look cluttered then. This way, all settings are grouped together in one place.

Implementation Notes

Usually only one instance of the Editor exists. The Kate Part implementation internally uses a static accessor to make sure that only one Kate Part Editor object exists. So several factories still use the same Editor.

readConfig() and writeConfig() should be forwarded to all loaded plugins as well, see KTextEditor::Plugin::readConfig() and KTextEditor::Plugin::writeConfig().

Editor Extension Interfaces

There is only a single extension interface for the Editor: the CommandInterface. With the CommandInterface it is possible to add and remove new command line commands which are valid for all documents. Common use cases are for example commands like find or setting document variables. For further details read the detailed descriptions in the class KTextEditor::CommandInterface.

See also
KTextEditor::Factory, KTextEditor::Document, KTextEditor::ConfigPage KTextEditor::Plugin, KTextEditor::CommandInterface
Author
Christoph Cullmann <cullm.nosp@m.ann@.nosp@m.kde.o.nosp@m.rg>

Definition at line 102 of file editor.h.

Constructor & Destructor Documentation

Editor::Editor ( QObject *  parent)

Constructor.

Create the Editor object with parent.

Parameters
parentparent object

Definition at line 85 of file ktexteditor.cpp.

Editor::~Editor ( )
virtual

Virtual destructor.

Definition at line 91 of file ktexteditor.cpp.

Member Function Documentation

virtual const KAboutData* KTextEditor::Editor::aboutData ( ) const
pure virtual

Get the about data of this Editor part.

Returns
about data
virtual void KTextEditor::Editor::configDialog ( QWidget *  parent)
pure virtual

Show the editor's config dialog, changes will be applied to the editor, but not saved anywhere automagically, call writeConfig() to save them.

Note
Instead of using the config dialog, the config pages can be embedded into your own config dialog by using configPages() and configPage().
Parameters
parentparent widget
See also
configDialogSupported()
virtual bool KTextEditor::Editor::configDialogSupported ( ) const
pure virtual

Check, whether this editor has a configuration dialog.

Returns
true, if the editor has a configuration dialog, otherwise false
See also
configDialog()
virtual ConfigPage* KTextEditor::Editor::configPage ( int  number,
QWidget *  parent 
)
pure virtual

Get the config page with the number, config pages from 0 to configPages()-1 are available if configPages() > 0.

Parameters
numberindex of config page
parentparent widget for config page
Returns
created config page or NULL, if the number is out of bounds
See also
configPages()
virtual QString KTextEditor::Editor::configPageFullName ( int  number) const
pure virtual

Get a readable full name for the config page number.

The name should be translated.

Example: If the name is "Filetypes", the full name could be "Filetype Specific Settings". For "Shortcuts" the full name would be something like "Shortcut Configuration".

Parameters
numberindex of config page
Returns
full name of given page index
See also
configPageName(), configPagePixmap()
virtual KIcon KTextEditor::Editor::configPageIcon ( int  number) const
pure virtual

Get a pixmap with size for the config page number.

Parameters
numberindex of config page
Returns
pixmap for the given page index
See also
configPageName(), configPageFullName()
virtual QString KTextEditor::Editor::configPageName ( int  number) const
pure virtual

Get a readable name for the config page number.

The name should be translated.

Parameters
numberindex of config page
Returns
name of given page index
See also
configPageFullName(), configPagePixmap()
virtual int KTextEditor::Editor::configPages ( ) const
pure virtual

Get the number of available config pages.

If the editor returns a number < 1, it does not support config pages and the embedding application should use configDialog() instead.

Returns
number of config pages
See also
configPage(), configDialog()
virtual Document* KTextEditor::Editor::createDocument ( QObject *  parent)
pure virtual

Create a new document object with parent.

Parameters
parentparent object
Returns
new KTextEditor::Document object
See also
documents()
const QString & Editor::defaultEncoding ( ) const

Get the current default encoding for this Editor part.

Returns
default encoding
Since
4.5

Definition at line 106 of file ktexteditor.cpp.

void KTextEditor::Editor::documentCreated ( KTextEditor::Editor *  editor,
KTextEditor::Document *  document 
)
signal

The editor emits this signal whenever a document was successfully created.

Parameters
editoreditor which created the new document
documentthe newly created document instance
See also
createDocument()
virtual const QList<Document*>& KTextEditor::Editor::documents ( )
pure virtual

Get a list of all documents of this editor.

Returns
list of all existing documents
See also
createDocument()
virtual void KTextEditor::Editor::readConfig ( KConfig *  config = 0)
pure virtual

Read editor configuration from KConfig config.

Note
Implementation Notes: If config is NULL you should use kapp->config() as a fallback solution. Additionally the readConfig() call should be forwarded to every loaded plugin.
Parameters
configconfig object
See also
writeConfig()
void Editor::setDefaultEncoding ( const QString &  defaultEncoding)
protected

Set the current default encoding for this Editor part.

Editor part implementation should call this internally on creation and config changes.

Parameters
defaultEncodingnew default encoding
Since
4.5

Definition at line 111 of file ktexteditor.cpp.

void Editor::setSimpleMode ( bool  on)

Switch editor to simple mode for average users.

Switch the editor to a simple mode which will hide advanced stuff from average user or switch it back to normal mode. This mode will only affect documents/views created after the change.

Parameters
onturn simple mode on or not

Definition at line 96 of file ktexteditor.cpp.

bool Editor::simpleMode ( ) const

Query the editor whether simple mode is on or not.

Returns
true if simple mode is on, otherwise false
See also
setSimpleMode()

Definition at line 101 of file ktexteditor.cpp.

virtual void KTextEditor::Editor::writeConfig ( KConfig *  config = 0)
pure virtual

Write editor configuration to KConfig config.

Note
Implementation Notes: If config is NULL you should use kapp->config() as a fallback solution. Additionally the writeConfig() call should be forwarded to every loaded plugin.
Parameters
configconfig object
See also
readConfig()

The documentation for this class was generated from the following files:
  • editor.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