Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qtextcursor_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef TEXTCURSOR_H
6#define TEXTCURSOR_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/qstring.h>
20
21QT_BEGIN_NAMESPACE
22
23namespace Utils {
24
25class TextDocument;
26class TextBlock;
27
29{
30public:
38
40
42
44 TextCursor(const TextBlock &block);
45 TextCursor(TextDocument *document);
46
47 bool movePosition(MoveOperation op, MoveMode = MoveAnchor, int n = 1);
48 int position() const;
49 void setPosition(int pos, MoveMode mode = MoveAnchor);
50 QString selectedText() const;
51 void clearSelection();
52 int anchor() const;
53 TextDocument *document() const;
54 void insertText(const QString &text);
55 TextBlock block() const;
56 int positionInBlock() const;
57 int blockNumber() const;
58
59 void select(SelectionType selection);
60
61 bool hasSelection() const;
62
63 void removeSelectedText();
64 int selectionEnd() const;
65
66 bool isNull() const;
67
68private:
69 TextDocument *m_document = nullptr;
70 int m_position = 0;
71 int m_anchor = 0;
72};
73} // namespace Utils
74
75QT_END_NAMESPACE
76
77#endif // TEXTCURSOR_H
TextBlock next() const
int length() const
bool isValid() const
int position() const
int blockNumber() const
int selectionEnd() const
bool movePosition(MoveOperation op, MoveMode=MoveAnchor, int n=1)
TextCursor(TextDocument *document)
int blockNumber() const
bool hasSelection() const
int positionInBlock() const
TextBlock block() const
TextCursor(const TextBlock &block)
int anchor() const
void insertText(const QString &text)
int position() const
TextDocument * document() const
QString selectedText() const
void setPosition(int pos, MoveMode mode=MoveAnchor)
void select(SelectionType selection)
bool isNull() const
TextBlock firstBlock() const
int characterCount() const