From dec308cbdead51af302cf36aec20d0c901a0a2f0 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Thu, 19 Jul 2018 20:51:58 +0800 Subject: [PATCH] editor: fix the style sheet issue --- src/vmdeditoperations.cpp | 4 ++-- src/vmdeditor.cpp | 19 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/vmdeditoperations.cpp b/src/vmdeditoperations.cpp index ca58e989..833360ab 100644 --- a/src/vmdeditoperations.cpp +++ b/src/vmdeditoperations.cpp @@ -156,10 +156,10 @@ bool VMdEditOperations::insertImageFromURL(const QUrl &imageUrl) return false; } - title = "Insert Image From File"; + title = tr("Insert Image From File"); } else { imagePath = imageUrl.toString(); - title = "Insert Image From Network"; + title = tr("Insert Image From Network"); } diff --git a/src/vmdeditor.cpp b/src/vmdeditor.cpp index e9d1cfda..2c3c213e 100644 --- a/src/vmdeditor.cpp +++ b/src/vmdeditor.cpp @@ -115,27 +115,26 @@ void VMdEditor::updateFontAndPalette() setFont(font); const QPalette &palette = g_config->getMdEditPalette(); + /* Do not use this function in conjunction with Qt Style Sheets. When using style sheets, the palette of a widget can be customized using the "color", "background-color", "selection-color", "selection-background-color" and "alternate-background-color". */ - // We still call this to set the background. If the stylesheet defines background, - // then it will take no effect here. - setPalette(palette); - - setTextColor(palette.color(QPalette::Text)); + // setPalette(palette); + // setTextColor(palette.color(QPalette::Text)); // Only this could override the font-family set of QWidget in QSS. - // Do NOT set background-color in stylesheet below, otherwise it will - // make the scrollbars messy. - setStyleSheet(QString("font-family: \"%1\";" + setStyleSheet(QString("VMdEditor, VLineNumberArea {" + "font-family: \"%1\";" "font-size: %2pt;" - "color: %3;") + "color: %3;" + "background-color: %4; }") .arg(font.family()) .arg(font.pointSize()) - .arg(palette.color(QPalette::Text).name())); + .arg(palette.color(QPalette::Text).name()) + .arg(palette.color(QPalette::Base).name())); updateLineNumberAreaWidth(fontMetrics()); }