diff options
author | Eike Ziller <eike.ziller@qt.io> | 2019-11-08 14:02:01 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-11-13 06:59:16 +0000 |
commit | 364160600889d6055a556a189e6f3d4a8dc3f96d (patch) | |
tree | fa2e0169636e1becedaf0adeaac84bbc4a6320eb | |
parent | 8693c07a8090e0449171f0bb9197d82c3075f833 (diff) | |
download | qtbase-364160600889d6055a556a189e6f3d4a8dc3f96d.tar.gz |
Use default QTD font size for mono font when importing markdown
QFontDatabase::systemFont(FixedFont) determines the font for inline code and
code blocks in a markdown document. Now we change the size of that font to the
same size as QTextDocument::defaultFont() so that the user has the ability to
customize the font size in each document instead of only system-wide.
Change-Id: Ief7367336f7613e88695dbb08bcb7e9f50db8961
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
-rw-r--r-- | src/gui/text/qtextmarkdownimporter.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/text/qtextmarkdownimporter.cpp b/src/gui/text/qtextmarkdownimporter.cpp index c2ad1e5612..78d18a714b 100644 --- a/src/gui/text/qtextmarkdownimporter.cpp +++ b/src/gui/text/qtextmarkdownimporter.cpp @@ -160,6 +160,10 @@ void QTextMarkdownImporter::import(QTextDocument *doc, const QString &markdown) m_paragraphMargin = m_doc->defaultFont().pointSize() * 2 / 3; m_cursor = new QTextCursor(doc); doc->clear(); + if (doc->defaultFont().pointSize() != -1) + m_monoFont.setPointSize(doc->defaultFont().pointSize()); + else + m_monoFont.setPixelSize(doc->defaultFont().pixelSize()); qCDebug(lcMD) << "default font" << doc->defaultFont() << "mono font" << m_monoFont; QByteArray md = markdown.toUtf8(); md_parse(md.constData(), MD_SIZE(md.size()), &callbacks, this); |