summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-01-15 09:44:10 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2020-01-30 16:26:56 +0100
commitccbd6fbdbe071f42e1c060ca579786758701f358 (patch)
tree46e6fbfb35ffbd42eaa2bcaabcc78c0d106115f1 /tests
parentbc1d6ddeb5076f68e0a758725a20c3f2a6d081f0 (diff)
Add PdfLinkModel
Internal links and web links populate the QALM, which can then be used to drive a Repeater to position highlight rectangles with TapHandlers, which will handle a click by jumping to the link destination. Fixes: QTBUG-77511 Change-Id: I3b5b96d6e82bfd578f31f631f24279173036a080 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/manual/quick/pdf/withdoc.qml25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/manual/quick/pdf/withdoc.qml b/tests/manual/quick/pdf/withdoc.qml
index fe3297ee8..2d82a6abf 100644
--- a/tests/manual/quick/pdf/withdoc.qml
+++ b/tests/manual/quick/pdf/withdoc.qml
@@ -171,6 +171,31 @@ Window {
}
}
}
+
+ Repeater {
+ model: PdfLinkModel {
+ id: linkModel
+ document: doc
+ page: image.currentFrame
+ }
+ delegate: Rectangle {
+ color: "transparent"
+ border.color: "lightgrey"
+ x: rect.x
+ y: rect.y
+ width: rect.width
+ height: rect.height
+// HoverHandler { cursorShape: Qt.PointingHandCursor } // 5.15 onward (QTBUG-68073)
+ TapHandler {
+ onTapped: {
+ if (page >= 0)
+ image.currentFrame = page
+ else
+ Qt.openUrlExternally(url)
+ }
+ }
+ }
+ }
}
}
}