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

Signed-off-by: Le Tan <tamlokveer@gmail.com>
This commit is contained in:
Le Tan 2016-10-09 22:37:45 +08:00
parent 5ff4382f90
commit 321289c8e0
4 changed files with 7 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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