mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-06 06:19:52 +08:00
support transparent render background
It is useful for export.
This commit is contained in:
parent
935bb4d3b4
commit
22104ebde3
@ -370,6 +370,7 @@ void VExportDialog::initUIFields(MarkdownConverterType p_renderer)
|
||||
|
||||
// Markdown rendering background.
|
||||
m_renderBgCB->addItem(tr("System"), "System");
|
||||
m_renderBgCB->addItem(tr("Transparent"), "Transparent");
|
||||
const QVector<VColor> &bgColors = g_config->getCustomColors();
|
||||
for (int i = 0; i < bgColors.size(); ++i) {
|
||||
m_renderBgCB->addItem(bgColors[i].m_name, bgColors[i].m_name);
|
||||
|
@ -1487,7 +1487,9 @@ void VConfigManager::clearGroupOfSettings(QSettings *p_settings, const QString &
|
||||
|
||||
QString VConfigManager::getRenderBackgroundColor(const QString &p_bgName) const
|
||||
{
|
||||
if (p_bgName != "System") {
|
||||
if (p_bgName == "Transparent") {
|
||||
return "transparent";
|
||||
} else if (p_bgName != "System") {
|
||||
for (int i = 0; i < m_customColors.size(); ++i) {
|
||||
if (m_customColors[i].m_name == p_bgName) {
|
||||
return m_customColors[i].m_color;
|
||||
|
@ -1528,6 +1528,17 @@ void VMainWindow::initRenderBackgroundMenu(QMenu *menu)
|
||||
if (curBgColor == "System") {
|
||||
tmpAct->setChecked(true);
|
||||
}
|
||||
|
||||
renderBgMenu->addAction(tmpAct);
|
||||
|
||||
tmpAct = new QAction(tr("Transparent"), renderBackgroundAct);
|
||||
tmpAct->setToolTip(tr("Use a transparent background for Markdown rendering"));
|
||||
tmpAct->setCheckable(true);
|
||||
tmpAct->setData("Transparent");
|
||||
if (curBgColor == "Transparent") {
|
||||
tmpAct->setChecked(true);
|
||||
}
|
||||
|
||||
renderBgMenu->addAction(tmpAct);
|
||||
|
||||
const QVector<VColor> &bgColors = g_config->getCustomColors();
|
||||
@ -1810,6 +1821,7 @@ void VMainWindow::setRenderBackgroundColor(QAction *action)
|
||||
if (!action) {
|
||||
return;
|
||||
}
|
||||
|
||||
g_config->setCurRenderBackgroundColor(action->data().toString());
|
||||
vnote->updateTemplate();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user