summaryrefslogtreecommitdiffstats
path: root/tests/manual/quick/pdf
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/quick/pdf')
-rw-r--r--tests/manual/quick/pdf/bookmarks-list.qml5
-rw-r--r--tests/manual/quick/pdf/bookmarks.qml4
-rw-r--r--tests/manual/quick/pdf/gridview.qml16
-rw-r--r--tests/manual/quick/pdf/listview.qml2
-rw-r--r--tests/manual/quick/pdf/pdfPageView.qml22
5 files changed, 31 insertions, 18 deletions
diff --git a/tests/manual/quick/pdf/bookmarks-list.qml b/tests/manual/quick/pdf/bookmarks-list.qml
index a4c030ea5..fd6c38b54 100644
--- a/tests/manual/quick/pdf/bookmarks-list.qml
+++ b/tests/manual/quick/pdf/bookmarks-list.qml
@@ -87,11 +87,10 @@ ApplicationWindow {
width: parent.width
text: model.title
background: Item { }
- onClicked: image.currentFrame = pageNumber
+ onClicked: image.currentFrame = page
}
model: PdfBookmarkModel {
document: root.doc
- structureMode: PdfBookmarkModel.ListMode
}
}
}
@@ -179,6 +178,6 @@ ApplicationWindow {
}
Text {
anchors { bottom: parent.bottom; right: parent.right; margins: 6 }
- text: "page " + (image.currentFrame + 1) + " of " + doc.pageCount
+ text: "page " + doc.pageLabel(image.currentFrame) + " of " + doc.pageCount
}
}
diff --git a/tests/manual/quick/pdf/bookmarks.qml b/tests/manual/quick/pdf/bookmarks.qml
index 0d7a84dee..230e3daf4 100644
--- a/tests/manual/quick/pdf/bookmarks.qml
+++ b/tests/manual/quick/pdf/bookmarks.qml
@@ -88,7 +88,7 @@ ApplicationWindow {
clip: true
delegate: TreeViewDelegate {
width: parent.width
- onClicked: image.currentFrame = pageNumber
+ onClicked: image.currentFrame = page
}
model: PdfBookmarkModel {
document: root.doc
@@ -189,6 +189,6 @@ ApplicationWindow {
}
Label {
anchors { bottom: parent.bottom; right: parent.right; margins: 6 }
- text: "page " + (image.currentFrame + 1) + " of " + doc.pageCount
+ text: "page " + doc.pageLabel(image.currentFrame) + " of " + doc.pageCount
}
}
diff --git a/tests/manual/quick/pdf/gridview.qml b/tests/manual/quick/pdf/gridview.qml
index 48e34732a..4ad9e4676 100644
--- a/tests/manual/quick/pdf/gridview.qml
+++ b/tests/manual/quick/pdf/gridview.qml
@@ -68,10 +68,13 @@ Window {
id: view
anchors.fill: parent
anchors.margins: 10
- model: doc.pageCount
+ model: doc.pageModel
cellWidth: cellSize
cellHeight: cellSize
delegate: Item {
+ required property int index
+ required property string label
+ required property size pointSize
width: view.cellWidth
height: view.cellHeight
Rectangle {
@@ -86,10 +89,11 @@ Window {
currentFrame: index
asynchronous: true
fillMode: Image.PreserveAspectFit
- property size naturalSize: doc.pagePointSize(index)
- property bool landscape: naturalSize.width > naturalSize.height
- width: landscape ? Math.min(view.cellWidth, naturalSize.width) : height * naturalSize.width / naturalSize.height
- height: landscape ? width * naturalSize.height / naturalSize.width : Math.min(view.cellHeight - pageNumber.height, naturalSize.height)
+ property bool landscape: pointSize.width > pointSize.height
+ width: landscape ? Math.min(view.cellWidth, pointSize.width)
+ : height * pointSize.width / pointSize.height
+ height: landscape ? width * pointSize.height / pointSize.width
+ : Math.min(view.cellHeight - pageNumber.height, pointSize.height)
sourceSize.width: width
sourceSize.height: height
}
@@ -98,7 +102,7 @@ Window {
id: pageNumber
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
- text: "Page " + (image.currentFrame + 1)
+ text: "Page " + label
}
}
}
diff --git a/tests/manual/quick/pdf/listview.qml b/tests/manual/quick/pdf/listview.qml
index 65da5d483..3201908ac 100644
--- a/tests/manual/quick/pdf/listview.qml
+++ b/tests/manual/quick/pdf/listview.qml
@@ -81,7 +81,7 @@ Window {
}
}
Text {
- text: "Page " + (image.currentFrame + 1)
+ text: "Page " + doc.pageLabel(image.currentFrame)
}
}
}
diff --git a/tests/manual/quick/pdf/pdfPageView.qml b/tests/manual/quick/pdf/pdfPageView.qml
index 393d1f774..7038e61d0 100644
--- a/tests/manual/quick/pdf/pdfPageView.qml
+++ b/tests/manual/quick/pdf/pdfPageView.qml
@@ -136,18 +136,28 @@ ApplicationWindow {
}
SpinBox {
id: currentPageSB
- from: 1
+ from: 0
to: document.pageCount
editable: true
- value: pageView.currentPage + 1
- onValueModified: pageView.goToPage(value - 1)
+ value: pageView.currentPage
+ onValueModified: pageView.goToPage(value)
+
+ textFromValue: function(value) { return document.pageLabel(value) }
+ valueFromText: function(text) {
+ for (var i = 0; i < document.pageCount; ++i) {
+ if (document.pageLabel(i).toLowerCase().indexOf(text.toLowerCase()) === 0)
+ return i
+ }
+ return spinBox.value
+ }
+
Shortcut {
sequence: StandardKey.MoveToPreviousPage
- onActivated: pageView.goToPage(currentPageSB.value - 2)
+ onActivated: pageView.goToPage(currentPageSB.value - 1)
}
Shortcut {
sequence: StandardKey.MoveToNextPage
- onActivated: pageView.goToPage(currentPageSB.value)
+ onActivated: pageView.goToPage(currentPageSB.value + 1)
}
}
ToolButton {
@@ -331,7 +341,7 @@ ApplicationWindow {
ScrollBar.vertical: ScrollBar { }
delegate: ItemDelegate {
width: parent ? parent.width : 0
- text: "page " + (page + 1) + ": " + contextBefore + pageView.searchString + contextAfter
+ text: "page " + document.pageLabel(page) + ": " + contextBefore + pageView.searchString + contextAfter
highlighted: ListView.isCurrentItem
onClicked: {
searchResultsList.currentIndex = index