diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-01-31 14:32:24 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-02-03 14:58:06 +0100 |
commit | 2d265dce58d26047f196d79eabfe41edab45c799 (patch) | |
tree | adc89bf20f21399a2e0709c24382deea0d0c9778 /src/gui/text/qtextmarkdownimporter.cpp | |
parent | c29fac453f3eaac73b29eb0a66d130220d073fc6 (diff) |
Markdown importer: properly set hyperlinks
The "title" in markdown is the tooltip, not the name attribute of
a link. Also, tell the char format that it's an anchor.
Change-Id: I2978848ec6705fe16376d6fe17f31007cce4b801
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/gui/text/qtextmarkdownimporter.cpp')
-rw-r--r-- | src/gui/text/qtextmarkdownimporter.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/text/qtextmarkdownimporter.cpp b/src/gui/text/qtextmarkdownimporter.cpp index b6a275f59c..7e18a10895 100644 --- a/src/gui/text/qtextmarkdownimporter.cpp +++ b/src/gui/text/qtextmarkdownimporter.cpp @@ -399,8 +399,10 @@ int QTextMarkdownImporter::cbEnterSpan(int spanType, void *det) MD_SPAN_A_DETAIL *detail = static_cast<MD_SPAN_A_DETAIL *>(det); QString url = QString::fromUtf8(detail->href.text, int(detail->href.size)); QString title = QString::fromUtf8(detail->title.text, int(detail->title.size)); + charFmt.setAnchor(true); charFmt.setAnchorHref(url); - charFmt.setAnchorNames(QStringList(title)); + if (!title.isEmpty()) + charFmt.setToolTip(title); charFmt.setForeground(m_palette.link()); qCDebug(lcMD) << "anchor" << url << title; } break; |