# class KTextEditor.SmartCursorWatcher

###

Table of contents
Modules
ktexteditor Classes
All Classes

Module | ktexteditor
Namespace | ktexteditor
Class | KTextEditor.SmartCursorWatcher
Inherits |

A class which provides notifications of state changes to a SmartCursor via virtual inheritance.

This class provides notifications of changes to a SmartCursor such as the position in the document, and deletion or insertion of text immediately before or after the cursor.

If you prefer to receive notifications via QObject signals, see SmartCursorNotifier.

See also SmartCursor, SmartCursorNotifier

Author Hamish Rodda \<rodda@kde.org\>

### methods

- SmartCursorWatcher ()

  returns nothing

  Default constructor.

- characterDeleted (cursor, deletedBefore)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  cursor | KTextEditor.SmartCursor |
  deletedBefore | bool |

  The character immediately surrounding the cursor was deleted. If both characters are simultaneously deleted, positionDeleted() is called instead.

  cursor - pointer to the cursor which generated the notification.

  deletedBefore - true if the character immediately before was deleted, false if the character immediately after was deleted.

- characterInserted (cursor, insertedBefore)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  cursor | KTextEditor.SmartCursor |
  insertedBefore | bool |

  A character was inserted immediately before or after the cursor, as given by insertedBefore.

  cursor - pointer to the cursor which generated the notification.

  insertedBefore - true if a character was inserted before cursor, false if a character was inserted after

- deleted (cursor)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  cursor | KTextEditor.SmartCursor |

  The SmartCursor instance specified by cursor is being deleted.

  cursor - pointer to the cursor which is about to be deleted. It is still safe to access information at this point.

- positionChanged (cursor)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  cursor | KTextEditor.SmartCursor |

  The cursor's position was changed.

  cursor - pointer to the cursor which generated the notification.

- positionDeleted (cursor)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  cursor | KTextEditor.SmartCursor |

  The cursor's surrounding characters were both deleted simultaneously. The cursor is automatically placed at the start of the deleted region.

  cursor - pointer to the cursor which generated the notification.

- setWantsDirectChanges (wantsDirectChanges)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  wantsDirectChanges | bool |

  Set whether this watcher should be notified of changes that happen directly to the cursor, e.g. by calls to SmartCursor.setPosition(), rather than just when surrounding text changes.

  wantsDirectChanges - whether this watcher should receive notifications for direct changes.

- wantsDirectChanges ()

  returns (bool)

  Returns whether this watcher wants to be notified of changes that happen directly to the cursor, e.g. by calls to SmartCursor.setPosition(), rather than just when surrounding text changes.