QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
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_sip.h"
20#include "qgis_core.h"
21
22#include <QFont>
23#include <QColor>
24
25class QTextCharFormat;
27
40class CORE_EXPORT QgsTextCharacterFormat
41{
42 public:
43
48
52 QgsTextCharacterFormat( const QTextCharFormat &format );
53
55 enum class BooleanValue
56 {
57 NotSet,
58 SetTrue,
59 SetFalse,
60 };
61
68 QColor textColor() const;
69
78 void setTextColor( const QColor &textColor );
79
87 double fontPointSize() const;
88
98 void setFontPointSize( double size );
99
107 QString family() const;
108
117 void setFamily( const QString &family );
118
126 int fontWeight() const;
127
137 void setFontWeight( int fontWeight );
138
145 BooleanValue italic() const;
146
153 void setItalic( BooleanValue enabled );
154
160 BooleanValue strikeOut() const;
161
167 void setStrikeOut( BooleanValue enabled );
168
174 BooleanValue underline() const;
175
181 void setUnderline( BooleanValue enabled );
182
188 BooleanValue overline() const;
189
195 void setOverline( BooleanValue enabled );
196
206 void updateFontForFormat( QFont &font, const QgsRenderContext &context, double scaleFactor = 1.0 ) const;
207
208 private:
209
210 QColor mTextColor;
211 int mFontWeight = -1;
212 QString mStyleName;
213 BooleanValue mItalic = BooleanValue::NotSet;
214 double mFontPointSize = -1;
215 QString mFontFamily;
216 BooleanValue mStrikethrough = BooleanValue::NotSet;
217 BooleanValue mUnderline = BooleanValue::NotSet;
218 BooleanValue mOverline = BooleanValue::NotSet;
219};
220
221#endif // QGSTEXTCHARACTERFORMAT_H
Contains information about the context of a rendering operation.
Stores information relating to individual character formatting.
QgsTextCharacterFormat()=default
Constructor for QgsTextCharacterFormat.
BooleanValue
Status values for boolean format properties.