summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpagesize.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove extra semi-colonsTasuku Suzuki2024-02-061-1/+1
| | | | | Change-Id: I92fddb36cd136fd1bd627955f15d0559b9942d7e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* pagesize: Fix pixel overflow in QPageSize::sizePixels and rectPixelsJarkko Koivikko2023-12-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | This update addresses an issue in converting page size from points to device pixels. Previously, rounding the result could lead to an overflow beyond the physical pixel capacity. Example case: A4 paper size at 600 dpi: - points to pixels: 842 pt / (72.0 / 600) = 7016.666666666667 However, the physical pixel height for an HP printer: - GetDeviceCaps(hdc, PHYSICALHEIGHT)) = 7016 This fix prevents pixel size from exceeding the physical print area, avoiding unprinted pixels. Pick-to: 6.6 Change-Id: I66eabc628d3374d9cfb19b0eb5928f83afbc13dc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Faure <david.faure@kdab.com>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QtGui: replace remaining uses of QLatin1String with QLatin1StringViewSona Kurazyan2022-04-281-1/+1
| | | | | | Task-number: QTBUG-98434 Change-Id: I98c27030c783f968cbf38dc966ce486dc366b302 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtGui: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-04-281-2/+4
| | | | | | Task-number: QTBUG-98434 Change-Id: Idcb71c1d27125333a53b6bdd3e1af0d4c66617fa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtGui: sweep Q_DECLARE_METATYPE → QT_DECL_METATYPE_EXTERN [1/2]: public APIMarc Mutz2022-04-051-0/+4
| | | | | | | | | | | | | It's one of our best tools to improve compile times. Can't backport to Qt 6.3 or 6.2 because this change introduces new exported symbols. Task-number: QTBUG-102206 Change-Id: Ib8224ed60afa893744f369fe7394d27e89b66c11 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QPageSize: pack StandardPageSize structMarc Mutz2022-02-101-5/+6
| | | | | | | | | | | | | | | | | | | | On most platforms, the old struct had a padding hole before the FP members, as well as after the character array. By packing the integer members into bit fields, we compress five ints incl. the padding hole (24 bytes) into 64 bits w/o padding (8 bytes). The size of the struct shrinks from 80 to 64 bytes, saving almost 2KiB in TEXT size. Four bytes of tail padding remain, and are available to grow the character array in the future. More compactification could be had by changing the FP members (either by turning them into floats and/or by making them a union over {mm, in}, because one can be calculated from the other), but these are for another patch, because they change return values. Pick-to: 6.3 6.2 Change-Id: I0e7f354a0341e94e9a9401a7d3b4529a8ff20a3d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QPageSize: remove 119 relocationsMarc Mutz2022-02-091-1/+1
| | | | | | | | | Also saves ~1.4KiB in combined TEXT and DATA size on optimized Linux GCC 11 C++20 AMD64 builds. Pick-to: 6.3 6.2 Change-Id: I53922ccd191e412a13e3e23f2e26fdb3bf43af33 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Make comparison operators in gui/painting classes hidden friendsVolker Hilsheimer2020-10-281-7/+11
| | | | | | | | Reduce ADL noise from QColorSpace, QPageSize, and QPageLayout with the help of a private equals method. Change-Id: I0082597dd216b982e8d8eb5a4bd7dd29a5d3263b Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Cleanup PageSize enum for Qt6Allan Sandfeld Jensen2020-09-101-5/+3
| | | | | | | Fixes B5/B6 order and removes abandoned documentation for a removed duplicate. Change-Id: I7647ee31a4ef4aa754058c8a6f68b4d4304e0043 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Clean up PageSizeId enumVolker Hilsheimer2020-09-101-2/+2
| | | | | | | | | | | Reorder, and remove ### Qt 6 comment It would be nice to have a way to statically assert that the order of StandardPageSizes (and their id) matches the order of the enum, but it's not possible (or at least very cumbersome) to do so. Change-Id: Id0d0a58958f1e17151725cbe8f8068db64f84939 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Port Q_STATIC_ASSERT(_X) to static_assertGiuseppe D'Angelo2020-06-191-1/+1
| | | | | | | | | | | | | | | | | There is no reason for keep using our macro now that we have C++17. The macro itself is left in for the moment being, as well as its detection logic, because it's needed for C code (not everything supports C11 yet). A few more cleanups will arrive in the next few patches. Note that this is a mere search/replace; some places were using double braces to work around the presence of commas in a macro, no attempt has been done to fix those. tst_qglobal had just some minor changes to keep testing the macro. Change-Id: I1c1c397d9f3e63db3338842bf350c9069ea57639 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Port QtGui from QStringRef to QStringViewLars Knoll2020-06-111-1/+1
| | | | | | Task-number: QTBUG-84319 Change-Id: I1761096fbcc9421a013cf73f831a2a2ba0c18006 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-10/+10
| | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Convert a few sizeof(array)/sizeof(element0) fors to range forsAlbert Astals Cid2019-10-041-5/+3
| | | | | | | | Increases readability Change-Id: I81ea915517fd2cd6bc2780f37ba8d8097c63f44b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Add missing full stops in briefsPaul Wicking2018-06-211-1/+1
| | | | | | Task-number: QTBUG-68933 Change-Id: I3f2a9f8c562f9a44bb32bddd31d75abbfe6de04d Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Fix build for Android with android-clang in r17Liang Qi2018-06-061-3/+3
| | | | | | Task-number: QTBUG-67464 Change-Id: Ib971a5da82b31bce9ac1c9ac623ad7d5302cfaec Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Use QStringRef() more, exploiting its new ::chop()Anton Kudryavtsev2016-08-161-1/+1
| | | | | | Change-Id: Id2201639be604b9a32b2dc5d21e675a961bee477 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-03-111-7/+7
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change partially reverts 1bfc7f68 about QT_HAS_BUILTIN define and undef in src/corelib/tools/qsimd_p.h. This change is also squashed with "Fall back to c++11 standard compiler flag for host builds" which is done by Peter Seiderer. Conflicts: mkspecs/features/default_post.prf src/3rdparty/sqlite/0001-Fixing-the-SQLite3-build-for-WEC2013-again.patch src/3rdparty/sqlite/sqlite3.c src/corelib/tools/qsimd_p.h src/gui/kernel/qevent.cpp src/gui/kernel/qwindowsysteminterface.cpp src/gui/kernel/qwindowsysteminterface_p.h src/plugins/bearer/blackberry/blackberry.pro src/plugins/platforms/cocoa/qcocoasystemsettings.mm src/plugins/platformthemes/gtk2/gtk2.pro src/plugins/styles/bb10style/bb10style.pro src/sql/drivers/sqlite2/qsql_sqlite2.cpp tools/configure/configureapp.cpp Task-number: QTBUG-51644 Done-with: Peter Seiderer <ps.report@gmx.net> Change-Id: I6100d6ace31b2e8d41a95f0b5d5ebf8f1fd88b44
| * Fix debug operators for QPageSize/QPageLayout.Friedemann Kleint2016-03-101-7/+7
| | | | | | | | | | | | | | Remove placeholder formatting and add noquote. Change-Id: I4a89f88778caf007ce42bbf57edfb514fe76bcdb Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-151-13/+19
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Use QDebugStateSaver to restore space setting in stream operators.Friedemann Kleint2015-03-301-1/+2
| | | | | | | | Returning dbg.space() breaks formatting on streams that already have nospace() set. Change-Id: I55e38b018679a67eb40be6b4664505483a3a7d8e Reviewed-by: David Faure <david.faure@kdab.com>
* Update copyright headersJani Heikkinen2015-02-111-6/+6
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Don't stream QStringLiterals into QDebugMarc Mutz2014-10-091-1/+1
| | | | | | | | Normal (C) string literals do just as well and use more than twice less space in the DATA section. Change-Id: Iafb0682a362c41dfd5b4d8b9137d88014d7992a2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Don't use QStringLiteral in startsWith/endsWidthMarc Mutz2014-10-091-2/+2
| | | | | | | | | | | | | | | For QLatin1String, startsWith/endsWith is overloaded, so comparing to a latin-1 (C) string literal is efficient, since strlen() is comparatively fast. OTOH, QStringLiteral, when not using RVO, litters the code with QString dtor calls, which are not inline. Worse, absent lambdas, it even allocates memory. So, just use QLatin1String instead. Change-Id: I7eaf464c67b55116f970fe7f58a85f19ce4d254e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-18/+10
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* QPageSize: remove QPageSize:: overqualificationsMarc Mutz2014-04-091-146/+146
| | | | | | | | This is not Qt style, not needed, and clutters the code, so remove QPageSize:: qualifications where they're not needed. Change-Id: Ia93ac9523ef43a40cf4dab3bcb383a54af666c96 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* QPageSize: clean up operator==Marc Mutz2014-04-081-3/+1
| | | | | | | | | | | | Recognize that the d-pointer can never be nullptr and drop the nullptr checks. The d-pointer can never be nullptr as there's no move ctor and all other ctors create a QPageSizePrivate. Change-Id: I6c4e165949ed55510aefbc2d933f20fc8e624333 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QPageSize: provide op!=Marc Mutz2014-04-081-0/+8
| | | | | | | | For consistency. Change-Id: I4375a6f8c2514479a7479c735d397bf8a9876db1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: John Layt <jlayt@kde.org>
* QPageSize: make op== non-memberMarc Mutz2014-04-081-5/+8
| | | | | | | | | Better style, since it treats the left-hand and right-hand size symmetrically, e.g. for implicit conversions. Change-Id: If1ffa9dc2a018e402c884f60bfbc82e799daeb92 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use Q_STATIC_ASSERT to check that the array has the right sizeThiago Macieira2014-04-051-12/+1
| | | | | | | | | | | | No need to sprinkle the code with Q_ASSERT. We don't want this to fail to the user anyway. By using a Q_STATIC_ASSERT, a failure will be immediately reported to the developer. This also solves a warning found by Clang 3.4: error: unused variable 'pageSizesCount' [-Werror,-Wunused-const-variable] Change-Id: I79cf72c64242ad395276ce4360c59ad81112d9eb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix translation of QtPrintSupport and QPageSize.Friedemann Kleint2014-03-171-10/+16
| | | | | | | | | | Add translator comments, fix spelling, reduce repetitive messages. Change-Id: Id4cbbc3de8fa261cf8f125c5faf735dc608e2b15 Reviewed-by: Robert Loehning <robert.loehning@digia.com> Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: John Layt <jlayt@kde.org>
* QPageSize - Add new QPageSize classJohn Layt2014-03-171-0/+1876
New QPageSize class to encapsulate paper sizes and names to ensure all sizes and conversions are consistent and match the Postscript standard sizes. Subsequent changes will use this class in the paged paint devices, paint engines, print engines, and print plugins to replace multiple inconsistent local implementations. [ChangeLog][QtGui][QPageSize] Added new QPageSize class to implement Adobe Postscript PPD standard page sizes. This class supports the standard page sizes, names and keys from the PPD standard, and provides convenient size and rect conversion methods. Change-Id: Ie2c8be0c3df0d29ac5da4cd9877ad41d0982633c Reviewed-by: Lars Knoll <lars.knoll@digia.com>