summaryrefslogtreecommitdiff
path: root/src/pdfwidgets
Commit message (Collapse)AuthorAgeFilesLines
* Teach QPdfView to render search result highlightsShawn Rutledge2023-03-173-1/+100
| | | | | | | | | | | | | | | | | | The bounding boxes of all visible search results are filled with a translucent color on top of the page image, because we don't know whether the image is opaque or not. currentSearchResult is further highlighted by drawing bounding box borders. The colors are the same as PdfStyle.pageSearchResultsColor and PdfStyle.currentSearchResultStrokeColor, respectively. Perhaps they could be configurable somehow in the future, but it's not clear yet what API that ought to have, since we do not have suitable QPalette roles (except QPalette::Highlight, which is not translucent). Task-number: QTBUG-77507 Task-number: QTBUG-92973 Change-Id: I3df634229811e72d2d438a39997e0b4887d6bf11 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Make QPdfLinkModel public and use in QPdfViewShawn Rutledge2023-03-173-1/+88
| | | | | | | | | 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>
* Add QPdfPageSelectorShawn Rutledge2023-02-164-0/+192
| | | | | | | | | | | | | | | | | | 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>
* Port from container::count() and length() to size() - V4Marc Mutz2022-10-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* 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>
* Use SPDX license identifiersLucie Gérard2022-06-224-153/+9
| | | | | | | | | | | 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 QPdfDocument::pageSize() to QPdfDocument::pagePointSize()Shawn Rutledge2022-05-311-3/+3
| | | | | | | | 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>
* Rename QPdfNavigationStack to QPdfPageNavigator; QML type tooShawn Rutledge2022-05-273-14/+14
| | | | | | | | | | | | | | | | | 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-18/+18
| | | | | | | [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-8/+91
| | | | | | | | 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>
* Move QQuickPdfNavStack core into QPdfNavigationStack; use in QPdfViewShawn Rutledge2022-04-083-10/+10
| | | | | | | | | | | | | | | 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>
* QPdfView: scale page rendering according to devicePixelRatioShawn Rutledge2022-03-181-2/+2
| | | | | | | | | On high-dpi screens we want the rendered pixels to match device pixels. Fixes: QTBUG-86948 Pick-to: 6.2 6.3 5.15 Change-Id: I4879adc0aeb001750d42abc1e7d50ca3f11a5fe8 Reviewed-by: Morten Johan Sørvig <morten.sorvig@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-024-44/+56
| | | | | | | | 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>
* Remove the rest of qmake based configurationMichal Klocek2021-10-142-41/+0
| | | | | | | | | | The only not cover part in cmake port are: * ios builds for qtpdf * qt static dependecies for qpdf Pick-to: 6.2 Change-Id: Iefe624c35d847b4a9c3cd970192487340b1657f9 Reviewed-by: Michael Brüning <michael.bruning@qt.io>
* Rewrite gn-cmake integrationMichal Klocek2021-08-291-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous gn-cmake integration was driven towards having the complete cmake build tree which included gn build artifacts. These were marked as IMPORTED in cmake build files, this way cmake "knew" all object files and static libs coming from gn. To achieve that we needed to run the cmake configure twice. First to feed gn with the build information from cmake and then the second run to import all the build information to cmake based on gn run. As a side effect of this the first run cmake was creating incomplete targets, so we could use generator expressions to gather all the data needed for gn run. The second run of cmake was able to create fully initialized targets. We used 'external project' to run cmake the second time. This approach worked well when doing "module" builds and having two targets, one in the main project and one in external was not an issue. Moreover, this approach could be integrated nicely since CI does only "module" builds. Unfortunately "top level" builds are implemented to import all qt targets into one build tree. This created issue for qtwebengine since fully initialized targets were 'hidden' by 'external project' and including half baked (dummy) targets from the main project resulted in bunch of issues related to the dependency tracking and build race conditions. Also using 'external project' complicated installation rules and in the end installation worked differently than in other modules. With current approach we use response files, so we hide all build artifacts coming from gn and feed cmake with those response files. This way we run the cmake configure once and we create all the targets once. Using rsp files hacks linker options in cmake, so this approach is sub-optimal, however allows to have working "top level" builds. It is worth mentioning here that the final module linking has to take place with cmake's part of build since doing one static lib in gn is not possible due to the toolchain limitation (msvc is not able to process static libs over 4Gb and has no support for thin archives, so only a shared lib is doable at time of writing) Following changes are made: * remove 'external project' for qtwebengine target, we keep it however for ninja ,gn and a host project * call gn from cmake in a scripting mode during build and not configure run, this way BUILD.gn is assembled as a build step so after generator expressions are executed * BUILD.gn is assembled now from 4 files: - root template BUILD.root.gn.in - compiler data gn_config_c.cmake, gn_config_cxx.cmake - sources data gn_cofnig_target.cmake * since we use gn wrapper script use gn.args file to pass arguments instead of a command line, so this file can be now easily modified when running gn and ninja 'manually' * since a script mode does not support handling of properties with TARGET as such, use the DIRECTORY scope in some of our functions which handle GN_TARGET * use qt_build_repo() in main CMakeFile and remove all coin and top level build hacks * remove 'external project' for examples and tests, this is no longer required as all qt targets are not hidden by external project * remove leftovers from gn feedback call used for GN_TARGET * improve installation rules, WebEgineCore target is not by default installed during build, therefore we need to copy resources and translations to root so tests and examples still can be built without a module being installed first * adjust GN lookup paths, we look for gn in main configure and during scripting mode when gn is executed Fixes: QTBUG-94349 Fixes: QTBUG-94709 Fixes: QTBUG-94922 Fixes: QTBUG-94997 Fixes: QTBUG-95051 Fixes: QTBUG-95152 Fixes: QTBUG-95158 Fixes: QTBUG-95972 Task-number: QTBUG-95231 Task-number: QTBUG-95590 Pick-to: 6.2 Change-Id: I5e7a34287ee59d904103fe310fc7c6a36a8dfbc9 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Add QtPdf to cmake buildMichal Klocek2021-08-171-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPEAndreas Buhr2021-08-121-1/+1
| | | | | | | | | | | | | | Q_MOVABLE_TYPE was conceived before C++ had move semantics. Now, with move semantics, its name is misleading. Q_RELOCATABLE_TYPE was introduced as a synonym to Q_MOVABLE_TYPE. Usage of Q_MOVABLE_TYPE is discouraged now. This patch replaces all usages of Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE in qtwebengine. As the two are synonymous, this patch should have no impact on users. Pick-to: 6.2 Task-number: QTBUG-86829 Change-Id: I6cf26bb24c4d68cc3da85193cf6f8e63daeaa9d7 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Fix compilation after 757a9c21c1 in basePeter Varga2020-09-231-0/+1
| | | | | | | | | | | | Adaptations for the following qtbase changes: - acbf9a858b Cleanup QTypeInfo - 652bd1efca Make QStringList an alias to QList<QString> - 25351dcc54 Long live QKeyCombination! - ed8acbeb7c Automatically register data/debug stream operations in QMetaType - a735038376 Move QStateMachine from QtCore to QtScxml Change-Id: Ieb2677cd0572cc6dfe7be4b8f8dd4189a39bd3fe Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devMichael Brüning2020-07-241-0/+1
|\ | | | | | | | | | | | | | | | | Conflicts: src/core/compositor/delegated_frame_node.cpp src/core/core_chromium.pri src/core/render_widget_host_view_qt.cpp Change-Id: I9387151e9647c87fc387095e7b6d8d66560cdf71
| * Fix prl generation in sub modules of webengine repoMichal Klocek2020-07-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QtPdf and QtWebEngine builds are producing few libraries in one build. This creates some corner cases like prl file generation. Paths in prl files are replaced on installation with sed. Unfortunately this will not work well if we build libraries which depends on not yet installed libs, since prl files reused by build are not processed by sed. Add workaround in this case so all depend libs are aware of their static dependencies and generate correct prl files. Task-number: QTBUG-85616 Change-Id: I0dbeb96bccbc4865dd52dea7c5d619f8cda1a596 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Use QList instead of QVectorJarek Kobus2020-07-151-1/+1
| | | | | | | | | | | | Task-number: QTBUG-84469 Change-Id: I666a060351f73783e15e3f96884c9393a5cd7e46 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Adapt to newer dependenciesAllan Sandfeld Jensen2020-07-063-16/+10
| | | | | | | | | | | | Change-Id: I495880f56fbc10d8f332f26101f8a25c2a1c5631 Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io> Reviewed-by: Michal Klocek <michal.klocek@qt.io>
* | Add ; to Q_UNUSEDLars Schmertmann2020-06-271-2/+2
|/ | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: Id948c173695923a1ea83a2098bafc10cfd4dc22b Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Enum class QPdfPageRenderer::RenderModev5.15.0-beta2Allan Sandfeld Jensen2020-03-161-1/+1
| | | | | | | Avoid having the enum name in the enum values. Change-Id: Ida5b3405e6922eb1a2a37edc6fb650019254f4d4 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Add QtPdf and QtPdfWidgets modulesMichal Klocek2019-11-251-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Allow compile with gcc-4.8.5Martin Koller2019-11-251-1/+1
| | | | | | Change-Id: Ia3953e0318a97eabfd917dbefef3bbac65828287 Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com> Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
* Add initial version of QPdfView classTobias Koenig2019-11-255-0/+805
Change-Id: I9185320d8a4e725fdbbfe1fde205a2be3bc2113c Task-number: QTBUG-28886 Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>