KTextEditor::InlineNoteInterface

KTextEditor::InlineNoteInterface Class Referenceabstract

#include <KTextEditor/InlineNoteInterface>

Inherited by KTextEditor::ViewPrivate.

Public Member Functions

virtual void registerInlineNoteProvider (KTextEditor::InlineNoteProvider *provider)=0
 
virtual void unregisterInlineNoteProvider (KTextEditor::InlineNoteProvider *provider)=0
 

Detailed Description

Inline notes interface for rendering notes in the text.

Introduction

The inline notes interface provides a way to render arbitrary things in the text. The text layout of the line is adapted to create space for the note. Possible applications include showing a name of a function parameter in a function call or rendering a square with a color preview next to CSS color property.

inlinenote.png
Inline note showing a CSS color preview

To register as inline note provider, call registerInlineNoteProvider() with an instance that inherits InlineNoteProvider. Finally, make sure you remove your inline note provider by calling unregisterInlineNoteProvider().

Accessing the InlineNoteInterface

The InlineNoteInterface is an extension interface for a View, i.e. the View inherits the interface. Use qobject_cast to access the interface:

// view is of type KTextEditor::View*
auto iface = qobject_cast<KTextEditor::InlineNoteInterface*>(view);
if (iface) {
// the implementation supports the interface
// myProvider inherits KTextEditor::InlineNoteProvider
iface->registerInlineNoteProvider(myProvider);
} else {
// the implementation does not support the interface
}
See also
InlineNoteProvider
InlineNote
Author
Sven Brauch, Michal Srb
Since
5.50

Definition at line 83 of file inlinenoteinterface.h.

Member Function Documentation

virtual void KTextEditor::InlineNoteInterface::registerInlineNoteProvider ( KTextEditor::InlineNoteProvider provider)
pure virtual

Register the inline note provider provider.

Whenever a line is painted, the provider will be queried for notes that should be painted in it. When the provider is about to be destroyed, make sure to call unregisterInlineNoteProvider() to avoid a dangling pointer.

Parameters
providerinline note provider
See also
unregisterInlineNoteProvider(), InlineNoteProvider
virtual void KTextEditor::InlineNoteInterface::unregisterInlineNoteProvider ( KTextEditor::InlineNoteProvider provider)
pure virtual

Unregister the inline note provider provider.

Parameters
providerinline note provider to unregister
See also
registerInlineNoteProvider(), InlineNoteProvider

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Jul 14 2020 22:57:48 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.