From 189bcbea07cf640aeb4ce0937b86ee1b936a9425 Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Sun, 10 Apr 2022 21:10:47 +0300 Subject: [PATCH] QPdfEnginePrivate: generate link only when there is a href Otherwise, when anchor is just something that can be linked to (not a link itself), it will result in a PDF link pointing to an empty URI. See https://github.com/retext-project/retext/issues/580. Pick-to: 6.3 Change-Id: Ib3c71797b09579783d74505601bad08c84856719 Reviewed-by: Lars Knoll --- src/gui/painting/qpdf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 29fa644e9d8..9b42783b186 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -2983,7 +2983,7 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti) { Q_Q(QPdfEngine); - if (ti.charFormat.isAnchor()) { + if (ti.charFormat.hasProperty(QTextFormat::AnchorHref)) { qreal size = ti.fontEngine->fontDef.pixelSize; int synthesized = ti.fontEngine->synthesized(); qreal stretch = synthesized & QFontEngine::SynthesizedStretch ? ti.fontEngine->fontDef.stretch/100. : 1.;