summaryrefslogtreecommitdiffstats
path: root/src/gui
Commit message (Collapse)AuthorAgeFilesLines
* Prevent repeated instantiations of some qRegisterNormalizedMetaType<>s [1/N] ↵Marc Mutz2022-01-214-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (QtGui) Create macros that wrap the magic developed in 7d63efc16f65f98c657caa90e0d7e9b72a879ade and apply it to all Q_DECLARE_METATYPE invocations that show up in Clang -ftime-trace for a PCH'ed QtGui build. Effects on compile times: Clang 10 -ftme-trace: $ ClangBuildAnalyzer --analyze qtgui-before.trace | head -n6 Analyzing build trace from 'qtgui-before.trace'... **** Time summary: Compilation (523 times): Parsing (frontend): 628.3 s Codegen & opts (backend): 304.5 s $ ClangBuildAnalyzer --analyze qtgui-after.trace | head -n6 Analyzing build trace from 'qtgui-after.trace'... **** Time summary: Compilation (523 times): Parsing (frontend): 546.0 s Codegen & opts (backend): 304.4 s GCC 11 time (bash builtin): before: $ time for ((i=0; i < 3; ++i)) do touch src/gui/painting/qpolygon.h ; ninja libQt6Gui.so; done real 4m13,539s user 49m24,416s sys 3m18,177s after: $ time for ((i=0; i < 3; ++i)) do touch src/gui/painting/qpolygon.h ; ninja libQt6Gui.so; done real 3m55,697s user 45m19,941s sys 3m7,370s Task-number: QTBUG-97601 Pick-to: 6.3 Change-Id: Ia8e37a58937568a7ed21cfeb4b27274deca4d53b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Remove obsolete virtual method after submodules adjustedVolker Hilsheimer2022-01-211-4/+1
| | | | | | | | | | Amends cb27ed30f7bc58474eba991f837843eb76cbd339 after follow-up change 43fb6953fb940edfec358a2d1c01e05705712829 in Qt Svg. Task-number: QTBUG-99642 Pick-to: 6.2 6.3 Change-Id: Ice190dc9d1bdcb08d74c86edf0028cf50266d94e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QFactoryLoader: add setExtraSearchPath() (for QPA plugins' use)Thiago Macieira2022-01-202-69/+6
| | | | | | | | | | | | | | | | | This is added specifically for the QPA platform and theme plugins, to honor the QT_QPA_PLATFORM_PLUGIN_PATH environment variable and the (inadvisable) -platformpluginpath command-line argument. This removes the last QFactoryLoader used with an empty path (also the only two that could be reached), which were causing a scan of the application's binary directory whenever the platform plugin path was set. In case of applications installed to /usr/bin, the entire /usr/bin was scanned, which can be qualified as "not good". Fixes: QTBUG-97950 Pick-to: 6.3 Change-Id: Ice04365c72984d07a64dfffd16b47fe1d22f26d3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QWindowPrivate: de-inline dtor and ctorMarc Mutz2022-01-202-0/+9
| | | | | | | | | | | | | | It's private API, but exported, so de-inline the dtor to pin the vtable in QtGui instead of potentially duplicating it in every library that uses the class. Ditto ctor, but that's just code hygiene: we don't want the code to be duplicated across all users. Pick-to: 6.3 Task-number: QTBUG-45582 Change-Id: I91ea38be20fc67795466a68ca5721837255b33a0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QVulkanWindow: make it possible to override the enabled featuresLaszlo Agocs2022-01-203-2/+50
| | | | | | | | | | | | | | | We already have a precedent for this: the QueueCreateInfoModifier callback. Following the pattern, add a EnabledFeaturesModifier that can alter the VkPhysicalDeviceFeatures that is passed to vkCreateDevice(). [ChangeLog][QtGui][QVulkanWindow] QVulkanWindow can now invoke a callback to alter the VkPhysicalDeviceFeatures object used to create the Vulkan device. This allows enabling 1.1, 1.2, and extension features. Fixes: QTBUG-99803 Change-Id: I5ede0c6bc3430cbb304d4961eb9e44faad5ce4d7 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Enable all supported 1.0 device features in QVulkanWindowLaszlo Agocs2022-01-201-0/+23
| | | | | | | | | | [ChangeLog][QtGui][QVulkanWindow] QVulkanWindow is now enabling all Vulkan 1.0 features reported as supported from the physical device. Pick-to: 6.2 6.3 5.15 Task-number: QTBUG-99803 Change-Id: Ib9cfcd449904c67b07e0e2d4ade5bcaeb4cb0ce6 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Fix queue passed to vkQueuePresentLaszlo Agocs2022-01-201-1/+1
| | | | | | | | | | | | | | | | | We do not test actively test setups where a separate graphics and present queue is used because there is no combined queue at all. (it won't be tested because we neither want to nor have the possibility to do so) However, QVulkanWindow (unlike, say, QRhi's Vulkan backend) attempts to support this. It turns out the argument passed to vkQueuePresent is wrong: the present is to be submitted to the present queue. So fix this up. Pick-to: 6.3 6.2 5.15 Fixes: QTBUG-73470 Change-Id: Ic9b589aba52e3326637216b98a074e27fdc3e3b9 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* QColorTransform: optimize member-swap()Marc Mutz2022-01-191-1/+1
| | | | | | | | | | | | | | | | | | | We know decltype(d), so we don't need to jump though the ADL-enabling that qSwap() does. Just call QExplicitlySharedDataPointer's member-swap directly. Found through Clang -ftrace-time over PCH'ed libQt6Gui.so build: **** Templates that took longest to instantiate: [...] 4050 ms: qSwap<QExplicitlySharedDataPointer<QColorTransformPrivate> > (87 times, avg 46 ms) which is gone afterwards. Task-number: QTBUG-97601 Pick-to: 6.3 6.2 Change-Id: Ie054848922a50dbf746781491cb28e598c0e12bc Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* rhi: d3d: Fix up non-vsynced presentationLaszlo Agocs2022-01-192-24/+48
| | | | | | | | | | | | | | | Doing Present(0, 0) is not necessarily sufficient to get rid of blocking. It may very well start blocking after a few frames. This does not apply to a non-flip-discard swapchain (when running with QT_D3D_NO_FLIP=1), but for flip-discard we should also try using DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING and DXGI_PRESENT_ALLOW_TEARING in case a swap interval of 0 is wanted. Pick-to: 6.3 Fixes: QTBUG-99949 Change-Id: I9cb13b139ba04e41b4f25b94bcd3d1e973496414 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* QPolygon: de-inline setPoint()Marc Mutz2022-01-192-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt 5 times, the core of QList::realloc() was out-of-line by design, because it was independent of T. Now that QList is QVector, its equivalent detachAndGrow() function on QArrayDataPointer is inline and instantiated for each type anew. We therefore need to be careful to not use detach()ing QList operations in non-generic code inline code (in public, but also private, headers), because (common) PCH builds force this code to be compiled over and over again. Generic code is only instantiated when used in a TU, so that's ok. But for non-generic code, the only option is to de-inline. If there is an effect on compile-times, it's hidden in the run-by-run noise of building QtGui, but at least this entry is gone afterwards from clang -ftime-trace: **** Templates that took longest to instantiate: [...] 4676 ms: QList<QPoint>::operator[] (261 times, avg 17 ms) Added 'inline' to the definition of the setPoint(int, QPoint) overload, since MinGW used to complain about it missing. Task-number: QTBUG-97601 Pick-to: 6.3 Change-Id: Ie6f67da7ef39a16c98a7451d37b6d96531656392 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* CMake: add support for GNU/HurdPino Toscano2022-01-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Add a "HURD" CMake platform specification, so it can be properly checked in the build system. Set QT_DEFAULT_MKSPEC to the existing hurd-g++ mkspec. Hurd supports $ORIGIN in RPATH, so enable it. Hurd uses X11, so add it to the X11_SUPPORTED list. Enable few more feature checks that apply to Hurd as well: either because they are provided by GNU libc itself, or because they are implemented on Hurd. Check and set the ELF interpreter, as it is a common functionality of the GNU toolchain. Change-Id: Id347033560bbc5a2a4e2c3abb493c948c002b40e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* QRhiGles2: replace two QSet<int> with QDuplicateTrackerMarc Mutz2022-01-182-8/+9
| | | | | | | | | | Apart from a more fitting, minimal, API, QDuplicateTracker also transparently uses C++17 pmr::monotonic_buffer_resource to avoid, or at least reduce, memory allocations. Pick-to: 6.3 Change-Id: Ied2574734949b2dadc1bcbaa9d1e3c0ed98ba50a Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* CMake: re-enable SIMD on AndroidThiago Macieira2022-01-171-34/+34
| | | | | | | | | | | Except for MIPS, which is disabled in Qt 5 too. It's not my place to question why. This partially reverses commit b6e75ff3eaccc4f0322c9735533a1f3435597eba. Change-Id: Ib42b3adc93bf4d43bd55fffd16c1feffb9c5890c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Remove unused .qrc filesJoerg Bornemann2022-01-171-7/+0
| | | | | | | | Task-number: QTBUG-94446 Change-Id: I136d8b4ab070a832866aa50b5701fc6bd863df8a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Doc: Use \inmodule for all classes and headersTopi Reinio2022-01-175-0/+8
| | | | | | | | | | | | | | | QDoc made some assumptions about the module a class/header belongs to, based on the source file path. This feature is rather error-prone and unnecessarily complex and will be removed from QDoc. Define modules explicitly to avoid documentation warnings when this removal happens. Pick-to: 6.2 6.3 Change-Id: I7947d197db5ac36c12e816caa19bb2f74eda8849 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Doc: Remove mentioning of Fowler bookKai Köhne2022-01-172-2/+2
| | | | | | | | | It is out of print since years, and probably quite dated by now (released 1997). Pick-to: 6.3 Change-Id: I1653eb404713c15d70b8a15858e8c7d12b2e71cb Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* QtGui/math3d: Fix QQuaternion::getEulerAngles for GimbalLock casesYuya Nishihara2022-01-161-16/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is heavily inspired by the patch written by Inho Lee <inho.lee@qt.io>, which says "There is a precision problem in the previous algorithm when checking pitch value. (In the case that the rotation on the X-axis makes Gimbal lock.)" In order to work around the precision problem, this patch does: 1. switch to the algorithm described in the inline comment to make the story simple. 2. forcibly normalize the {x, y, z, w} components to eliminate fractional errors. 3. set threshold to avoid hidden division by cos(pitch) =~ 0. From my testing which compares dot product of the original quaternion and the one recreated from Euler angles, calculation within float range seems okay. (abs(normalize(q_orig) * normalize(q_roundtrip)) >= 0.99999) Many thanks to Inho Lee for the original patch and discussion about rounding errors. Fixes: QTBUG-72103 Pick-to: 6.3 6.2 5.15 Change-Id: I8995e4affe603111ff2303a0dfcbdb0b1ae03f10 Reviewed-by: Yuya Nishihara <yuya@tcha.org> Reviewed-by: Inho Lee <inho.lee@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QMutableEventPoint: turn into memberless structMarc Mutz2022-01-151-33/+4
| | | | | | | | | | | | | | | | ... as a befriendable namespace. This breaks all remaining users of QMutableEventPoint, thus forcing them to port to the new static-setter-only API that reliably avoids the UB that the old QMutableEventPoint::from(), in particular, depended on. Fixes: QTBUG-99615 Pick-to: 6.3 Change-Id: Id162cd98f13b52c4f491749ee73826b1c5755453 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QCSS: Support Qt 5-style integer property selectorsVolker Hilsheimer2022-01-153-15/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt 5 style sheets, objects could be selected by an enum-type property using the integer value of the enum value, e.g QToolButton[popupMode="1"] { ... } In Qt 6, the the new meta type system and QVariant implementation enabled QVariant::toString to return the string representation of the enum value instead for a property containing an enum. Since QStyleSheetStyle's attribute matching is string based, this breaks the Qt 5 style selector, and QCSS code instead needs to use e.g. QToolButton[popupMode=MenuButtonPopup] { ... } While the new syntax is arguably preferable, this is an unintentional change that silently breaks style sheet code (no error or warning at compile- or run-time). To support Qt 5-style selectors, we have to change the StyleSelector interface of the QCssParser API so that we can pass through what type of value the attribute extractor should return; if an integer string "1" is provided, then we need to compare the enum integer value; if the string provided does not represent a number, then we need to compare the name of the enum value. Since the pure virtual attribute() method that needs to be implemented to extract the attribute value of the node is implemented in modules outside qtbase, add a second virtual method that takes the entire QCss::AttributeSelector, which includes the value to match. Extractor implementations can use it to evaluate which type of data to return for an exact match. The default implementation calls the old attribute() method so that existing StyleSelector implementations continue to work. Make the respective change in the QStyleSheetStyleSelector, and simplify the surrounding code. Adjust other StyleSelector implemnentations in qtbase. As a drive-by, remove the superfluous virtual declaration from those overrides. Once submodules are adjusted to override this virtual function instead of the (now no longer pure) virtual attribute() method, that method can be removed. Pick-to: 6.3 6.2 Fixes: QTBUG-99642 Change-Id: I9a2b3498f77bf7cab5e90980b7dab2f621d3d859 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* tests: port to new QMutableEventPoint static APIMarc Mutz2022-01-151-0/+9
| | | | | | | | | | | | | | | | | | This code didn't actually use QMutableEventPoint::from(), so didn't run into the UB that from() depended on, but it's in the way of making QMutableEventPoint a befriendable namespace instead of a public subclass of QEventPoint. Replaced the QMutableEventPoint ctor that takes a timestamp, and therefore isn't compatible with the ctors on QEventPoint, with a static function that returns QEventPoint instead. Port QList initialization to braced-initialization as a drive-by. Task-number: QTBUG-99615 Pick-to: 6.3 Change-Id: If5a1dbea21cc31cdefdb640716793421c8ec0af4 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Don't include qeventpoint_p.h from qevent_p.hMarc Mutz2022-01-146-1/+6
| | | | | | | | | | | The header no longer uses QMutableEventPoint. Fix TUs that relied on the transitive include. Task-number: QTBUG-99615 Pick-to: 6.3 Change-Id: Iae4ff34ea708304fcd365fd763875dd4a97a1cf8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix crash when text shaping failsEskil Abrahamsen Blomfeldt2022-01-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | | If text shaping failed for some reason (for example if the string passed to Harfbuzz contains ignorables only), we would return a single glyph for the whole string. But we forgot to initialize the log clusters array, which could cause crashes later when this was read. We initialize a single cluster consisting of the "missing glyph" glyph to be consistent. Amends fccd419dd632306a4bd85928223e0a56a59510ef. [ChangeLog][QtGui][Text] Fixed a possible crash with certain fonts when shaping strings consisting only of control characters. Pick-to: 5.15 6.2 6.3 Task-number: QTBUG-89155 Fixes: QTBUG-92358 Change-Id: I1ec0237d99b48be2a8bb340f0feb056bca4fdffe Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QWindow: Remove unnecessary castVolker Hilsheimer2022-01-141-2/+1
| | | | | | | | | We already have a QMouseEvent, don't static_cast the QEvent again to the parent-class of QMouseEvent. Pick-to: 6.3 6.2 Change-Id: Ifd8a5a82d0a8ded564a68ec4f3ae877886c6e1c7 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QWindow: fix UB (invalid static_cast)Marc Mutz2022-01-141-1/+6
| | | | | | | | | | | | | | | | | | | Do the cast to QMouseEvent only after we determined that it's actually a QMouseEvent. Says ubsan: src/gui/kernel/qwindow.cpp:2558:27: runtime error: downcast of address 0x7fffca0e5af0 which does not point to an object of type 'QMouseEvent' 0x7fffca0e5af0: note: object is of type 'QShowEvent' ff 7f 00 00 b0 09 01 b8 61 7f 00 00 11 00 00 00 00 00 00 00 b3 8a b5 41 00 00 00 00 80 50 5a cc ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QShowEvent' Only cast _after_ determining that `ev` is-a mouse event. Amends 3d71c4b740d23d5c3f380f495990f35ea17dc2a0. Pick-to: 6.3 6.2 Change-Id: I8455c998e2f4390a1483c1a097eb095358963ace Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QGuiApplication: port the last user of QMutableEventPoint::from()Marc Mutz2022-01-143-44/+40
| | | | | | | | | | | | ... to the new static setter API, preventing the undefined behavior that from() depended on. Remove from() and constFrom(). Task-number: QTBUG-99615 Pick-to: 6.3 Change-Id: I69c52aa286eaf51303734e42184af36815cf828a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QPathEdge: Fix array initializationIvan Tkachenko2022-01-141-5/+1
| | | | | | | | | | | | We had a copy-paste error there: not all array members were initialized. Pointed out by PVS-Studio static analysis tool: https://habr.com/ru/company/pvs-studio/blog/542760 Co-Authored-By: Marc Mutz <marc.mutz@qt.io> Pick-to: 6.3 6.2 5.15 Change-Id: I06a4f2cd928846eab6330af014981fd0a3170ba0 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Port the last user of QMutableSinglePointEvent::mutableEvent()Marc Mutz2022-01-141-2/+0
| | | | | | | | | | | ... to the static setters of QMutableEventPoint. Remove the mutableEvent() function. Task-number: QTBUG-99615 Pick-to: 6.3 Change-Id: If4d3decae67baff41e23e7e9eaed3f3035fab595 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* rhi: Add the basic infrastructure for tessellation supportLaszlo Agocs2022-01-139-48/+218
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...but this will only be supported with Vulkan and OpenGL 4.0+ and OpenGL ES 3.2+ for the time being. Taking the Vulkan model as our standard, the situation is the following: - Vulkan is ok, qsb secretly accepts .tesc and .tese files as input already (plus QShader already has the necessary plumbing when it comes to enums and such) To switch the tessellation domain origin to bottom left we require Vulkan 1.1 (don't bother with VK_KHR_maintenance2 on top of 1.0 at this point since 1.1 or 1.2 implementations should be common by now). The change is essential to allow the same evaluation shader to work with both OpenGL and Vulkan: this way we can use the same shader source, declaring the tessellation winding order as CCW, with both APIs. - OpenGL 4.0 and OpenGL ES 3.2 (or ES 3.1 with the Android extension pack, but we won't bother with checking that for now) can be made working without much complications, though we need to be careful when it comes to gathering and setting uniforms so that we do not leave the new tessellation stages out. We will stick to the Vulkan model in the sense that the inner and outer tessellation levels must be specified from the control shader, and cannot be specified from the host side, even though OpenGL would allow this. (basically the same story as with point size in vertex shaders) - D3D11 would be no problem API-wise, and we could likely implement the support for hull and domain shader stages in the backend, but SPIRV-Cross does not support translating tessellation shaders to HLSL. Attempting to feed in a .tesc or .tese file to qsb with --hlsl specified will always fail. One issue here is how hull shaders are structured, with the patchconstantfunc attribute specifying a separate function computing the patch constant data. With GLSL there is a single entry point in the tessellation control shader, which then performs both the calculations on the control points as well as the constant data (such as, the inner and outer tessellation factors). One option here is to inject handwritten HLSL shaders in the .qsb files using qsb's replace (-r) mode, but this is not exactly a viable universal solution. - Metal uses a different tessellation pipeline involving compute shaders. This needs more investigation but probably not something we can prioritize in practice. SPIRV-Cross does support this, generating a compute shader for control and a (post-)vertex shader for evaluation, presumably in order to enable MoltenVK to function when it comes to tessellation, but it is not clear yet how usable this is for us. Change-Id: Ic953c63850bda5bc912c7ac354425041b43157ef Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* QWindowSystemInterface: port to QMutableEventPoint static setter APIMarc Mutz2022-01-131-6/+6
| | | | | | | | | | | | | This code was actually ok (no UB), but it's in the way of making QMutableEventPoint a befriendable namespace, so port from using QMutableEventPoint to QEventPoint instances + QMutableEventPoint static setters. Task-number: QTBUG-99615 Pick-to: 6.3 Change-Id: I1f123837d62a2200e36faf89f6912ee59be2f915 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Doc: Replace "C:\Documents and Settings" pathsKai Köhne2022-01-121-1/+1
| | | | | | | | | | "C:\Documents and Settings" isn't a real path anymore since Windows Vista. Replace it by C:\Users, or - in the snippet for QDesktopServices that is for demoing a path with space - with C:\Program Files. Pick-to: 6.2 6.3 5.15 Change-Id: I1bef97b6482180a6467fffcd1d62d6c168bcb389 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* rhi: Add queries for vertex input/output limitsLaszlo Agocs2022-01-128-1/+70
| | | | | | | | | | Mainly because we do have legacy code in the Qt 5 graphical effects that tries to dynamically determine the max number of varyings. Make it easier to port such code. Change-Id: I846cab2c2fe7b4cd473b5ced0146ca36f1c8169b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Draw extended RGB solid colorsAllan Sandfeld Jensen2022-01-126-25/+67
| | | | | | | Pass extended RGB colors through the paint engine. Change-Id: I2e212cd4c76aaa65439746352c0da2b9db4a506d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QSinglePointEvent: port away from QMutableEventPoint::from()Marc Mutz2022-01-121-16/+16
| | | | | | | | | | | | | Use the new static QMutableEventPoint setters, which do not depend on undefined behavior. Made it a separate commit, because, while straight-forward, it's a lot of changes compared to other users. Task-number: QTBUG-99615 Pick-to: 6.3 Change-Id: I580b6b225421a1e908f04c8e30adcdef6540ea52 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Make QCursor::setPos() use the correct screenMorten Johan Sørvig2022-01-121-1/+2
| | | | | | | | | | | | | | | | setPos() takes a screen argument, however this argument indicates which cursor should be moved only and is not usable as an argument to toNativePixels() since the position may be on a sibling screen. Add call to QScreen::virtualSiblingAt to get the target screen. Task-number: QTBUG-99009 Pick-to: 6.3 6.2 5.15 Change-Id: I8714ebc93a283c58bc67911315f787c484fb0dd8 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QPointingDevice: avoid double lookup in Private::pointById()Marc Mutz2022-01-121-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Use the newly-added try_emplace() function, to work around Qt's associative container's broken insert() behavior (which is equivalent to STL's insert_or_assign()), forcing either a double lookup: auto it = c.find(key); // lookup 1 if (it == c.end()) c.insert(key, ~~~); // lookup 2 or the usual size-check trick: const auto oldSize = c.size(); auto &e = c[key]; if (c.size() != oldSize) { // newly inserted onto any lookup-or-initialize-like code. try_emplace beats them both in terms of efficiency and readability. Pick-to: 6.3 Change-Id: I4c52d2f2d5175991db4931d29c688de125f5b032 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QEventPoint: forward-declare QMutableEventPoint before befriending itMarc Mutz2022-01-121-0/+1
| | | | | | | | | | Otherwise the friend declaration declares the name, which here is ok, but can cause duplicate names in other situations. Pick-to: 6.3 6.2 Change-Id: I695f9c5c116b90ba52e1b99e15f31e732e63d357 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* rhi: Improve the handling of HDR capable texture formatsLaszlo Agocs2022-01-117-32/+73
| | | | | | | | | | | Add some sort of autotest for both RGBA16F and the new RGB10A2. The latter is introduced particularly because ideally we should have a texture format that corresponds to the D3D/Vulkan swapchain color buffer format with HDR10. Change-Id: I1e1bbb7c7e32cb3db89275900811c0bcaeac39d6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* rhi: Add some docs for the hdr info queriesLaszlo Agocs2022-01-111-0/+55
| | | | | Change-Id: I9b3b62ac83642a7d3e474c991e572877b9e46ca5 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Use QTextCharFormat::fontFixedPitch to remember Markdown backtick spansShawn Rutledge2022-01-112-1/+2
| | | | | | | | | | | | | | | | | | | | | | If the editing app (like qtbase/examples/widgets/richtext/textedit) has controls only for setting a specific font, and someone uses it to write markdown "from scratch", then we need to detect that they chose Courier or some other fixed-pitch font, and write the backticks, because Markdown has no syntax for selecting a specific font family. If the user loads markdown into such an application, the font is set to QFontDatabase::systemFont(QFontDatabase::FixedFont). Round-trip editing was already working, as long as such a font exists. QTextCharFormat::setFont() calls setFontFixedPitch(font.fixedPitch()), but for the chosen "mono" font, font.fixedPitch() can be false. For semantic completeness and separation of concerns, we now set fontFixedPitch explicitly if a `backtick` span is encountered. As a followup to f1e60de66540b198d696253ab5148de4fcbff319 this should get its autotest passing reliably. Fixes: QTBUG-99676 Pick-to: 6.3 6.2 5.15 Change-Id: I4987a1f0f819f82ec64546bdc3ef53e7d29933de Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Replace QString with QStringView and use qsizetype in QPdfEnginePrivateØystein Heskestad2022-01-112-4/+4
| | | | | | | | Task-number: QTBUG-98763 Change-Id: Iab09d5a4d23215fd44e4b2cf4212688cd8f27a63 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMutableEventPoint: add static overloads of settersMarc Mutz2022-01-086-78/+76
| | | | | | | | | | | | | | These overloads don't require a cast from QEventPoint to QMutableEventPoint, thus avoiding undefined behavior. Port easy users of QMutableEventPosition::(const)from() to the new API. Pick-to: 6.3 Task-number: QTBUG-99615 Change-Id: I4e9228322134ef7c712ca478ee8286466efc3585 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QGuiApplication: remove an unneeded const_castMarc Mutz2022-01-081-1/+1
| | | | | | | | | | QPointingDevicePrivate::pointById() already returns (mutable) EventPointData*, so the eventPoint member is mutable, too. Task-number: QTBUG-99615 Pick-to: 6.3 6.2 Change-Id: Iae1e665cab4b83b63e0e693bf7c4689e99aa3bae Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* rhi: gl: Prevent breaking with ES when querying the sampler mapping tableLaszlo Agocs2022-01-072-17/+17
| | | | | | | | Send the full QShaderVersion down the line, not just the version number. Change-Id: I895d552fc47e0eb4ca92f32f117cd5a1d4d9015a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Add PreselectFirstFileInDirectory platform theme hintMitch Curtis2022-01-072-1/+8
| | | | | | | | | | | | This allows Qt Quick Dialogs to accurately check whether it should select the first file in a directory when a file dialog is opened. While we're here, fix an incorrect version on the last theme hint that was added. Task-number: QTBUG-98562 Change-Id: I08cc8a0fbed28a42d1212016c6ee7fc5459578bf Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use ranged for loops instead of QString::utf16Øystein Heskestad2022-01-072-14/+7
| | | | | | | | Task-number: QTBUG-98763 Change-Id: I27a854121a783e67afcc4f8634ea7c8c921430c2 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace QString::utf16() with data() in memcpy() and QByteArray ctorØystein Heskestad2022-01-071-3/+3
| | | | | | | | | | | QString::utf16() needlessly detaches fromRawData() to ensure a terminating NUL. Use data() where we don't require said NUL, taking care not to call the mutable data() overload, which would detach, too. Task-number: QTBUG-98763 Change-Id: I7075a8f18ab1f82ebbcf8cfab1643e8ab7f38d51 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QHighDpiScaling: fix typo in docYuhang Zhao2022-01-071-1/+1
| | | | | | Pick-to: 6.3 6.2 Change-Id: I7f874e85484a6ab4be0280e736b57141bdebc656 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QFontDatabase: remove outdated commentsYuhang Zhao2022-01-072-6/+0
| | | | | | | | | | | | | | QtBase/2526df506bda99f9497e83a4e6820557a722660e has resolved what the comment said. As a drive-by, remove the unused QSystemLibrary include, which is forgotten in 2526df506bda99f9497e83a4e6820557a722660e. Amends commit 2526df506bda99f9497e83a4e6820557a722660e Pick-to: 6.3 Change-Id: Iab5c7d00e22d306be63d7588ea44bf73d377793d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* rhi: Returns mapping tables by value from QShaderLaszlo Agocs2022-01-075-31/+26
| | | | | | | | | As these are QList and QHash. All existing usages are based on this anyway, no value in being able to indicate "not available" - an empty container fulfills the same role. Change-Id: I8059025fa7a4acb6fc674cd98b16fcafa19ed85d Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* QGuiApplication: remove a use of QMutableEventPointMarc Mutz2022-01-061-1/+1
| | | | | | | | | | The 'persistentPoint' reference is never used as a QMutableEventPoint, so don't cast to it (which is UB). Pick-to: 6.3 6.2 Task-number: QTBUG-99615 Change-Id: I7fdfb2427a09d691242bf1fa28e202ba326ea678 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>