diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-09-09 08:30:04 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-09-21 05:37:18 +0000 |
commit | 0e3d03890442818b010ff763dccee4394c0430cf (patch) | |
tree | 0f31ee4a1dc909307b3ed7b19e1000e7cb9c135b /examples | |
parent | b6c1564c22332271c0a9473894200646efef4d50 (diff) | |
download | qtwebengine-0e3d03890442818b010ff763dccee4394c0430cf.tar.gz |
QtPdf multipage example: open files via DnD
Drop a different file onto the window to replace its contents with a
different PDF.
Pick-to: 6.4
Change-Id: I824d9f0caee69382352ab8d943b9977984db4fc9
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/pdf/multipage/viewer.qml | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/pdf/multipage/viewer.qml b/examples/pdf/multipage/viewer.qml index 56e7188f6..fcf326869 100644 --- a/examples/pdf/multipage/viewer.qml +++ b/examples/pdf/multipage/viewer.qml @@ -194,6 +194,19 @@ ApplicationWindow { onCurrentPageChanged: currentPageSB.value = view.currentPage + 1 } + DropArea { + anchors.fill: parent + keys: ["text/uri-list"] + onEntered: (drag) => { + drag.accepted = (drag.proposedAction === Qt.MoveAction || drag.proposedAction === Qt.CopyAction) && + drag.hasUrls && drag.urls[0].endsWith("pdf") + } + onDropped: (drop) => { + doc.source = drop.urls[0] + drop.acceptProposedAction() + } + } + Drawer { id: sidebar edge: Qt.LeftEdge |