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 <lars.knoll@qt.io>
This commit is contained in:
Dmitry Shachnev 2022-04-10 21:10:47 +03:00
parent bfd10af245
commit 189bcbea07

View File

@ -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.;