QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
textrenderer
qgstextfragment.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgstextfragment.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 QGSTEXTFRAGMENT_H
17
#define QGSTEXTFRAGMENT_H
18
19
#include "
qgis.h
"
20
#include "qgis_core.h"
21
#include "
qgis_sip.h
"
22
#include "
qgstextcharacterformat.h
"
23
24
class
QTextFragment;
25
41
class
CORE_EXPORT
QgsTextFragment
42
{
43
public
:
47
explicit
QgsTextFragment
(
const
QString &
text
= QString(),
const
QgsTextCharacterFormat
&format =
QgsTextCharacterFormat
() );
48
52
explicit
QgsTextFragment
(
const
QTextFragment &fragment );
53
59
QString
text
()
const
;
60
66
void
setText
(
const
QString &
text
);
67
73
bool
isTab
()
const
{
return
mText ==
'\t'
; }
74
81
bool
isWhitespace
()
const
{
return
isTab
() || mText.trimmed().isEmpty(); }
82
88
const
QgsTextCharacterFormat
&
characterFormat
()
const
{
return
mCharFormat; }
89
95
void
setCharacterFormat(
const
QgsTextCharacterFormat
&format );
96
102
bool
isImage()
const
;
103
116
double
horizontalAdvance(
const
QFont &font,
const
QgsRenderContext
&context,
bool
fontHasBeenUpdatedForFragment =
false
,
double
scaleFactor = 1.0 )
const
;
117
123
void
applyCapitalization(
Qgis::Capitalization
capitalization );
124
125
private
:
126
QString mText;
127
bool
mIsImage =
false
;
128
QgsTextCharacterFormat
mCharFormat;
129
};
130
131
#endif
// QGSTEXTFRAGMENT_H
Qgis::Capitalization
Capitalization
String capitalization options.
Definition
qgis.h:3627
QgsRenderContext
Contains information about the context of a rendering operation.
Definition
qgsrendercontext.h:63
QgsTextCharacterFormat
Stores information relating to individual character formatting.
Definition
qgstextcharacterformat.h:44
QgsTextFragment::setText
void setText(const QString &text)
Sets the text content of the fragment.
Definition
qgstextfragment.cpp:43
QgsTextFragment::text
QString text() const
Returns the text content of the fragment.
Definition
qgstextfragment.cpp:38
QgsTextFragment::characterFormat
const QgsTextCharacterFormat & characterFormat() const
Returns the character formatting for the fragment.
Definition
qgstextfragment.h:88
QgsTextFragment::QgsTextFragment
QgsTextFragment(const QString &text=QString(), const QgsTextCharacterFormat &format=QgsTextCharacterFormat())
Constructor for QgsTextFragment, with the specified text and optional character format.
Definition
qgstextfragment.cpp:26
QgsTextFragment::isTab
bool isTab() const
Returns true if the fragment consists of just a tab character.
Definition
qgstextfragment.h:73
QgsTextFragment::isWhitespace
bool isWhitespace() const
Returns true if the fragment consists of just whitespace characters, and does not contain any content...
Definition
qgstextfragment.h:81
qgis.h
qgis_sip.h
qgstextcharacterformat.h
Generated on
for QGIS API Documentation by
1.17.0