From 321289c8e01e0270af5ba1a823e8833e062838f5 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Sun, 9 Oct 2016 22:37:45 +0800 Subject: [PATCH] add VNote::editorAndBrowserFont for setting font in QTextEdit and QTextBrowser Signed-off-by: Le Tan --- vedit.cpp | 2 ++ veditor.cpp | 1 + vnote.cpp | 2 ++ vnote.h | 2 ++ 4 files changed, 7 insertions(+) diff --git a/vedit.cpp b/vedit.cpp index d72d5175..ebd95376 100644 --- a/vedit.cpp +++ b/vedit.cpp @@ -1,9 +1,11 @@ #include #include "vedit.h" +#include "vnote.h" VEdit::VEdit(VNoteFile *noteFile, QWidget *parent) : QTextEdit(parent), noteFile(noteFile) { + setFont(VNote::editorAndBrowserFont); } void VEdit::beginEdit() diff --git a/veditor.cpp b/veditor.cpp index 65e3509e..571c4b72 100644 --- a/veditor.cpp +++ b/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: diff --git a/vnote.cpp b/vnote.cpp index 1254dde3..441e9646 100644 --- a/vnote.cpp +++ b/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() diff --git a/vnote.h b/vnote.h index bc38aba8..8b0b1cf8 100644 --- a/vnote.h +++ b/vnote.h @@ -4,6 +4,7 @@ #include #include #include +#include #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