QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgscodeeditorcolorscheme.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscodeeditorcolorscheme.h
3  --------------------------------------
4  Date : October 2020
5  Copyright : (C) 2020 by 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 QGSCODEEDITORCOLORSCHEME_H
17 #define QGSCODEEDITORCOLORSCHEME_H
18 
19 #include "qgis_gui.h"
20 #include "qgis_sip.h"
21 #include <QString>
22 #include <QMap>
23 #include <QColor>
24 
30 class GUI_EXPORT QgsCodeEditorColorScheme
31 {
32  public:
33 
37  enum class ColorRole
38  {
39  Default,
40  Keyword,
41  Class,
42  Method,
43  Decoration,
44  Number,
45  Comment,
46  CommentLine,
47  CommentBlock,
48  Background,
49  Cursor,
50  CaretLine,
51  SingleQuote,
52  DoubleQuote,
53  TripleSingleQuote,
54  TripleDoubleQuote,
55  Operator,
56  QuotedOperator,
57  Identifier,
58  QuotedIdentifier,
59  Tag,
60  UnknownTag,
61  MarginBackground,
62  MarginForeground,
63  SelectionBackground,
64  SelectionForeground,
65  MatchedBraceBackground,
66  MatchedBraceForeground,
67  Edge,
68  Fold,
69  Error,
70  ErrorBackground,
71  FoldIconForeground,
72  FoldIconHalo,
73  IndentationGuide,
74  };
75 
83  QgsCodeEditorColorScheme( const QString &id = QString(), const QString &name = QString() );
84 
85 
89  QString id() const { return mId; }
90 
94  QString name() const { return mThemeName; }
95 
101  QColor color( ColorRole role ) const;
102 
108  void setColor( ColorRole role, const QColor &color );
109 
115  void setColors( const QMap< ColorRole, QColor > &colors ) SIP_SKIP;
116 
117  private:
118 
119  QString mId;
120  QString mThemeName;
121  QMap< ColorRole, QColor > mColors;
122 };
123 
124 #endif // QGSCODEEDITORCOLORSCHEME_H
QgsCodeEditorColorScheme
Defines a color scheme for use in QgsCodeEditor widgets.
Definition: qgscodeeditorcolorscheme.h:30
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
qgis_sip.h
QgsCodeEditorColorScheme::ColorRole
ColorRole
Color roles.
Definition: qgscodeeditorcolorscheme.h:50