QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
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
23
#include <QVector>
24
25
class
QgsTextBlock
;
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
84
const
QgsTextBlock
&at(
int
index )
const
SIP_FACTORY
;
85
#ifdef SIP_RUN
86
% MethodCode
87
if
( a0 < 0 || a0 >= sipCpp->size() )
88
{
89
PyErr_SetString( PyExc_KeyError, QByteArray::number( a0 ) );
90
sipIsErr = 1;
91
}
92
else
93
{
94
sipRes =
new
QgsTextBlock
( sipCpp->at( a0 ) );
95
}
96
% End
97
#endif
98
102
QgsTextBlock
&operator[](
int
index )
SIP_FACTORY
;
103
#ifdef SIP_RUN
104
% MethodCode
105
SIP_SSIZE_T idx = sipConvertFromSequenceIndex( a0, sipCpp->size() );
106
if
( idx < 0 )
107
sipIsErr = 1;
108
else
109
sipRes =
new
QgsTextBlock
( sipCpp->operator[]( idx ) );
110
% End
111
#endif
112
116
int
size()
const
;
117
118
#ifdef SIP_RUN
119
int
__len__()
const
;
120
% MethodCode
121
sipRes = sipCpp->size();
122
% End
123
#endif
124
128
QStringList toPlainText()
const
;
129
139
void
splitLines(
const
QString &wrapCharacter,
int
autoWrapLength = 0,
bool
useMaxLineLengthWhenAutoWrapping =
true
);
140
146
void
applyCapitalization(
QgsStringUtils::Capitalization
capitalization );
147
148
#ifndef SIP_RUN
149
QVector< QgsTextBlock >::const_iterator begin()
const
;
151
QVector< QgsTextBlock >::const_iterator end()
const
;
153
#endif
154
155
private
:
156
157
QVector< QgsTextBlock > mBlocks;
158
159
};
160
161
#endif // QGSTEXTDOCUMENT_H
qgsstringutils.h
QgsStringUtils::Capitalization
Capitalization
Capitalization options.
Definition:
qgsstringutils.h:189
QgsTextDocument::~QgsTextDocument
~QgsTextDocument()
SIP_FACTORY
#define SIP_FACTORY
Definition:
qgis_sip.h:76
SIP_SKIP
#define SIP_SKIP
Definition:
qgis_sip.h:126
QgsTextFragment
Stores a fragment of text along with formatting overrides to be used when rendering the fragment.
Definition:
qgstextfragment.h:36
QgsTextDocument::QgsTextDocument
QgsTextDocument()
qgis_sip.h
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
Generated on Sat Oct 24 2020 17:43:09 for QGIS API Documentation by
1.8.20