QGIS API Documentation
4.3.0-Master (1c7cf7431bd)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
textrenderer
qgstextcharacterformat.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgstextcharacterformat.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 QGSTEXTCHARACTERFORMAT_H
17
#define QGSTEXTCHARACTERFORMAT_H
18
19
#include "
qgis.h
"
20
#include "qgis_core.h"
21
#include "
qgis_sip.h
"
22
23
#include <QBrush>
24
#include <QColor>
25
#include <QFont>
26
#include <QSizeF>
27
28
class
QTextCharFormat;
29
class
QgsRenderContext
;
30
43
class
CORE_EXPORT
QgsTextCharacterFormat
44
{
45
public
:
46
QgsTextCharacterFormat
() =
default
;
47
51
QgsTextCharacterFormat
(
const
QTextCharFormat &format );
52
54
enum class
BooleanValue
55
{
56
NotSet,
57
SetTrue,
58
SetFalse,
59
};
60
74
void
overrideWith(
const
QgsTextCharacterFormat
&other );
75
82
QColor textColor()
const
;
83
92
void
setTextColor(
const
QColor &textColor );
93
104
double
fontPointSize()
const
;
105
118
void
setFontPointSize(
double
size );
119
129
double
fontPercentageSize()
const
;
130
142
void
setFontPercentageSize(
double
size );
143
151
QString family()
const
;
152
161
void
setFamily(
const
QString &family );
162
170
int
fontWeight()
const
;
171
181
void
setFontWeight(
int
fontWeight );
182
189
double
wordSpacing()
const
;
190
197
void
setWordSpacing(
double
spacing );
198
205
BooleanValue italic()
const
;
206
213
void
setItalic( BooleanValue enabled );
214
220
BooleanValue strikeOut()
const
;
221
227
void
setStrikeOut( BooleanValue enabled );
228
234
BooleanValue underline()
const
;
235
241
void
setUnderline( BooleanValue enabled );
242
248
BooleanValue overline()
const
;
249
255
void
setOverline( BooleanValue enabled );
256
266
QString imagePath()
const
;
267
277
void
setImagePath(
const
QString &path );
278
290
QSizeF imageSize()
const
;
291
303
void
setImageSize(
const
QSizeF &size );
304
315
bool
hasVerticalAlignmentSet
()
const
{
return
mHasVerticalAlignSet; }
316
327
void
setHasVerticalAlignmentSet
(
bool
set ) { mHasVerticalAlignSet = set; }
328
339
Qgis::TextCharacterVerticalAlignment
verticalAlignment
()
const
{
return
mVerticalAlign; }
340
351
void
setVerticalAlignment
(
Qgis::TextCharacterVerticalAlignment
alignment ) { mVerticalAlign = alignment; }
352
359
bool
hasBackground()
const
;
360
370
QBrush backgroundBrush()
const
;
371
380
void
setBackgroundBrush(
const
QBrush &brush );
381
391
QString backgroundImagePath()
const
;
392
401
void
setBackgroundImagePath(
const
QString &path );
402
412
void
updateFontForFormat( QFont &font,
const
QgsRenderContext
&context,
double
scaleFactor = 1.0 )
const
;
413
414
private
:
415
QColor mTextColor;
416
int
mFontWeight = -1;
417
QString mStyleName;
418
BooleanValue mItalic = BooleanValue::NotSet;
419
double
mFontPointSize = -1;
420
double
mFontPercentageSize = -1;
421
QString mFontFamily;
422
double
mWordSpacing = std::numeric_limits< double >::quiet_NaN();
423
424
bool
mHasVerticalAlignSet =
false
;
425
Qgis::TextCharacterVerticalAlignment
mVerticalAlign =
Qgis::TextCharacterVerticalAlignment::Normal
;
426
427
QString mImagePath;
428
QSizeF mImageSize;
429
430
BooleanValue mStrikethrough = BooleanValue::NotSet;
431
BooleanValue mUnderline = BooleanValue::NotSet;
432
BooleanValue mOverline = BooleanValue::NotSet;
433
434
QBrush mBackgroundBrush;
435
QString mBackgroundPath;
436
};
437
438
#endif
// QGSTEXTCHARACTERFORMAT_H
Qgis::TextCharacterVerticalAlignment
TextCharacterVerticalAlignment
Text vertical alignment for characters.
Definition
qgis.h:3202
Qgis::TextCharacterVerticalAlignment::Normal
@ Normal
Adjacent characters are positioned in the standard way for text in the writing system in use.
Definition
qgis.h:3203
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
QgsTextCharacterFormat::QgsTextCharacterFormat
QgsTextCharacterFormat()=default
QgsTextCharacterFormat::setVerticalAlignment
void setVerticalAlignment(Qgis::TextCharacterVerticalAlignment alignment)
Sets the format vertical alignment.
Definition
qgstextcharacterformat.h:351
QgsTextCharacterFormat::BooleanValue
BooleanValue
Status values for boolean format properties.
Definition
qgstextcharacterformat.h:55
QgsTextCharacterFormat::verticalAlignment
Qgis::TextCharacterVerticalAlignment verticalAlignment() const
Returns the format vertical alignment.
Definition
qgstextcharacterformat.h:339
QgsTextCharacterFormat::hasVerticalAlignmentSet
bool hasVerticalAlignmentSet() const
Returns true if the format has an explicit vertical alignment set.
Definition
qgstextcharacterformat.h:315
QgsTextCharacterFormat::setHasVerticalAlignmentSet
void setHasVerticalAlignmentSet(bool set)
Sets whether the format has an explicit vertical alignment set.
Definition
qgstextcharacterformat.h:327
qgis.h
qgis_sip.h
Generated on
for QGIS API Documentation by
1.17.0