Search for usage in LXR

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.


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.

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
} else {
// the implementation does not support the interface
See also

Definition at line 67 of file texthintinterface.h.

Member Function Documentation

◆ registerTextHintProvider()

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.

providertext hint provider
See also
unregisterTextHintProvider(), TextHintProvider

◆ setTextHintDelay()

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.

delaytool tip delay in milliseconds

◆ textHintDelay()

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().

◆ unregisterTextHintProvider()

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

Unregister the text hint provider provider.

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-2023 The KDE developers.
Generated on Wed Sep 27 2023 03:48:57 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.