class KTextEditor.SmartRange


abstract class

Table of contents
Modules
ktexteditor Classes
All Classes
Module ktexteditor
Namespace ktexteditor
Class KTextEditor.SmartRange
Inherits KTextEditor.Range

A Range which is bound to a specific Document, and maintains its position.

A SmartRange is an extension of the basic Range class. It maintains its position in the document and provides extra functionality, including:

  • convenience functions for accessing and manipulating the content
  • of the associated document,
  • adjusting behavior in response to text edits,
  • forming a tree structure out of multiple SmartRange%s,
  • providing attribute information for the arbitrary highlighting extension,
  • allowing KAction%s to be bound to the range, and
  • providing notification of changes to 3rd party software.
  • As a result of a smart range's close association with a document, and the processing that occurrs as a result, smart ranges may not be copied.

    For simplicity of code, ranges always maintain their start position to be before or equal to their end position. Attempting to set either the start or end of the range beyond the respective end or start will result in both values being set to the specified position.

    Create a new SmartRange like this:

    // Retrieve the SmartInterface
    KTextEditor.SmartInterface* smart =
    qobject_cast( yourDocument );
    

    if ( smart ) { KTextEditor.SmartRange* range = smart->newSmartRange(); }

    When finished with a SmartRange, simply delete it.

    See also Range, SmartRangeNotifier, SmartRangeWatcher, and SmartInterface

    Author Hamish Rodda \



    enums

    enum details

    methods