summaryrefslogtreecommitdiffstats
path: root/src/printsupport
Commit message (Collapse)AuthorAgeFilesLines
* a11y: Align visual and focus order in print dialog's "Page" tabMichael Weghorn2025-11-241-20/+20
| | | | | | | | | | | | | | By default, the tab focus order matches the order in which widgets are created. While that could manually be overriden, just define the widgets in the .ui file in their visual order, to ensure that the combobox to set the unit to use receives focus before the "Page Size" combobox below it when using the Tab key to navigate through the dialog. Change-Id: Ib6130b71c80048019e7874e695a7767225da7cfa Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* a11y: Set buddies in print properties dialog's "Advanced" tabMichael Weghorn2025-11-241-0/+1
| | | | | | | | | | | | | Set the comboboxes for the advanced PPD options in the "Advanced" tab of the printer properties dialog as the labels' buddies, which also makes sure that the accessible relations between the label and the widgets are set. This makes screen readers like Orca on Linux announce the label text when the combobox receives focus, so the meaning/context becomes clear. Change-Id: I1b2b9f4ba682577673d97de66f5ad2fb0cc6ce83 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* a11y: Align visual and focus order in print dialog's "Job Options" tabMichael Weghorn2025-11-241-11/+11
| | | | | | | | | | | | | | By default, the tab focus order matches the order in which widgets are created. While that could manually be overriden, just define the widgets in the .ui file in their visual order, to ensure that the "Start" combobox receives focus before the "End" one below it when using the Tab key to navigate through the dialog. Change-Id: I362bd90df22dc7b3b7ebab1e7c704952bd3a7169 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* a11y: Set buddies in print properties dialog's "Job Options" tabMichael Weghorn2025-11-241-15/+30
| | | | | | | | | | | | | Set the widgets labelled by labels in the "Job Options" tab of the printer properties dialog as their buddies, which also makes sure that the accessible relations between the label and the widgets are set. This makes screen readers like Orca on Linux announce the label text when the widget receives focus, so the meaning of the widget becomes clear. Change-Id: I096d1e835b8d3aa9a081436c256933becdb6872a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* a11y: Set buddies in print properties dialog's "Page" tabMichael Weghorn2025-11-241-2/+8
| | | | | | | | | | | | | Set the comboboxes labelled by the "Pages per sheet" and "Page order" labels as their buddies, which also makes sure that the accessible relations between the label and the combobox are set. This makes screen readers like Orca on Linux announce the label text when the combobox receives focus, so the meaning of the combobox becomes clear. Change-Id: Ibf0df6970d7f80f047751be29cbe01ab796a377b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* a11y: Set buddy in print dialog's "Copies" panelMichael Weghorn2025-11-241-3/+6
| | | | | | | | | | | | Set the combobox labelled by the "Page Set" label as its buddy, which also makes sure that the accessible relations between the label and the combobox are set. This makes screen readers like Orca on Linux announce the label text when the combobox receives focus, so the meaning of the combobox becomes clear. Change-Id: I7f82b07e741b743268c4b6817ceed671ee2657c6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Build with QT_NO_URL_CAST_FROM_STRINGAhmad Samir2025-11-201-0/+1
| | | | | | | | | | | Can't mark the whole repo with that macro, because in corelib that would take out the QString conversion operator which is BiC. Add a hard build-time error if QT_NO_URL_CAST_FROM_STRING is defined in corelib, as requested in code review. Change-Id: Ia0e302a2f82b86800e84d15e86ab138f78d45e4d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Add alt text for QMake, QtOpenGl, and QtPrintSupportEren Bursali2025-11-182-3/+6
| | | | | | | | Adding alt texts for \image tags that were needed for qdoc Pick-to: 6.10 Change-Id: I71166238a7f7810e3c41ae944edda8d184836465 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix documentation for QPrinter::PrinterResolutionTomi Korpipaa2025-10-101-5/+5
| | | | | | | | | | | | | Documentation omitted the fact that PrinterResolution is not checked in QPdfPrintEngine code at all, and would end up using the default value set in the code. Pick-to: 6.8 6.10 Fixes: QTBUG-133410 Change-Id: I2424b46acf10db6da7d8e02b31132e6e0c273976 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Sami Varanka <sami.varanka@qt.io> Reviewed-by: Titta Heikkala <titta.heikkala@qt.io>
* Remove Qt::WindowType::Desktop in QPaintEngineMacAxel Spoerl2025-09-271-8/+1
| | | | | | | | | Qt::WindowType::Desktop is no longer a valid window type in Qt6. Remove its occurence in QPaintEngineMac. Task-number: QTBUG-140514 Change-Id: I651a71932e4512034f11689c0387a3698a600dfc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add security headers for src\printsupportSadegh Taghavi2025-09-2553-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | As defined in QUIP 23, security critical files should be marked with Qt-Security score:critical. This change also marks all non-critical files as significant (the default) to make it clear that all files have been considered. As all printing to the device using the input data falls under the responsibility of other modules, such as parsing a document and painting it to the device. There are no direct network access or parsing operations in the printing subsystem other than wrapping around the native APIs. Then we cannot mark anything here as Critical. There are some parsing functions like QPrintUtils::parsePpdResolution, QCUPSSupport::findPpdOption, and QCocoaPrintDevice::defaultColorMode(), but all rely on the native ppd APIs. Fixes: QTBUG-134646 Pick-to: 6.10 6.9 6.8 Change-Id: Ic02a81051f4a03f9caf188f091dcbf29f8094ed1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Gui: make QtGui unity buildable on windowsTim Blechmann2025-07-311-1/+1
| | | | | | | | | * add consistent declarations for qt_pixelMultiplier / qt_regionToPath * exclude qwindowsfontdatabasebase.cpp due to duplicate OS2Table Pick-to: 6.10 Change-Id: Ica7e7143838241f0b7a0d6dca6b65fefbffec6d0 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Remove year from Qt Copyright in REUSE.tomlLucie Gérard2025-07-091-4/+4
| | | | | Change-Id: I2d5ec5fa766857e49dfca84838847ecdba8a6545 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Use QPainter::brushOriginF() where appropriateChristian Ehrlicher2025-06-251-2/+2
| | | | | | | | Replace QPainter::brushOrigin() with brushOriginF() to not loose precision. Change-Id: I86f9e4c3399d32755f0b2b062ad7654149edab1b Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Doc: Enable automatic linking to sources on code.qt.ioTopi Reinio2025-05-271-0/+3
| | | | | | | | | | | | Since 6.10, QDoc is capable of generating links to the declaration in the source code for each documented C++ API entity in their `Detailed description`. Add the required configuration to enable this feature in online documentation builds. Change-Id: Iaafabc5aea50a6cd72549bb1c04007bb4de498ca Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QPrintPreviewDialog: Improve i18n for percent valueEmir SARI2025-04-031-3/+10
| | | | | | | | | This fixes the initial percent value being in the wrong format for languages that have a different format set. Also enables locale-aware decimals separator. Change-Id: I77db487635284e58ed47ed3807fe4390d8d97123 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Replace variable length array in qt_mac_draw_pattern with QVarLengthArrayTor Arne Vestbø2025-04-031-2/+2
| | | | | | | Pick-to: 6.9 6.8 Change-Id: I1869ba14cdddb23cd903013fb6d160e24ac72967 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* rely on CUPS for multiple page ranges in unix version of QPrintDialogAlexander Stippich2025-03-231-4/+2
| | | | | | | | | | | | | | | | | | | Since the introduction of QPageRanges with Qt6, multiple/arbitrary page ranges are broken in the unix implementation of QPrintDialog due to a possible double application of the page ranges: on the application side and on the server side with CUPS. Reason for this is that the QPrinter::PrintRange is set to PageRange instead of AllPages. The latter is needed when relying on the CUPS server-side page range. However, the server-side page range is always applied later on. Restore the behavior of Qt5 and set the PrintRange to AllPages for multiple/arbitrary page ranges and rely on the server-side filtering with CUPS. Pick-to: 6.9 6.8 Change-Id: I1b85552a8cf2509b11a81db028f957584043f3ee Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: David Faure <david.faure@kdab.com>
* Correct doc/images licensingLucie Gérard2025-02-181-6/+0
| | | | | | Pick-to: 6.9 6.8 Change-Id: I202366f8294920fa4ac15f95a4352d5c56c1a6cd Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Make module ready for source SBOM checkingLucie Gérard2025-01-271-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | This includes: - turning VERIFY_SOURCE_SBOM ON - adding exception to the licenseRule.json files - correcting the licensing given via REUSE.toml files - renaming license files not located in LICENSES folder. They need to be named LICENSE. to be ignored by reuse and excluded from the source SBOM. The name are updated in the corresponding qt_attribution.json A lot of files are skipped during the license test, but all are present in the source SBOM. This is why correction are needed before turning the source SBOM check on. [ChangeLog][Third-Party Code] Renaming the license files with prefix LICENSE. to have them ignored by reuse tool. Task-number: QTBUG-131434 Pick-to: 6.9 Change-Id: Iab517215bb10a17357d2d2436bba8d3af76e5cd1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Docs: Add that Qt Print Support is not available on AndroidNicholas Bennett2025-01-211-1/+5
| | | | | | | | | Created a list and added Android to the existing mention of iOS. Fixes: QTBUG-132742 Pick-to: 6.9 6.8 Change-Id: I6e906980d28b54daf18c019eb9299a9d67daef3d Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* QPrinterInfoPrivate: code tidiesGiuseppe D'Angelo2025-01-082-6/+1
| | | | | | | | Make the constructor explicit, and remove the unncessary declaration of the destructor (turning the type into a RO0 type). Change-Id: I485d2c5f21d3a1972dbdb348ce3d7f3a15bd6275 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace qgetenv() calls converted to QString with qEnvironmentVariable()Thiago Macieira2025-01-011-1/+1
| | | | | | | | It's slightly more efficient. Pick-to: 6.9 Change-Id: Id5ac04fc27eee108c8e5fffd786c3d5f793a0a9d Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Unix printing: Check for a valid page range before accepting dialogJonathan Marten2024-12-041-7/+10
| | | | | | | | | | | | | | | | | | QPrintDialog::accept() checks for valid page ranges if the "Pages" option is selected, but it did that before calling setupPrinter() to read the settings from the user input. The page ranges would not yet have been parsed at this point, so giving the error message whenever this option is used even if a valid page range string is entered. Perform an equivalent check before the dialog is accepted: that is, that the entered page range string is not empty and that it can be parsed to a valid QPageRanges. Pick-to: 6.8 Fixes: QTBUG-112346 Change-Id: Idc1a3154055a425967596d66f26477e41b0b138b Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: David Faure <david.faure@kdab.com>
* Replace QPair/qMakePair with std::pair in qtbase/printsupportIsak Fyksen2024-11-133-7/+7
| | | | | | Task-number: QTBUG-115841 Change-Id: If36354196f27e598421da695b2accfb9fc581bb6 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Add REUSE.toml filesLucie Gérard2024-11-051-0/+20
| | | | | | | | | | | | | | | | | | | | | Those files are read by reuse to complement or override the copyright and licensing information found in file. The use of REUSE.toml files was introduced in REUSE version 3.1.0a1. This reuse version is compatible with reuse specification version 3.2 [1]. With this commit's files, * The SPDX document generated by reuse spdx conforms to SPDX 2.3, * The reuse lint command reports that the Qt project is reuse compliant. [1]: https://reuse.software/spec-3.2/ Task-number: QTBUG-124453 Task-number: QTBUG-125211 Pick-to: 6.8 Change-Id: I01023e862607777a5e710669ccd28bbf56091097 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Mark Cups::Cups optional target when building for non-APPLE systemsAlexey Edelev2024-09-241-2/+7
| | | | | | | | | | | | | | | | | | Relax the dependency on Cups for PrintSupport module on non-APPLE platforms. 30bb15e7bf42a07b49700b6e822513f125d9ed4d added the missing dependency for the PrintSupportPrivate target, but made it required. In general users not necessarly need the Cups found when linking PrintSupport on non-APPLE platforms. So we may mark Cups optional. We also need Cups as the required dependency when Qt is built statically, since then QCupsPrinterSupportPlugin will require the library to be found. Amends 30bb15e7bf42a07b49700b6e822513f125d9ed4d Pick-to: 6.5 6.7 6.8 Change-Id: Ia31d52f7beb9fab6ffa5123147a243f5be6345ef Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Doc: Remove usage of defunct QDoc commandPaul Wicking2024-08-281-2/+0
| | | | | | | | | | | | | | The QDoc command `\tableofcontents` was rendered useless by a change more than a decade ago. Remove the use of `\tableofcontents` as it serves no purpose, and ensure that the surrounding context still makes sense for the reader, by removing preceding text that refers to a non-existing table of contents, such as `Contents:`. Task-number: QTBUG-128173 Pick-to: 6.8 Change-Id: Ibb5a6af0e80f70fa487cdf6a7e38009a9ef60cbf Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Manage the PrintSupport dependencies on Cups correctlyAlexey Edelev2024-06-241-0/+13
| | | | | | | | | | | | | Add the missing interface include directories to PrintSupportPrivate and record the dependency on Cups package in PrintSupport if the cups feature is enabled in UNIX systems. PrintSupport doens't require the Cups library to be linked, but still rely on it's headers in the private part. Pick-to: 6.8 6.7 6.5 Fixes: QTBUG-126594 Change-Id: I9409fedc0f1e457ab740a40c18a04e31be074b02 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove GENERATE_CPP_EXPORTS argumentAlexey Edelev2024-06-121-1/+0
| | | | | | | | | The behavior that argument was enabling is the default one now. Pick-to: 6.8 Task-number: QTBUG-90492 Change-Id: I11711d4c794f0b22169abb595b8ffad2eeb1300d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* iOS: Enable the Qt Print Support moduleTor Arne Vestbø2024-05-297-11/+11
| | | | | | | | | | | | | | | | | | | | | | | The print support module was disabled for the initial port of Qt for iOS due to the lack of a native print backend and native print dialogs, as we have on macOS. However, even lacking these we should be able to offer the print to PDF feature, with widget based print dialogs. We can do so by opting in to the generic Unix print dialogs and backends, as these do not have a hard dependency on CUPS. Longer term we should adopt UIPrintInteractionController, UIPrinterPickerController, and UIPrinter, but that's a bigger task. [ChangeLog[iOS] The Qt Print Support module is now enabled, allowing printing to PDF. Printing to system provided printers are not yet supported. Fixes: QTBUG-125581 Change-Id: I5bc143e47c7277b3cea52760672ac4d0c8a7a898 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Emit QPrintDialog::accepted(QPrinter*) before QDialog::finishedTor Arne Vestbø2024-05-271-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | As part of d8bbb5ee0e60d44a70d29306e607a59caf7fe5bc the order of QDialog::accepted/rejected and QDialog::finished was changed so that the latter came last. This has been the behavior now for the entire Qt 6 series. QPrintDialog didn't pick up on this new behavior, and was emitting the QPrintDialog::accepted(QPrinter*) signal after calling the dialog's done() method, which resulted in emitting finished before the QPrintDialog printer-specific accepted signal. Clients such as the textedit example, who would "clean up" in finished() would then crash when processing the accepted signal. We now emit QPrintDialog::accepted(QPrinter*) at the same time as the dialog's accepted signal. The natural place to do this would be the QPrintDialog constructor, but that's spread out and duplicated between all the platform specific print dialog implementations, so we do it via a single shot connect instead in QPrintDialog::done. [ChangeLog[Print support] QPrintDialog::accepted(QPrinter*) is now emitted before QDialog::finished, in line with QDialog::accepted. Pick-to: 6.7 6.5 Change-Id: Idade32b667bdf7b81845025b8d83f08a551d32bb Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Add -Wweak-vtables to headerscleanJesus Fernandez2024-05-193-2/+18
| | | | | | | | | | | | | | | | | | | This requires some fixes in several classes that are also included in this patch. The QTestEvent hierarchy is all-inline and changes layout depending on QT_GUI_LIB and QT_WIDGETS_LIB, so we can't just export it. Suppress the warning in that header for now. Created QTBUG-104486 to track a fix for the real issue. The QFutureInterface hierarchy is also all-inline, but templates, so doesn't trigger, except the <void> specialization. Created QTBUG-125115 to track a fix for the real issue. Done-with: Marc Mutz <marc.mutz@qt.io> Task-number: QTBUG-45582 Change-Id: I96b3e109aa989b70e0d4809b90bd53a369e50d55 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* print: Clamp margins entered by the user in the page setup dialogJarkko Koivikko2024-04-254-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The current functionality discards all margins if any values fall outside the minimum or maximum limits. This can confuse and frustrate users since the Windows native page setup dialog doesn't enforce minimum values. Introduce a new parameter outOfBoundsPolicy for the set margins functions in the QPageLayout: - OutOfBoundsPolicy::Reject The old behavior rejecting out of bounds values. - OutOfBoundsPolicy::Clamp The new behavior for clamping the values. The OutOfBoundsPolicy is applied only in StandardMode to maintain backwards compatibility in FullPageMode, where all margins are accepted. Use the new Clamp policy in the printsupport where the clamping is necessary. Maintain binary compatibility by putting the declaration of the old symbols without policy parameter behind QT_GUI_REMOVED_SINCE, and implement them in removed_api.cpp to call the new versions. Task-number: QTBUG-122410 Change-Id: I06aee292c1daff2863502f471b03798dafbcd81b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Long live [[nodiscard]] QFile::openGiuseppe D'Angelo2024-04-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having already caught some bugs in real code because of unchecked calls to QFile::open, this commit marks QFile::open (and open() in other file-I/O classes) as [[nodiscard]]. Since it's going to raise warnings, the plan is to keep the existing behavior up to and including the next LTS. Then the warnings will switch on by default. All of this is protected by system of macros to opt-in or opt-out the behavioral change at any time. A possible counter-argument for doing this is that QFile::open is also used for opening files in the the resource system, and that opening "cannot fail". It clearly can, if the resource is moved away or renamed; code should at a minimum use a Q_ASSERT in debug builds. Another counter-argument is the opening of file handles or descriptors; but again, that opening may fail in case the handle has been closed or if the flags are incompatible. --- Why not marking *every* open() override? Because some are not meant to be called directly -- for instance sockets are supposed to be open via calls to `connectToHost` or similar. One notable exception is QIODevice::open() itself. Although rarely called directly by user code (which just calls open() on a specific subclass, which likely has an override), it may be called: 1) By code that just takes a `QIODevice *` and does something with it. That code is arguably more rare than code using QFile directly. Still, being "generic" code, they have an extra responsibility when making sure to handle a possible opening failure. 2) By QIODevice subclasses, which are even more rare. However, they usually ignore the return from QIODevice::open() as it's unconditionally true. (QIODevice::open() doesn't use the protected virtual pattern.) I'll try and tackle QIODevice in a future commit. [ChangeLog][QtCore][QFileDevice] The open() functions of file-related I/O classes (such as QFile, QSaveFile, QTemporaryFile) can now be marked with the "nodiscard" attribute, in order to prevent a category of bugs where the return value of open() is not checked and the file is then used. In order to avoid warnings in existing code, the marking can be opted in or out, by defining QT_USE_NODISCARD_FILE_OPEN or the QT_NO_USE_NODISCARD_FILE_OPEN macros. By default, Qt will automatically enable nodiscard on these functions starting from Qt 6.10. Change-Id: Ied940e1c0a37344f5200b2c51b05cd1afcb2557d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* print: windows: Fix setting page orientationJarkko Koivikko2024-04-121-1/+1
| | | | | | | | | | | | | | | Previously when PPK_Orientation property was set, updateMetrics() was called before doReinit() and updateMetrics() used physical dimensions of the DC initialized with previous orientation, which resulted in miscalculation of m_paintRectPixels, origin_x and origin_y variables. This bug manifested itself as all sorts of weird behavior, such as unexpected margins when changing paper size and printing beyond paper margins. Pick-to: 6.7 6.5 Change-Id: I2d0e104bee11165e3541e7f3119b29edd4b882c8 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Honor QPrinter::setFullPage(true) on Windows too (no margins)David Faure2024-03-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | fullPage means the print engine shouldn't add any margins, the application will take care of that. That's already what happens on Linux and Mac, but the Windows print engine was offset-ting everything to the bottom right by the value of the margins, erroneously. As noted in QTBUG-95927, the workaround for this bug was to call printer.setPageMargins(QMargins(0,0,0,0)); when using printer.setFullPage(true), and this fix is compatible with that workaround, existing apps won't be broken. [ChangeLog][QtPrintSupport][Windows] setFullPage(true) now behaves as expected, i.e. the QPrinter margins are ignored and the drawing's (0, 0) is the topleft corner of the page. This is what setFullPage(true) is documented to do, and how it was already working on other operating systems. If this causes regressions in your application, consider removing the call to setFullPage(true) so that the painting honors the margins again. Fixes: QTBUG-119003 Fixes: QTBUG-95927 Change-Id: Ia3d621302bf752833002614303dd64128027163a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Fix previewing a preview on reentranceAllan Sandfeld Jensen2024-03-013-0/+9
| | | | | | | | | | Make the print preview more tolerant of reentrance by avoiding previewing itself. Change-Id: Ia4774cb51bdda7d311414c4e2f9c2bfbed4f187f Pick-to: 6.7 6.6 6.5 Fixes: QTBUG-122749 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Correct doc snippet licenseLucie Gérard2024-02-281-1/+1
| | | | | | | | | | | | | | All file under doc/snippet should be license as Documentation snippets and according to QUIP-18 [1] this is 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: I76eedfb6b15c4091f726a5652e3530001d7cdaf7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove extra semi-colonsTasuku Suzuki2024-02-061-1/+1
| | | | | Change-Id: I92fddb36cd136fd1bd627955f15d0559b9942d7e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QPrintEngine: emit CMYK colors as CMYK when printing in PDFGiuseppe D'Angelo2024-02-031-1/+1
| | | | | | | | | When printing in PDF, QPrintEngine used to convert every color to RGB. Stop doing that -- if the user paints with a CMYK color, emit it in CMYK. Change-Id: I2714d243103501e4602dec9f225f5379ed8f7dec Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Add CMYK support for pens/fills in the PDF engineGiuseppe D'Angelo2024-02-023-2/+28
| | | | | | | | | | | | | | | | | | | | | | | Insofar, painting with a CMYK color (pen/brush) was completely ignored by QPdfWriter, although the PDF format can faithfully represent CMYK colors. This commit adds support for CMYK colors in the PDF engine. The support is opt-in, in the name of backwards compatibility; an enumeration on QPdfWriter controls the output. QPrinter was using a hidden hook in QPdfEngine in order to do grayscale printing; this hook can now be made public API through the same enumeration. This work has been kindly sponsored by the QGIS project (https://qgis.org/). [ChangeLog][QtGui][QPdfWriter] QPdfWriter can now use CMYK colors directly, without converting them into RGB colors. Change-Id: Ia27c19ec81a58ab68ddc8b9c89c4e57d7d637301 Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* printpreview: Avoid rendering artifacts while scrolling zoomed viewJarkko Koivikko2023-12-211-1/+0
| | | | | | | Fixes: QTBUG-120107 Pick-to: 6.7 6.6 6.5 Change-Id: I4de062c9ded47cc911abc0aebf1b1b7f57ed7e09 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QWin32PrintEnginePrivate: Properly initialize flags and fields of DEVMODEFriedemann Kleint2023-11-223-0/+19
| | | | | | | | | | | | | | | | | | - Set the respective flags of dmFields in QWin32PrintEngine::setProperty() - Properly initialize newly allocated structs This is merely for completeness, the allocation code paths are not currently hit since the DEVMODE from the current printer is used, which also has most dmFields bits set. Pick-to: 6.6 Task-number: QTBUG-114604 Change-Id: I880d9faef9b1d491db4accd53d0d75b718f7f244 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
* QWin32PrintEnginePrivate: Brush up the codeFriedemann Kleint2023-11-223-68/+56
| | | | | | | | | | | | - Use nullptr - Use member initialization - Remove C-style casts Pick-to: 6.6 Task-number: QTBUG-114604 Change-Id: I6f9519010bfbd7c5afa07d9a8752b40c3b29673e Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* QPrinter: allow any margins when setting a fullpage QPageLayoutEirik Aavitsland2023-11-091-0/+4
| | | | | | | | | | | | By default, QPrinter::setPageLayout correctly rejects a layout that specifies margins outside the printable area. However, when the layout specifies fullpage mode, that check should be skipped, since then one should be allowed to target the unprintable area, by definition. Fixes: QTBUG-118580 Pick-to: 6.6 6.5 Change-Id: I8bd93d11aefee0344725ac51c2490d029657f483 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Use Desktop Handle in case of no valid app HWND for QPrintDialogWladimir Leuschner2023-11-081-1/+6
| | | | | | | | | | | | | The call Win32 API PrintDlgEx needs in the PRINTDLGEX struct a valid window handle for hwndOwner to show up. In case there is no window created, as seen in the example, the call to PrintDlgEx fails with COM error code E_HANDLE. Using the Desktop HWND, in case of no valid app HWND creates a valid call to PrintDlgEx with showing up the dialog. Pick-to: 6.6 Fixes: QTBUG-118899 Change-Id: Ie7009c8e6e8285a0b6312e310b3d065c532f9e17 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* print: Use transient parent for native print dialog if providedJarkko Koivikko2023-10-261-13/+16
| | | | | | Pick-to: 6.6 Change-Id: I6703784d57dab732e5d501cec0d1231b564a065e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Include what you need: <QPointer>Marc Mutz2023-10-122-0/+4
| | | | | | | | | | | | | | | | | | | | | | | All these TUs relied on transitive includes of qpointer.h, maybe to a large extent via qevent.h, though, given that qevent.h is more or less the only public QtBase header that includes qpointer.h, something else seems to be at play here. Said qevent.h actually needs QPointer in-name-only, so a forward declaration would suffice. Prepare for qevent.h dropping the include. The algorithm I used was: If the TU mentions 'passiveGrabbers', the name of the QEvent function that returns QPointers, and the TU doesn't have qpointer.h included explicitly, include it. That may produce False Positives, but better safe than sorry. Otherwise, in src/, add an include to all source and header files which mention QPointer. Exception: if foo.h of a foo.cpp already includes it, don't include again. Task-number: QTBUG-117670 Change-Id: I3321cccdb41ce0ba6d8a709cea92427aba398254 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Doc: Fix warnings and linking issuesTopi Reinio2023-10-091-0/+3
| | | | | | | | | | | | | | | | | | | | Remove or replace links to examples that were removed or moved under manual tests. Replace code snippets that were quoting the now-missing examples. Fix documentation of QSet::removeIf(). Fix typo in documentation macro: Unknown command '\examplecateogry'. Add qtopengl, qtshadertools dependencies to Qt Widgets documentation project to enable correct linking to those topics. Mark all documentation sets in qtbase as free of warnings. Pick-to: 6.6 6.5 Change-Id: I058cd5f2063aa933ea310bceff906f05422a7cb2 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>