KDE 4.9 PyKDE API Reference

- KDE's Python API

# SmartRangeNotifier Class Reference

`from PyKDE4.ktexteditor import *`

Inherits: QObject
Namespace: KTextEditor

## Detailed Description

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

This class provides notifications of changes to the position or contents of a SmartRange via QObject signals.

If you prefer to receive notifications via virtual inheritance, see SmartRangeWatcher.

\sa SmartRange, SmartRangeWatcher

Author:
  Hamish Rodda <rodda@kde.org>

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

## Signal Documentation

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

Signal syntax:
  `QObject.connect(source, SIGNAL("caretEnteredRange(KTextEditor::SmartRange*, KTextEditor::View*)"), target_slot)`

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

Signal syntax:
  `QObject.connect(source, SIGNAL("caretExitedRange(KTextEditor::SmartRange*, KTextEditor::View*)"), target_slot)`

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

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

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

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

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

Signal syntax:
  `QObject.connect(source, SIGNAL("mouseEnteredRange(KTextEditor::SmartRange*, KTextEditor::View*)"), target_slot)`

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

Signal syntax:
  `QObject.connect(source, SIGNAL("mouseExitedRange(KTextEditor::SmartRange*, KTextEditor::View*)"), target_slot)`

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

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

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

Signal syntax:
  `QObject.connect(source, SIGNAL("rangeAttributeChanged(KTextEditor::SmartRange*, KTextEditor::Attribute::Ptr, KTextEditor::Attribute::Ptr)"), target_slot)`

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

The contents of the range changed.

Warning:
  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 | pointer to the range which generated the notification.

Parameters:

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

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

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

The contents of the range changed.

Warning:
  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 | pointer to the range which generated the notification.

Parameters:

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

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

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

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

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

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

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

The range's position changed.

Parameters:

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

Signal syntax:
  `QObject.connect(source, SIGNAL("rangePositionChanged(KTextEditor::SmartRange*)"), 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 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 provide notifications for direct changes.

bool wantsDirectChanges | ( |  | self ) |

Returns whether this notifier will notify 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.