* @brief Updates the editor colour scheme to match the active theme. */
| 578 | * @brief Updates the editor colour scheme to match the active theme. |
| 579 | */ |
| 580 | void 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. |
nothing calls this directly
no test coverage detected