浏览代码

editor: fix the style sheet issue

Le Tan 7 年之前
父节点
当前提交
dec308cbde
共有 2 个文件被更改,包括 11 次插入12 次删除
  1. 2 2
      src/vmdeditoperations.cpp
  2. 9 10
      src/vmdeditor.cpp

+ 2 - 2
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");
     }
 
 

+ 9 - 10
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());
 }