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

KTextEditor

  • KTextEditor
  • ConfigInterface
Public Member Functions | List of all members
KTextEditor::ConfigInterface Class Referenceabstract
View Extension Interfaces | Document Extension Interfaces

#include <configinterface.h>

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
  • folding-bar [bool], show/hide the folding 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
  • 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)
  • modification-markers [bool] read/set whether the modification markers are shown

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. "."
  • tab-width [int], read/set the width for tabs
  • indent-width [int], read/set the indentation width

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 <mbroa.nosp@m.dst@.nosp@m.gmail.nosp@m..com>

Definition at line 105 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
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