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

KTextEditor

Classes | Enumerations
Smart Cursors and Ranges
Document Extension Interfaces

Classes

class  KTextEditor::SmartCursor
 
class  KTextEditor::SmartCursorNotifier
 
class  KTextEditor::SmartCursorWatcher
 
class  KTextEditor::SmartRange
 
class  KTextEditor::SmartRangeNotifier
 
class  KTextEditor::SmartRangeWatcher
 

Enumerations

enum  KTextEditor::SmartRange::InsertBehavior { KTextEditor::SmartRange::DoNotExpand = 0, KTextEditor::SmartRange::ExpandLeft = 0x1, KTextEditor::SmartRange::ExpandRight = 0x2 }
 

Document-related functions

The following functions are provided for convenient access to the associated Document.

enum  KTextEditor::SmartCursor::AdvanceMode { KTextEditor::SmartCursor::ByCharacter, KTextEditor::SmartCursor::ByCursorPosition }
 
Document * KTextEditor::SmartCursor::document () const
 
virtual bool KTextEditor::SmartCursor::atEndOfLine () const
 
virtual bool KTextEditor::SmartCursor::atEndOfDocument () const
 
virtual bool KTextEditor::SmartCursor::isValid () const
 
QChar KTextEditor::SmartCursor::character () const
 
virtual bool KTextEditor::SmartCursor::insertText (const QStringList &text, bool block=false)
 
virtual bool KTextEditor::SmartCursor::advance (int distance, AdvanceMode mode=ByCharacter)
 

Behavior

The following functions relate to the behavior of this SmartCursor.

enum  KTextEditor::SmartCursor::InsertBehavior { KTextEditor::SmartCursor::StayOnInsert = 0, KTextEditor::SmartCursor::MoveOnInsert }
 
InsertBehavior KTextEditor::SmartCursor::insertBehavior () const
 
void KTextEditor::SmartCursor::setInsertBehavior (InsertBehavior insertBehavior)
 

Detailed Description

If the KTextEditor implementation supports the KTextEditor::SmartInterface, there are several smart classes available.

In general, instances of the smart classes are bound to a specific document, and maintain their position in that document regardless of changes to the text. They also provide:

  • feedback on changes to their position and changes to text related to their position,
  • support for the other smart interfaces, such as arbitrary highlighting, action binding, etc.

The following is a list of all classes that are available when the document supports the KTextEditor::SmartInterface:

Warning
All Smart interfaces were deprecated and not implemented anymore in KDE >= 4.6. They were replaced by the MovingCursors and MovingRanges

Enumeration Type Documentation

enum KTextEditor::SmartCursor::AdvanceMode

Defines the ways in which the cursor can be advanced.

Important for languages where multiple characters are required to form one letter.

Enumerator
ByCharacter 

Movement is calculated on the basis of absolute numbers of characters.

ByCursorPosition 

Movement takes into account valid cursor positions only (as defined by bidirectional processing)

Definition at line 149 of file smartcursor.h.

enum KTextEditor::SmartRange::InsertBehavior

Determine how the range reacts to characters inserted immediately outside the range.

Enumerator
DoNotExpand 

Don't expand to encapsulate new characters in either direction. This is the default.

ExpandLeft 

Expand to encapsulate new characters to the left of the range.

ExpandRight 

Expand to encapsulate new characters to the right of the range.

Definition at line 100 of file smartrange.h.

enum KTextEditor::SmartCursor::InsertBehavior
Enumerator
StayOnInsert 
MoveOnInsert 

Definition at line 187 of file smartcursor.h.

Function Documentation

bool SmartCursor::advance ( int  distance,
AdvanceMode  mode = ByCharacter 
)
virtual

Move cursor by specified distance along the document buffer.

E.g.:

cursor.advance(1);

will move the cursor forward by one character, or, if the cursor is already on the end of the line, will move it to the start of the next line.

Note
Negative numbers should be accepted, and move backwards.
Not all modes are required to be supported.
Parameters
distancedistance to advance (or go back if distance is negative)
modewhether to move by character, or by number of valid cursor positions
Returns
true if the position could be reached within the document, otherwise false (the cursor should not move if distance is beyond the end of the document).

Definition at line 93 of file smartcursor.cpp.

bool SmartCursor::atEndOfDocument ( ) const
virtual

Determine if this cursor is located at the end of the document.

Returns
true if the cursor is situated at the end of the document, otherwise false.

Definition at line 43 of file smartcursor.cpp.

bool SmartCursor::atEndOfLine ( ) const
virtual

Determine if this cursor is located at the end of the current line.

Returns
true if the cursor is situated at the end of the line, otherwise false.

Definition at line 73 of file smartcursor.cpp.

QChar SmartCursor::character ( ) const

Returns the character in the document immediately after this position, ie.

from this position to this position plus Cursor(0,1).

Definition at line 58 of file smartcursor.cpp.

Document * SmartCursor::document ( ) const

Returns the document to which this cursor is attached.

Definition at line 68 of file smartcursor.cpp.

SmartCursor::InsertBehavior SmartCursor::insertBehavior ( ) const

Returns how this cursor behaves when text is inserted at the cursor.

Defaults to moving on insert.

Definition at line 78 of file smartcursor.cpp.

bool SmartCursor::insertText ( const QStringList &  text,
bool  block = false 
)
virtual

Insert text into the associated Document.

Parameters
texttext to insert
blockinsert this text as a visual block of text rather than a linear sequence
Returns
true on success, otherwise false

Definition at line 53 of file smartcursor.cpp.

bool SmartCursor::isValid ( ) const
virtual
Reimplemented from superclass.
See also
Document::cursorInText()

Reimplemented from KTextEditor::Cursor.

Definition at line 38 of file smartcursor.cpp.

void SmartCursor::setInsertBehavior ( InsertBehavior  insertBehavior)

Change the behavior of the cursor when text is inserted at the cursor.

If moveOnInsert is true, the cursor will end up at the end of the insert.

Definition at line 83 of file smartcursor.cpp.

This file is part of the KDE documentation.
Documentation copyright © 1996-2015 The KDE developers.
Generated on Wed Sep 16 2015 09:45:21 by doxygen 1.8.9.1 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-4.14.12 API Reference

Skip menu "kdelibs-4.14.12 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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