QGIS API Documentation  3.21.0-Master (5b68dc587e)
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 
25 class QTextCharFormat;
26 
39 class CORE_EXPORT QgsTextCharacterFormat
40 {
41  public:
42 
47 
51  QgsTextCharacterFormat( const QTextCharFormat &format );
52 
54  enum class BooleanValue
55  {
56  NotSet,
57  SetTrue,
58  SetFalse,
59  };
60 
67  QColor textColor() const;
68 
77  void setTextColor( const QColor &textColor );
78 
79 #if 0
80 
87  int fontWeight() const;
88 
97  void setFontWeight( int fontWeight );
98 
104  BooleanValue italic() const;
105 
111  void setItalic( BooleanValue enabled );
112 #endif
113 
119  BooleanValue strikeOut() const;
120 
126  void setStrikeOut( BooleanValue enabled );
127 
133  BooleanValue underline() const;
134 
140  void setUnderline( BooleanValue enabled );
141 
147  BooleanValue overline() const;
148 
154  void setOverline( BooleanValue enabled );
155 
165  void updateFontForFormat( QFont &font, double scaleFactor = 1.0 ) const;
166 
167  private:
168 
169  QColor mTextColor;
170 
171 #if 0 // settings which affect font metrics are disabled for now
172  int mFontWeight = -1;
173  BooleanValue mItalic = BooleanValue::NotSet;
174  double mFontPointSize = -1;
175  QString mFontFamily;
176 #endif
177 
178  BooleanValue mStrikethrough = BooleanValue::NotSet;
179  BooleanValue mUnderline = BooleanValue::NotSet;
180  BooleanValue mOverline = BooleanValue::NotSet;
181 };
182 
183 #endif // QGSTEXTCHARACTERFORMAT_H
Stores information relating to individual character formatting.
QgsTextCharacterFormat()=default
Constructor for QgsTextCharacterFormat.
BooleanValue
Status values for boolean format properties.