KTextEditor

inlinenote.h
1/*
2 SPDX-FileCopyrightText: 2018 Sven Brauch <mail@svenbrauch.de>
3 SPDX-FileCopyrightText: 2018 Michal Srb <michalsrb@gmail.com>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef KTEXTEDITOR_INLINENOTE_H
9#define KTEXTEDITOR_INLINENOTE_H
10
11#include <ktexteditor/cursor.h>
12#include <ktexteditor/view.h>
13
14class QFont;
16namespace KTextEditor
17{
19}
20
21namespace KTextEditor
22{
23/**
24 * @class InlineNote inlinenote.h <KTextEditor/InlineNote>
25 *
26 * Describes an inline note.
27 *
28 * This class contains all the information required to deal with a particular
29 * inline note. It is instantiated and populated with information internally by
30 * KTextEditor based on the list of notes returned by InlineNoteProvider::inlineNotes(),
31 * and then passed back to the user of the API.
32 *
33 * @note Users of the InlineNoteInterface API should never create a InlineNote
34 * themselves. Maybe it helps to think of a InlineNote as if it were a
35 * QModelIndex. Only the internal KTextEditor implementation creates them.
36 *
37 * @since 5.50
38 */
39class KTEXTEDITOR_EXPORT InlineNote
40{
41public:
42 /**
43 * Constructs an inline note. User code never calls this constructor,
44 * since notes are created internally only from the columns returned by
45 * InlineNoteProvider::inlineNotes(), and then passed around as handles
46 * grouping useful information.
47 */
48 InlineNote(const KateInlineNoteData &data);
49
50 /**
51 * Returns the width of this note in pixels.
52 */
53 qreal width() const;
54
55 /**
56 * The provider which created this note
57 */
59
60 /**
61 * The View this note is shown in.
62 */
63 const KTextEditor::View *view() const;
64
65 /**
66 * The cursor position of this note.
67 */
69
70 /**
71 * The index of this note, i.e. its index in the vector returned by
72 * the provider for a given line
73 */
74 int index() const;
75
76 /**
77 * Returns whether the mouse cursor is currently over this note.
78 * @note This flag is useful when in InlineNoteProvider::paintInlineNote().
79 */
80 bool underMouse() const;
81
82 /**
83 * The font of the text surrounding this note.
84 * This can be used to obtain the QFontMetrics or similar font information.
85 */
86 QFont font() const;
87
88 /**
89 * The height of the line containing this note
90 */
91 int lineHeight() const;
92
93private:
94 // Internal implementation data structure.
95 const KateInlineNoteData &d;
96};
97
98}
99
100#endif
The Cursor represents a position in a Document.
Definition cursor.h:75
A source of inline notes for a document.
qreal width() const
Returns the width of this note in pixels.
InlineNoteProvider * provider() const
The provider which created this note.
KTextEditor::Cursor position() const
The cursor position of this note.
int index() const
The index of this note, i.e.
bool underMouse() const
Returns whether the mouse cursor is currently over this note.
QFont font() const
The font of the text surrounding this note.
int lineHeight() const
The height of the line containing this note.
InlineNote(const KateInlineNoteData &data)
Constructs an inline note.
const KTextEditor::View * view() const
The View this note is shown in.
A text widget with KXMLGUIClient that represents a Document.
Definition view.h:244
Internal data container for KTextEditor::InlineNote interface.
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-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:55:24 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.