Search for usage in LXR

#include <KTextEditor/ConfigInterface>

Inheritance diagram for KTextEditor::ConfigInterface:

Public Member Functions

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.


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*
auto iface = qobject_cast<KTextEditor::ConfigInterface*>(ptr);
if (iface) {
// the implementation supports the interface
// do stuff
} else {
// the implementation does not support the interface

Accessing Data

A list of available config variables (or keys) can be obtained 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
  • folding-bar [bool], show/hide the folding bar
  • folding-preview [bool], enable/disable folding preview when mouse hovers on folded region
  • 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
  • search-highlight-color [QColor], read/set the background color for search
  • replace-highlight-color [QColor], read/set the background color for replaces
  • 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.
  • icon-border-color [QColor] read/set the icon border color (on the left, with the line numbers)
  • folding-marker-color [QColor] read/set folding marker colors (in the icon border)
  • line-number-color [QColor] read/set line number colors (in the icon border)
  • current-line-number-color [QColor] read/set current line number color (in the icon border)
  • modification-markers [bool] read/set whether the modification markers are shown
  • word-count [bool] enable/disable the counting of words and characters in the statusbar
  • line-count [bool] show/hide the total number of lines in the status bar (
  • scrollbar-minimap [bool] enable/disable scrollbar minimap
  • scrollbar-preview [bool] enable/disable scrollbar text preview on hover
  • font [QFont] change the font
  • theme [QString] change the theme

KTextEditor::Document has support for the following:

  • 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. "."
  • replace-tabs [bool], whether to replace tabs
  • indent-pasted-text [bool], whether to indent pasted text
  • tab-width [int], read/set the width for tabs
  • indent-width [int], read/set the indentation width
  • on-the-fly-spellcheck [bool], enable/disable on the fly spellcheck

The KTextEditor::Document or KTextEditor::View objects will emit the configChanged signal when appropriate.

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
Matt Broadstone <mbroa[email protected][email protected][email protected]gmail[email protected].com>

Definition at line 105 of file configinterface.h.

Constructor & Destructor Documentation

◆ ~ConfigInterface()

ConfigInterface::~ConfigInterface ( )

Virtual destructor.

Member Function Documentation

◆ configKeys()

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

Get a list of all available keys.

Implemented in KTextEditor.

◆ configValue()

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

Get a value for the key.

Implemented in KTextEditor.

◆ setConfigValue()

virtual void KTextEditor::ConfigInterface::setConfigValue ( const QString key,
const QVariant value 
pure virtual

Set a the key's value to value.

Implemented in KTextEditor.

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Wed Jun 29 2022 03:54:13 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.