• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

KTextEditor

  • KTextEditor
  • TextHintInterface
Public Member Functions | List of all members
KTextEditor::TextHintInterface Class Referenceabstract
View Extension Interfaces

#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:

// view is of type KTextEditor::View*
KTextEditor::TextHintInterface *iface =
qobject_cast<KTextEditor::TextHintInterface*>( view );
if( iface ) {
// the implementation supports the interface
// do stuff
}
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.

TextHintInterface::~TextHintInterface ( )
virtual

Definition at line 278 of file ktexteditor.cpp.

Member Function Documentation

virtual void KTextEditor::TextHintInterface::disableTextHints ( )
pure virtual

Disable all text hints for the view.

By default, text hints are disabled.

virtual void KTextEditor::TextHintInterface::enableTextHints ( int  timeout)
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
timeouttool tip delay in milliseconds
Todo:
KDE5 add default value for timeout
virtual void KTextEditor::TextHintInterface::needTextHint ( const KTextEditor::Cursor &  position,
QString &  text 
)
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
positiontext cursor under the mouse position
texttool 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:
  • texthintinterface.h
  • ktexteditor.cpp
This file is part of the KDE documentation.
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.

KTextEditor

Skip menu "KTextEditor"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal