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

Method onThemeChanged

app/src/DataModel/Editors/PainterCodeEditor.cpp:515–528  ·  view source on GitHub ↗

* @brief Applies the current theme to the code editor widget. */

Source from the content-addressed store, hash-verified

513 * @brief Applies the current theme to the code editor widget.
514 */
515void DataModel::PainterCodeEditor::onThemeChanged()
516{
517 static const auto* t = &Misc::ThemeManager::instance();
518 const auto name = t->parameters().value(QStringLiteral("code-editor-theme")).toString();
519 const auto path =
520 QDir::isAbsolutePath(name) ? name : QStringLiteral(":/themes/code-editor/%1.xml").arg(name);
521
522 QFile file(path);
523 if (file.open(QFile::ReadOnly)) {
524 m_style.load(QString::fromUtf8(file.readAll()));
525 m_widget.setSyntaxStyle(&m_style);
526 file.close();
527 }
528}
529
530/**
531 * @brief Grabs the editor widget into a pixmap for QML rendering.

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