* @brief Applies the current theme to the code editor widget. */
| 513 | * @brief Applies the current theme to the code editor widget. |
| 514 | */ |
| 515 | void 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. |
nothing calls this directly
no test coverage detected