MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / updateStyle

Method updateStyle

lib/QCodeEditor/src/internal/QCodeEditor.cpp:136–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136void QCodeEditor::updateStyle()
137{
138 if (m_highlighter)
139 {
140 m_highlighter->rehighlight();
141 }
142
143 if (m_syntaxStyle)
144 {
145 auto currentPalette = palette();
146
147 // Setting text format/color
148 currentPalette.setColor(
149 QPalette::ColorRole::Text,
150 m_syntaxStyle->getFormat("Text").foreground().color());
151
152 // Setting common background
153 currentPalette.setColor(
154 QPalette::Base, m_syntaxStyle->getFormat("Text").background().color());
155
156 // Setting selection color
157 currentPalette.setColor(
158 QPalette::Highlight,
159 m_syntaxStyle->getFormat("Selection").background().color());
160 currentPalette.setColor(
161 QPalette::HighlightedText,
162 m_syntaxStyle->getFormat("Selection").foreground().color());
163
164 setPalette(currentPalette);
165
166 if (m_completer && m_completer->popup())
167 {
168 m_completer->popup()->setFont(font());
169 m_completer->popup()->setPalette(currentPalette);
170 }
171 }
172
173 updateExtraSelection();
174}
175
176void QCodeEditor::onSelectionChanged()
177{

Callers

nothing calls this directly

Calls 3

getFormatMethod · 0.80
setFontMethod · 0.80
setColorMethod · 0.45

Tested by

no test coverage detected