summaryrefslogtreecommitdiffstats
path: root/src/pdf/api/qpdfdocument_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Add QtPdf to cmake buildMichal Klocek2021-08-171-124/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Port QtPdf to Qt6: * QtPdf,QtPdfWidgets,QtPdfQuick libs * QtPdfQuickPlugin, QtPdfPlugin (imageformat) plugins * widget and quick examples * qtpdf tests To fit gn cmake integration and new repo layout code is a bit reshuffled. Compared to qmke build following features are not ported yet: * ios fat libs * qtbase 3rdparty static dependencies WebEngine build can be skipped with setting QT_FEATURE_qtwebengine_build=OFF Note this patch needs follow up for 6.2 branch to disable qtpdf builds by default, since this should not part of qt 6.2 release. Pick-to: 6.2 Task-number: QTBUG-95353 Change-Id: I4dd9f3934bdd478fb6d2fa686074a24d91f09953 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Update dependencies on 'dev' in qt/qtwebengineAllan Sandfeld Jensen2020-11-021-1/+3
| | | | | Change-Id: I74c7293ebf5ace5bd07e3bf5455dd90bf4ed6380 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Support text selection handles in PDF viewsShawn Rutledge2020-04-301-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Testing only on iOS so far; QtPdf doesn't work on Android because of QTBUG-83459, so we can only hope that this might perhaps be cross-platform, if only text selection handles actually existed on all platforms. As usual, text selection begins with a long-press; the iOS platform plugin intercepts that, and we get QInputMethodEvent::Cursor. There is no cursor, but we use the opportunity to do hit-testing, because the Cursor event is the only way that we receive the pixel location where the user is interacting. Then a popover menu appears, which contains Select and Select All, and either Copy or Paste depending on the qt_im_readonly property workaround. You don't get handles until you choose Select, which will select a word. That makes the popover menu disappear. You can use the toolbar button to copy to the clipboard. After that, you can drag either handle. inputMethodQuery(query, argument) is only ever called with ImCursorPosition regardless which handle is being dragged, so it doesn't make sense to change the selection there, even though that would be easy if we were given that information. Instead, the iOS platform figures out the character range for itself and sends a QInputMethodEvent::Selection event to tell us which text to select. And yet it still doesn't move the handles without being told: QGuiApplication::inputMethod()->update(Qt::ImCursorRectangle | Qt::ImAnchorRectangle) makes that happen. Then the popover menu will appear again, and now you can use the Copy function on it as an alternative way to copy text to the clipboard. By default, when the user does the initial long-press to start selecting text, the popover menu has Select, Select All, and Paste. In editable controls there is a second possible menu that normally has Cut, Copy, Paste and Delete. We are not able to enter that mode. So as a workaround, to substitute Copy instead of Paste, we set the qt_im_readonly property so that QIOSTextResponder::canPerformAction() can detect it and make the substition. Of course that won't work without the patch to 5.15; so you still get a useless Paste action on earlier Qt versions. Selecting a word via the Select popover menu item happens because iOS sends QKeySequence::MoveToPreviousWord and then QKeySequence::SelectNextWord. We spend time calling getSelectionAtIndex() twice because of that. With an actual keyboard, it should be possible to use keystrokes to extend the selection, but it doesn't seem to work yet with shift-arrows on a physical bluetooth keyboard on iOS. Select All on the popover menu works via inputMethodEvent() with attr QInputMethodEvent::Selection. Copy sends the standard copy key sequence, so keyReleaseEvent() handles it. We must rename the geometryChanged signal to selectedAreaChanged now that we're inheriting from QQuickItem, to avoid shadowing QQuickItem::geometryChanged. For this kind of text selection to work even when the rendering is scaled, it became necessary to inform PdfSelection of the rendering scale; so a renderScale property is added. Thus it is sensible (and a nice simplification in QML code) to use it for the fromPoint and toPoint properties, such that those are now expressed in pixels rather than points. Fixes: QTBUG-82441 Task-number: QTBUG-83811 Change-Id: I16ecd2db55c6a834be6139ce4f3aae23446fed54 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fixup copyright headers and includesAllan Sandfeld Jensen2020-03-161-5/+5
| | | | | | | | From API review. Task-number: QTBUG-81853 Change-Id: Ib208a342edcaa9c48dde80ef02bc6f85e35d8029 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* PdfSelection: add selectAll() function; use in examplesShawn Rutledge2020-03-111-0/+1
| | | | | | | | The usual shortcut (control-A) now selects all text on the current page, it is highlighted, and it can be copied to the clipboard. Change-Id: I5e6d9cae675862808f8b9027cb47024ca65cf2fd Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QPdfDocument: check first page in load(), current page in render()Shawn Rutledge2020-01-271-0/+1
| | | | | | | | | | | | When a viewer application is opened with a book-sized PDF, there's no need to check hundreds of pages before we can render the first page. Using it in QPdfIOHandler is even worse because this check needs to be repeated each time we advance from one page to the next. But we do need to ensure that the page we want to render is available. Amends 945840bd067d9ca3179a667f48b451cc2087931b Change-Id: Ib6576b1b91c63c2b57893d14b05632eff8cc4a15 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Fix sync script warningMichal Klocek2019-11-251-0/+11
| | | | | | | Add missing "We mean it." Change-Id: Ib5efa6829148fcb1f58a252a839386067ffbf8a6 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add QtPdf and QtPdfWidgets modulesMichal Klocek2019-11-251-0/+100
This change adds two new modules to qtwebengine repository. New modules do not depend on webengine module, however webengine chromium source code and Chromium "gn" configuration is required to build QtPdf. Adding two unrelated modules to webengine might look crazy: however sharing gn build configuration and Chromium code base with necessary qt adaptations simplifies code maintenance and minimises required code checkouts. Back porting of security patches for Chromium also affects Pdfium. Moreover, Pdfium is no longer a separate project, but integrated into Chromium: therefore moving it out of Chromium source tree would require extra effort. Rename webengine-core feature to build-qtwebengine-core, this makes consistent feature naming with build-qtpdf At the moment two new modules have integrated build, with possible shortcuts: qmake -- --no-build-qtwebengine-core qmake -- --no-build-qtpdf Webengine build is disabled by default now. Change-Id: Iac3d9927d51f3ac316db0148d275eda843dcc19b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>