QGIS API Documentation
3.20.0-Odense (decaadbb31)
src
core
textrenderer
qgstextdocument.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgstextdocument.h
3
-----------------
4
begin : May 2020
5
copyright : (C) Nyall Dawson
6
email : nyall dot dawson at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
16
#ifndef QGSTEXTDOCUMENT_H
17
#define QGSTEXTDOCUMENT_H
18
19
#include "
qgis_sip.h
"
20
#include "qgis_core.h"
21
#include "
qgsstringutils.h
"
22
#include "
qgstextblock.h
"
23
24
#include <QVector>
25
26
class
QgsTextFragment
;
27
38
class
CORE_EXPORT
QgsTextDocument
39
{
40
41
public
:
42
43
QgsTextDocument
();
44
~QgsTextDocument
();
45
49
explicit
QgsTextDocument
(
const
QgsTextBlock
&block );
50
54
explicit
QgsTextDocument
(
const
QgsTextFragment
&fragment );
55
59
static
QgsTextDocument
fromPlainText(
const
QStringList &lines );
60
64
static
QgsTextDocument
fromHtml(
const
QStringList &lines );
65
69
void
append(
const
QgsTextBlock
&block );
70
74
void
append(
QgsTextBlock
&&block )
SIP_SKIP
;
75
79
void
reserve(
int
count );
80
81
#ifndef SIP_RUN
82
86
const
QgsTextBlock
&at(
int
index )
const
SIP_FACTORY
;
87
#else
88
94
const
QgsTextBlock
&at(
int
index )
const
SIP_FACTORY
;
95
% MethodCode
96
if
( a0 < 0 || a0 >= sipCpp->size() )
97
{
98
PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
99
sipIsErr = 1;
100
}
101
else
102
{
103
sipRes =
new
QgsTextBlock
( sipCpp->at( a0 ) );
104
}
105
% End
106
#endif
107
111
QgsTextBlock
&operator[](
int
index )
SIP_FACTORY
;
112
#ifdef SIP_RUN
113
% MethodCode
114
SIP_SSIZE_T idx = sipConvertFromSequenceIndex( a0, sipCpp->size() );
115
if
( idx < 0 )
116
sipIsErr = 1;
117
else
118
sipRes =
new
QgsTextBlock
( sipCpp->operator[]( idx ) );
119
% End
120
#endif
121
125
int
size()
const
;
126
127
#ifdef SIP_RUN
128
int
__len__()
const
;
129
% MethodCode
130
sipRes = sipCpp->size();
131
% End
132
#endif
133
137
QStringList toPlainText()
const
;
138
148
void
splitLines(
const
QString &wrapCharacter,
int
autoWrapLength = 0,
bool
useMaxLineLengthWhenAutoWrapping =
true
);
149
155
void
applyCapitalization(
QgsStringUtils::Capitalization
capitalization );
156
157
#ifndef SIP_RUN
159
QVector< QgsTextBlock >::const_iterator begin()
const
;
160
QVector< QgsTextBlock >::const_iterator end()
const
;
162
#endif
163
164
private
:
165
166
QVector< QgsTextBlock > mBlocks;
167
168
};
169
170
#endif
// QGSTEXTDOCUMENT_H
QgsStringUtils::Capitalization
Capitalization
Capitalization options.
Definition:
qgsstringutils.h:189
QgsTextBlock
Represents a block of text consisting of one or more QgsTextFragment objects.
Definition:
qgstextblock.h:36
QgsTextDocument
Represents a document consisting of one or more QgsTextBlock objects.
Definition:
qgstextdocument.h:39
QgsTextDocument::QgsTextDocument
QgsTextDocument()
QgsTextDocument::~QgsTextDocument
~QgsTextDocument()
QgsTextFragment
Stores a fragment of text along with formatting overrides to be used when rendering the fragment.
Definition:
qgstextfragment.h:36
qgis_sip.h
SIP_SKIP
#define SIP_SKIP
Definition:
qgis_sip.h:126
SIP_FACTORY
#define SIP_FACTORY
Definition:
qgis_sip.h:76
qgsstringutils.h
qgstextblock.h
Generated on Sun Jun 20 2021 10:45:59 for QGIS API Documentation by
1.9.1