KDE 4.9 PyKDE API Reference

- KDE's Python API

# CoordinatesToCursorInterface Class Reference

`from PyKDE4.ktexteditor import *`

Namespace: KTextEditor

## Detailed Description

Pixel coordinate to Cursor extension interface for the View.

Introduction

The CoordinatesToCursorInterface makes it possible to map a pixel coordinate to a cursor position. To map a cursor position to pixel coordinates use one of - KTextEditor.View.cursorToCoordinate() - KTextEditor.View.cursorPositionCoordinates()

Accessing the CoordinatesToCursorInterface

The CoordinatesToCursorInterface 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.CoordinatesToCursorInterface *iface =
         qobject_cast<KTextEditor.CoordinatesToCursorInterface*>( view );

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

See also:
  KTextEditor.View

Since:
  4.2

Note:
  KDE5: merge into KTextEditor.View

## Methods

KTextEditor.Cursor | coordinatesToCursor (self, QPoint coord)

## Method Documentation

KTextEditor.Cursor coordinatesToCursor | ( | self, |
|  | QPoint | coord
| ) |  |  |

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

Get the text-cursor in the document from the screen coordinates, relative to the view widget.

To map a cursor to pixel coordinates (the reverse transformation) use KTextEditor.View.cursorToCoordinate().

Parameters:

  | coord | coordinates relative to the view widget

Returns:
  cursor in the View, that points onto the character under the given coordinate. May be KTextEditor.Cursor.invalid().