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

KTextEditor

  • KTextEditor
  • ConfigInterface
Public Member Functions

KTextEditor::ConfigInterface Class Reference
View Extension Interfaces | Document Extension Interfaces

Config interface extension for the Document and View. More...

#include <configinterface.h>

List of all members.

Public Member Functions

 ConfigInterface ()
virtual ~ConfigInterface ()
virtual QStringList configKeys () const =0
virtual QVariant configValue (const QString &key)=0
virtual void setConfigValue (const QString &key, const QVariant &value)=0

Detailed Description

Config interface extension for the Document and View.

Introduction

The ConfigInterface provides methods to access and modify the low level config information for a given Document or View. Examples of this config data can be displaying the icon bar, showing line numbers, etc. This generally allows access to settings that otherwise are only accessible during runtime.

Accessing the Interface

The ConfigInterface is supposed to be an extension interface for a Document or View, i.e. the Document or View inherits the interface provided that the KTextEditor library in use implements the interface. Use qobject_cast to access the interface:

 // ptr is of type KTextEditor::Document* or KTextEditor::View*
 KTextEditor::ConfigInterface *iface =
     qobject_cast<KTextEditor::ConfigInterface*>( ptr );

 if( iface ) {

     // the implementation supports the interface
     // do stuff
 }

Accessing Data

A list of available config variables (or keys) can be optained by calling configKeys(). For all available keys configValue() returns the corresponding value as QVariant. A value for a given key can be set by calling setConfigValue(). Right now, when using KatePart as editor component, KTextEditor::View has support for the following tuples:

  • line-numbers [bool], show/hide line numbers
  • icon-bar [bool], show/hide icon bar
  • dynamic-word-wrap [bool], enable/disable dynamic word wrap
  • background-color [QColor], read/set the default background color
  • selection-color [QColor], read/set the default color for selections
  • default-mark-type [uint], read/set the default mark type
  • allow-mark-menu [bool], enable/disable the menu shown when right clicking on the left gutter. When disabled, click on the gutter will always set or clear the mark of default type.

KTextEditor::Document has support for the following:

  • auto-brackets [bool], enable/disable automatic bracket completion
  • backup-on-save-local [bool], enable/disable backup when saving local files
  • backup-on-save-remote [bool], enable/disable backup when saving remote files
  • backup-on-save-suffix [string], set the suffix for file backups, e.g. "~"
  • backup-on-save-prefix [string], set the prefix for file backups, e.g. "."

Either interface should emit the configChanged signal when appropriate. TODO: Add to interface in KDE 5.

For instance, if you want to enable dynamic word wrap of a KTextEditor::View simply call

 iface->setConfigValue("dynamic-word-wrap", true);
See also:
KTextEditor::View, KTextEditor::Document
Author:
Matt Broadstone <mbroadst@gmail.com>

Definition at line 96 of file configinterface.h.


Constructor & Destructor Documentation

ConfigInterface::ConfigInterface ( )

Definition at line 24 of file configinterface.cpp.

ConfigInterface::~ConfigInterface ( ) [virtual]

Virtual destructor.

Definition at line 29 of file configinterface.cpp.


Member Function Documentation

virtual QStringList KTextEditor::ConfigInterface::configKeys ( ) const [pure virtual]

Get a list of all available keys.

virtual QVariant KTextEditor::ConfigInterface::configValue ( const QString &  key) [pure virtual]

Get a value for the key.

virtual void KTextEditor::ConfigInterface::setConfigValue ( const QString &  key,
const QVariant &  value 
) [pure virtual]

Set a the key's value to value.


The documentation for this class was generated from the following files:
  • configinterface.h
  • configinterface.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
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
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