KTextEditor.SmartCursorWatcher

KDE 4.9 PyKDE API Reference

- KDE's Python API

# SmartCursorWatcher Class Reference

`from PyKDE4.ktexteditor import *`

Namespace: KTextEditor

## Detailed Description

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.

\sa SmartCursor, SmartCursorNotifier

Author:
  Hamish Rodda <rodda@kde.org>

## Methods
| __init__ (self)
| characterDeleted (self, KTextEditor.SmartCursor cursor, bool deletedBefore)
| characterInserted (self, KTextEditor.SmartCursor cursor, bool insertedBefore)
| deleted (self, KTextEditor.SmartCursor cursor)
| positionChanged (self, KTextEditor.SmartCursor cursor)
| positionDeleted (self, KTextEditor.SmartCursor cursor)
| setWantsDirectChanges (self, bool wantsDirectChanges)
bool | wantsDirectChanges (self)

## Method Documentation

__init__ | ( |  | self ) |

Default constructor.

characterDeleted | ( | self, |
|  | KTextEditor.SmartCursor | cursor,
|  | bool | deletedBefore
| ) |  |  |

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

Parameters:

  | cursor | pointer to the cursor which generated the notification.

Parameters:

  | deletedBefore | true if the character immediately before was deleted,

false if the character immediately after was deleted.

characterInserted | ( | self, |
|  | KTextEditor.SmartCursor | cursor,
|  | bool | insertedBefore
| ) |  |  |

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

Parameters:

  | cursor | pointer to the cursor which generated the notification.

Parameters:

  | insertedBefore | true if a character was inserted before cursor,

false if a character was inserted after

deleted | ( | self, |
|  | KTextEditor.SmartCursor | cursor
| ) |  |  |

The SmartCursor instance specified by cursor is being deleted.

Parameters:

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

positionChanged | ( | self, |
|  | KTextEditor.SmartCursor | cursor
| ) |  |  |

The cursor's position was changed.

Parameters:

  | cursor | pointer to the cursor which generated the notification.

positionDeleted | ( | self, |
|  | KTextEditor.SmartCursor | cursor
| ) |  |  |

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

Parameters:

  | cursor | pointer to the cursor which generated the notification.

setWantsDirectChanges | ( | self, |
|  | bool | wantsDirectChanges
| ) |  |  |

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.

Parameters:

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

bool wantsDirectChanges | ( |  | self ) |

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.