Skip to content

Commit

Permalink
Fix crash under Qt6 (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
pbek committed Dec 5, 2022
1 parent b6bea15 commit 029d9eb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions markdownhighlighter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2310,7 +2310,11 @@ void MarkdownHighlighter::highlightEmAndStrong(const QString &text,
startDelim.marker == QLatin1Char('_');
while (k != (startDelim.pos + boldLen)) {
QTextCharFormat fmt = QSyntaxHighlighter::format(k);
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
fmt.setFontFamily(_formats[Bold].fontFamily());
#else
fmt.setFontFamilies(_formats[Bold].fontFamilies().toStringList());
#endif

if (_formats[state].fontPointSize() > 0)
fmt.setFontPointSize(_formats[state].fontPointSize());
Expand Down Expand Up @@ -2353,7 +2357,12 @@ void MarkdownHighlighter::highlightEmAndStrong(const QString &text,
const int itLen = endDelim.pos - startDelim.pos;
while (k != (startDelim.pos + itLen)) {
QTextCharFormat fmt = QSyntaxHighlighter::format(k);

#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
fmt.setFontFamily(_formats[Italic].fontFamily());
#else
fmt.setFontFamilies(_formats[Italic].fontFamilies().toStringList());
#endif

if (_formats[state].fontPointSize() > 0)
fmt.setFontPointSize(_formats[state].fontPointSize());
Expand Down

0 comments on commit 029d9eb

Please sign in to comment.