KTextEditor.SmartRangeWatcher

KDE 4.9 PyKDE API Reference

- KDE's Python API

# SmartRangeWatcher Class Reference

`from PyKDE4.ktexteditor import *`

Namespace: KTextEditor

## Detailed Description

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

This class provides notifications of changes to the position or contents of a SmartRange via virtual inheritance.

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

Before destruction, you must unregister the watcher from any ranges it is watching.

\sa SmartRange, SmartRangeNotifier

Author:
  Hamish Rodda <rodda@kde.org>

## Methods
| __init__ (self)
| caretEnteredRange (self, KTextEditor.SmartRange range, KTextEditor.View view)
| caretExitedRange (self, KTextEditor.SmartRange range, KTextEditor.View view)
| childRangeInserted (self, KTextEditor.SmartRange range, KTextEditor.SmartRange child)
| childRangeRemoved (self, KTextEditor.SmartRange range, KTextEditor.SmartRange child)
| mouseEnteredRange (self, KTextEditor.SmartRange range, KTextEditor.View view)
| mouseExitedRange (self, KTextEditor.SmartRange range, KTextEditor.View view)
| parentRangeChanged (self, KTextEditor.SmartRange range, KTextEditor.SmartRange newParent, KTextEditor.SmartRange oldParent)
| rangeAttributeChanged (self, KTextEditor.SmartRange range, KSharedPtr currentAttribute, KSharedPtr previousAttribute)
| rangeContentsChanged (self, KTextEditor.SmartRange range)
| rangeContentsChanged (self, KTextEditor.SmartRange range, KTextEditor.SmartRange mostSpecificChild)
| rangeDeleted (self, KTextEditor.SmartRange range)
| rangeEliminated (self, KTextEditor.SmartRange range)
| rangePositionChanged (self, KTextEditor.SmartRange range)
| setWantsDirectChanges (self, bool wantsDirectChanges)
bool | wantsDirectChanges (self)

## Method Documentation

__init__ | ( |  | self ) |

Default constructor

caretEnteredRange | ( | self, |
|  | KTextEditor.SmartRange | range,
|  | KTextEditor.View | view
| ) |  |  |

The caret on view entered range.

To do: For now, to receive this notification, the range heirachy must be registered with the SmartInterface as for arbitrary highlighting with dynamic highlighting. Need to add another (and probably simplify existing) method.

Parameters:

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

Parameters:

  | view | view over which the mouse moved to generate the notification

caretExitedRange | ( | self, |
|  | KTextEditor.SmartRange | range,
|  | KTextEditor.View | view
| ) |  |  |

The caret on view exited range.

To do: For now, to receive this notification, the range heirachy must be registered with the SmartInterface as for arbitrary highlighting with dynamic highlighting. Need to add another (and probably simplify existing) method.

Parameters:

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

Parameters:

  | view | view over which the mouse moved to generate the notification

childRangeInserted | ( | self, |
|  | KTextEditor.SmartRange | range,
|  | KTextEditor.SmartRange | child
| ) |  |  |

The range child was inserted as a child range into the current range.

Parameters:

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

Parameters:

  | child | pointer to the range which was inserted as a child range.

childRangeRemoved | ( | self, |
|  | KTextEditor.SmartRange | range,
|  | KTextEditor.SmartRange | child
| ) |  |  |

The child range child was removed from the current range.

Parameters:

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

Parameters:

  | child | pointer to the child range which was removed.

mouseEnteredRange | ( | self, |
|  | KTextEditor.SmartRange | range,
|  | KTextEditor.View | view
| ) |  |  |

The mouse cursor on view entered range.

To do: For now, to receive this notification, the range heirachy must be registered with the SmartInterface as for arbitrary highlighting with dynamic highlighting. Need to add another (and probably simplify existing) method.

Parameters:

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

Parameters:

  | view | view over which the mouse moved to generate the notification

mouseExitedRange | ( | self, |
|  | KTextEditor.SmartRange | range,
|  | KTextEditor.View | view
| ) |  |  |

The mouse cursor on view exited range.

To do: For now, to receive this notification, the range heirachy must be registered with the SmartInterface as for arbitrary highlighting with dynamic highlighting. Need to add another (and probably simplify existing) method.

Parameters:

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

Parameters:

  | view | view over which the mouse moved to generate the notification

parentRangeChanged | ( | self, |
|  | KTextEditor.SmartRange | range,
|  | KTextEditor.SmartRange | newParent,
|  | KTextEditor.SmartRange | oldParent
| ) |  |  |

The range's parent was changed.

Parameters:

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

Parameters:

  | newParent | pointer to the range which was is now the parent range.

Parameters:

  | oldParent | pointer to the range which used to be the parent range.

rangeAttributeChanged | ( | self, |
|  | KTextEditor.SmartRange | range,
|  | KSharedPtr | currentAttribute,
|  | KSharedPtr | previousAttribute
| ) |  |  |

The highlighting attribute of range was changed from previousAttribute to currentAttribute.

Parameters:

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

Parameters:

  | currentAttribute | the attribute newly assigned to this range

Parameters:

  | previousAttribute | the attribute previously assigned to this range

rangeContentsChanged | ( | self, |
|  | KTextEditor.SmartRange | range
| ) |  |  |

The contents of the range changed. This notification is special in that it is only emitted by the top range of a heirachy, and also gives the furthest descendant child range which still encompasses the whole change (see contents).

Parameters:

  | range | the range which has changed

Parameters:

  | mostSpecificChild | the child range which both contains the entire change and is the furthest descendant of this range.

rangeContentsChanged | ( | self, |
|  | KTextEditor.SmartRange | range,
|  | KTextEditor.SmartRange | mostSpecificChild
| ) |  |  |

The contents of the range changed. This notification is special in that it is only emitted by the top range of a heirachy, and also gives the furthest descendant child range which still encompasses the whole change (see contents).

Parameters:

  | range | the range which has changed

Parameters:

  | mostSpecificChild | the child range which both contains the entire change and is the furthest descendant of this range.

rangeDeleted | ( | self, |
|  | KTextEditor.SmartRange | range
| ) |  |  |

The SmartRange instance specified by range is being deleted.

Parameters:

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

rangeEliminated | ( | self, |
|  | KTextEditor.SmartRange | range
| ) |  |  |

The range now contains no characters (ie. the start and end cursors are the same).

Parameters:

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

rangePositionChanged | ( | self, |
|  | KTextEditor.SmartRange | range
| ) |  |  |

The range's position changed.

Parameters:

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

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

Set whether this watcher should be notified of changes that happen directly to the range, e.g. by calls to SmartCursor.setRange(), or by direct assignment to either of the start() or end() cursors, 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 will be notified of changes that happen directly to the range, e.g. by calls to SmartCursor.setRange(), or by direct assignment to either of the start() or end() cursors, rather than just when surrounding text changes.