summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* QNativeSocketEngine/Unix: implement IP_RECVIF in setOption()Thiago Macieira2025-10-211-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This amends and complements abe269bb72233b360bccbc8f54d3f13e8dc10b5a, which added QNativeSocketEngine::ReceivePacketInformation and actually did implement the heretofore-dead code to handle the IP_RECVIF ancilary data in nativeReceiveDatagram(), but we never asked the OS for the information via setsockopt(). Similar to what e9778dfe6ead0c4d704570816a56aead084a0263 did for Windows. Tested on FreeBSD. dtruss says: socket(PF_INET,SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK,0) = 7 (0x7) setsockopt(7,SOL_SOCKET,SO_BROADCAST,0xb1cf40aece4,4) = 0 (0x0) setsockopt(7,IPPROTO_IP,IP_RECVDSTADDR,0xb1cf40aece4,4) = 0 (0x0) setsockopt(7,IPPROTO_IP,IP_RECVIF,0xb1cf40aece4,4) = 0 (0x0) setsockopt(7,IPPROTO_IP,IP_RECVTTL,0xb1cf40aece4,4) = 0 (0x0) bind(7,{ AF_INET 127.0.0.1:0 },16) = 0 (0x0) ... ppoll({ 7/POLLIN },1,{ 8.999999439 },0x0) = 1 (0x1) recvfrom(7,"@",1,MSG_PEEK,NULL,0x0) = 1 (0x1) recvmsg(7,{{ AF_INET 127.0.0.1:55621 },16,[{"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"...,1200}],1, { {level=IPPROTO_IP,type=IP_RECVDSTADDR,data={0x7f,0x00,0x00,0x01}}, {level=IPPROTO_IP,type=IP_RECVTTL,data={0x40}}, {level=IPPROTO_IP,type=IP_RECVIF,data={0x38,0x12,0x02,0x00,0x18,0x03,0x00,0x00,0x6c,0x6f,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} },120,0},0) = 600 (0x258) lldb decodes the sockaddr_dl as: (lldb) p *sdl (sockaddr_dl) { sdl_len = '8' sdl_family = '\x12' sdl_index = 2 sdl_type = '\x18' sdl_nlen = '\x03' sdl_alen = '\0' sdl_slen = '\0' sdl_data = "lo0" } And interface index 2 is lo0: lo0: flags=1008049<UP,LOOPBACK,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 16384 options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6> inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 groups: lo nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> Change-Id: I37b88bfce40421117d99fffd1110eced5d102430 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QMdiSubWindow: Respect null icon setting on MacEirik Aavitsland2025-10-221-1/+4
| | | | | | | | | | | | On Mac, a QMdiSubWindow title bar by default shows no icon. However, if an icon is then set on it, there would be no way to return to the initial no-icon-shown state. Setting a null icon would only result in the default window icon to be shown instead. This commit fixes that. Fixes: QTBUG-139345 Pick-to: 6.10 6.8 Change-Id: I456a2cbdc4b81312a2959bc0f84a1dd545908b1f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Revert "QArrayDataOps::assign: improve for forward iterators (typical case)"Fabian Kosmale2025-10-212-48/+18
| | | | | | | | | This reverts commit 37b37cddb67febd595cb06b54ac08f1e676ead4d. Reason for revert: This caused QTBUG-141366 Change-Id: I1f878386e969f986bbd9c289b0b9a1fe8e9daaf7 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
* CMake: Refactor AUTOGEN and metatypes path functionsAlexandru Croitor2025-10-211-13/+32
| | | | | | | | | | | | | | | | | Extract code into two new functions: - _qt_internal_get_metatypes_build_dir - _qt_internal_get_target_autogen_info_dir Add some comments on what values they return. These will be adjusted in further changes, to help with CMake's shorter build paths feature. Pick-to: 6.8 6.10 Task-number: QTBUG-110696 Task-number: QTBUG-117413 Change-Id: I96251e9130b9e1e556dbd7ba1e7fe2362fcb623c Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Set CMAKE_POLICY_VERSION_MINIMUM with older Android NDKsAlexandru Croitor2025-10-211-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using CMake 3.31+ with Android NDKs older than r28, CMake shows the following deprecation warning: CMake Deprecation Warning at ndk/27.2.12479018/build/cmake/android.toolchain.cmake:35 (cmake_minimum_required): Compatibility with CMake < 3.10 will be removed from a future version of CMake. This warning appears multiple times, when configuring Qt, user projects, try_compile calls, etc. That's because the Android NDK cmake toolchain file sets cmake_minimum_required(VERSION 3.6) unconditionally, which is less than 3.10. To avoid the warnings, we can set the CMAKE_POLICY_VERSION_MINIMUM variable or environment variable to 3.10. The variable can only be set in CMake 4.0+ though, so it won't help with CMake 3.31. The assignment has to be done in multiple places: - When detecting Android in QtAutoDetectHelpers.cmake - When generating the Qt toolchain file in QtToolchainHelpers.cmake - When doing try_compile calls in QtFeature.cmake - When doing test calls in QtRunCMakeTestWrappers.cmake To be on the safer side, the following opt-outs are provided: - QT_NO_SET_ANDROID_CMAKE_POLICY_VERSION_MINIMUM If set to true, the automatic setting of CMAKE_POLICY_VERSION_MINIMUM is disabled. - QT_ANDROID_CMAKE_POLICY_VERSION_MINIMUM A version to use instead of 3.10. - QT_NO_SET_RUN_CMAKE_TESTS_CMAKE_POLICY_VERSION_MINIMUM Disables the assignment for RunCMake tests. These are considered at various points in the code, rather than just once when configuring Qt. When using NDK r28 or newer, the toolchain file sets 3.10 itself, so no warning appears. Pick-to: 6.8 6.10 Change-Id: I47c6013f9cafed8836c32d2b726e75838c9d8779 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Set QGuiApplicationPrivate::lastCursorPosition on Enter eventShawn Rutledge2025-10-211-0/+1
| | | | | | | | | | | | | As soon as a window is shown, if it happens to be under the mouse cursor, lastCursorPosition should be set correctly. The fact that this was not done was masked in Qt Quick by the separate tracking of current mouse position in QQuickDeliveryAgent. We need the tracking to be reliable in QtGui so that Qt Quick does not need to do that. Pick-to: 6.10 Task-number: QTBUG-136976 Change-Id: Ida397beeb335bc054fd8a005c7dc65f2b7e48ffa Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* wasm: a11y - Handle case where a child does not have a childIndexEven Oscar Andersen2025-10-211-13/+14
| | | | | | | | Some interfaces will return -1 for childIndex. Work around this by adding an explicit test. Change-Id: I703f20f8d57ed4cb7e69efd87e03c68eb30aec90 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* macOS: Add note about effect of [NSInputContext handleEvent:]Tor Arne Vestbø2025-10-211-0/+3
| | | | | Change-Id: Idf825418f522ce576c8530327c79c080a2925401 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Widgets: QMenu - do not start sloppy menu timer from QMenu APITim Blechmann2025-10-212-3/+5
| | | | | | | | | | When QMenu::setCurrentAction starts a timer for closing the menu again. This causes unexpected behaviour when calling QMenu::setCurrentAction, as it may unset the current action when this timer fires. Fixes: QTBUG-138956 Change-Id: Ia4d80455a04453d2e6b173a9d7e7c5df39e696ce Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QSemaphore: stub out tryAcquire() for no-threadMorten Sørvig2025-10-211-1/+19
| | | | | | | | | Ammends 7075ac5bf6bf51a7538bf5c6592e2ff97f5c7cbe. Pick-to: 6.10 Fixes: QTBUG-141130 Change-Id: I699bb61832cded1b2f05d0138478e3d8c703f8f2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QAbstractItemView: Make the keyboard search configurableChristian Kandeler2025-10-214-2/+34
| | | | | | | | | | | | Introduce a new property keyboardSearchFlags, so that keyboard search is no longer limited to prefix matching. [ChangeLog][QtWidgets][QAbstractItemView] The new property keyboardSearchFlags was introduced, allowing client code to do something other than a prefix search. Change-Id: Ic2408e51b15de0275c80936de66a07058ddf7132 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* QChar: fix Clang 21 -Wcharacter-conversion warningsMarc Mutz2025-10-211-31/+31
| | | | | | | | | | | | | | | | | | | | | | | | Clang 21 started warning about all conversions between charNN_t types (since fixed for char16_t → char32_t¹), and QChar appears to be the only header in QtBase that is affected by it. While char16_t → char32_t has already been fixed upstream, we ought to have our public headers clean of even this overzealous warning, so fix them by adding an explicit cast. I would have used 'char32_t{ucs}', but the warning is so buggy it's not fixed by braced initialization (filed as upstream bug report https://github.com/llvm/llvm-project/issues/164220). Interestingly, the warning does not trigger, for the same code, in constexpr function, but proactively "fix" those, too, so we don't need to re-touch these functions later. As a drive-by, remove the pointless inline keywords from these functions to make horizontal space for the cast. Done-with: Thiago Macieira <thiago.macieira@intel.com> Task-number: QTBUG-141204 Pick-to: 6.10 6.8 6.5 Change-Id: I2a9e46ea4f327fb554418c4649d189a98e15ffae Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Mark QTZP::NamePrefixMatch's operator bool() as constEdward Welbourne2025-10-211-1/+1
| | | | | | | | When I added it I forgot to specify that it doesn't change *this. Amends commit d13e9a1ae53ee53c4929bc88d578a02eec4b2dc4 Change-Id: Ie94ff05fc19f696688dd8ccbfa9a352086d0cc94 Reviewed-by: Mate Barany <mate.barany@qt.io>
* QRAAFP: get rid of the QObjectPrivateVersion parameter in c-torIvan Solovev2025-10-212-3/+3
| | | | | | | | | | | The parameter is not really relevant for classes inside QtCore, as it's mostly used to bind a library to a certain version of QtCore if it relies on specific private APIs. Amends 65b7217ae71ad8b0448a0ba60e7e33350e84d97c. Change-Id: I167221eb1746cf36adde3da1fd11b4062cb77a0a Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* wasm: a11y - Implement fast lookup in eventhandlerEven Oscar Andersen2025-10-212-25/+30
| | | | | | | | | | Store the interface with the element when registering the handler, extract it in the eventhandler. Limitations, only one interface for each element. Change-Id: I68b0cf63cf4fa4dfa2f851ae40a6c1f9e6f868e7 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Testlib: simplify invocation of initMainTim Blechmann2025-10-211-19/+7
| | | | | | | | | | `std::void_t` is the more idiomatic way to test for the presence of a member of a template class. We can also use `if constexpr` instead of SFINAE, making the code much simpler to read Change-Id: I4c15f1efb4bb8ffdf64fe212a3b5e98b2d98b9fe Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Q{Explicitly,}SharedDataPointer: share most codeThiago Macieira2025-10-203-134/+195
| | | | | | | | | | | | | The majority of the code for the two classes is identical, so we can share code. QExplicitlySharedDataPointerV2's is different... and wrong? We need explicit constructors, assignment operators, and destructors to prevent early instantiation of the base class's equivalents, which break compilation of classes using the QT_DECLARE_Q(E)SDP_SPECIALIZATION_DTOR macros. Change-Id: I9e3cde075b537c61e8fcfffdb7a1a2d74b399967 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Suppress Clang 21 -Wcharacter-conversionMarc Mutz2025-10-211-0/+4
| | | | | | | | | | | | | | | | | | The new Clang 21 warning is wreaking havoc in C++ projects that want to use modern C++, because it not only warns about char8_t → char16_t, but also about the completely harmless char16_t → char32_t conversions. It has since been fixed, but suppress the warning globally until we know which version has the fix (looks to be 21.1.4 at this point). Upstream bug report: https://github.com/llvm/llvm-project/issues/163719 More discussion in: https://github.com/llvm/llvm-project/issues/138526 Upstream fix: https://github.com/llvm/llvm-project/pull/163927 Pick-to: 6.10 6.8 6.5 Change-Id: I6409f6f6833131e3a77d81ab679125b2806e86a2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* qalloc.h: add missing <cstdlib> includeMarc Mutz2025-10-211-0/+1
| | | | | | | | | | | | | | A Clang 21 headerscheck complained that malloc() and realloc() were undefined without it, and, indeed, these functions are defined in stdlib.h. Amends 03d5daf9437d8b46db2e89e3a9763ea701fa681c. Pick-to: 6.10 Change-Id: Ibe603769c3f25106c8f97215fccead255ce687c7 Reviewed-by: Aurélien Brooke <aurelien@bahiasoft.fr> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Long live Q_PRESUMETim Blechmann2025-10-204-9/+22
| | | | | | | | | | | | | | | | | Q_PRESUME wraps a Q_ASSERT/[[assume]] and can be used as a stop-gap until [[assume]] can be used unconditionally. It has stricter semantics than the deprecated Q_ASSUME and is helpful to silence static analyzer warnings. Documentation and [ChangeLog] in the next commit so it won't be cherry-picked. Fixes: QTBUG-141074 Pick-to: 6.10 Change-Id: Id5376bcc5e9e9708c836ceff5eea982c2b0e382e Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Tim Blechmann <tim.blechmann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix alpha value after to-FP16 conversions on AVX2Allan Sandfeld Jensen2025-10-201-1/+1
| | | | | | | Pick-to: 6.10 6.8 Fixes: QTBUG-141255 Change-Id: I2c11709b3168386a8568b109cad4028dfefb979e Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* a11y Android: Use RANGE_TYPE_PERCENT for RangeInfo of ProgressBarJulian Greilich2025-10-201-2/+11
| | | | | | | | | This way the current value is announced as "xy percent". Task-number: QTBUG-139712 Pick-to: 6.10 6.8 Change-Id: I796e942a799c78f4fc144e77bf9d18b9c1cb0ea3 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* QLockFile/win: Open the file with FILE_SHARE_DELETEMårten Nordheim2025-10-201-4/+24
| | | | | | | | | So we may be able to switch to using SetFileInformationByHandle to perform the deletion without closing the HANDLE first some time in the future. Task-number: QTBUG-140486 Change-Id: I8098d7f54e00e20065310e29436eb8e29bea60ae Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLockFile: refactor local helper into static member functionsMårten Nordheim2025-10-204-18/+34
| | | | | | | | | | | | | To prepare for the Windows backend doing extra work. We want to open the file with FILE_SHARE_DELETE so that we can eventually create the file with the DELETE permission, enabling us to delete it without closing the handle first. Since we can't do that through QFile directly we need to open the file descriptor first and then pass that to QFile. Change-Id: I0baf0ee3089b489f3bd1e0259cc06195e9256647 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* TestLib: macOS - unconditionally disable display sleepTim Blechmann2025-10-201-5/+3
| | | | | | | | | | | | | The tests only disabled display powersave for displays when a QApplication was running. It did not prevent display powersave for QGuiApplication, nor did it prevent any system sleep if the qApp singleton was created as part of the unit test of for app-less tests. To be on the safe side, we should prevent the display (and system) from going to sleep while any test is running. Change-Id: Icd8ddfda8c9fb8d551548def27ff65776bc82486 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Testlib: disable App Nap for whole execution of the testTim Blechmann2025-10-201-1/+4
| | | | | | | | | | | The intention was to disable App Nap for the whole test. However it was a RAII class which was destroyed at the end of QTest::qInit. This patch moves the AppNap disabler into a global variable, which is cleared in qCleanup. Pick-to: 6.8 6.10 Change-Id: I5c267b2b66626b230851e61e79655ef3a30d4481 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QMetaObjectBuilder: Fix detecting enum properties from QMetaTypeFriedemann Kleint2025-10-201-1/+1
| | | | | | | | | Fix condition wrongly inverted by dd95d5126ce9e022dfd25f0f44ee0f2a9e50f45e. Fixes: PYSIDE-3217 Pick-to: 6.10 Change-Id: I3c30541617a90ac32020aaddfca79024ba1ba351 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QCryptographicHash: hashInto(): write directly into the given bufferAhmad Samir2025-10-201-13/+25
| | | | | | | Pick-to: 6.10 Fixes: QTBUG-125521 Change-Id: I1cdf2fe38799f36e04903ae5f8a5b4e2050bad50 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qnumeric.h: fix build with FreeBSDThiago Macieira2025-10-191-0/+2
| | | | | | | | | | | | | | | | Their stdckdint.h is broken for C++ and Clang's implementation just falls back to it. global/qnumeric.h:280:12: error: use of undeclared identifier '_Bool' 280 | return ckd_add(r, v1, v2); | ^ /usr/include/stdckdint.h:16:3: note: expanded from macro 'ckd_add' 16 | (_Bool)__builtin_add_overflow((a), (b), (result)) | ^ Pick-to: 6.10 Change-Id: Ide6f468820478f46d21ffffdb825c8c1977a99f2 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Doc: Fix broken link to the Sinclair ZX SpectrumJoerg Bornemann2025-10-201-1/+1
| | | | | | | | | The page that describes the Sinclair ZX Spectrum has moved. Update the link. Pick-to: 6.10 Change-Id: I12d3f0f8aa38e2b426ee322a55518e2f742b8423 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QChar: avoid char{32→16}_t narrowing in canonicalOrderHelper()Marc Mutz2025-10-191-6/+14
| | | | | | | | | | | | | | | | | Same pattern as in the previous few patches: the old code used a char32_t to temporarily store a UTF-16 code point, narrowing it back to char16_t in a call to QChar::surrogateToUcs4(), triggering Clang 21 -Wcharacter-conversion. Solution is also the same: keep the UTF-16 code unit in a separate variable, until we have determined whether it needs surrogate decoding or merely promotion to char32_t. Amends the start of the public history. Pick-to: 6.10 6.8 6.5 Change-Id: I955948348d637c4fe13485808bef47a4ee58f7bf Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QChar: scope variables tigher in canonicalOrderHelper()Marc Mutz2025-10-191-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old code defined four variables outside a complex loop (with a nested goto). These can all be defined at their point of initialization, though, improving readability of the function (a tiny bit...), because the tighter scope makes it obvious that the loop isn't carrying state in these variables from one iteration to the next. The construction is safe, because, in C++, a backwards goto will destroy all variables declared after the label¹, iow: u2 and c2 are re-created by each jump though `advance`. Found while trying to fix char32_t → char16_t narrowing highlighted by Clang 21's -Wcharacter-conversion. Fix function has many other problems (most prominently, said goto), but they're out of scope of this immediate patch series, though they should eventually be fixed. This is security-critical code; we ought not have to deal with assembler-esque C++ code in such components. Amends f4d02ecdbf54987a0bada20fe8f8537e90c051d8. As a drive-by, change the c variables from char16_t back to ushort, because they don't represent characters, but character combining classes, partially reverting 7b04e0012b40203970f27869db2ab3e838ffe359. ¹ https://en.cppreference.com/w/cpp/language/goto.html#Explanation Pick-to: 6.10 6.8 6.5 Change-Id: If06356483bc77a16812d2790bd98f793bc74faa2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QChar: avoid char{32→16}_t narrowing in normalizationQuickCheckHelper()Marc Mutz2025-10-191-3/+6
| | | | | | | | | | | | | | | | | Same pattern as in the previous few patches: the old code used a char32_t to temporarily store a UTF-16 code point, narrowing it back to char16_t in a call to QChar::surrogateToUcs4(), triggering Clang 21 -Wcharacter-conversion. Solution is also the same: keep the UTF-16 code unit in a separate variable, until we have determined whether it needs surrogate decoding or merely promotion to char32_t. Amends 2e0a4b13addf1f56112bac38448be96fb02f650d. Pick-to: 6.10 6.8 6.5 Change-Id: I291871c73b26a1766c30f0c1c6858e09d9693678 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QChar: remove confusing foldCase(ch, ch&) overloadMarc Mutz2025-10-192-12/+1
| | | | | | | | | | | | | | | | | For years, I've been confused by the various foldCase() overloads, until Clang 21 -Wcharacter-conversion now forced me down the rabbit hole. Turns out that there's just one user of the ch,ch& overload and it's readily ported to the ch*,ch* overload, so do that and remove the now-unused overload. Amends the start of the public history. Pick-to: 6.10 6.8 6.5 Change-Id: I8ddd22b08423540f58c1a5fe0ef36c93c8b337f1 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QChar: avoid char{32→16}_t narrowing in foldCase(char16_t*, char16_t*)Marc Mutz2025-10-191-4/+6
| | | | | | | | | | | | | | | | | | | ... which triggers Clang 21 -Wcharacter-conversion. Instead of using the char32_t ucs4 variable to temporarily store the read from *ch, keep using *ch until we have determined whether it needs to be decoded as a surrogate pair or can simply be promoted to char32_t. Since this touches most lines of the function, anyway, take the opportunity to rename the first argument from 'ch' to 'cur', and change pointer arithmetic to indexing operations. Amends the start of the public history. Pick-to: 6.10 6.8 6.5 Change-Id: I47a026fd509da8fa3dee4b6be30ac4432148d9c6 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QChar: fix the signature of foldCase(char32_t, char32_t&)Marc Mutz2025-10-192-5/+5
| | | | | | | | | | | | | | | | | | | | | | | The only caller, ucstricmp(), passes UTF-16 code units, as implied by the implementation of foldCase(char32_t, char32_t&) (which decodes surrogate pairs, which shouldn't exist in UTF-32, and, if they do, not be decoded). Of course, the accumulator variables were char32_t, but only because C++ enforces this, due to the foldCase() signature. Fix by taking both arguments as char16_t instead of char32_t. As a drive-by, don't store the first argument in a char32_t and then narrow it for the QChar::*surrogate*() calls, use the argument instead. Found by Clang 21's -Wcharacter-conversion. Amends the start of the public history. Pick-to: 6.10 6.8 6.5 Change-Id: Ic08b695749d7f68353a4af8703eb6a86ba88d567 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QChar: avoid char{32→16}_t narrowing in (de)composeHelper()Marc Mutz2025-10-191-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | The old code used a char32_t to temporarily store a UTF-16 code point. Upon finding it to be a surrogate, it then had to narrow it back to char16_t for the call to QChar::surrogateToUcs4(). It also invoked QChar(uint), a ctor which should have never existed to begin with. Rewrite the functions to keep the UTF-16 code point in a char16_t variable until it's inspected to be either safe for promotion to char32_t or else has been decoded (or decoding failed). This requires to write 'uc = c' twice instead of once, but allows us to add a comment on the failed-decoding path to guide the reader of the code, improving readability. Specifically declare `uc` as uninit'ed to provoke compiler warnings when code is changed to forget to assign to `uc`. Found by Clang 21's -Wcharacter-conversion. Amends the start of the public history. Pick-to: 6.10 6.8 6.5 Change-Id: I8d43b4c0e0b3852ddf730f349886bd6943b94f17 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QCborValue: rewrite nextUtf32Character to avoid narrowing char32_t → char16_tMarc Mutz2025-10-191-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | Ought to fix Clang 21 -Wcharacter-conversion in this function. Instead of storing the initial *ptr in r.c (a char32_t) and then narrowing it back to char16_t for the call to QChar::surrogateToUcs4(), store it in a separate variable and construct an R only in the return statement. Also move the len = 1 return from the end of the function to the (inverted) if (c < 0x80) near the start of the function. This is less assmebler-esque, so might execute slower (though it's all values, so the optimizer should have no problem rewirting this to the old code, if that was faster), but is much easier to read, which is not the sneezed at in a security-critical component. Amends d4c7da9a07dc1434692fe08a61ba22c794574c4f. Pick-to: 6.10 6.8 6.5 Change-Id: I1ce610fa80e3d874106c9c5b3a1d50bf99f39732 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QTimer: fix clang -Wshorten-64-to-32 warningsAhmad Samir2025-10-181-11/+16
| | | | | | | | | | | | | | std::chrono::milliseconds::count() does not return int, so assigning the result to an int variable triggers said warning. Fix by using q26::saturate_cast<int> and checking (or asserting) that the value didn't change. Amends 1ca89b65d85c5df971fac7c1f9d5678e0e0cf45b. Pick-to: 6.10 6.8 Change-Id: I419c931d04b533402335568cc2e9569cc627f117 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QArrayDataOps::assign: improve for forward iterators (typical case)Thiago Macieira2025-10-182-18/+48
| | | | | | | | | | | | | Similar to commit 7ed2db674328f1c96d06be5ffb15b8ffefeae545, which did this for QVarLengthArray. This disentangles the forward iterator case from the more complex, iterative input-only iterator one, because we know the final size from the beginning. This generates far better code for the more common uses of random-access iterators and especially that of trivial types. Change-Id: Ib71e489ae0dafb7a917bfffd3441d8c14b82ad46 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QArrayDataOps::assign: simplify undoing the prepend optim. for trivialsThiago Macieira2025-10-181-1/+6
| | | | | | | | | | | | | | | Since they are trivial, we don't need to loop destroying anything (dead code anyway), so help the compiler out and always store the new capacity begin. This may be storing the value that was already there if no element was removed from the beginning of the list, but it does remove a conditional. Further, this removes the entire looping over the prepend optimization buffer for new elements. We'll fall straight to the main assignment loop. Change-Id: I5338b6a53bffbda17a08fffd1d7eda72d57eff29 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QArrayDataOps::assign: invert how we find the beginning of the capacityThiago Macieira2025-10-181-12/+14
| | | | | | | | | | | | | | | Ideally the equation would be the same: offset = this->ptr - Data::dataStart(d, alignment); capacityBegin = this->ptr - offset; => capacityBegin = Data::dataStart(d, alignment) But codegen isn't as simple as that, so invert and use QADP::dataStart() to calculate the beginning of the allocated capacity and only if needed calculate how many elements we must destroy/overwrite. Change-Id: Ib716ed04c4684964ec0dfffd473c635456062bde Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QArrayDataOps::assign: reuse capacity if this is the last referenceThiago Macieira2025-10-181-3/+17
| | | | | | | | | It's a waste to allocate new memory, then deref the old and free it, if we can still use it. This detach-me-for-growth code may be useful in other places too. Change-Id: Ie4d7300589ff21b0aa03fffdb7a74c01c385d842 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QArrayDataOps::assign: make the detaching case common to all iterator typesThiago Macieira2025-10-181-9/+7
| | | | | | | | This only simplifies the code and enforces offset = size = 0 if we've just detached. Change-Id: Ia5d667fc0f528eaa154bfffde155e28f54f7a8ff Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QArrayDataOps: move assign() from QArrayDataPointerThiago Macieira2025-10-185-101/+99
| | | | | | | | The implementation was already using the Ops (like in (*this)->emplace), so this is only natural. We want to access the extra operations anyway. Change-Id: Id1f422be54154f2c41b0fffd416dcb1916e8f022 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QNativeSocketEnginePrivate::setOption: simplify ugly perror() handlingThiago Macieira2025-10-171-13/+10
| | | | | | | | | | | With a macro. Drive-by clean up the VxWorks implementation of NonBlockingSocketOption, as we know v == 1 on input. Pick-to: 6.10 6.9 6.8 Change-Id: I917f5f39ded2fa338803fffd91002fca28d7faaa Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QApplication: reset WA_KeyboardFocusChange on focus changeChristian Ehrlicher2025-10-171-5/+9
| | | | | | | | | | | | | | | WA_KeyboardFocusChange is set when the user changes the focus by mouse but never cleared once the focus was changed e.g. with the mouse. The only way to clear it is to unfocus the whole top-level widget. This is results in focus rects in some style like fusion on checkboxes where there shouldn't be one. Fix it by clearing the attribute when the FocusReason is not keyboard. Fixes: QTBUG-141100 Pick-to: 6.10 Change-Id: I211e7f435c9fe748ee9925e35b481166b7446a55 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Avoid float rounding errors in QDashStrokerRobert Löhning2025-10-171-2/+4
| | | | | | | | | | | | | | Calculations which should have a result of zero can lead to slightly different results when using floating point values. This patch fixes a case which could trigger an assert although all values passed to the public API were harmless. Credit to OSS-Fuzz for finding an SVG file which triggered this as issue 429123947. I derived the test from the values in the file. Pick-to: 6.10 6.8 Change-Id: I06d6f0f0bf6beb758f54423e16e9c5653ed8edf1 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* qfloat16.h: scope warning suppression tighterMarc Mutz2025-10-171-4/+3
| | | | | | | | | | | | | | | | | The Clang -Wc99-extensions warning was fixed for Clang 5.0, and the function causing it (_cvtss_sh()) has since been replaced in commit c817b33b45f2886c89d8a768c61ffffaa46f67a4. That leaves the -Wold-style-cast suppression needed for _mm_cvtps_ph(), so put the suppression magic around just that call, amending 89c8dd30a12bbe44f4661a1b4dd5aec079e41cae. This exposes the rest of the function to warnings again, so not picking back, in case this unearths something. Once we have had a release cycle where this has caused no problems, we can reconsider. Change-Id: Ib489fd14c2337bfe64155ed5825c23f7a53b3cdc Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QJsonParseError: fix clang -Wshorten-64-to-32 warningsAhmad Samir2025-10-162-2/+6
| | | | | | | | | Change it to qint64 in Qt7, as requested in code review, so as to make it easier to extend it in the future. Pick-to: 6.10 6.8 6.5 Change-Id: If893d719dd0457fac46fdd37ff95ce95222b1858 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>