diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-05-30 11:34:17 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-06-04 20:55:31 +0200 |
commit | 35697c1ded0577e88e774917a8ead31d7445465a (patch) | |
tree | c1bd34898b36308e806cfe1d3beae5d90b8449e5 /examples/pdf | |
parent | af4f03f51fc647c48968e149799cd35ab161dc55 (diff) |
Add QPdfDocument::pageLabel(int) and pageModel property
This API is available for both C++ and QML.
The pageModel makes it easier to populate item-views with per-page
information, such as thumbnails labeled with page labels.
Fixes: QTBUG-102271
Change-Id: I70df481b378efed0327e7bb89a63c7669daecc70
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'examples/pdf')
-rw-r--r-- | examples/pdf/multipage/viewer.qml | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/examples/pdf/multipage/viewer.qml b/examples/pdf/multipage/viewer.qml index cf94c099b..3a12d9700 100644 --- a/examples/pdf/multipage/viewer.qml +++ b/examples/pdf/multipage/viewer.qml @@ -371,11 +371,13 @@ ApplicationWindow { id: thumbnailsView implicitWidth: parent.width implicitHeight: parent.height - model: doc.pageCount + model: doc.pageModel cellWidth: width / 2 cellHeight: cellWidth + 10 delegate: Item { required property int index + required property string label + required property size pointSize width: thumbnailsView.cellWidth height: thumbnailsView.cellHeight Rectangle { @@ -390,11 +392,10 @@ ApplicationWindow { currentFrame: index asynchronous: true fillMode: Image.PreserveAspectFit - property size naturalSize: doc.pagePointSize(index) - property bool landscape: naturalSize.width > naturalSize.height + property bool landscape: pointSize.width > pointSize.height width: landscape ? thumbnailsView.cellWidth - 6 - : height * naturalSize.width / naturalSize.height - height: landscape ? width * naturalSize.height / naturalSize.width + : height * pointSize.width / pointSize.height + height: landscape ? width * pointSize.height / pointSize.width : thumbnailsView.cellHeight - 14 sourceSize.width: width sourceSize.height: height @@ -404,7 +405,7 @@ ApplicationWindow { id: pageNumber anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter - text: "Page " + (image.currentFrame + 1) + text: label } TapHandler { onTapped: view.goToPage(index) |