summaryrefslogtreecommitdiffstats
path: root/examples/pdfwidgets/pdfviewer
Commit message (Collapse)AuthorAgeFilesLines
* Correct license for examples filesLucie Gérard2024-04-091-1/+1
| | | | | | | | | | | | | Example takes precedence over build system file type. According to QUIP-18 [1], all examples file should be LicenseRef-Qt-Commercial OR BSD-3-Clause [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I558c6f409a480835d335101577ae633194b0559d Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Doc: Move PDF examples to UI Components categoryKai Köhne2023-09-271-1/+1
| | | | | | Pick-to: 6.5 6.6 6.6.0 Change-Id: Id3279026fcc791a9bd5e3e51a7ba7dd3c4a6930c Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* QPdfPageSelector: port from is-a to has-a QSpinBoxMarc Mutz2023-08-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Yes, the class needs to inherit from QSpinBox in order to override the protected virtuals, but that doesn't mean a QPdfPageSelector should model is-a QSpinBox. E.g. the range of the QPdfPageSelector is taken from the QPdfDocument, and no good can come from a user changing it through the use of QSpinBox API, esp. if one thinks about the class being displayed as a native widget in QtDesigner. In a similar vein, the inheritance from QSpinBox leaves users wondering (and the docs didn't do anything to enlighten them) what properties are pertinent to the task at hand. setValue() to set the page index is ... meh, but still somewhat discoverable. But that text() is only QPdfDocument::pageLabel() if no affixes are set takes quite some digging. Part of this could be fixed by providing domain-specific properties like currentPage for value, but that would just increase the confusion, because those two properties would must needs exist on the same object. Instead, fix by moving the old QPdfPageSelector as QPdfPageSelectorSpinBox into qpdfpageselector_p.h, removing its pimpl and having QPdfPageSelector inherit QWidget instead, aggregating a QPdfPageSelectorSpinBox. This involves a few more objects (the widget, the layout), but gives QPdfPageSelector full control over its interface. Add a few salient properties (more can be added if needed, by copying them from QSpinBox or QAbstractSpinBox). Note how well the new API rhymes with QPdfPageNavigator in the connect() in pdfviewer example's MainWindow. Since we still store everything in QPdfPageSelectorSpinBox, but don't pimpl it anymore, QPdfPageSelectorPrivate can lose the q_ptr now, and merely contains the pointer to its QPdfPageSelectorSpinBox. This could be optimized further, by making QPdfPageSelectorSpinBox and QPdfPageSelectorPrivate the same class, but that's neither BC- nor SC-relevant anymore, and can be done later (or never, seeing as this widget is unlikely to be used more than a few times per application). Found in API-review. As a drive-by, port to the std-compatible subset of the QPointer API. Pick-to: 6.6 Change-Id: I0d82d098d38d5f2fcf7f1c8c9aed6e792a8deb2d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Doc: Update example category namesKai Köhne2023-08-101-0/+1
| | | | | | | | | | | | | | | | WebEngine examples are generally added to the new 'Web Technologies' category - only Nano Browser remains also in the 'Application Examples' category. The 2 Qt PDF examples are placed in the 'Graphics & Multimedia' category. This is not ideal, but from the existing categories the arguably best matching one. Pick-to: 6.5 6.6 Task-number: QTBUG-115174 Change-Id: I3824272f62a4940f91041c8694fd2a06929863ed Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Rename QPdfView::currentSearchResult() -> currentSearchResultIndex()Shawn Rutledge2023-08-021-1/+1
| | | | | | | | | | | | I don't think it was very confusing, but just in case we could want a currentSearchResult() returning the actual result object at some point. It was a suggestion from header review. Amends 288e9be6ba2be40761333036f3397298df5e1018 Pick-to: 6.6 Change-Id: Ie3eb500e3a79b80b8abafbe19c48b57c7e9d71be Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* doc: Provide a screenshot of the PDF Viewer widget example; rename pageShawn Rutledge2023-03-301-4/+2
| | | | | | | | | | | | | | | | 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>
* Add search feature to PDF widget exampleShawn Rutledge2023-03-1710-0/+203
| | | | | | | | | Task-number: QTBUG-16211 Task-number: QTBUG-77507 Fixes: QTBUG-92973 Change-Id: I650bed9392e5e098e46368c60fb7c5dbebde666f Reviewed-by: <irfan.omair@qt.io> Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Support DecorationRole for icons in QPdfDocument::pageModelShawn Rutledge2023-02-163-1/+47
| | | | | | | | ...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-8/+12
| | | | | | | | | | | | | | | | | | 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>
* Polish the PdfWidgets/PdfViewer exampleFriedemann Kleint2022-09-073-9/+33
| | | | | | | | | | - Use QCommandLineParser - Fix up QFileDialog handling - Small fixes Pick-to: 6.4 6.3 Change-Id: I0cbe30a0fb5c856805956970407aa526d1d93fa4 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Change the license of all CMakeLists.txt and *.cmake files to BSDLucie Gérard2022-08-261-1/+1
| | | | | | Task-number: QTBUG-105718 Change-Id: I2ad190e5536cdbdc8d2656e61892545d66911a02 Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Add license headers to cmake filesLucie Gérard2022-07-071-0/+3
| | | | | | | | | | | | 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: Set correct install path for Qt PDF examplesTopi Reinio2022-06-301-0/+1
| | | | | | | | | | | | | These examples do not share a common root directory, so use the \meta command to set the install path in \example documentation. This fixes the 'projectPath' attributes in examples-manifest.xml and makes the examples appear in Qt Creator. Pick-to: 6.4 Task-number: QTBUG-103221 Change-Id: I141882137eabc253ba355188a1f2672ef7c402a0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Use SPDX license identifiersLucie Gérard2022-06-226-271/+12
| | | | | | | | | | | 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>
* Rename QPdfNavigationStack to QPdfPageNavigator; QML type tooShawn Rutledge2022-05-272-12/+12
| | | | | | | | | | | | | | | | | 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>
* QPdfView: replace enums with enum classesShawn Rutledge2022-05-242-4/+6
| | | | | | | [ChangeLog][QtPDF] All enums are replaced with enum classes. Change-Id: I41063de084a23db657a24805ceaf22881f25c990 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QPdfDocument: use enum classesShawn Rutledge2022-05-241-1/+1
| | | | | Change-Id: Iad3f8da130abe86a464d63323920a2a39d6fa955 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* doc: Add docs for QPdfViewShawn Rutledge2022-04-231-1/+1
| | | | | | | | 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-221-2/+2
| | | | | | | | | - 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>
* doc: Add Qt Quick details to the Qt PDF module page; clarify examplesShawn Rutledge2022-04-171-1/+1
| | | | | | | | | 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>
* doc: fix QtPDF doc warnings and mistakesShawn Rutledge2022-04-081-9/+10
| | | | | Change-Id: Id2ce2bd8852c4051edd29bf474bac216ba14f2b5 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Move QQuickPdfNavStack core into QPdfNavigationStack; use in QPdfViewShawn Rutledge2022-04-087-227/+71
| | | | | | | | | | | | | | | 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>
* PDF widget example: switch to SVG iconsShawn Rutledge2022-03-2922-22/+38
| | | | | | | | | | | | | | | They look better on high-dpi displays, and come mostly from the KDE Oxygen theme, except that document-open.svgz is from https://commons.wikimedia.org/wiki/File:Gnome-fs-directory.svg For future reference: Nuvola icons have a similar style https://commons.wikimedia.org/wiki/Category:Nuvola_SVG_icons The UI file also has icon theme names specified now, so the icons ought to come from the system theme if one is set, and fall back to the SVG resources otherwise. Change-Id: I6d50f143c9d1f24e0ba87ea1506c1a35a47588d8 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix building PdfWidgets examplesAllan Sandfeld Jensen2022-03-141-1/+1
| | | | | | | | | Was missing a find package call. Pick-to: 6.3 Fixes: QTBUG-101290 Change-Id: I9b566b3644ab0713427ff559684a3f1bcb3d2349 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Improve examples CMakeLists.txtKai Köhne2022-02-251-10/+4
| | | | | | | | | | | | | | | | | - Remove "# generated from xyz.pro" comment from pro2cmake - Remove automatic use of CMAKE_AUTORCC - Only opt into CMAKE_AUTOUIC if .ui files are involved - Remove explicit setting of CMAKE_INCLUDE_CURRENT_DIR - Combine multiple find_package(Qt6 ... calls) - use REQUIRED COMPONENTS - sort components alphabetically - Fix wrong indentations - Use (only) one empty line after multi-line commands Pick-to: 6.3 Change-Id: I09083474432ce171e8ee1e28120b062f2ef3c052 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Use up-to date LGPL license headerKai Köhne2021-12-027-130/+228
| | | | | | | | 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>
* Doc: Fix qdoc warnings and enable zero warning limitVenugopal Shivashankar2021-11-151-5/+7
| | | | | Change-Id: Ifa2914e7bca9c224670a1891785d0ba8262cd61b Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Minor. Cleanup qt6_add_resources usageMichal Klocek2021-10-281-1/+1
| | | | | | | | We should not use qt6 prefixed functions in examples. Pick-to: 6.2 Change-Id: Ibf2618ef4f64b560decb219527d619aad680f216 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* CMake: Bump almost all cmake_minimum_required calls to 3.16Alexandru Croitor2021-09-241-1/+1
| | | | | | | | | | | | | Needed for subsequent change that will check and error out if the version is lower than 3.16. We do that to ensure all policies introduced by CMake up to version 3.16 have their behavior set to NEW. Pick-to: 6.2 Task-number: QTBUG-95018 Change-Id: I6385d1fc83af8a937f0e7987fade1178bfc9c487 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* Doc: Fix documentation warnings for Qt WebEngineTopi Reinio2021-08-231-3/+3
| | | | | | | Pick-to: 6.2 Task-number: QTBUG-95860 Change-Id: I5b1fd6a6e5f172724fcfbde1a791b342a7e1ff92 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Add QtPdf to cmake buildMichal Klocek2021-08-171-0/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Doc: Fix documentation issues for Qt WebEngineTopi Reinio2021-07-011-4/+4
| | | | | | | | | | API and documentation changes since 5.15 caused multiple warnings from QDoc; this change addresses most of them. Some warnings indicate missing documentation, those issues still remain. Pick-to: 6.2 Change-Id: I96be38b7daac37a7e35c149b4b3ec3f18c4415c9 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Update 'dev' dependenciesAllan Sandfeld Jensen2020-05-142-4/+4
| | | | | | | Including three compile fixes. Change-Id: I497ed359d229e869b67aa10e4114a37ceec4be97 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix building dev with newer QtBaseAllan Sandfeld Jensen2020-04-242-4/+4
| | | | | Change-Id: I0d52e4f6684425cb15319760e0001bdb13846997 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
* Doc: Add docs for the Qt PDF Viewer exampleLeena Miettinen2020-01-281-0/+108
| | | | | | Task-number: QTBUG-81560 Change-Id: I159747a097a6a6a28c2355e8ff6b6c59a4f3a29a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add QtPdf and QtPdfWidgets modulesMichal Klocek2019-11-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Port pdfviewer example to QPdfView widgetTobias Koenig2019-11-2510-479/+311
| | | | | Change-Id: Id651a2c179628506f0955751abda57cbae569ee9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix compilation with custom Qt namespaceTobias Koenig2019-11-253-0/+8
| | | | | | | | Fix the compilation of QtPdf examples when compiled against a Qt version that uses a custom namespace. Change-Id: I3bd8d89a3ad1e270ed1d54c2b0a458e967f21cca Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Add support for render rotation and flagsTobias Koenig2019-11-251-1/+1
| | | | | | | | | Extend the QPdfDocument::render() method with a parameter of new type QPdfDocumentRenderOptions to specify the rotation and additional render flags. Change-Id: I354acc7fad4d094a96cefcea4dfa3513f4955c47 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Add bookmarks view to pdfviewer exampleTobias Koenig2019-11-253-20/+121
| | | | | | | | Add a treeview to the pdfviewer example to show the usage of QPdfBookmarkModel Change-Id: Ia93d868655a74ea6c41bb28945fe16d0cc740410 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Improve the PDF viewer example aestheticsJake Petroules2019-11-252-7/+39
| | | | | | | | | | | Sets the window title as the title of the PDF document, enlarges the default window size, uses unified toolbars on macOS, extends the viewer area to the edges of the containing window, and removes the Windows 95 style shrunken frame around the PDF viewer. Change-Id: I38753a2b5492ac0cc0d2a11ae62011ac595a0e70 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com>
* install the pdfviewer example; provide examples subdirs .pro filesShawn Rutledge2019-11-2518-0/+989
Actually moving the files is unfortunately necessary because of a rule about having the source directory structure match the intended installation directory structure. It was intended to differentiate widget examples from future QtQuick examples, but now that distiction is being unfortunately lost in order to keep the directory structure as shallow as it can still be, after having to comply with the first rule. Change-Id: I831227d2be3c8f5cab55a98a531e16bcb3aa0303 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>