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
qtextblock.cpp
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#include "qtextblock_p.h"
7
8#include <QtCore/qstring.h>
9
11
12namespace Utils {
13
14bool TextBlock::isValid() const
15{
16 return m_document;
17}
18
19void TextBlock::setBlockNumber(int blockNumber)
20{
21 m_blockNumber = blockNumber;
22}
23
25{
26 return m_blockNumber;
27}
28
29void TextBlock::setPosition(int position)
30{
31 m_position = position;
32}
33
34int TextBlock::position() const
35{
36 return m_position;
37}
38
39void TextBlock::setLength(int length)
40{
41 m_length = length;
42}
43
44int TextBlock::length() const
45{
46 return m_length;
47}
48
50{
51 return m_document->findBlockByNumber(m_blockNumber + 1);
52}
53
55{
56 return m_document->findBlockByNumber(m_blockNumber - 1);
57}
58
59int TextBlock::userState() const
60{
61 return m_document->userState(m_blockNumber);
62}
63
64void TextBlock::setUserState(int state)
65{
66 m_document->setUserState(m_blockNumber, state);
67}
68
70{
71 m_document = document;
72}
73
75{
76 return m_document;
77}
78
80{
81 return document()->toPlainText().mid(position(), length());
82}
83
84int TextBlock::revision() const
85{
86 return m_revision;
87}
88
89void TextBlock::setRevision(int rev)
90{
91 m_revision = rev;
92}
93
94bool operator==(const TextBlock &t1, const TextBlock &t2)
95{
97}
98
99bool operator!=(const TextBlock &t1, const TextBlock &t2)
100{
101 return !(t1 == t2);
102}
103
104} // namespace Utils
105
106QT_END_NAMESPACE
TextBlock next() const
int userState() const
int length() const
void setLength(int length)
void setRevision(int rev)
void setDocument(TextDocument *document)
bool isValid() const
TextDocument * document() const
int revision() const
int position() const
void setUserState(int state)
void setPosition(int position)
int blockNumber() const
void setBlockNumber(int blockNumber)
TextBlock previous() const
QString text() const
void setUserState(int blockNumber, int state)
int userState(int blockNumber) const
TextBlock findBlockByNumber(int blockNumber) const
bool operator!=(const TextBlock &t1, const TextBlock &t2)
bool operator==(const TextBlock &t1, const TextBlock &t2)