summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-03-11 12:18:00 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2020-03-11 12:18:00 +0100
commit85fddca7c51b3e2bfec4ffa071ed5b0cf8d6e6be (patch)
treeda62143afa4b40abfcaa9b8cbacfbd8f6c7b7a33 /examples
parent6025803547477884fe1d027b7cb54a70429337c6 (diff)
parent5dc78ed4e2891205a7162b696b3439a87253140f (diff)
Merge remote-tracking branch 'origin/wip/qtpdf' into 5.15
Diffstat (limited to 'examples')
-rw-r--r--examples/pdf/multipage/resources/edit-select-all.svg13
-rw-r--r--examples/pdf/multipage/viewer.qml33
-rw-r--r--examples/pdf/multipage/viewer.qrc1
-rw-r--r--examples/pdf/pdfviewer/resources/edit-select-all.svg13
-rw-r--r--examples/pdf/pdfviewer/viewer.qml34
-rw-r--r--examples/pdf/pdfviewer/viewer.qrc1
6 files changed, 93 insertions, 2 deletions
diff --git a/examples/pdf/multipage/resources/edit-select-all.svg b/examples/pdf/multipage/resources/edit-select-all.svg
new file mode 100644
index 000000000..5f21950a0
--- /dev/null
+++ b/examples/pdf/multipage/resources/edit-select-all.svg
@@ -0,0 +1,13 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
+ <defs id="defs3051">
+ <style type="text/css" id="current-color-scheme">
+ .ColorScheme-Text {
+ color:#232629;
+ }
+ </style>
+ </defs>
+ <path style="fill:currentColor;fill-opacity:1;stroke:none"
+ d="M 4 4 L 4 5 L 4 8 L 5 8 L 5 5 L 8 5 L 8 4 L 5 4 L 4 4 z M 16 4 L 16 5 L 19 5 L 19 8 L 20 8 L 20 4 L 16 4 z M 6 6 L 6 11 L 11 11 L 11 6 L 6 6 z M 13 6 L 13 11 L 18 11 L 18 6 L 13 6 z M 7 7 L 10 7 L 10 10 L 7 10 L 7 7 z M 14 7 L 17 7 L 17 10 L 14 10 L 14 7 z M 6 13 L 6 18 L 11 18 L 11 13 L 6 13 z M 13 13 L 13 18 L 18 18 L 18 13 L 13 13 z M 7 14 L 10 14 L 10 17 L 7 17 L 7 14 z M 14 14 L 17 14 L 17 17 L 14 17 L 14 14 z M 4 16 L 4 20 L 5 20 L 8 20 L 8 19 L 5 19 L 5 16 L 4 16 z M 19 16 L 19 19 L 16 19 L 16 20 L 20 20 L 20 19 L 20 16 L 19 16 z "
+ class="ColorScheme-Text"
+ />
+</svg>
diff --git a/examples/pdf/multipage/viewer.qml b/examples/pdf/multipage/viewer.qml
index 9e5f92407..02513fa5b 100644
--- a/examples/pdf/multipage/viewer.qml
+++ b/examples/pdf/multipage/viewer.qml
@@ -161,6 +161,13 @@ ApplicationWindow {
}
ToolButton {
action: Action {
+ shortcut: StandardKey.SelectAll
+ icon.source: "resources/edit-select-all.svg"
+ onTriggered: view.selectAll()
+ }
+ }
+ ToolButton {
+ action: Action {
shortcut: StandardKey.Copy
icon.source: "resources/edit-copy.svg"
enabled: view.selectedText !== ""
@@ -258,7 +265,31 @@ ApplicationWindow {
ScrollBar.vertical: ScrollBar { }
delegate: ItemDelegate {
width: parent ? parent.width : 0
- text: "page " + (page + 1) + ": " + context
+ RowLayout {
+ anchors.fill: parent
+ spacing: 0
+ Label {
+ text: "Page " + (page + 1) + ": "
+ }
+ Label {
+ text: contextBefore
+ elide: Text.ElideLeft
+ horizontalAlignment: Text.AlignRight
+ Layout.fillWidth: true
+ Layout.preferredWidth: parent.width / 2
+ }
+ Label {
+ font.bold: true
+ text: view.searchString
+ width: implicitWidth
+ }
+ Label {
+ text: contextAfter
+ elide: Text.ElideRight
+ Layout.fillWidth: true
+ Layout.preferredWidth: parent.width / 2
+ }
+ }
highlighted: ListView.isCurrentItem
onClicked: {
searchResultsList.currentIndex = index
diff --git a/examples/pdf/multipage/viewer.qrc b/examples/pdf/multipage/viewer.qrc
index 1b6fa52f7..ffca51679 100644
--- a/examples/pdf/multipage/viewer.qrc
+++ b/examples/pdf/multipage/viewer.qrc
@@ -4,6 +4,7 @@
<file>resources/document-open.svg</file>
<file>resources/edit-clear.svg</file>
<file>resources/edit-copy.svg</file>
+ <file>resources/edit-select-all.svg</file>
<file>resources/go-down-search.svg</file>
<file>resources/go-next-view-page.svg</file>
<file>resources/go-previous-view-page.svg</file>
diff --git a/examples/pdf/pdfviewer/resources/edit-select-all.svg b/examples/pdf/pdfviewer/resources/edit-select-all.svg
new file mode 100644
index 000000000..5f21950a0
--- /dev/null
+++ b/examples/pdf/pdfviewer/resources/edit-select-all.svg
@@ -0,0 +1,13 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
+ <defs id="defs3051">
+ <style type="text/css" id="current-color-scheme">
+ .ColorScheme-Text {
+ color:#232629;
+ }
+ </style>
+ </defs>
+ <path style="fill:currentColor;fill-opacity:1;stroke:none"
+ d="M 4 4 L 4 5 L 4 8 L 5 8 L 5 5 L 8 5 L 8 4 L 5 4 L 4 4 z M 16 4 L 16 5 L 19 5 L 19 8 L 20 8 L 20 4 L 16 4 z M 6 6 L 6 11 L 11 11 L 11 6 L 6 6 z M 13 6 L 13 11 L 18 11 L 18 6 L 13 6 z M 7 7 L 10 7 L 10 10 L 7 10 L 7 7 z M 14 7 L 17 7 L 17 10 L 14 10 L 14 7 z M 6 13 L 6 18 L 11 18 L 11 13 L 6 13 z M 13 13 L 13 18 L 18 18 L 18 13 L 13 13 z M 7 14 L 10 14 L 10 17 L 7 17 L 7 14 z M 14 14 L 17 14 L 17 17 L 14 17 L 14 14 z M 4 16 L 4 20 L 5 20 L 8 20 L 8 19 L 5 19 L 5 16 L 4 16 z M 19 16 L 19 19 L 16 19 L 16 20 L 20 20 L 20 19 L 20 16 L 19 16 z "
+ class="ColorScheme-Text"
+ />
+</svg>
diff --git a/examples/pdf/pdfviewer/viewer.qml b/examples/pdf/pdfviewer/viewer.qml
index e3bb4b474..75d2daab0 100644
--- a/examples/pdf/pdfviewer/viewer.qml
+++ b/examples/pdf/pdfviewer/viewer.qml
@@ -164,6 +164,13 @@ ApplicationWindow {
}
ToolButton {
action: Action {
+ shortcut: StandardKey.SelectAll
+ icon.source: "resources/edit-select-all.svg"
+ onTriggered: view.selectAll()
+ }
+ }
+ ToolButton {
+ action: Action {
shortcut: StandardKey.Copy
icon.source: "resources/edit-copy.svg"
enabled: view.selectedText !== ""
@@ -206,6 +213,7 @@ ApplicationWindow {
PdfScrollablePageView {
id: view
anchors.fill: parent
+ anchors.leftMargin: searchDrawer.position * searchDrawer.width
document: PdfDocument {
id: document
source: Qt.resolvedUrl(root.source)
@@ -231,7 +239,31 @@ ApplicationWindow {
ScrollBar.vertical: ScrollBar { }
delegate: ItemDelegate {
width: parent ? parent.width : 0
- text: "page " + (page + 1) + ": " + context
+ RowLayout {
+ anchors.fill: parent
+ spacing: 0
+ Label {
+ text: "Page " + (page + 1) + ": "
+ }
+ Label {
+ text: contextBefore
+ elide: Text.ElideLeft
+ horizontalAlignment: Text.AlignRight
+ Layout.fillWidth: true
+ Layout.preferredWidth: parent.width / 2
+ }
+ Label {
+ font.bold: true
+ text: view.searchString
+ width: implicitWidth
+ }
+ Label {
+ text: contextAfter
+ elide: Text.ElideRight
+ Layout.fillWidth: true
+ Layout.preferredWidth: parent.width / 2
+ }
+ }
highlighted: ListView.isCurrentItem
onClicked: {
searchResultsList.currentIndex = index
diff --git a/examples/pdf/pdfviewer/viewer.qrc b/examples/pdf/pdfviewer/viewer.qrc
index 1b6fa52f7..ffca51679 100644
--- a/examples/pdf/pdfviewer/viewer.qrc
+++ b/examples/pdf/pdfviewer/viewer.qrc
@@ -4,6 +4,7 @@
<file>resources/document-open.svg</file>
<file>resources/edit-clear.svg</file>
<file>resources/edit-copy.svg</file>
+ <file>resources/edit-select-all.svg</file>
<file>resources/go-down-search.svg</file>
<file>resources/go-next-view-page.svg</file>
<file>resources/go-previous-view-page.svg</file>