Commit 528490ff authored by Victor Yacovlev's avatar Victor Yacovlev

Help viewer: use main editor font for code preview

parent 7c60a7e1
......@@ -3,6 +3,7 @@
#include "mathmlrenderer.h"
#include "extensionsystem/pluginmanager.h"
#include "interfaces/editorinterface.h"
#include "widgets/iconprovider.h"
#include <QUrl>
......@@ -184,8 +185,8 @@ QString ContentView::wrapHTML(const QString &body) const
" font-size: " + GuiElementsFontSize + ";"
"}"
".code {"
" font-family: " + CodeFontFamily + ";"
" font-size: " + CodeFontSize + ";"
" font-family: " + codeFontFamily() + ";"
" font-size: " + codeFontSize() + ";"
"}"
"th {"
" font-weight: bold;"
......@@ -1752,6 +1753,36 @@ void ContentView::contextMenuEvent(QContextMenuEvent *e)
e->accept();
}
QString ContentView::codeFontSize() const
{
using Shared::EditorInterface;
using ExtensionSystem::PluginManager;
EditorInterface * editor =
PluginManager::instance()->findPlugin<EditorInterface>();
if (editor) {
return QString::fromLatin1("%1pt").arg(editor->defaultEditorFont().pointSize());
}
else {
return CodeFontSize;
}
}
QString ContentView::codeFontFamily() const
{
using Shared::EditorInterface;
using ExtensionSystem::PluginManager;
EditorInterface * editor =
PluginManager::instance()->findPlugin<EditorInterface>();
if (editor) {
return editor->defaultEditorFont().family();
}
else {
return CodeFontFamily;
}
}
void ContentView::clearLastAnchorUrl()
{
if (!ignoreClearAnchorUrl_) {
......
......@@ -36,6 +36,9 @@ private:
void wheelEvent(QWheelEvent *e);
void contextMenuEvent(QContextMenuEvent *e);
QString codeFontSize() const;
QString codeFontFamily() const;
QString wrapHTML(const QString & body) const;
QString renderModel(ModelPtr data) const;
QString renderElement(ModelPtr data) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment