KTextEditor
#include <texthintinterface.h>
Public Member Functions | |
TextHintInterface () | |
virtual | ~TextHintInterface () |
virtual void | disableTextHints ()=0 |
virtual void | enableTextHints (int timeout)=0 |
virtual void | needTextHint (const KTextEditor::Cursor &position, QString &text)=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.
By default, the text hint interface is disable for the View. To enable it, call enableTextHints() with the desired timeout. The timeout specifies the delay the user needs to hover over the text before the tool tip is shown. Therefore, the timeout should not be too large, a value of 200 milliseconds is recommended.
Once text hints are enabled, the signal needTextHint() is emitted after the timeout whenever the mouse moved to a new text position in the View. Therefore, in order to show a tool tip, you need to connect to this signal and then fill the parameter text
with the text to display.
To disable all text hints, call disableTextHints(). This, however will disable the text hints entirely for the View. If there are multiple users of the TextHintInterface, this might lead to a conflict.
Accessing the TextHintInterface
The TextHintInterface 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:
- Since
- KDE 4.11
Definition at line 78 of file texthintinterface.h.
Constructor & Destructor Documentation
TextHintInterface::TextHintInterface | ( | ) |
Definition at line 274 of file ktexteditor.cpp.
|
virtual |
Definition at line 278 of file ktexteditor.cpp.
Member Function Documentation
|
pure virtual |
Disable all text hints for the view.
By default, text hints are disabled.
|
pure virtual |
Enable text hints with the specified timeout
in milliseconds.
The timeout specifies the delay the user needs to hover over the text befure the tool tip is shown. Therefore, timeout
should not be too large, a value of 200 milliseconds is recommended.
After enabling the text hints, the signal needTextHint() is emitted whenever the mouse position changed and a new character is underneath the mouse cursor. Calling the signal is delayed for the time specified by timeout
.
- Parameters
-
timeout tool tip delay in milliseconds
- Todo:
- KDE5 add default value for timeout
|
pure virtual |
This signal is emitted whenever the timeout for displaying a text hint is triggered.
The text cursor position
specifies the mouse position in the text. To show a text hint, fill text
with the text to be displayed. If you do not want a tool tip to be displayed, set text
to an empty QString() in the connected slot.
- Parameters
-
position text cursor under the mouse position text tool tip to be displayed, or empty string to hide
- Todo:
- KDE5: add first parameter "KTextEditor::View * view"
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:48 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.