summaryrefslogtreecommitdiffstats
path: root/src/pdf
Commit message (Collapse)AuthorAgeFilesLines
* doc: Document QPdfBookmarkModel and QPdfLinkModelShawn Rutledge2022-06-063-1/+95
| | | | | | | | | | | QML docs were already in place since 303c25e79ab12d5d48523aa890f2091e98d3b560 and ccbd6fbdbe071f42e1c060ca579786758701f358; but QPdfBookmarkModel existed since 398880564621b06a79a4ba245baf350022ad438a (5ccb928983e8ff5e51989fab60ea413a5b418f29 in the qtpdf repo). Change-Id: Id3e91b4e98e25cf035868e55a22cf69262ee5afc Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Do not compile v8 for pdf by defaultMichal Klocek2022-06-041-0/+1
| | | | | | | | | | | We shipped qtpdf for 5.15 without v8. Now it disables all the extra xfa features by default. Fixes: QTBUG-102394 Fixes: QTBUG-102951 Pick-to: 6.3 6.2 Change-Id: Icd4784037f6db9b489d691c15d95e72563c16356 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Rename QPdfLinkModel::Role::Rect to RectangleShawn Rutledge2022-06-042-2/+2
| | | | | | | Roles are not abbreviated in general; this doesn't need to be either. Change-Id: I55a6fcbc4818d7363f1184b660948da4943c110b Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Add link role to QPdfLinkModel, providing a QPdfLink instanceShawn Rutledge2022-06-046-51/+74
| | | | | | | | | | | | | | | | | | | | | | We want to call PdfPageNavigator.jump(link) when a link is clicked; therefore PdfLinkModel needs to provide this object; therefore it makes sense to store the links as QPdfLink instances, and get rid of the redundant internal Link object type. But QPdfLink did not have storage for a QUrl until now. The textStart and textCharCount fields sounded useful, but in practice were set and not used. QPdfLink gains toString() and copyToClipboard() methods. Also removed some unused cruft in qquickpdflinkmodel. [ChangeLog][QtPDF] PdfLinkModel now provides a QPdfLink object for each link. QPdfLink now contains everything necessary to render delegates for links and search results, and handle clicking links; and there is a copyToClipboard() method for use in context menus, which will copy the text returned trom toString(), which is also invokable. Change-Id: Ifa5abe6df8f8d6f9ef98971044c26691ec4b9a36 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Redefine PdfSearchModel.currentResult as document-based; use PdfLinkShawn Rutledge2022-06-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PdfSearchModel.currentResult is now the index within the whole list of search results, rather than starting over from 0 on each page. This simplifies some code. The way that PdfMultiPageView uses PdfSearchModel, the currentPage property is read-only: it tells the page of currentResult (which we need in the view, because each page has the ability to show a current-search-result highlight shape, but only one page actually needs to show it). The controls in a viewer to iterate search results (up and down arrows in the footer) simply increment and derement currentResult; the currentPage property gets updated to tell the view which page currently holds currentResult; and the ListView highlight follows along in the sidebar too, because ListView.currentIndex is now bound to searchModel.currentResult. But in PdfScrollablePageView, we still need to bind the currentPage property, to get the currentPageBoundingPolygons property updated when we switch pages. Since that viewer only sees one page at a time, it's much more declarative to do it that way, rather than calling the invokable boundingPolygonsOnPage(int) function. Bindings get updated on their own; whereas in PdfMultiPageView it's a bit inelegant that we need to call boundingPolygonsOnPage() repeatedly, at the right times so that the highlights are never shown in the wrong places at the wrong time. It could be avoided if we had a separate per-page model object to filter the results from the main PdfSearchModel; but that would add significant API complexity, and perhaps be too confusing for anyone who tries to re-implement a QML-based viewer component. The current search result highlight now stays on the page where the user left it: scrolling manually to another page will no longer choose a current result on the new page, as it did before. This is more consistent with typical applications. A currentResultLink property is added, to make it easy to call PdfPageNavigator.jump(link), thus passing along the QPdfLink.rectangles. The same link object gets re-emitted in the PdfPageNavigator.jumped signal to tell the view to scroll in such a way as to get those rectangles visible in the viewport, via TableView.positionViewAtCell(). There are a couple of drive-by fixes: QQuickPdfSearchModel::documentChanged() doesn't need to be declared, because we are using the signal inherited from QPdfSearchModel. And const-correctness is improved in the implementation of boundingPolygonsOnPage(). [ChangeLog][QtPDF] PdfSearchModel.currentResult is now the result index within the whole set of search results rather than on currentPage; and changing currentPage no longer makes currentResult change. In the views, this means the current highlighted search result stays on the same page even when the user views a different page. Change-Id: I96957f50e703f62101b3d3c708ff5f27b162cd8d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Use QPdfLink in PageNavigator jump() / jumped(); QML viewsShawn Rutledge2022-06-043-7/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One reason for this is to use the new tableView.positionViewAtCell(.., TableView.Contain, offset, rect) to do less scrolling when iterating search results. Now in that case, the QPdfLink object contains correct rectangles, so that we can scale the first one and pass it directly to positionViewAtCell(). When clicking a hyperlink, the destination is a point rather than a rectangle; but positionViewAtCell with a subRect works better than calling it with just an offset, so we construct a small rectangle for that purpose. It's important that the QPdfLink object emitted in the jumped() signal must not contain any rectangles in this case, so that we can distinguish a hyperlink destination from a search-result destination. The QPdfLink object from PdfLinkModel has its own rectangle, but that's the place where the user clicks. When clicked, the view calls pageNavigator.jump(page, location, zoom), rather than the jump(QPdfLink) overload, so that rectangle is not passed along. In an onJumped() handler, we expect the rectangles to be the destination, if present; otherwise we fall back to using the location property, which is always the destination, never the source. In both cases, we need to grow the destination rectangle by jumpLocationMargin, because the offset argument to positionViewAtCell() is an offset, not a margin. But since the rectangle needs to be scaled from points to pixels anyway (according to the current renderScale), it's not much more trouble to add the margin. It looks better to avoid having a search result and its highlight rectangle banging up against the corner of the viewport: the margin lets the user see a bit of context on the page, and the highlight looks more distinct by being spaced out away from the edge. And since the margin gets added to the rectangle's edges, it makes more sense to use the (qreal) point type rather than vector2d. To make it possible to emit a QPdfLink object and access its properties in QML, it's now registered as a QML type. Fixes: QTBUG-102740 Change-Id: I74ccd11a106c5e49a0ce94eef9cf2d50992923b4 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Give QPdfPageNavigator::jump() a default value for zoomShawn Rutledge2022-06-042-3/+3
| | | | | | | | If the caller doesn't want to change it, it's easier to omit it rather than remembering that 0 is a special value. Change-Id: I851f678941e5144a9dea306fddba59fd15ed9939 Reviewed-by: Doris Verria <doris.verria@qt.io>
* Add QPdfDocument::pageLabel(int) and pageModel propertyShawn Rutledge2022-06-043-0/+119
| | | | | | | | | | | 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>
* Emit fully-qualified enum in QPdfPageRenderer::renderModeChanged()Shawn Rutledge2022-06-021-1/+1
| | | | | | | This fixes a clazy warning. Change-Id: I2f6d4dc394fbf81d5acbd4b013e935fe50300e0e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Rename QPdfDocument::pageSize() to QPdfDocument::pagePointSize()Shawn Rutledge2022-05-313-6/+6
| | | | | | | | It is in fact the size in points (1/72 of an inch), so we might as well be consistent about the naming between QML and C++ APIs. Change-Id: I8f8b05eeecc635a4d105558959834ae0e15add81 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Include moc filesAllan Sandfeld Jensen2022-05-311-0/+1
| | | | | | | | Faster to build and gives smaller binaries Fixes: QTBUG-103291 Change-Id: Iab52995e03c13a4c5b185750028c449a19d98d93 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Rename QPdfNavigationStack to QPdfPageNavigator; QML type tooShawn Rutledge2022-05-275-39/+39
| | | | | | | | | | | | | | | | | This might reduce some confusion about the fact that the back/forward "stack" isn't strictly a stack in the data structure sense: it's more like QUndoStack. It causes a QML source incompatibility relative to Qt 5, but keeps the C++ class name the same as it has been in QtPdf for a long time. Amends 3ad445f9f24a9d3f259ed1781460a63346a728e4 [ChangeLog][QtPDF] The PdfNavigationStack QML type has been renamed to PdfPageNavigator, matching the C++ type QPdfPageNavigator. These remember navigation history within a document, and are helpful to implement back/forward buttons similar to those on a web browser in both Qt Quick and widget-based viewer applications. Change-Id: Id8dc17aa416bb7064b1f0f300a47c07c83b7f47e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Move QPdf namespace enums into QPdfDocumentRenderOptions enum classesShawn Rutledge2022-05-246-175/+70
| | | | | | | [ChangeLog][QtPDF] The QPdf namespace is removed. Change-Id: I9c760c9187760a3a8356e90113ca1ab3535bed95 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QPdfBookmarkModel: make DisplayRole distinct from Title roleShawn Rutledge2022-05-242-2/+4
| | | | | | | | They both return the same title string, but we don't make the enum values identical, because roleNames() needs to have unique mappings. Change-Id: I6d19ed2e5a3f2f5ea83d8b542b3042e91c37c497 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Remove QPdfBookmarkModel::structureModeShawn Rutledge2022-05-242-37/+2
| | | | | | | | | | | Bookmarks are naturally a tree. It's unusual for a QAIM to have the internal ability to flatten a tree to a list, and we don't need it in any of our viewers or examples. This patch could be reverted if it turns out that anybody misses this feature; or else flattening could be done in a proxy model. Change-Id: I5cf60a39cb699932cc7c61e33a5129323d648344 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QPdfBookmarkModel: replace StructureMode enum with an enum classShawn Rutledge2022-05-242-6/+6
| | | | | Change-Id: I6335c1b13ef50dc04d50bd1ce66b3524e2615b3f Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QPdfDocument: use enum classesShawn Rutledge2022-05-247-92/+76
| | | | | Change-Id: Iad3f8da130abe86a464d63323920a2a39d6fa955 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Support cross-compilation on macOSMichal Klocek2022-04-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | So far we only supported a cross-compiling with universal builds, however qmake also supports 'regular' cross compilation (by setting '-device-option'). This is semi-supported with qt-cmake as we need to provide additional configure defines like: * CMAKE_OSX_ARCHITECTURES=arm64 * CMAKE_SYSTEM_NAME=Darwin * CMAKE_OSX_DEPLOYMENT_TARGET=10.14 It might seem to be a far fetched issue, however in case of webengine doing the cross compilation for only one architecture allows to save compile times when testing only arm64 builds. Note we do not need to create gn toolchains for that case, however unlike universal builds it requires host qt build for tools. Pick-to: 6.3 6.2 Change-Id: Ica8470fdd4cad4866c1470e0403ffd019eaf39a6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QPdfBookmarkModel: add location and zoom rolesShawn Rutledge2022-04-242-4/+56
| | | | | | | | | | | We need them for more accurate navigation. Switch to initializing BookmarkNode's variables where declared, while we're at it. Task-number: QTBUG-77510 Change-Id: Ia6762c9b6336c9148a85ad782e71e5b59feab754 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* doc: Add docs for QPdfViewShawn Rutledge2022-04-232-3/+7
| | | | | | | | Wrap some long lines in qpdfview.cpp, as a drive-by. Task-number: QTBUG-81560 Change-Id: Ia9865c42e48c81ac2c99b5cbe9d5a10beff40847 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Turn QPdfBookmarkModel::Role into an enum classShawn Rutledge2022-04-222-18/+19
| | | | | | | | | - link, search and bookmark models have similar role names now - being an enum class allows the role name to be shorter - the Role enum name is the same as the name in roleNames(), lowercased Change-Id: I2e710d7acb8479995d82ef2d324807b6cd4e10e5 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QtPDF: Get styles working again; remove visible hyperlink adornmentsShawn Rutledge2022-04-201-0/+0
| | | | | | | | | | | | | | | | | | | | | | | Update to versionless imports. The color type comes from the QtQuick import now. Add the styles to CMakeLists.txt so they get installed. Use SystemPalette rather than instantiating a Control. We'd probably better just assume that the PDF has hyperlinks decorated however the author wanted, rather than risking redundant underlines. Declare linkUnderscoreStrokeWidth: -1 since the ShapePath.strokeWidth docs tell us "When set to a negative value, no stroking occurs." But the user can turn them back on using a custom style. Update the screenshot: avoid showing off how bad the underscores looked. PdfPageView doesn't depend on Controls and doesn't import styles: it simply loses the light-grey rectangles around links. The cursor change still informs the user when the mouse is hovering a link. Pick-to: 6.3 Fixes: QTBUG-102303 Change-Id: Ifa4f9982bfaaf0e2e46230e8dbe30a5db7c9f592 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* doc: Add Qt Quick details to the Qt PDF module page; clarify examplesShawn Rutledge2022-04-171-0/+22
| | | | | | | | | The module is more about Qt Quick than about widgets nowadays. Also clarify on the Qt PDF Examples page that one example uses widgets and the other uses Qt Quick. Change-Id: I38a77a4290f9489ef17bf66fe3a0f69be9bd0e88 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* PdfQuick: deal with loading a different documentShawn Rutledge2022-04-122-0/+15
| | | | | | | | | When loading a new document, clear the navigation stack, reset the view to the upper-left corner, and clear the special device in PdfPageImage. Task-number: QTBUG-102294 Change-Id: I275b46f8958d4e8abe3814c1f358df5969c36d4d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QPdfDocument: qCDebug time for FPDF_InitLibrary and FPDF_DestroyLibraryShawn Rutledge2022-04-121-2/+8
| | | | | | | | FPDF_InitLibrary seems to take too long. Task-number: QTBUG-102394 Change-Id: Ia5b629885a5a8a50dfd787f370d85878ad043046 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* doc: fix QtPDF doc warnings and mistakesShawn Rutledge2022-04-083-4/+4
| | | | | Change-Id: Id2ce2bd8852c4051edd29bf474bac216ba14f2b5 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Move QQuickPdfNavStack core into QPdfNavigationStack; use in QPdfViewShawn Rutledge2022-04-084-327/+356
| | | | | | | | | | | | | | | QQuickPdfNavigationStack was implemented independently until now, but users will need the same functionality in widget-based PDF viewers. QPdfPageNavigation on the other hand may have eventually had the same aspiration, but was just a glorified up/down counter thus far, with questionable API; so we get rid of it, and make the API for page navigation as much the same as possible between Quick and Widgets. We rename push() to jump() along with removing the emitJumped argument. Now jump() always emits (so we have to be more careful when to call it). Change-Id: Icb07158a351e29b81e58ec037cd323bc0f54a1a1 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* doc: begin adding docs for MultiPageView component and exampleShawn Rutledge2022-04-073-0/+9
| | | | | | | Pick-to: 6.3 Task-number: QTBUG-81560 Change-Id: I062e022a97c146e9a746b6d6358868bfe0c0a7d7 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Expose PdfBookmarkModel to QML; use with TreeView in manual testShawn Rutledge2022-04-063-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | - TreeViewDelegate uses Qt::DisplayRole by default, so we need it to map to the text we want to display, in the roleNames() hash. But asking explicitly for the TitleRole is OK too (as before). - In QML, the document property must be a QQuickPdfDocument, whereas in C++ QPdfDocument is used directly; so we shadow the document property for QML. Therefore QML_EXTENDED(QPdfBookmarkModel) does not work: we need real inheritance to get real property shadowing. - Added tests/manual/quick/pdf/bookmarks.qml with a TreeView - Clicking the TreeViewDelegate expands the subtree if there is one; but it also goes to the destination in the PDF, whether there is a subtree or not. But this can be fixed in TreeViewDelegate. - Added tests/manual/quick/pdf/bookmarks-list.qml to test the case with structureMode: PdfBookmarkModel.ListMode (using ListView) test.pdf is uninteresting for this purpose: there is only one bookmark; but you can run these tests with an optional argument like this: qml bookmarks.qml -style Material -- ~/path/to/some.pdf qml bookmarks-list.qml -- ~/path/to/some.pdf Change-Id: I65d12a3d9b8ef0f0fa2bc99003430324fd759dcb Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QPdfBookmarkModelPrivate: stop inheriting QAbstractItemModelPrivateShawn Rutledge2022-04-062-25/+10
| | | | | | | | | | We try to avoid private API from other modules, for portability between different Qt versions. Task-number: QTBUG-102156 Change-Id: Ia95a026fbae946eba53ad6835c7615214d93ec62 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* doc: Document the QPdfSearchModel C++ classShawn Rutledge2022-03-312-0/+62
| | | | | | | | | | | PdfSearchModel already has QML docs since b6dd845ec4a6bfb6b620686681e20d38a2f24101; but QPdfSearchModel could also be used in widget applications (although we haven't added it to the widget example yet). Task-number: QTBUG-81560 Change-Id: I23adf4ef777542a7aea6ecade74ca583a0933d43 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Enable use of system ICU in QtPDFAllan Sandfeld Jensen2022-03-301-4/+8
| | | | | Change-Id: I88b402d3da4ec079a72ff6882e68f09b2d507446 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Adaptations for Chrome 98Allan Sandfeld Jensen2022-03-292-1/+1
| | | | | Change-Id: I607604f85a111a69da77ca949dddf3399b9721b3 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* QPdfDocument: replace QScopedPointer with std::unique_ptrShawn Rutledge2022-03-291-2/+2
| | | | | | | As suggested by the warning, because take() is deprecated. Change-Id: Ib7372ee6119cc0bb07380e49f94b16e2993f353a Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QPdfDocumentRenderOptions: pass by cref where still possibleMarc Mutz2022-03-241-3/+3
| | | | | | | | | | | | | The object is quite large (16 for QRect + 8 for QSize + 4+4 for flags = 32 bytes), and Clazy complains about passing it by value. Fix at least for the relational operators, where, granted, it makes least sense (them being inline). The other users are behind the ABI wall, though. Change-Id: I9a70d007cc1f90e3ee71d3522c02fd7efcbee6ba Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QPdfDocumentRenderOptions: fix compilation with QT_TYPESAFE_FLAGSMarc Mutz2022-03-241-1/+1
| | | | | | | | ... which is now enabled in headerscheck. Pick-to: 6.3 Change-Id: Ifee53c6ab0cff5d25928cdd4e569ce740d7a2362 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Combine QPdfDestination and QPdfSearchResult into QPdfLinkShawn Rutledge2022-03-2412-422/+248
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inheritance was a decent way to model this, conceptually. A hyperlink is modeled like the HTML kind: a region covering the source material that the user will click on, and a destination where we will jump when they click it; whereas a search result has the same information plus the text before and after the search text, so that we can show some context in a ListView with search results. By going this way, we need to document which fields we use which way under which conditions. But, we have a rule that value types cannot use inheritance, just in case the user would ever try to use them polymorphically (in spite of the other rule that we never pass value types by pointer, and thus there is no actual polymorphism), or just in case the destructor of the base class would not be called when a subclass value goes out of scope. Anyway, perhaps an upside is that this resembles a link in Xanadu, or in a fully-normalized database schema: an object that fully describes both ends of a connection, and thus is able to traverse either direction, in theory. (Although we don't really use it that way. The link-following behavior in a PDF viewer tends to be one-way, as in a web browser.) When using QAbstractItemModel (as in QPdfSearchModel and QPdfLinkModel), the cells in the "database" are accessed separately via the data() function, so there is no need for a transport object to hold a whole "row". That's OK for item views; but we need this link object for the purpose of less-clumsy C++ API, as a return value from a few functions. For example when implementing a viewer in QML, we use Repeater to instantiate Items for each hyperlink (decorations and a TapHandler), and Repeater uses the QAIM interface. But when implementing a widget-based viewer, it's better to call a hit-testing function like QPdfLinkModel::linkAt(pos) to find out whether a link exists at a particular mouse location; and that function can return a QPdfLink. In this case, the link will not contain contextBefore and contextAfter, because the viewer doesn't need them, and it's difficult to find this text in the PDF model. But QPdfSearchModel::resultsOnPage() and reultAtIndex() return link objects that do contain the context strings. We don't expect users to have made much use of these classes in C++ so far, because we prioritized QML API (which this change does not affect), and did not yet document how to use QPdfSearchModel and QPdfLinkModel in widget-based viewers. Fixes: QTBUG-98886 Change-Id: Ie68f9b893a342d145abac0b143e9254827c70bd7 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace outdated license headerKai Köhne2022-03-212-20/+26
| | | | | | | | | Replace outdated header.LGPL3 with header.LGPL. Amends 7b8832ca2 Change-Id: I6a7b4406413febe7cfaca7f5698e4c93692526b7 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* doc: Document the rest of the public API in QPdfDocumentShawn Rutledge2022-03-191-4/+49
| | | | | | | | Pick-to: 6.3 Task-number: QTBUG-81560 Change-Id: I145ff595e07c9e60139eb169832be86741698799 Reviewed-by: Luca Di Sera <luca.disera@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* PDF C++ classes: mark destructors with override keywordShawn Rutledge2022-03-184-4/+4
| | | | | | Fixes: QTBUG-98890 Change-Id: I30ceaeb978e430cf6dbad659023d012688c77b21 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Handle qtpdf compilation with static runtimeMichal Klocek2022-03-172-1/+10
| | | | | | | | | Add feature to enable compilation with static runtime. Fixes: QTBUG-94046 Pick-to: 6.3 Change-Id: I6e150cfaad020dfd942c45111139556b7e50dce5 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add bitcode support for qtpdf on iosMichal Klocek2022-03-172-1/+14
| | | | | | | | | | Adds -fembed-bitcode-marker for debug or -fembed-bitcode in case of release. Fixes: QTBUG-94368 Pick-to: 6.3 Change-Id: I65031a545517799245e8d08d79e78141d26e9c58 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add static builds for qtpdfMichal Klocek2022-03-093-3/+45
| | | | | | | | | | | | | | | | | | Add 3rdparty installed headers so static builds can use bundled qt libs. Fix static gn and archiver/librarian setup. Updates 3rdparty: * 5d88de975 Fix static build with qt3rdparty libs Task-number: QTBUG-87154 Task-number: QTBUG-88614 Pick-to: 6.3 6.2 Change-Id: Iad7682da92b558b500140f415acc0bc9c9a1c22e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QPdfDocument: avoid setStatus(error) before certainty of which errorShawn Rutledge2022-03-071-2/+5
| | | | | | | | | | | When a document requires a password, we will first see PDF_DATA_NOTAVAIL, but we should not call setStatus(QPdfDocument::Error) yet, because updateLastError() will discover that it requires a password immediately afterwards. This avoids showing the user an incorrect error dialog. Amends 9968e2578f96081d2a242340620fcb2b96d9a1d3 Change-Id: I2216017d417bb0bad707900ce8c745363a396d7d Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add QQuickPdfPageImage and use in the PDF viewer componentsShawn Rutledge2022-03-037-10/+172
| | | | | | | | | | | | | | | | | | | | | | | Image works fine, except that if QPdfIOHandler is not given an already-allocated QPdfDocument instance, it needs to construct its own. So we now have QPdfFile: a subclass of QFile acting as a wrapper, to carry the document instance (that the user has most likely declared) down into QPdfIOHandler::load(QIODevice *). Thus, in nontrivial PDF-viewing use cases, there is now usually only one multi-purpose document instance. And this takes care of viewing password-protected PDFs in the multipage example, because we already prompt for it and set the document.password property. In trivial use cases, it's OK to continue using Image, and QPdfIOHandler will still construct its own QPdfDocument instance if the QIODevice cannot be cast to a QPdfFile. Task-number: QTBUG-77506 Task-number: QTBUG-83988 Task-number: QTBUG-96574 Change-Id: I3adfa54c30b0baa5dedebcf3bc759758f136b757 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* PDF: Remove Q_FUNC_INFO from qCDebugShawn Rutledge2022-02-101-3/+3
| | | | | | | | They are redundant as long as you have %{function} in your QT_MESSAGE_PATTERN, and have configured with -developer-build. Change-Id: I89106bab0f4c1275633d7033761b9a5844df9403 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add QtPdf iOS buildsMichal Klocek2022-02-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | QtPDf iOS builds must support fat libs builds. Compared to 5.15 however this is done differently. Before we tweaked gn to compile multi arch with 'Xarch' parameter. This had few downsides as we could not determine which arch/cpu compiles given file as compilation was opaque to gn. The current approach is to follow mac universal builds, compile builds separately for each architecture and lipo the outcome. However, this introduces some issues as ios builds are static builds and creating lipo archive will gather object files, which should end up in final QtPdf lib instead. Therefore create multi arch object file instead of archive and use this one. Note the compiler now uses arch triple for Pdfium as Chromium does, however qt files still use 'arch' and '*-version-min' combination. Task-number: QTBUG-88614 Pick-to: 6.3 6.2 Change-Id: I7775c8b4d1554df497eb61fa6187f12c00b9032d Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Introduce gn complete static lib target for qtpdfMichal Klocek2022-02-042-2/+5
| | | | | | | | | | | | | | | | | | | | | | With 6.x we have gn-cmake integration which allows now in case of static builds to switch gn target output to static_library with 'complete static' option instead of shared_library. This way we can avoid installing dependencies in form of internal static Chromium archives as it was done in 5.15 in case of static builds. Unfortunately 'complete static' option can not be used with QtWebEngineCore build as it will exceed 4Gb static archive limitation on Windows, however it will work fine with QtPdf. Note the qtbase 3rdparty static libs have to be still installed in case of qt static build, this patch only eliminates need for Chromium specific ones. Task-number: QTBUG-88614 Pick-to: 6.3 6.2 Change-Id: I6fc4ce48c79a1631b013d0b29c190c62280f7304 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* Doc: Fix find_package() call for Qt PDFKai Köhne2022-01-161-2/+2
| | | | | | Pick-to: 6.3 6.2 Change-Id: Id19aa463db605c861a1bd3502eb964c8f9340e4d Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Minor. Fix cmake warningMichal Klocek2022-01-121-1/+1
| | | | | | Pick-to: 6.3 Change-Id: I940db4bc953db9e571370886f142387dce5f12bb Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>