Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/editor/editwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,14 @@ void EditWrapper::OnThemeChangeSlot(QString theme)
m_pReadPage->setPalette(readPalette);
}

//设置 MarkdownView widget 背景色,防止 reparent 时 Show 事件绘制白色表面
if (m_pMarkdownView) {
QPalette mdPalette = m_pMarkdownView->palette();
mdPalette.setColor(QPalette::Window, backgroundColor);
m_pMarkdownView->setAutoFillBackground(true);
m_pMarkdownView->setPalette(mdPalette);
}

//设置编辑器
if (m_pSyntaxHighlighter) {
qCDebug(appLog) << "EditWrapper OnThemeChangeSlot, m_pSyntaxHighlighter is not nullptr";
Expand Down
7 changes: 6 additions & 1 deletion src/editor/markdown/markdownview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,13 @@ void MarkdownView::applyTheme(const QVariantMap &themeMap)
// (无需等 JS bridge 异步注入 CSS 变量,消除切换瞬间白色闪烁)
QColor bgColor = QColor(themeMap.value(QStringLiteral("editor-colors"))
.toMap().value(QStringLiteral("background-color")).toString());
if (bgColor.isValid())
if (bgColor.isValid()) {
page()->setBackgroundColor(bgColor);
QPalette p = palette();
p.setColor(QPalette::Window, bgColor);
setAutoFillBackground(true);
setPalette(p);
}
m_lastThemeJson = json;
m_lastThemeDark = dark;
m_hasTheme = true;
Expand Down
Loading