class KTextEditor.MarkInterface


abstract class

Table of contents
Modules
ktexteditor Classes
All Classes
Module ktexteditor
Namespace ktexteditor
Class KTextEditor.MarkInterface
Inherits

The line that contains the mark. The mark types in the line, combined with logical OR. Mark extension interface for the Document.

Introduction

The MarkInterface provides methods to enable and disable marks in a Document, a marked line can be visualized for example with a shaded background color and/or a pixmap in the iconborder of the Document's View. There are a number of predefined mark types, specified in reservedMarkersCount(). Additionally it is possible to add custom marks and set custom pixmaps.

Accessing the Interface

The MarkInterface is supposed to be an extension interface for a Document, i.e. the Document inherits the interface provided that the KTextEditor library in use implements the interface. Use qobject_cast to access the interface:

// doc is of type KTextEditor.Document*
KTextEditor.MarkInterface *iface =
qobject_cast( doc );

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

Handling Marks

Get all marks in the document by calling marks(). Use clearMarks() to remove all marks in the entire document. A single mark can be retrieved with mark(). To remove all marks from a line call clearMark(). To add and remove marks from a given line use addMark() and removeMark(). It is also possible to replace all marks with setMark(), i.e. setMark() is the same as a call of clearMark() followed by addMark(). The signals marksChanged() and markChanged() are emitted whenever a line's marks changed.

\attention A mark type is represented as an uint. An uint can have several mark types combined (see above: logical OR). That means for all functions/signals with an uint parameter, e.g. setMark(), removeMark(), etc, the uint may contain multiple marks, i.e. you can add and remove multiple marks simultaneously.

User Defined Marks

All marks that should be editable by the user can be specified with a mark mask via setEditableMarks(). To set a description and pixmap of a mark type call setMarkDescription() and setMarkPixmap().

See also KTextEditor.Document, KTextEditor.Mark Author Christoph Cullmann \



enums

enum details

methods