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

Method onThemeChanged

app/src/DataModel/Editors/JsCodeEditor.cpp:580–594  ·  view source on GitHub ↗

* @brief Updates the editor colour scheme to match the active theme. */

Source from the content-addressed store, hash-verified

578 * @brief Updates the editor colour scheme to match the active theme.
579 */
580void DataModel::JsCodeEditor::onThemeChanged()
581{
582 static const auto* t = &Misc::ThemeManager::instance();
583 const auto name = t->parameters().value(QStringLiteral("code-editor-theme")).toString();
584
585 const auto path =
586 QDir::isAbsolutePath(name) ? name : QStringLiteral(":/themes/code-editor/%1.xml").arg(name);
587
588 QFile file(path);
589 if (file.open(QFile::ReadOnly)) {
590 m_style.load(QString::fromUtf8(file.readAll()));
591 m_widget.setSyntaxStyle(&m_style);
592 file.close();
593 }
594}
595
596/**
597 * @brief Captures the editor widget as a pixmap for QML painting.

Callers

nothing calls this directly

Calls 5

valueMethod · 0.45
openMethod · 0.45
loadMethod · 0.45
setSyntaxStyleMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected