KTextEditor

texthintinterface.h
1/*
2 SPDX-FileCopyrightText: 2001 Joseph Wenninger <jowenn@kde.org>
3 SPDX-FileCopyrightText: 2013-2014 Dominik Haumann <dhaumann@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KTEXTEDITOR_TEXTHINTINTERFACE_H
9#define KTEXTEDITOR_TEXTHINTINTERFACE_H
10
11#include <QString>
12
13#include <ktexteditor_export.h>
14
15#include <ktexteditor/cursor.h>
16
17namespace KTextEditor
18{
19class TextHintProvider;
20class View;
21
22/**
23 * \brief Class to provide text hints for a View.
24 *
25 * The class TextHintProvider is used in combination with TextHintInterface.
26 * TextHintProvider allows to provide text hint information for text under
27 * the mouse cursor.
28 *
29 * To use this class, derive your provider from TextHintProvider and register
30 * it with TextHintInterface::registerTextHintProvider(). When not needed
31 * anymore, make sure to remove your provider by calling
32 * TextHintInterface::unregisterTextHintProvider(), otherwise the View will
33 * contain a dangling pointer to your potentially deleted provider.
34 *
35 * Detailed information about how to use the TextHintInterface can be found
36 * in the documentation about the TextHintInterface.
37 *
38 * \see TextHintInterface
39 * \p since 5.0
40 */
41class KTEXTEDITOR_EXPORT TextHintProvider
42{
43public:
44 /**
45 * Default constructor.
46 */
48
49 /**
50 * Virtual destructor to allow inheritance.
51 */
53
54 /**
55 * This function is called whenever the users hovers over text such
56 * that the text hint delay passes. Then, textHint() is called
57 * for each registered TextHintProvider.
58 *
59 * Return the text hint (possibly Qt richtext) for @p view at @p position.
60 *
61 * If you do not have any contents to show, just return an empty QString().
62 *
63 * \param view the view that requests the text hint
64 * \param position text cursor under the mouse position
65 * \return text tool tip to be displayed, may be Qt richtext
66 */
67 virtual QString textHint(KTextEditor::View *view, const KTextEditor::Cursor &position) = 0;
68
69private:
70 class TextHintProviderPrivate *const d = nullptr;
71};
72
73}
74
75#endif
The Cursor represents a position in a Document.
Definition cursor.h:75
Class to provide text hints for a View.
TextHintProvider()
Default constructor.
virtual QString textHint(KTextEditor::View *view, const KTextEditor::Cursor &position)=0
This function is called whenever the users hovers over text such that the text hint delay passes.
virtual ~TextHintProvider()
Virtual destructor to allow inheritance.
A text widget with KXMLGUIClient that represents a Document.
Definition view.h:244
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:56 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.