KDE 4.9 PyKDE API Reference

- KDE's Python API

# SmartCursorNotifier Class Reference

`from PyKDE4.ktexteditor import *`

Inherits: QObject
Namespace: KTextEditor

## Detailed Description

A class which provides notifications of state changes to a SmartCursor via QObject signals.

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 virtual inheritance, see SmartCursorWatcher.

\sa SmartCursor, SmartCursorNotifier

Author:
  Hamish Rodda <rodda@kde.org>

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

## Signal Documentation

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

One 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.

Signal syntax:
  `QObject.connect(source, SIGNAL("characterDeleted(KTextEditor::SmartCursor*, bool)"), target_slot)`

characterInserted | ( | 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

Signal syntax:
  `QObject.connect(source, SIGNAL("characterInserted(KTextEditor::SmartCursor*, bool)"), target_slot)`

deleted | ( | 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.

Signal syntax:
  `QObject.connect(source, SIGNAL("deleted(KTextEditor::SmartCursor*)"), target_slot)`

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

The cursor's position was changed.

Parameters:

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

Signal syntax:
  `QObject.connect(source, SIGNAL("positionChanged(KTextEditor::SmartCursor*)"), target_slot)`

positionDeleted | ( | 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.

Signal syntax:
  `QObject.connect(source, SIGNAL("positionDeleted(KTextEditor::SmartCursor*)"), target_slot)`

## Method Documentation

__init__ | ( |  | self ) |

Default constructor.

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

Set whether this notifier should notify 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 notifier should provide notifications for direct changes.

bool wantsDirectChanges | ( |  | self ) |

Returns whether this notifier will notify of changes that happen directly to the cursor, e.g. by calls to SmartCursor.setPosition(), rather than just when surrounding text changes.