From 0fccabc2022e6f722a2612c32ae6f05004109276 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. Change-Id: Ib3c71797b09579783d74505601bad08c84856719 Reviewed-by: Lars Knoll (cherry picked from commit 189bcbea07cf640aeb4ce0937b86ee1b936a9425) Reviewed-by: Qt Cherry-pick Bot --- 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 2d25b5811e1..1de807e6fce 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -2982,7 +2982,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.;