HAL
python_qss_adapter.cpp
Go to the documentation of this file.
2 
3 #include <QDebug>
4 #include <QStyle>
5 namespace hal
6 {
8  {
9  repolish();
10  hide();
11  }
12 
14  {
15  qDebug() << "python qss adapter killed"; // DEBUG CODE, DELETE LATER
16  }
17 
19  {
20  QStyle* s = style();
21 
22  s->unpolish(this);
23  s->polish(this);
24 
25  mKeywordFormat.setForeground(mKeywordColor);
27 
28  mOperatorFormat.setForeground(mOperatorColor);
30 
31  mBraceFormat.setForeground(mBraceColor);
33 
34  mDefclassFormat.setForeground(mDefclassColor);
36 
37  mSelfFormat.setForeground(mSelfColor);
39 
40  mNumberFormat.setForeground(mNumberColor);
42 
43  mSingleQuotedStringFormat.setForeground(mSingleQuotedStringColor);
45 
46  mDoubleQuotedStringFormat.setForeground(mDoubleQuotedStringColor);
48 
49  mCommentFormat.setForeground(mCommentColor);
51  }
52 
54  {
55  // CLEANUP NECESSARY ?
56  static PythonQssAdapter* instance = nullptr;
57 
58  if (!instance)
59  instance = new PythonQssAdapter();
60 
61  return instance;
62  }
63 
65  {
66  return mKeywordColor;
67  }
68 
70  {
71  return mOperatorColor;
72  }
73 
75  {
76  return mBraceColor;
77  }
78 
80  {
81  return mDefclassColor;
82  }
83 
85  {
86  return mSelfColor;
87  }
88 
90  {
91  return mNumberColor;
92  }
93 
95  {
96  return mSingleQuotedStringColor;
97  }
98 
100  {
101  return mDoubleQuotedStringColor;
102  }
103 
105  {
106  return mCommentColor;
107  }
108 
109  /*void PythonQssAdapter::setTextColor(const QColor& color)
110  {
111  mTextColor = color;
112  }*/
113 
115  {
116  mKeywordColor = color;
117  }
118 
120  {
121  mOperatorColor = color;
122  }
123 
125  {
126  mBraceColor = color;
127  }
128 
130  {
131  mDefclassColor = color;
132  }
133 
135  {
136  mSelfColor = color;
137  }
138 
140  {
141  mNumberColor = color;
142  }
143 
145  {
146  mSingleQuotedStringColor = color;
147  }
148 
150  {
151  mDoubleQuotedStringColor = color;
152  }
153 
155  {
156  mCommentColor = color;
157  }
158 }
QSS Adapter to provide the color configurations used by the PythonSyntaxHighlighter.
QTextCharFormat mDefclassFormat
void setDoubleQuotedStringColor(const QColor &color)
static PythonQssAdapter * instance()
void setNumberColor(const QColor &color)
void setCommentColor(const QColor &color)
void setKeywordColor(const QColor &color)
void setOperatorColor(const QColor &color)
void setBraceColor(const QColor &color)
QTextCharFormat mBraceFormat
QTextCharFormat mNumberFormat
void setSingleQuotedStringColor(const QColor &color)
QTextCharFormat mSingleQuotedStringFormat
QTextCharFormat mCommentFormat
void setDefclassColor(const QColor &color)
QTextCharFormat mDoubleQuotedStringFormat
QTextCharFormat mKeywordFormat
QTextCharFormat mOperatorFormat
void setSelfColor(const QColor &color)
PythonQssAdapter(QWidget *parent=nullptr)
QTextCharFormat mSelfFormat
virtual void polish(QWidget *widget)
virtual void unpolish(QWidget *widget)
void setFontItalic(bool italic)
void setForeground(const QBrush &brush)
void hide()
QStyle * style() const const