summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix version in which SH_Table_AlwaysDrawLeftTopGridLines was addedVolker Hilsheimer2022-01-211-1/+1
| | | | | | | | | Since it shows up as a new enum value in the 6.3 header review, it's reasonable to assume that it was added for 6.3. Pick-to: 6.3 Change-Id: If766ef56f3354644fbda09088514e55b28a44f32 Reviewed-by: Andy Shaw <andy.shaw@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>
* Windows XP style: Fix coding style violationsVolker Hilsheimer2022-01-201-375/+329
| | | | | | | | | | | | | | | | | | | | Fix various violations of the coding style or general inconsistencies. No claim for completeness. * indentation and line breaks * consistent scopes for case statements where needed * add curly-brackets for if-statements where needed * removed {} where not needed * const'ify a few obvious local variables * remove random empty lines * use auto when type is obvious from cast Deliberately not touching nested if-statements that could be merged into one. Pick-to: 6.3 Change-Id: Ie22b36568f33e18d5f15c751c7fd76e1490133b9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtCore: replace qSwap with std::swap/member-swap where possibleMarc Mutz2022-01-2043-60/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qSwap() is a monster that looks for ADL overloads of swap() and also detects the noexcept of the wrapped swap() function, so it should only be used when the argument type is unknown. In the vast majority of cases, the type is known to be efficiently std::swap()able or to have a member-swap. Call either of these. For the common case of pointer types, circumvent the expensive trait checks on std::swap() by providing a hand-rolled qt_ptr_swap() template, the advantage being that it can be unconditionally noexcept, removing all type traits instantiations. Don't document it, otherwise we'd be unable to pick it to 6.2. Effects on Clang -ftime-trace of a PCH'ed libQt6Gui.so build: before: **** Template sets that took longest to instantiate: [...] 27766 ms: qSwap<$> (9073 times, avg 3 ms) [...] 2806 ms: std::swap<$> (1229 times, avg 2 ms) (30572ms) after: **** Template sets that took longest to instantiate: [...] 5047 ms: qSwap<$> (641 times, avg 7 ms) [...] 3371 ms: std::swap<$> (1376 times, avg 2 ms) [qt_ptr_swap<$> does not appear in the top 400, so < 905ms] (< 9323ms) As a drive-by, remove superfluous inline keywords and template ornaments. Task-number: QTBUG-97601 Pick-to: 6.3 6.2 Change-Id: I88f9b4e3cbece268c4a1238b6d50e5712a1bab5a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@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>
* QtConcurrent: use variable templates for compile-time checksSona Kurazyan2022-01-203-17/+10
| | | | | | | | | Noticed during the API review. Pick-to: 6.3 6.2 Task-number: QTBUG-99883 Change-Id: I19571343a0cf0609beae2422ef1f69f7a34eb9ac Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QTabBar: Improve scrolling with high resolution mouse wheelsNoah Davis2022-01-202-2/+17
| | | | | | | | | | | | | | | | | | | | | The current behavior for handling the angle delta of a wheel event changes index the instant there is a change in angle delta. This works fine for mouse wheels that send events with 120 angle delta units and there is also already behavior defined for devices with pixel deltas, but there is nothing good for handling events from high resolution mouse wheels that don't have pixel deltas. This patch makes it so that the current index doesn't change until the accumulated angle delta for the X or Y axis reaches 120. [ChangeLog][QtWidgets][QTabBar] Scrolling with a high resolution mouse wheel changes the current index at a rate more like a normal mouse wheel. Task-number: QTBUG-97844 Pick-to: 6.3 Change-Id: I2e7fd88984a253f6ef8a0008deb7233e4cb4d84a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* QTlsBackend/QSslSocket - check the arguments we pass to QObject::connectTimur Pocheptsov2022-01-202-7/+11
| | | | | | | Not to have warnings about invalid (nullptr) parameters. Change-Id: I5fdfa7e99df0f3c9907055cf244efa5a56b21c11 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add documentation for the Android Multi-ABI related variablesAlexey Edelev2022-01-202-0/+95
| | | | | | | | | | | | | | | Document: QT_ANDROID_BUILD_ALL_ABIS - cache variable QT_ANDROID_ABIS - cache variable QT_PATH_ANDROID_ABI_<ABI> - cache variables ANDROID_ABIS - new argument of qt6_add_executable function Pick-to: 6.3 Task-number: QTBUG-99261 Change-Id: I7061065a6f329864ec9004ef41121f1225c5fc80 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@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>
* wasm: fix installation when staging prefix is usedSamuli Piippo2022-01-201-1/+2
| | | | | Change-Id: I2f9acdd977702f78c75eaeb67fc67f1b82836ff7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* convertDoubleTo: add an x86-64 intrinsics versionThiago Macieira2022-01-191-5/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The UB that the C and C++ standards talk about do not apply if we use intrinsics. We can rely on the processors' architectural behavior instead. There are two ways to detect a conversion that cannot be represented in the result. One would be to check if the #IE bit got set in the MXCSR, but in order to do that we'd need two issue an STMXCSR+LDMCXSR pair to clear the bit first and then another STMXCSR at the end to see if it got set. Those instructions are 4 uops long and necessarily target memory, so that's a bit slow. This commit implements the second way, which is to check if the result of the conversion is the "undefined" value. Unfortunately, that value is a valid, precise value that double can hold for all data types except unsigned 64-bit, so we need to recheck if that was the actual value stored in the original double. This implementation targets 64-bit exclusively because that avoids having to deal with the 64-bit intrinsics not even being defined in 32- bit code (converting a double to 64-bit integer in 32-bit is messy). The unsigned implementation is only implemented with AVX512F because of the unsigned conversion instructions that were introduced then. Change-Id: I89446ea06b5742efb194fffd16bb9f04b2014bab Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Use QStylePainter when painting widgetsMorten Johan Sørvig2022-01-205-11/+15
| | | | | | | | This makes it easier to set global painter options which affect all style painting. Change-Id: I6a38204ed2d874255e92345e6a6a50d27939fb24 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Cross-link QString's methodsIvan Tkachenko2022-01-191-3/+5
| | | | | | | | | | Arguably, when talking about «null-string» constructor, it might be useful to read about which strings are considered null, and which methods one can use to test that. Change-Id: Ie30144f33000aac53f4041cfb99da28a79dad946 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QVersionNumber: don't detach() in rvalue QList/QVector ctorMarc Mutz2022-01-191-2/+2
| | | | | | | | | | | | Qt 5 uses begin() so the fix there will be to use cbegin(). Found by Clang -ftime-trace pin-pointing repeated instantiations of QList<int>::data(). Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-97601 Change-Id: I6410e5b303766fdbc7e158a9ac1263adec973099 Reviewed-by: Fabian Kosmale <fabian.kosmale@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>
* Win32: always allow the event loop to be woken up by posted eventsVolker Hilsheimer2022-01-191-0/+2
| | | | | | | | | | | | | | | | | | | We set the wakeUps atomic to prevent multiple WM_QT_SENDPOSTEDEVENTS from being posted. However, this might happen right after the event processing thread cleared the atomic, but before it processed the previous WM_QT_SENDPOSTEDEVENTS message. In that case, we end up with a set atomic and an empty event queue, resulting in the event loop to block even though there are posted QEvents. To prevent that, always reset the atomic when we handle the WM_QT_SENDPOSTEDEVENTS message. In that case, we either call sendPostedEvents, or startPostedEventsTimer. The former already resets wakeUps; reset it in the latter as well. Fixes: QTBUG-99323 Pick-to: 6.2 6.3 5.15 Change-Id: I931c02be9c42b02e8ca20daba5059cd8185f0a37 Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
* Doc: Remove "Docs about UI Design" book overviewKai Köhne2022-01-192-81/+4
| | | | | | | | | | | | | | Recommending a Qt 4 book in Qt 6 documentation tells us something about how much we maintain the list :) The other books might still be good sources. Anyhow, the chances of a customer looking exactly in this place to learn good books about icons are not very high. So let's just ditch the page, and use external links instead. Pick-to: 6.3 Change-Id: I8013a5ab9d3416fe795f4aaed647e26db79508a1 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Nicholas Bennett <nicholas.bennett@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>
* QPropertyBindingPrivate: move static_assert()s to .cpp fileMarc Mutz2022-01-192-2/+6
| | | | | | | | | | | | | | | | | | One of them has managed to percolate up to the top of the Clang -ftime-trace list of expensive template instantiations when building libQt6Gui.so with -pch: **** Templates that took longest to instantiate: 7882 ms: std::is_trivially_destructible<QPropertyBindingSourceLocation> (135 times, avg 58 ms) The checks aren't really necessary, because the compiler would complain about the union's deleted dtor if any of the members were not trivially destructible. Keep it around, though, but in the .cpp file. Task-number: QTBUG-97601 Pick-to: 6.3 6.2 Change-Id: I74a513a907735bde298e0bd9557d10abbcee5c91 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QDBusMessage: de-inline createReply(QVariant)Marc Mutz2022-01-192-4/+5
| | | | | | | | | | | | | | | | | | | | | The building of the QList has percolated to the top of the lists of most expensive template instantiations in Clang -ftime-trace PCH builds of libQt6Gui.so: **** Templates that took longest to instantiate: 7137 ms: QList<QVariant>::operator<< (260 times, avg 27 ms) 7115 ms: QList<QVariant>::append (263 times, avg 27 ms) 7071 ms: QList<QVariant>::emplaceBack<const QVariant &> (256 times, avg 27 ms) 6651 ms: QtPrivate::QMovableArrayOps<QVariant>::emplace<const QVariant &> (256 times, avg 25 ms) [...] 5649 ms: QArrayDataPointer<QVariant>::detachAndGrow (256 times, avg 22 ms) [...] 4668 ms: QArrayDataPointer<QVariant>::reallocateAndGrow (256 times, avg 18 ms) Task-number: QTBUG-97601 Pick-to: 6.3 Change-Id: Ib766e70e4f741e057f9032bf232160cf6e83f4b9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString: use char16_t in ucstr{n,i,}cmp & ucstreq instead of QCharThiago Macieira2022-01-181-26/+24
| | | | | Change-Id: I0e5f6bec596a4a78bd3bfffd16c907b827f08519 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QString: optimize equalStrings() with a template in ucstrncmp()Thiago Macieira2022-01-181-6/+27
| | | | | | | | | If the SIMD code has already determined that the byte content differs, we don't need to actually subtract the bytes we loaded from memory in vector operations to return a sorting result. Change-Id: I0e5f6bec596a4a78bd3bfffd16c908b2902e1b1b Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QString: merge the two ucstrcmp overloads into a templateThiago Macieira2022-01-181-11/+8
| | | | | | | So we don't accidentally make modifications to one and not the other. Change-Id: I0e5f6bec596a4a78bd3bfffd16c94f1025aea521 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QString: introduce ucstreq() to optimize equalStrings()Thiago Macieira2022-01-181-2/+15
| | | | | | | | | If the lengths aren't equal, the strings can't be equal either, so we can skip the entire comparison. Some of the front-end functions that call these entry points already check for this, actually. Change-Id: Ib42b3adc93bf4d43bd55fffd16c8ceb9594512f2 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QString: make ucstricmp() parameters match the compareStrings'Thiago Macieira2022-01-181-27/+20
| | | | | | | | | | | | | The compareStrings() entry points take QStringView and QLatin1String, which are both ordered [size, pointer], so match that in the ucstricmp() parameters. This further reduces the prologue of the compareStrings() functions before reaching the case-sensitive comparison. There's no need to do the same for the case-sensitive functions because they're getting inlined. Change-Id: I0e5f6bec596a4a78bd3bfffd16c8ffc980c8af0c Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QString: add Q_NEVER_INLINE for ucstricmp()Thiago Macieira2022-01-181-3/+3
| | | | | | | | | | | | | | | Case-insensitive comparisons are not common, but both GCC and Clang inlined the ucstricmp() functions into QtPrivate::compareStrings(), with the side-effect that a lot of unnecessary setup code saving CPU registers was executed in the prologue of those functions. After this, Clang 13 emits both compareString() functions without any push/pop to save registers on x86-64; GCC 11 still emits a few, but fewer than before (it's emitting some unnecessary overhead for the loops). Change-Id: I0e5f6bec596a4a78bd3bfffd16c8fc2c0be9165f Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QString: remove the old unaligned 4-byte compares in ucstrncmp()Thiago Macieira2022-01-181-60/+9
| | | | | | | | | | | | | This is very old code, predating the public Qt history (Qt 4.5). It predates all other SIMD code in qstring.cpp, actually. Now that we do have implementations for MIPS DSP, ARM Neon and x86 SSE2, this content has very little value. It would be relevant for other architectures Qt still supports (POWER and RISC-V come to mind), but I guess the compiler's auto-vectorizer functionality can do a better job than this content. Change-Id: I0e5f6bec596a4a78bd3bfffd16c90733fb0d8f22 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* CMake: add support for GNU/HurdPino Toscano2022-01-193-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* Restore std::as_const() where a qAsConst was lost between 5.15 and 6Edward Welbourne2022-01-181-2/+2
| | | | | | | | | | Amends commit 837a29b0b92c72b7b9d66a427c24a9fa8037f4f4's fix for shadowing to take account of the loss of const-qualification of uiLanguages where it was then used in a ranged-for loop. Pick-to: 6.3 6.2 Change-Id: Ic4021bd9917cb27832a197126cc80a7f384a14a2 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QNetworkRequest: Document how Qt handles 301 and 302 status codesMårten Nordheim2022-01-181-0/+5
| | | | | | | | | To make it explicit Pick-to: 6.3 6.2 5.15 Task-number: QTBUG-92909 Change-Id: I8f8dc99628168a566158acef72ae2a5e001eef88 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Remove (set but) unused member from QTimerPrivateEdward Welbourne2022-01-181-3/+1
| | | | | Change-Id: I004fef8ce84cdc74837f674239c05901000bee33 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QProcess/Unix: fallback on _POSIX_PIPE_BUF w/ missing PIPE_BUFPino Toscano2022-01-181-0/+5
| | | | | | | | | | | | | | | | | | | PIPE_BUF is optional in POSIX, e.g. "where the corresponding value is equal to or greater than the stated minimum, but where the value can vary depending on the file to which it is applied." [1] GNU/Hurd does not provide PIPE_BUF, so fallback to its minimum acceptable value, that is _POSIX_PIPE_BUF. [1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html Also, explicitly include <limits.h> in this file, to make sure PIPE_BUF or _POSIX_PIPE_BUF are available without relying on other headers to pull <limits.h>. Change-Id: Ifae964db81841e1d31fc09e73b45594af9a326d1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString::toLatin1_helper_inplace: simplify the codeThiago Macieira2022-01-173-21/+43
| | | | | | | | | Hot function, so help the compiler out. In particular, this removes any touch to the ref count, so there are no atomic operations or dead code leading to memory allocations and deallocations. Change-Id: I0e5f6bec596a4a78bd3bfffd16c9a0fbd8dd2c12 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QMetaType: add a missing check for null d_ptrThiago Macieira2022-01-181-1/+1
| | | | | | | | | | | | | Bug introduced in 6.0. This is the only unprotected d_ptr I could find. [ChangeLog][QtCore][QMetaType] Fixed a bug that would cause QMetaType::compare() and QVariant::compare() to crash on invalid meta types and variants. Pick-to: 6.2 6.3 Fixes: QTBUG-99960 Change-Id: I0e5f6bec596a4a78bd3bfffd16cb1f7b2d146688 Reviewed-by: Fabian Kosmale <fabian.kosmale@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>
* JSON: When clearing duplicate object entries, also clear containersUlf Hermann2022-01-181-10/+44
| | | | | | | | | | | | | | | | | Previously, if you had multiple entries with the same name in an object, and some of them were again objects or arrays, parsing the JSON document would leak memory. Also, we use std::stable_sort instead of std::sort now, so that we don't accidentally randomize the order of elements with equal keys. [ChangeLog][QtCore][JSON] A memory leak in the JSON parser when reading objects with duplicate keys was fixed. Pick-to: 5.15 6.2 6.3 Fixes: QTBUG-99799 Change-Id: Ic2065f2e490c2d3506a356745542148ad9c24262 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVersionNumber: don't allocate in fromString() in the common caseMarc Mutz2022-01-182-6/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use QVarLengthArray instead of QList to avoid allocations in the case where the result fits into inline storage. Of course, we now perform one allocation more when we need the QList backend, but a) that should be the rarer case and b) we use 32 (more than InlineSegmentsCount) Prealloc for the QVarLengthArray to reliably skip the first few QList non-reserved capacity jumps (measured to be {4, 12, 28} for back-insertion, not all of which is probably available for append()s) to come out ahead either way. Reviewers may object, saying that we could just reserve(32) the QList, too, but while that would skip over the first few QList reallocations alright, it means we'd be carrying the extra capacity around for the duration of the QVersionNumber's lifetime (unless we'd shrink it at the end, bringing back the additional allocation and that solution back to par compared to this one). As a consequence: [ChangeLog][QtCore][QVersionNumber] Can now be also be constructed from QVarLengthArray. Change-Id: I4016367f64f6cefa6ed9147d33b06636f36b02cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVersionNumber: port fromString() to QAnyStringViewMarc Mutz2022-01-185-68/+60
| | | | | | | | | | | | | | | | | We can handle the UTF-8 case by reinterpreting it as Latin-1. This way, the suffixIndex stays valid as a return value. As a drive-by, optimize away toLatin1() calls by using a QVLA. We really need a better way of converting UTF-16 -> L1 than qt_to_latin1()... [ChangeLog][QtCore][QVersionNumber] fromString() now takes QAnyStringView (was: QString, QStringView, QLatin1String) and a qsizetype pointer (was: int pointer). Change-Id: I86abaadba2792658fbf93ccd1e0b86e3302c697c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVersionNumber: change int to qsizetype in fromString()Thiago Macieira2022-01-173-8/+48
| | | | | | | | | This completes the update to qsizetype in this class, adding a couple of methods that need to be removed in Qt 7. They're only required where int is not qsizetype (i.e., 64-bit platforms). Change-Id: I0e5f6bec596a4a78bd3bfffd16c9de29bec4c637 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Offscreen: Implement QPlatformBackingStore::toImageVolker Hilsheimer2022-01-181-0/+1
| | | | | | | | | This makes testing of actually produced output easy in unit tests. Pick-to: 6.3 Task-number: QTBUG-99962 Change-Id: Ia806539230af12d1eae1e31ef7a47155d9bc1bed Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@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>
* QLatin1String: perform the comparison to another QL1S using memcmp()Thiago Macieira2022-01-171-4/+4
| | | | | | | | | | | | | | | | | | qstrncmp() would stop at the first null character, which isn't correct. The tests that had been disabled in tst_qstring.cpp (with an inaccurate comment) were actually passing. I've added one more to ensure that the terminating null is compared where needed. [ChangeLog][QtCore][QLatin1String and QUtf8StringView] Fixed a couple of bugs where two QLatin1Strings or two QUtf8StringViews would stop their comparisons at the first embedded null character, instead of comparing the full string. This issue affected both classes' relational operators (less than, greater than, etc.) and QUtf8StringView's operator== and operator!=. Pick-to: 5.15 6.2 6.3 Change-Id: I0e5f6bec596a4a78bd3bfffd16c90ecea71ea68e Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Remove unused .qrc filesJoerg Bornemann2022-01-179-278/+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>
* Convert date-time to UTC before claiming it's in GMTEdward Welbourne2022-01-171-4/+4
| | | | | | | | | | | | | | | | | | QNetworkHeadersPrivate::toHttpDate() used a custom format to output a date-time; the format supplied GMT as suffix, but neglected to convert the date-time to UTC, so local-time was formatted as if it were UTC, regardless of its actual offset from it. Fixing this (by the obvious toUTC() call) broke formatting when the supplied header value was a QDate, since it's packaged as a QVariant and QVariant's conversion of QDate to QDateTime uses local time's (not UTC's) start of day. So fix headerValue() to separate QDate and QDateTime cases and use startOfDay(Qt::UTC) to get the right start of the day. Added tests for non-UTC date-times appearing correctly in HTTP headers. Fixes: QTBUG-80666 Pick-to: 6.3 6.2 6.2.3 5.15 Change-Id: I2792bce14a07be025cf551b0594630260c112269 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Simplify some #if-ery and use positive testsEdward Welbourne2022-01-171-8/+6
| | | | | | | | | | Two cases coincide without feature textdate, and the first falls through to the second with the feature, making it possible to simplify the #if-ery, converting its tests to positive form and skipping a duplicate case body in the process. Change-Id: I2c0ee800442474707bf8893bd72b9706fef54485 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move input event logic into QWasmCompositorDavid Skoland2022-01-179-598/+658
| | | | | | | | | | | | | | | | | | | | | Move the window logic and state out of QWasmEventTranslator and into QWasmCompositor. The reasoning for this change is that the state of the windowing system was split between QWasmCompositor (eg. window stack) and QWasmEventTranslator (eg. dragged and pressed windows). This change moves the input handling and state to QWasmCompositor and demotes QWasmEventTranslator to a helper class. In this model, QWC acts as a proper window system / display server and can leverage multiple helper classes which are "owned" by the QWC. Here is a quick diagram illustrating the proposed general architecture around WASM window handling and its difference from typical OSes: https://i.imgur.com/vcBwUPf.png Change-Id: Idca617992b8e1b431e5c71d46b5db61597c99e75 Pick-to: 6.3 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Doc: Use \inmodule for all classes and headersTopi Reinio2022-01-1717-2/+20
| | | | | | | | | | | | | | | 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>