| 176 | } |
| 177 | |
| 178 | void TextEditorPrivate::updateSettings() |
| 179 | { |
| 180 | fontName = EditorSettings::instance()->value(Node::FontColor, Group::FontGroup, Key::FontFamily, DEFAULT_FONT_NAME).toString(); |
| 181 | fontSize = EditorSettings::instance()->value(Node::FontColor, Group::FontGroup, Key::FontSize, 10).toInt(); |
| 182 | commentSettings = EditorSettings::instance()->getMap(Node::MimeTypeConfig); |
| 183 | |
| 184 | QFont font(fontName, fontSize, QFont::Normal); |
| 185 | if (q->lexer()) |
| 186 | q->lexer()->setDefaultFont(font); |
| 187 | else if (!fileName.isEmpty()) |
| 188 | q->setFont(font); |
| 189 | |
| 190 | int fontZoom = EditorSettings::instance()->value(Node::FontColor, Group::FontGroup, Key::FontZoom, 100).toInt(); |
| 191 | int realFontZoom = (fontZoom - 100) / 10; |
| 192 | { |
| 193 | // Avoid triggering the `zoomChanged` signal. |
| 194 | QSignalBlocker blk(q); |
| 195 | q->zoomTo(realFontZoom); |
| 196 | } |
| 197 | |
| 198 | // Indentation |
| 199 | auto tabPolicy = EditorSettings::instance()->value(Node::Behavior, Group::TabGroup, Key::TabPolicy, 0).toInt(); |
| 200 | auto tabSize = EditorSettings::instance()->value(Node::Behavior, Group::TabGroup, Key::TabSize, 4).toInt(); |
| 201 | auto autoIndent = EditorSettings::instance()->value(Node::Behavior, Group::TabGroup, Key::EnableAutoIndentation, true).toBool(); |
| 202 | q->setIndentationsUseTabs(tabPolicy); |
| 203 | q->setTabWidth(tabSize); |
| 204 | q->setWhitespaceSize(3); |
| 205 | q->setAutoIndent(autoIndent); |
| 206 | |
| 207 | int hoverTime = EditorSettings::instance()->value(Node::Behavior, Group::TipGroup, Key::TipActiveTime, 500).toInt(); |
| 208 | q->SendScintilla(TextEditor::SCI_SETMOUSEDWELLTIME, hoverTime); |
| 209 | |
| 210 | // Highlight the current line |
| 211 | q->setCaretLineVisible(true); |
| 212 | |
| 213 | // Opening brace matching |
| 214 | q->setBraceMatching(TextEditor::SloppyBraceMatch); |
| 215 | |
| 216 | q->setEolMode(TextEditor::EolUnix); |
| 217 | q->setScrollWidth(1); |
| 218 | q->setScrollWidthTracking(true); |
| 219 | |
| 220 | resetThemeColor(); |
| 221 | |
| 222 | q->setMarginsFont(font); |
| 223 | q->updateLineNumberWidth(false); |
| 224 | } |
| 225 | |
| 226 | void TextEditorPrivate::onSelectionChanged() |
| 227 | { |
nothing calls this directly
no test coverage detected