KDE 4.9 PyKDE API Reference

- KDE's Python API

# AnnotationViewInterface Class Reference

`from PyKDE4.ktexteditor import *`

Inherits: KTextEditor.AnnotationInterface
Namespace: KTextEditor

## Detailed Description

Annotation interface for the View

Introduction

The AnnotationViewInterface allows to do two things: - (1) show/hide the annotation border along with the possibility to add actions into its context menu. - (2) set a separate AnnotationModel for the View: Not that this interface inherits the AnnotationInterface.

For a more detailed explanation about whether you want an AnnotationModel in the Document or the View, read the detailed documentation about the AnnotationInterface.

Accessing the AnnotationViewInterface

The AnnotationViewInterface is an extension interface for a View, i.e. the View inherits the interface provided that the used KTextEditor library implements the interface. Use qobject_cast to access the interface:

     // view is of type KTextEditor.View*
     KTextEditor.AnnotationViewInterface *iface =
         qobject_cast<KTextEditor.AnnotationViewInterface*>( view );

     if( iface ) {
         // the implementation supports the interface
         // do stuff
         iface->setAnnotationBorderVisible( true );
     }

Since:
  4.1

## Methods

| annotationActivated (self, KTextEditor.View view, int line)
| annotationBorderVisibilityChanged (self, KTextEditor.View view, bool visible)
| annotationContextMenuAboutToShow (self, KTextEditor.View view, QMenu menu, int line)
bool | isAnnotationBorderVisible (self)
| setAnnotationBorderVisible (self, bool visible)

## Method Documentation

annotationActivated | ( | self, |
|  | KTextEditor.View | view,
|  | int | line
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

This signal is emitted when an entry on the annotation border was activated, for example by clicking or double-clicking it. This follows the KDE wide setting for activation via click or double-clcik

Parameters:

  | view | the view to which the activated border belongs to

Parameters:

  | line | the document line that the activated posistion belongs to

annotationBorderVisibilityChanged | ( | self, |
|  | KTextEditor.View | view,
|  | bool | visible
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

This signal is emitted when the annotation border is shown or hidden.

Parameters:

  | view | the view to which the border belongs to

Parameters:

  | visible | the current visibility state

annotationContextMenuAboutToShow | ( | self, |
|  | KTextEditor.View | view,
|  | QMenu | menu,
|  | int | line
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

This signal is emitted before a context menu is shown on the annotation border for the given line and view.

Note:
  Kate Part implementation detail: In Kate Part, the menu has an entry to hide the annotation border.

Parameters:

  | view | the view that the annotation border belongs to

Parameters:

  | menu | the context menu that will be shown

Parameters:

  | line | the annotated line for which the context menu is shown

bool isAnnotationBorderVisible | ( |  | self ) |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Checks whether the View's annotation border is visible.

setAnnotationBorderVisible | ( | self, |
|  | bool | visible
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

This function can be used to show or hide the annotation border The annotation border is hidden by default.

Parameters:

  | visible | if true the annotation border is shown, otherwise hidden