summaryrefslogtreecommitdiff
path: root/src/pdf
Commit message (Collapse)AuthorAgeFilesLines
* Fix use of system png for qtpdfMichal Klocek2023-05-161-0/+8
| | | | | | | | | | | | | | QtPdf has own png library which is controlled by pdfium_use_system_libpng and used by xfa. However skia dependency also pulls root third_party png and we need also use_system_libpng flag set accordingly. Add missing pdfium_use_system_zlib flag too. Fixes: QTBUG-112466 Pick-to: 6.5 Change-Id: I08b7b32e5fd0ffe08cf77421ff2f0965755304ca Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add system libtiff featureMichal Klocek2023-05-161-0/+4
| | | | | | | | | We use that feature when compiling pdfium for qtwebengine and qtpdfium if xfa enabled. Fixes: QTBUG-111626 Change-Id: I362739e7529f89b1705d3c25a1c9849b13a1a968 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Docs: Fix "Can't link to" example warningsSafiyyah Moosa2023-05-101-1/+1
| | | | | | | Task-number: QTBUG-113160 Pick-to: 6.5 Change-Id: Ic987711802db7eb32cdb15ac9f313d2203984981 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix build race condition between data_dep and WebEngineCore.stampMichal Klocek2023-05-031-1/+8
| | | | | | | | | | | | | For v8 context generator data_dep race condition occurs on universal builds. As data_dep is runtime dependency, it will be not included into our linker WebEngineCore.stamp, changing the behavior in gn would look ugly as it would require introducing another flag to just to handle this case to force this dependency for build time. Therefore add extra v8_context_snapshot.stamp to cmake to cover that case. Change-Id: Ia8b2320fc8e615235bde483d282dfca73a38f215 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QPdfNavigator: emit forward/backAvailableChanged when jumping pagesJoni Poikelin2023-04-201-4/+4
| | | | | | | | | | | | | | QPdfPageNavigator did not emit the page history signals when pages were jumped. This patch ensures correct signal emission in all cases. It adds a new auto test class for QPdfPageNavigator. Fixes: QTBUG-112614 Pick-to: 6.5 6.2 Change-Id: I67af5a4d22a8e76b9c12c72c168fa5b3b4390f2c Reviewed-by: Yigit Akcay <yigit.akcay@qt.io> Reviewed-by: Michael Brüning <michael.bruning@qt.io>
* Clear PDF search results on document page model changeMikolaj Boc2023-04-173-0/+15
| | | | | | | | | | | | Not clearing the search results leads to crashes when the incoming page model is larger than the outgoing model, due to internal state being still in sync with the old document, but the page count of the new document being used. Fixes: QTBUG-111067 Pick-to: 6.5 Change-Id: Ic81744ebe0cb7d1a152453721abd7d1b5c5fa2b9 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Resolve duplicate symbol errorAmir Masoud Abdol2023-04-141-1/+1
| | | | | | | | | | | When doing unity build, `CharacterHitTolerance` collides with similarly named variable in `qpdfdocument.cpp`. Pick-to: 6.5 Task-number: QTBUG-109394 Change-Id: If7ac4ec095c88bff38f3b62b4caac82f0bfd8368 Reviewed-by: Orkun Tokdemir <orkun.tokdemir@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* doc: Provide a screenshot of the PDF Viewer widget example; rename pageShawn Rutledge2023-03-301-0/+0
| | | | | | | | | | | | | | | | Let's be clear in the title that this is a widget-based example, as opposed to the Qt Quick example in the docs. The screenshot is from macOS 13.2.1. The 6.6 example has more features, so this screenshot looks a bit incomplete compared to that. Pick-to: 6.5 Task-number: QTBUG-81560 Change-Id: I28b50d608756f10967f1bf5f7ac72ec9a83d9417 Reviewed-by: Matthias Rauter <matthias.rauter@qt.io> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Require gn for generating docsMichal Klocek2023-03-301-0/+1
| | | | | | | | | | | | | Make sure gn is build before doc target, otherwise parallel top level build might not succeed. As configure runs the gn binary is not compiled so use scripting mode to execute gn call during build time. Pick-to: 6.5 Task-number: QTBUG-108751 Change-Id: I7e851de90e2a3ec52f5259d51f677b23d8245bcb Reviewed-by: Michael Brüning <michael.bruning@qt.io>
* doc: Add the QtPDF Licenses and Attributions sectionShawn Rutledge2023-03-285-0/+53
| | | | | | | Fixes: QTBUG-88482 Pick-to: 6.5 Change-Id: If58a8443afb38f372ca3dc7372472db888586dba Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Make QPdfLinkModel public and use in QPdfViewShawn Rutledge2023-03-175-101/+105
| | | | | | | | | Now you can click links on pages in PDF documents in QPdfView. Task-number: QTBUG-77511 Fixes: QTBUG-102760 Change-Id: I348dcfd906be088aa3fcbe53aec4628b521cc2f3 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Pass system library paths to cmakeMartin Negyokru2023-03-011-1/+1
| | | | | | | | | | | | Generate a new rsp file for each cmake target containing '-L' flags and pass them to cmake. Task-number: QTBUG-105053 Task-number: QTBUG-111225 Change-Id: Ib25c009795b776bc5f0f6e07fb89b932ef30b484 Reviewed-by: Michal Klocek <michal.klocek@qt.io> (cherry picked from commit a21742ef6064c1e84ebc43468d253dd14d86bf02) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add QtPdf android supportMichal Klocek2023-02-231-2/+4
| | | | | | Task-number: QTBUG-83459 Change-Id: I39915206859f031dd78798eeb7b2b49f4f148452 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Support DecorationRole for icons in QPdfDocument::pageModelShawn Rutledge2023-02-161-0/+26
| | | | | | | | ...and begin rendering thumbnails in the widget-based example by adding a QListView in IconMode. Change-Id: Ia0f446e48ce868e27cd7d64a3712a7db1b1e618b Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Add QPdfPageSelectorShawn Rutledge2023-02-162-0/+18
| | | | | | | | | | | | | | | | | | This is a QSpinBox subclass that shows PDF page "labels" rather than a 1-based or 0-based page index. If a book starts with Roman numerals in the preface, and then page 1 is the first page of Chapter 1, the spinbox should be in sync with the page numbers as printed on the pages, and with the labels that will eventually be shown under the thumbnails on the Pages sidebar tab. On the other hand, the user probably needs to see the 1-based page index somewhere, at least to be able to make sense of the print dialog, because there the range of pages to print will be 1-based. So we put the page index into the title bar: title, page label, index, count. Task-number: QTBUG-102271 Change-Id: Ic461094ba4caae3067409f7f436bd4e7504a4bdb Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Define an enum for FPDF rotation int valuesAxel Spoerl2023-02-142-16/+26
| | | | | | | | | | | FPDF uses int values defined in fpdfview.h:955ff, representing page rotation. Respecting coding style, this patch adds an enum in QPdfDocumentPrivate to introduce meaningful names instead of int values. Pick-to: 6.5 Change-Id: I54cefe336de3670026cfc4d7f4436e5898e43b54 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add option to build using system OpenJPEG 2Allan Sandfeld Jensen2023-02-131-0/+4
| | | | | | | | | | Adds a check on Unix system for the presence of a system OpenJPEG 2 library and builds against it if present. Task-number: QTBUG-63889 Pick-to: 6.5 Change-Id: I9fd90c96d733154b912acf4e9c7f06c17a39b244 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Retire the qt_parse_all_argumentsAmir Masoud Abdol2023-02-081-1/+1
| | | | | | | | | | | To do so, we need to deal with the macros a bit differently, so here, I replaced the macros with available utility functions, and added one for the QTWEBENGINEPROCESS_NAME. Fixes: QTBUG-110873 Task-number: QTBUG-99238 Change-Id: I29b41ffb8059511d2d93bfc01d40308aedaa8ad4 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Fix translation of QPdfLink::toString()Friedemann Kleint2023-01-071-6/+5
| | | | | | | | | | Use the same message text as in QML and allow for changing languages by removing the static string constant. Use 1 fractional digit for the point. Pick-to: 6.5 Change-Id: Iac3b5374e32a9a97af157c6ba6833ad845b02750 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Adaptations for 108-basedAllan Sandfeld Jensen2023-01-061-0/+6
| | | | | | | Pick-to: 6.5 Fixes: QTBUG-105147 Change-Id: I0022964903f3443cc97843c62468ab9be8ae2ed8 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
* QPdfDocument: make code locale-independentMarc Mutz2022-12-221-1/+3
| | | | | | | | | | | | | | | | | | | | The C toupper/tolower functions are locale-dependent. Given the right locale (Türkiye, e.g.), tolower(I) is either - ı (LATIN SMALL LETTER DOTLESS I; if representable in current charset) - I (unchanged; if it isn't) Both results are wrong for the present use-case, so use US-ASCII-only QtMiscUtils::toAsciiLower() to side-step the issue. Besides, feeding unfiltered char values into tolower() is UB. You'd first have to cast to uchar: https://en.cppreference.com/w/cpp/string/byte/tolower Task-number: QTBUG-109235 Pick-to: 6.5 6.4 Change-Id: I57887581ba2e548e978223337d681124b30bf754 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Port from container::count() and length() to size() - V4Marc Mutz2022-10-115-29/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to handle typedefs and accesses through pointers, too: const std::string o = "object"; auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); }; auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) { auto exprOfDeclaredType = [&](auto decl) { return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o); }; return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes)))); }; auto renameMethod = [&] (ArrayRef<StringRef> classes, StringRef from, StringRef to) { return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)), callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))), changeTo(cat(access(o, cat(to)), "()")), cat("use '", to, "' instead of '", from, "'")); }; renameMethod(<classes>, "count", "size"); renameMethod(<classes>, "length", "size"); a.k.a qt-port-to-std-compatible-api V4 with config Scope: 'Container'. Change-Id: I3e6fef8eca212da0c4f0b464545ba96183b4476f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Port from qAsConst() to std::as_const()Marc Mutz2022-10-071-1/+1
| | | | | | | | | | | | | | We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I4b5f85df579532c2af938fe70db945ba273782fb Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* doc: Mark all QPdfLinkModel docs internal for nowShawn Rutledge2022-09-071-8/+8
| | | | | | | | | | | So far we only have QML API, but we don't have a public header yet; so this class should not appear in public docs. Pick-to: 6.4 6.4.0 Task-number: QTBUG-77511 Change-Id: I1f0f5c6b625597a73a67a3019b9f8271ce9cea9e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Add the git repo URL for the Qt PDF examplesVenugopal Shivashankar2022-09-071-0/+1
| | | | | | | | | This should enable the readers to access the up-to-date example code. Change-Id: Ie62bdea39d1374b49f1b8f5bf576b27c8f37996f Pick-to: 6.3 6.2 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-263-3/+3
| | | | | | Task-number: QTBUG-105718 Change-Id: I2ad190e5536cdbdc8d2656e61892545d66911a02 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Move QPdfBookmarkModel::d_rolesNames to private classAllan Sandfeld Jensen2022-08-102-4/+4
| | | | | | | | | | To protect implementation internals From API Review Pick-to: 6.4 Change-Id: Idaf221546a1d7d00b433759b2f3160b915155cc3 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Change Rotation values from RotateX to ClockwiseXAllan Sandfeld Jensen2022-08-093-12/+12
| | | | | | | | To avoid syntax such as Rotation::Rotate, and made direction explicit. Pick-to: 6.4 Change-Id: Id7bd7024ba11cfe2f4f23061e4fb05f46d75061e Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Rename _Count to NRolesAllan Sandfeld Jensen2022-08-098-16/+16
| | | | | | | | | | Identifiers shouldn't really begin with underscore even if it works. It is reserved for compiler/library internals. Pick-to: 6.4 Change-Id: I17e1b3ce2dc19af036fcb13a6c90fc1f6f149e17 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add QT_NO_DEBUG_STREAM protectionsAllan Sandfeld Jensen2022-08-092-1/+6
| | | | | | | | So the header compiles with QDebug disabled. Pick-to: 6.4 Change-Id: I0f89dee4ff07734d53eee4dc5e2183633ee05da1 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Use SPDX license identifiersLucie Gérard2022-07-081-0/+3
| | | | | | | | | | | Ammend 9b9d789fcb8f63a8998f1eefe44f2a1c8156c362 : some files were still missing SPDX headers Pick-to: 6.4 Task-number: QTBUG-67283 Task-number: QTBUG-104589 Change-Id: Ia4d2aae636bbdb1a99c422e3b8d3f097c3af34d6 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Doc: Do not advertise Qt module includeKai Köhne2022-07-083-15/+0
| | | | | | | | | People should rather use class includes, like they are advertised in each class documentation. Pick-to: 6.4 Change-Id: I3fc26c2ff01e35595959878c392dcafa2527d29f Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Add license headers to cmake filesLucie Gérard2022-07-073-0/+9
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I118bd63694cfe2c9a413af4a38828a31727f8e86 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Doc: Fix linking issues on Qt PDF documentationTopi Reinio2022-07-051-1/+2
| | | | | | | | | | | | | These warnings were not captured by the documentation testing in CI. Fix or remove links to properties from inherited QML types, and remove \sa entries that are already linked to in the documentation. Fix incorrect \inqmlmodule argument for PdfPageImage. Pick-to: 6.4 Change-Id: If2c14d468a6dc3cd464ca4de1f4e39ad48d4d326 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Highlight the multipage pdf viewer exampleShawn Rutledge2022-07-051-0/+2
| | | | | | | | | | ...so that it shows up prominently on Creator's welcome page. Pick-to: 6.4 Task-number: QTBUG-81850 Task-number: QTBUG-103221 Change-Id: I4b61115b45eddb3142fdbc72701fcd005cea39a4 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* QPdfLinkModel: deal with flipped rectangle coordinatesShawn Rutledge2022-06-281-0/+6
| | | | | | | | | | Chromium's pdf/pdfium/pdfium_page.cc provides us a clue that this can happen: at least they seem to have found a need for a workaround there. Task-number: QTBUG-100630 Change-Id: I8b6091389d63687b4c6d9d31252b9b5a873347bc Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-2233-1208/+68
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I869ffda1080e283f231eb0dc4477b260f2054d99 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* 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>