summaryrefslogtreecommitdiffstats
path: root/src/pdf/qpdfdocument.h
Commit message (Collapse)AuthorAgeFilesLines
* Add QPdfPageSelectorShawn Rutledge2023-02-161-0/+1
| | | | | | | | | | | | | | | | | | 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>
* Rename _Count to NRolesAllan Sandfeld Jensen2022-08-091-1/+1
| | | | | | | | | | 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>
* Use SPDX license identifiersLucie Gérard2022-06-221-38/+2
| | | | | | | | | | | 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>
* Add QPdfDocument::pageLabel(int) and pageModel propertyShawn Rutledge2022-06-041-0/+15
| | | | | | | | | | | 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>
* Rename QPdfDocument::pageSize() to QPdfDocument::pagePointSize()Shawn Rutledge2022-05-311-1/+1
| | | | | | | | 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>
* QPdfDocument: use enum classesShawn Rutledge2022-05-241-13/+13
| | | | | Change-Id: Iad3f8da130abe86a464d63323920a2a39d6fa955 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Expose PdfBookmarkModel to QML; use with TreeView in manual testShawn Rutledge2022-04-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | - 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>
* PDF C++ classes: mark destructors with override keywordShawn Rutledge2022-03-181-1/+1
| | | | | | Fixes: QTBUG-98890 Change-Id: I30ceaeb978e430cf6dbad659023d012688c77b21 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Add QQuickPdfPageImage and use in the PDF viewer componentsShawn Rutledge2022-03-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Make default ctors implicitMarc Mutz2021-12-071-1/+2
| | | | | | | | | | Default ctors should be implicit, because users expect '{}' to call them. If they're explicit, because they're folded into the (QObject* parent) ctors, then that no longer works. Fixes: QTBUG-98881 Change-Id: Ie52812ba76ee0b489c75ecf48b0c048025fde8c7 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Use up-to date LGPL license headerKai Köhne2021-12-021-11/+14
| | | | | | | | Remove usages of outdated LGPL3 header that references LICENSES.LGPLv3 instead of LICENSES.LGPL3. For the examples, use BSD. Change-Id: I1fae49110160c1183327ec54c9dc447c69588a65 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add QtPdf to cmake buildMichal Klocek2021-08-171-0/+140
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>