KDE 4.9 PyKDE API Reference

- KDE's Python API

# AnnotationInterface Class Reference

`from PyKDE4.ktexteditor import *`

Namespace: KTextEditor

## Detailed Description

A Document extension interface for handling Annotation%s

Introduction

The AnnotationInterface is designed to provide line annotation information for a document. This interface provides means to associate a document with a annotation model, which provides some annotation information for each line in the document.

Setting a model for a Document makes the model data available for all views. If you only want to provide annotations in exactly one view, you can use the AnnotationViewInterface directly. See the AnnotationViewInterface for further details. To summarize, the two use cases are - (1) show annotations in all views. This means you set an AnnotationModel with this interface, and then call setAnnotationBorderVisible() for each view. - (2) show annotations only in one view. This means to not use this interface. Instead, use the AnnotationViewInterface, which inherits this interface. This means you set a model for the specific View.

If you set a model to the Document and the View, the View's model has higher priority.

Accessing the AnnotationInterface

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

     // document is of type KTextEditor.Document*
     KTextEditor.AnnotationInterface *iface =
         qobject_cast<KTextEditor.AnnotationInterface*>( document );

     if( iface ) {
         // the implementation supports the interface
         // do stuff
     }

Using the AnnotationInterface

Since:
  4.1

See also:
  KTextEditor.AnnotationModel, KTextEditor.AnnotationViewInterface

## Methods
KTextEditor.AnnotationModel | annotationModel (self)
| setAnnotationModel (self, KTextEditor.AnnotationModel model)

## Method Documentation

KTextEditor.AnnotationModel annotationModel | ( |  | self ) |

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

returns the currently set AnnotationModel or 0 if there's none set

Returns:
  the current AnnotationModel

setAnnotationModel | ( | self, |
|  | KTextEditor.AnnotationModel | model
| ) |  |  |

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

Sets a new AnnotationModel for this document to provide annotation information for each line.

Parameters:

  | model | the new AnnotationModel