Skip to content

Commit

Permalink
QPdfEnginePrivate: generate link only when there is a href
Browse files Browse the repository at this point in the history
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 retext-project/retext#580.

Change-Id: Ib3c71797b09579783d74505601bad08c84856719
Reviewed-by: Lars Knoll <[email protected]>
(cherry picked from commit 189bcbe)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
  • Loading branch information
mitya57 authored and Qt Cherry-pick Bot committed Apr 29, 2022
1 parent f2d2f2f commit 0fccabc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/gui/painting/qpdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.;
Expand Down

0 comments on commit 0fccabc

Please sign in to comment.