KTextEditor::TextHintInterface

KTextEditor::TextHintInterface Class Referenceabstract

Inherited by KTextEditor::ViewPrivate.

Public Member Functions

virtual void registerTextHintProvider (KTextEditor::TextHintProvider *provider)=0
 
virtual void setTextHintDelay (int delay)=0
 
virtual int textHintDelay () const =0
 
virtual void unregisterTextHintProvider (KTextEditor::TextHintProvider *provider)=0
 

Detailed Description

Text hint interface showing tool tips under the mouse for the View.

Introduction

The text hint interface provides a way to show tool tips for text located under the mouse. Possible applications include showing a value of a variable when debugging an application, or showing a complete path of an include directive.

texthint.png
Text hint showing the contents of a variable

To register as text hint provider, call registerTextHintProvider() with an instance that inherits TextHintProvider. Finally, make sure you remove your text hint provider by calling unregisterTextHintProvider().

Text hints are shown after the user hovers with the mouse for a delay of textHintDelay() milliseconds over the same word. To change the delay, call setTextHintDelay().

Accessing the TextHintInterface

The TextHintInterface 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::TextHintInterface*>(view);
if (iface) {
// the implementation supports the interface
// myProvider inherits KTextEditor::TextHintProvider
iface->registerTextHintProvider(myProvider);
} else {
// the implementation does not support the interface
}
See also
TextHintProvider
Since
4.11

Definition at line 81 of file texthintinterface.h.

Member Function Documentation

virtual void KTextEditor::TextHintInterface::registerTextHintProvider ( KTextEditor::TextHintProvider provider)
pure virtual

Register the text hint provider provider.

Whenever the user hovers over text, provider will be asked for a text hint. When the provider is about to be destroyed, make sure to call unregisterTextHintProvider() to avoid a dangling pointer.

Parameters
providertext hint provider
See also
unregisterTextHintProvider(), TextHintProvider
virtual void KTextEditor::TextHintInterface::setTextHintDelay ( int  delay)
pure virtual

Set the text hint delay to delay milliseconds.

The delay specifies the time the user needs to hover over the text before the tool tip is shown. Therefore, delay should not be too large, a value of 500 milliseconds is recommended and set by default.

If delay is <= 0, the default delay will be set.

Parameters
delaytool tip delay in milliseconds
virtual int KTextEditor::TextHintInterface::textHintDelay ( ) const
pure virtual

Get the text hint delay in milliseconds.

By default, the text hint delay is set to 500 milliseconds. It can be changed by calling setTextHintDelay().

virtual void KTextEditor::TextHintInterface::unregisterTextHintProvider ( KTextEditor::TextHintProvider provider)
pure virtual

Unregister the text hint provider provider.

Parameters
providertext hint provider to unregister
See also
registerTextHintProvider(), TextHintProvider

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.