浏览代码

add VNote::editorAndBrowserFont for setting font in QTextEdit and QTextBrowser

Signed-off-by: Le Tan <[email protected]>
Le Tan 9 年之前
父节点
当前提交
321289c8e0
共有 4 个文件被更改,包括 7 次插入0 次删除
  1. 2 0
      vedit.cpp
  2. 1 0
      veditor.cpp
  3. 2 0
      vnote.cpp
  4. 2 0
      vnote.h

+ 2 - 0
vedit.cpp

@@ -1,9 +1,11 @@
 #include <QtWidgets>
 #include "vedit.h"
+#include "vnote.h"
 
 VEdit::VEdit(VNoteFile *noteFile, QWidget *parent)
     : QTextEdit(parent), noteFile(noteFile)
 {
+    setFont(VNote::editorAndBrowserFont);
 }
 
 void VEdit::beginEdit()

+ 1 - 0
veditor.cpp

@@ -43,6 +43,7 @@ void VEditor::setupUI()
     case DocType::Html:
         textBrowser = new QTextBrowser();
         addWidget(textBrowser);
+        textBrowser->setFont(VNote::editorAndBrowserFont);
         webPreviewer = NULL;
         break;
     default:

+ 2 - 0
vnote.cpp

@@ -13,11 +13,13 @@ const QString VNote::defaultCssUrl = QString("qrc:/resources/markdown.css");
 
 QString VNote::templateHtml;
 QString VNote::cssUrl = VNote::defaultCssUrl;
+QFont VNote::editorAndBrowserFont;
 
 VNote::VNote()
     : curNotebookIndex(0)
 {
     decorateTemplate();
+    editorAndBrowserFont.setPointSize(11);
 }
 
 void VNote::decorateTemplate()

+ 2 - 0
vnote.h

@@ -4,6 +4,7 @@
 #include <QString>
 #include <QVector>
 #include <QSettings>
+#include <QFont>
 #include "vnotebook.h"
 
 class VNote
@@ -25,6 +26,7 @@ public:
     static const QString templatePath;
 
     static QString templateHtml;
+    static QFont editorAndBrowserFont;
 
 private:
     // Write notebooks section of global config