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

KTextEditor

  • KTextEditor
  • EditorChooser
Signals | Public Member Functions | Static Public Member Functions | List of all members
KTextEditor::EditorChooser Class Reference

#include <editorchooser.h>

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

Signals

void changed ()
 

Public Member Functions

 EditorChooser (QWidget *parent=0)
 
virtual ~EditorChooser ()
 
void readAppSetting (const QString &postfix=QString())
 
void writeAppSetting (const QString &postfix=QString())
 

Static Public Member Functions

static KTextEditor::Editor * editor (const QString &postfix=QString(), bool fallBackToKatePart=true)
 

Detailed Description

Editor Component Chooser.

Topics:

  • Introduction
  • The GUI Editor Chooser
  • Accessing the Editor Part

Introduction

The EditorChooser is responsible for two different tasks: It provides

  • a GUI, with which the user can choose the preferred editor part
  • a static accessor, with which the current selected editor part can be obtained.

The GUI Editor Chooser

The EditorChooser is a simple widget with a group box containing an information label and a combo box which lists all available KTextEditor implementations. To give the user the possibility to choose a text editor implementation, create an instance of this class and put it into the GUI:

KTextEditor::EditorChooser* ec = new KTextEditor::EditorChooser(parent);
// read the settings from the application's KConfig object
ec->readAppSetting();
// optionally connect the signal changed()
// plug the widget into a layout
layout->addWidget(ec);

Later, for example when the user clicks the Apply-button:

// save the user's choice
ec->writeAppSetting();

After this, the static accessor editor() will return the new editor part object. Now, either the application has to be restarted, or you need code that closes all current documents so that you can safely switch and use the new editor part. Restarting is probably much easier.

Note
If you do not put the EditorChooser into the GUI, the default editor component will be used. The default editor is configurable in KDE's control center in "KDE Components > Component Chooser > Embedded Text Editor".

Accessing the Editor Part

The call of editor() will return the currently used editor part, either the KDE default or the one configured with the EditorChooser's GUI (see The GUI Editor Chooser). Example:

KTextEditor::Editor* editor = KTextEditor::EditorChooser::editor();
See also
KTextEditor::Editor
Author
Joseph Wenninger <jowen.nosp@m.n@kd.nosp@m.e.org>

Definition at line 88 of file editorchooser.h.

Constructor & Destructor Documentation

EditorChooser::EditorChooser ( QWidget *  parent = 0)

Constructor.

Create an editor chooser widget.

Parameters
parentthe parent widget

Definition at line 53 of file editorchooser.cpp.

EditorChooser::~EditorChooser ( )
virtual

Destructor.

Definition at line 90 of file editorchooser.cpp.

Member Function Documentation

void KTextEditor::EditorChooser::changed ( )
signal

This signal is emitted whenever the selected item in the combo box changed.

KTextEditor::Editor * EditorChooser::editor ( const QString &  postfix = QString(),
bool  fallBackToKatePart = true 
)
static

Static accessor to get the Editor instance of the currently used KTextEditor component.

That Editor instance can be qobject-cast to specific extensions. If the result of the cast is not NULL, that extension is supported:

Parameters
postfixconfig group postfix string
fallBackToKatePartif true, the returned Editor component will be a katepart if no other implementation can be found
Returns
Editor controller or NULL, if no editor component could be found

Definition at line 118 of file editorchooser.cpp.

void EditorChooser::readAppSetting ( const QString &  postfix = QString())

Read the configuration from the application's config file.

The group is handeled internally (it is called "KTEXTEDITOR:", but it is possible to add a string to extend the group name with postfix.

Parameters
postfixconfig group postfix string
See also
writeAppSetting()

Definition at line 96 of file editorchooser.cpp.

void EditorChooser::writeAppSetting ( const QString &  postfix = QString())

Write the configuration to the application's config file.

Parameters
postfixconfig group postfix string
See also
readAppSetting()

Definition at line 110 of file editorchooser.cpp.


The documentation for this class was generated from the following files:
  • editorchooser.h
  • editorchooser.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:52:20 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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

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