QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
textrenderer
qgstextblockformat.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgstextblockformat.h
3
-----------------
4
begin : September 2024
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 QGSTEXTBLOCKFORMAT_H
17
#define QGSTEXTBLOCKFORMAT_H
18
19
#include "
qgis.h
"
20
#include "qgis_core.h"
21
#include "
qgis_sip.h
"
22
#include "
qgsmargins.h
"
23
24
#include <QBrush>
25
#include <QColor>
26
#include <QFont>
27
28
class
QTextBlockFormat;
29
class
QgsRenderContext
;
30
43
class
CORE_EXPORT
QgsTextBlockFormat
44
{
45
public
:
46
QgsTextBlockFormat
() =
default
;
47
51
QgsTextBlockFormat
(
const
QTextBlockFormat &format );
52
54
enum class
BooleanValue
55
{
56
NotSet,
57
SetTrue,
58
SetFalse,
59
};
60
72
void
overrideWith(
const
QgsTextBlockFormat
&other );
73
82
bool
hasHorizontalAlignmentSet
()
const
{
return
mHasHorizontalAlignSet; }
83
92
void
setHasHorizontalAlignmentSet
(
bool
set ) { mHasHorizontalAlignSet = set; }
93
102
Qgis::TextHorizontalAlignment
horizontalAlignment
()
const
{
return
mHorizontalAlign; }
103
112
void
setHorizontalAlignment
(
Qgis::TextHorizontalAlignment
alignment ) { mHorizontalAlign = alignment; }
113
125
double
lineHeight()
const
;
126
140
void
setLineHeight(
double
height );
141
152
double
lineHeightPercentage()
const
;
153
166
void
setLineHeightPercentage(
double
height );
167
174
QgsMargins
margins
()
const
{
return
mMargins; }
175
182
void
setMargins
(
const
QgsMargins
&
margins
) { mMargins =
margins
; }
183
190
bool
hasBackground()
const
;
191
201
QBrush backgroundBrush()
const
;
202
211
void
setBackgroundBrush(
const
QBrush &brush );
212
222
QString backgroundImagePath()
const
;
223
232
void
setBackgroundImagePath(
const
QString &path );
233
243
void
updateFontForFormat( QFont &font,
const
QgsRenderContext
&context,
double
scaleFactor = 1.0 )
const
;
244
245
private
:
246
QBrush mBackgroundBrush;
247
QString mBackgroundPath;
248
249
double
mLineHeight = std::numeric_limits< double >::quiet_NaN();
250
double
mLineHeightPercentage = std::numeric_limits< double >::quiet_NaN();
251
252
bool
mHasHorizontalAlignSet =
false
;
253
Qgis::TextHorizontalAlignment
mHorizontalAlign =
Qgis::TextHorizontalAlignment::Left
;
254
255
QgsMargins
mMargins { std::numeric_limits< double >::quiet_NaN(), std::numeric_limits< double >::quiet_NaN(), std::numeric_limits< double >::quiet_NaN(), std::numeric_limits< double >::quiet_NaN() };
256
};
257
258
#endif
// QGSTEXTBLOCKFORMAT_H
Qgis::TextHorizontalAlignment
TextHorizontalAlignment
Text horizontal alignment.
Definition
qgis.h:3167
Qgis::TextHorizontalAlignment::Left
@ Left
Left align.
Definition
qgis.h:3168
QgsMargins
Defines the four margins of a rectangle.
Definition
qgsmargins.h:40
QgsRenderContext
Contains information about the context of a rendering operation.
Definition
qgsrendercontext.h:63
QgsTextBlockFormat
Stores information relating to individual block formatting.
Definition
qgstextblockformat.h:44
QgsTextBlockFormat::horizontalAlignment
Qgis::TextHorizontalAlignment horizontalAlignment() const
Returns the format horizontal alignment.
Definition
qgstextblockformat.h:102
QgsTextBlockFormat::setHasHorizontalAlignmentSet
void setHasHorizontalAlignmentSet(bool set)
Sets whether the format has an explicit horizontal alignment set.
Definition
qgstextblockformat.h:92
QgsTextBlockFormat::setHorizontalAlignment
void setHorizontalAlignment(Qgis::TextHorizontalAlignment alignment)
Sets the format horizontal alignment.
Definition
qgstextblockformat.h:112
QgsTextBlockFormat::setMargins
void setMargins(const QgsMargins &margins)
Sets the block margins, in points.
Definition
qgstextblockformat.h:182
QgsTextBlockFormat::hasHorizontalAlignmentSet
bool hasHorizontalAlignmentSet() const
Returns true if the format has an explicit horizontal alignment set.
Definition
qgstextblockformat.h:82
QgsTextBlockFormat::BooleanValue
BooleanValue
Status values for boolean format properties.
Definition
qgstextblockformat.h:55
QgsTextBlockFormat::margins
QgsMargins margins() const
Returns the block margins, in points.
Definition
qgstextblockformat.h:174
QgsTextBlockFormat::QgsTextBlockFormat
QgsTextBlockFormat()=default
qgis.h
qgis_sip.h
qgsmargins.h
Generated on
for QGIS API Documentation by
1.17.0