summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* moc: add line numbers to properties, methods, etcSami Shalayel2025-07-012-0/+204
| | | | | | | | | | Those are needed by qmlls to be able to jump to C++ definitions. Task-number: QTBUG-119143 Task-number: QTBUG-128393 Change-Id: I4fb9394b0a22a02501bafdbe95a7cd8998adfe11 Reviewed-by: Ulf Hermann <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>
* tst_moc: add missing dependency to mocSami Shalayel2025-07-011-0/+2
| | | | | | | | Add missing dependency to MOC such that the .json files are regenerated automatically when moc was modified. Change-Id: Ie874443b0c11cc7c7feefe1bc1a555c3bd135257 Reviewed-by: Fabian Kosmale <[email protected]>
* QAnyStringView: support single wchar_t arguments also on UnixMarc Mutz2025-06-303-5/+20
| | | | | | | | | | | | | | | | | | | | | | We support char32_t, so there's no reason to not support a 4-byte-wchar_t. This also fixes a nasty asymmery between QString::arg(L'ä') (integral output) and QL1SV::arg(L'ä') or QString::arg(L'ä', L'ä') (characters) [ChangeLog][Important Behavior Changes][QtCore][QString] The unary arg() function now treats wchar_t as a character (string-like; was: integer), so u"%1".arg(L'ø') will now return "ø" and not '248". This makes the function consistent with both QString multi-arg() and QLatin1StringView::arg(). [ChangeLog][QtCore][QAnyStringView] Supports construction from a single wchar_t on all platforms now (was: only on Windows). Fixes: QTBUG-126054 Pick-to: 6.10 Change-Id: I21b7a9782f03d04686207db30d1b1c9d50bc8169 Reviewed-by: Thiago Macieira <[email protected]>
* Add missing qquaternion.h includesMarc Mutz2025-06-303-0/+8
| | | | | | | | | | | | | | | | | | | The qquaternion.h include will vanish from qmatrix4x4.h soon, but some TUs depended on on the transitive include. This patch includes qquaternion.h into all TUs that use QQuaternion, but didn't include its header. I didn't check all the individual TU's history to make a detailed "amends", so I'll just pick this all the way back, knowing there may have been more users in older branches, or some TUs don't exist there, but it since we're not picking the removal of qquaternion.h from qmatrix4x4.h further than 6.10, I don't need to do detailed checking. CI will tell me when something's wrong. Pick-to: 6.10 6.9 6.8 6.5 Change-Id: Icf0db8ba4f12421fd46f9d1041f235bf4cc2c12b Reviewed-by: Volker Hilsheimer <[email protected]>
* QIdentityProxyModel: call data() from subclasses in match()David Faure2025-06-301-0/+34
| | | | | | | | | | | | | | | The implementation of match() was only looking into the source model, without considering the fact that data() could be reimplemented in a QIdentityProxyModel subclass (a very common usage pattern for the class, part of the documentation). The simplest solution is to let the default implementation from QAbstractItemModel do matching the usual way, calling data(). Fixes: QTBUG-78013 Pick-to: 6.10 6.9 6.8 Change-Id: If984ffa5f8dbdfe9a76eaec8b82648d705cfecd4 Reviewed-by: Volker Hilsheimer <[email protected]>
* Replace one-shot uses of QSemaphore with QLatchThiago Macieira2025-06-301-5/+5
| | | | | | | | | | | | | | | This commit replaces one-shot synchronization of threads that were using QSemaphore with QLatch. QSemaphore is efficient on Linux and Windows, but allocates memory elsewhere. Even on those platforms where we have futex-like OS support, QSemaphore is heavier than what we really need here. All but one uses of QSemaphore in qtbase libraries (I didn't change examples or tests) were replaced. The remaining use of QSemaphore in qnetworkproxy_libproxy.cpp is a proper producer-consumer. Change-Id: Ib5ce7a497e034ebabb2cfffd1761a4fcb2be9a6c Reviewed-by: Volker Hilsheimer <[email protected]>
* tst_QQuaternion: fix spelling of 'expected'Marc Mutz2025-06-301-7/+8
| | | | | | | | | | | | | | | | | | As a drive-by: - replace direct by copy initialization and reflow the line with the ternary - make objects const - don't compute the cross product twice; it's anti-commutative, so if a × b is 0, then so is b × a = -(a × b). Amends 95d034a14f78aaefd6990de180f715c8b4d510b1. Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I4dc4582854b3d93a6e3468e8b19afe28d77c6c1c Reviewed-by: Volker Hilsheimer <[email protected]>
* tst_bench_qfile: fix yet another [[nodiscard]] warningMarc Mutz2025-06-291-0/+1
| | | | | | | | Amends 7466831509fe163f3fd1e3a6bbf38f6f5a32ef00. Pick-to: 6.10 6.9 6.8 6.5 Change-Id: I73ec71d727e2e07761b7b7c70e8b8eddd9137450 Reviewed-by: Volker Hilsheimer <[email protected]>
* Android: update to Gradle 8.14.2 and AGP 8.10.1Assam Boudjelthia2025-06-281-1/+1
| | | | | | | | | | | | | Update to latest versions for Gradle: * Gradle 8.12 -> 8.14.0 * Android Gradle Plugin 8.8.0 -> 8.10.1. [ChangeLog][Third-Party Code] Updated Gradle to 8.14.1 and AGP to 8.10.1. Task-number: QTBUG-137782 Change-Id: Ifbc808e18412f6e2e45612612d36a1f9bf57c1a9 Reviewed-by: Ville Voutilainen <[email protected]>
* Replace `QT_NO_CREATE_TARGETS` with an automated and scoped logicCristian Le2025-06-271-6/+0
| | | | | | | | | | Effectively check if we are importing while still building the current project Task-number: QTBUG-135233 Change-Id: If172617463157e84e1b16fc2354147fabae41084 Reviewed-by: Alexandru Croitor <[email protected]> Reviewed-by: Alexey Edelev <[email protected]>
* Long live QLatchThiago Macieira2025-06-273-0/+289
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Like std::latch[1][2]. Originally proposed by N3666, it only became a reality after the atomic wait functionality in C++20. We can't depend on that yet in Qt because a) we don't depend on C++20 yet, and b) the implementations of atomic waiting and std::latch are too recent in the Standard Library implementations (GCC 12, LLVM 12, MSVC 19.28). This implementation therefore builds the functionality from scratch, like the original proposal did[3]. We'll probably keep our implementation for the long run, because it's more efficient than the Standard Libraries' implementations. The MS STL implementation is the closest to ours and to bare OS functionality: uses WaitOnAddress / WakeByAddress as expected, but it generates a bit more code than is necessary. And it's Windows-specific, of course. Both cross-platform implementations (libstdc++ and libc++) do far more work than necessary for platforms that offer a OS futex-like support. Both of them busy-loop waiting for the atomic value to change and then exponentially back off using sched_yield(). Those aren't useful to us, as the majority of our uses are with threads that have just been created and have therefore likely made little progress. They can be actively harmful in some cases. The libc++ implementation is even worse by using std::high_resolution_clock to time this looping up to 64 µs in inline code before making a system call to sleep and wait (and it can't / won't use the latch's address for the futex itself). Both implementations also use an extra atomic out of a global pool (16 in libstdc++, 256 in libc++) to indicate whether there is any waiter on this address and therefore avoid the system call to wake them. See the next commit for an efficient implementation for QLatch. This implementation uses the limited atomic-wait functionality added by the previous commit for platforms that don't support futexes. [1] https://wg21.link/p1135 [2] https://en.cppreference.com/w/cpp/thread/latch/latch [3] https://github.com/ogiroux/atomic_wait/tree/master/include Change-Id: Ib5ce7a497e034ebabb2cfffd1761a3a6ff2598d3 Reviewed-by: Mårten Nordheim <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>
* Short live q20::atomic_wait!Thiago Macieira2025-06-273-0/+322
| | | | | | | | | | | | | | | | | | | atomic_wait() and atomic_notify_{one,all}() are available in C++20, which we can't depend on right now. So we implement our own fallback implementation. This is a simple implementation for systems which don't have either futexes or the C++20 atomic wait API. That means it's not very efficient, just simple. The unit test tests the fallback implementation only: it is not Qt's business to test the Standard Library. The fallback implementation and the Standard Library's are not binary-compatible and cannot be mixed. Callers must ensure that all sides use the same implementation and the easiest way to do that is to only use this in non-inline code, or at worst inline code that isn't shared across libraries/modules/plugins. Change-Id: Ib5ce7a497e034ebabb2cfffd1761a0e497dd17d4 Reviewed-by: Mårten Nordheim <[email protected]>
* tst_QNetworkInterface: fix localAddress() for point-to-point connectionsThiago Macieira2025-06-251-4/+9
| | | | | | | | | | | | | | | | | | When the IPv4 netmask is 255.255.255.255 (point-to-point interface), we were calculating our own local IP. That meant we would route through the loopback interface to connect to it, not the interface, resulting in test failures. So just flip one bit and hope that it will work. FAIL! : tst_QNetworkInterface::localAddress(vpn0-10.124.222.242) The computed value is expected to be less than or equal to the baseline, but is not Computed (pmtu) : 65535 Baseline (outgoingIface->maximumTransmissionUnit()): 1422 $ ip r get 10.124.222.242 local 10.124.222.242 dev lo table local src 10.124.222.242 uid 1000 Pick-to: 6.10 6.9 6.8 Change-Id: I3d18ad117dd0c49fcec2fffdcb29534e64a438d9 Reviewed-by: Mårten Nordheim <[email protected]>
* moc: disable name clash bug for faulty MSVC verisonsFabian Kosmale2025-06-253-69/+19
| | | | | | | | | | | | | | | | | We still want to test the code on non-affected MSVC versions, so we - remove the header from the manual qt_wrap_cpp call, - instead, let automoc pick it up by making it part of the target, - include the moc file to prevent CMake putting the generated file in the combined C++ file, - but include it only conditionally to avoid the compilation issue on MSVC. This has the side effect that we no longer consider the file in the JSON output, but that is less important. Pick-to: 6.10 6.9 Change-Id: I46d93aac9721eba081221586b66a3742c863da90 Reviewed-by: Oliver Wolff <[email protected]>
* Add test collection for `find_package`Cristian Le2025-06-255-0/+29
| | | | | Change-Id: I78e339762206e0bb3408c55b09f0dba08dae22c9 Reviewed-by: Alexandru Croitor <[email protected]>
* Reland: CMake: Annotate some qt_find_package calls with MODULEAlexandru Croitor2025-06-242-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A qt_find_package call first tries to find a Config package with the CONFIG mode option, and if not found, falls back to an arg-less mode which searches both Config and Find modules. For some packages, we know we want to find the Find module because there can't be a Config package, e.g our FindWrap modules or any of the other Find modules we carry in our cmake directory. So we should annotate these calls with MODULE. Aside from slightly faster configuration, there is another reason to do so. Future versions of CMake will automatically log find_package calls that have a state change (e.g. Not Found -> Found) into CMakeConfigureLog.yaml. Due to the Config-first logic in qt_find_package, we always unset the Foo_DIR variable if the Config package is not found. This means that there will be a constant build up of not-found messages in the log. Explicitly annotating the calls with MODULE will prevent this. Do that. This commit relands f1a59e974f013fcf8629d8cbacab58d895523100 This reverts commit 0ce82b78a35026cb56ff76d1c24b311008934a53. Pick-to: 6.10 Change-Id: I5d37579d2f4957215ce1475b5c0ec8509d77c83d Reviewed-by: Joerg Bornemann <[email protected]>
* no-thread: enable using QFutureMorten Sørvig2025-06-242-3/+46
| | | | | | | | | | | | | | | | | | | | | | | | Enable using QFuture for handling async tasks, which is a use case which can work also for the no-thread configuration. Add implementation files and headers for the QFuture dependencies to the no-thread build. These files build, but as with no-thread QThread there is no guarantee that they will do anything useful. Stub out some more functions in QThread, and also add stubs for no-op QSemaphore. Enable the tst_qfuture test and skip tests which require threads. tst_qfuture now runs with: Totals: 70 passed, 0 failed, 13 skipped, 0 blacklisted, 6373ms Pick-to: 6.10 Change-Id: Icd82590915d6034ae7829ead3fb4ebaf1e9c2aad Reviewed-by: Tim Blechmann <[email protected]> Reviewed-by: Artem Dyomin <[email protected]>
* tests: fix a typo in tst_QWindow::touchInterruptedByPopup()Liang Qi2025-06-231-1/+1
| | | | | | Pick-to: 6.10 6.9 6.8 Change-Id: I6d846c7bfdaa6034994057725dd65c7ab75c9273 Reviewed-by: Shawn Rutledge <[email protected]>
* Wayland: skip tst_QWindow::touchInterruptedByPopup()Liang Qi2025-06-231-0/+6
| | | | | | | | | | | | | | | | | | | | and touchToMouseTranslationByPopup() Compositor will dismiss the request if we just use mInputDevices in the setGrabPopup() call in QWaylandXdgSurface::QWaylandXdgSurface(). We don't have a solution to fake it without hacking compositor. See also https://wayland.app/protocols/xdg-shell#xdg_popup:request:grab This request must be used in response to some sort of user action like a button press, key press, or touch down event. The serial number of the event should be passed as 'serial'. Pick-to: 6.10 Task-number: QTBUG-137020 Change-Id: I8c78fa8cc269125a4de56625433e313d5767b17d Reviewed-by: David Edmundson <[email protected]>
* tst_QMetaObject: add some more signature normalization testsAhmad Samir2025-06-231-0/+22
| | | | | | | | | | | | | | | | Add tests with nested template args. Add tests for empty and null signatures, requested in code review. Add a test for `char * const *` to verify that QTypeNormalizer::normalizeType() normalizes it as expected. Add a test for explicit void argument inside a template, suggested by Fabian in code review. Pick-to: 6.10 Change-Id: I040135355702e9c11d00a8685c274894dc46d848 Reviewed-by: Ivan Solovev <[email protected]>
* Update public suffix listMårten Nordheim2025-06-231-0/+0
| | | | | | | | | | | | Version 2025-06-16_09-45-02_UTC. [ChangeLog][Third-Party Code] Updated the public suffix list to upstream version 2025-06-16_09-45-02_UTC. Pick-to: 6.10 6.9 6.8 6.5 5.15 Task-number: QTBUG-137782 Change-Id: I8f4b430d5d01f73e9cc27ce6947d1fc595a97848 Reviewed-by: Alexandru Croitor <[email protected]>
* tests: skip tst_QWindow::modalWithChildWindow() on WaylandLiang Qi2025-06-221-0/+3
| | | | | | | | | | A nested window or a subsurface in wayland terms can't get focus. See also 0bd68fac97f4967f39715bf221f246c85371f3bf . Pick-to: 6.10 Task-number: QTBUG-137020 Change-Id: I563b8cfab84c136fa2a1e82f9feecafafc63d4a5 Reviewed-by: Tor Arne Vestbø <[email protected]>
* Add QMetaObject::normalizedSignature() benchmarkAhmad Samir2025-06-211-0/+25
| | | | | Change-Id: Ib8fcf8bc8feba5579d23f21ee9325199658e49bc Reviewed-by: Thiago Macieira <[email protected]>
* QByteArray: replace(view, view): don't detach the underlying data arrayAhmad Samir2025-06-211-6/+141
| | | | | | | | | | | | | | | | | | | | | | If the byte array would detach or reallocate it would copy the data over, then do the replacements; instead create a new byte array and copy the data and replacement to it as needed, then swap it with `this`. Use QVLA to hold the indices of the replacement locations into the byte array, this way we can do the replacements in one go, instead of chunks of 4096. Since we collect the indices, now there is no need to guard against `before` being part of `this`. Use qsizetype instead of size_t, so as not to convert from/to each other. Using an unsigned type to avoid negative values doesn't work, indices[size_t(-1)] could be out of bounds anyway. Task-number: QTBUG-133737 Task-number: QTBUG-106185 Change-Id: I8fe87d56227e3c4b2b39b7625659eb61c6b174d1 Reviewed-by: Thiago Macieira <[email protected]>
* Fix flaky tst_QProgressBar::setMinMaxRepaint on openSuSE and UbuntuFrédéric Lefebvre2025-06-211-1/+7
| | | | | | | | | | Set a fixed size to the progressbar and verify it before testing minimum and maximum repaint. Remove setActiveWindow as this anti-pattern is no longer necessary for Linux environments. Remove flakiness on openSuSE 15.6 and Ubuntu 24.04 Change-Id: I7b0deea5964abbebe31c24d98cacaf7336e82157 Reviewed-by: Axel Spoerl <[email protected]>
* Update TIKA mimetypes from upstreamDavid Faure2025-06-191-1/+1
| | | | | | | | | [ChangeLog][Third-Party Code] Updated TIKA mimetypes from upstream Pick-to: 6.10 Task-number: QTBUG-137782 Change-Id: Ic8437e94eaf334feb5c4896bc2ceccb162e2fb16 Reviewed-by: Mårten Nordheim <[email protected]>
* QByteArray: replace: add tests for `after` pointing into thisAhmad Samir2025-06-191-0/+48
| | | | | | | | Also `before` points into this. Pick-to: 6.10 6.9 6.8 Change-Id: I0d1aa522e96c046ea26fc0948546e0625c1a83e7 Reviewed-by: Ivan Solovev <[email protected]>
* Revert "CMake: Annotate some qt_find_package calls with MODULE"Alexandru Croitor2025-06-192-5/+5
| | | | | | | | | | | | | | | | | | | This breaks reconfiguring Qt in various ways, one of which is CMake Error at cmake/QtTargetHelpers.cmake:1557 (message): PkgConfig::ATSPI2 is not a valid target. This happens because pkg_check_modules sets ATSPI2_FOUND to 1, so qt_find_package thinks it shouldn't find the FindATSPI2.cmake module, which ends up not creating the ATSPI2 target. This reverts commit f1a59e974f013fcf8629d8cbacab58d895523100. Pick-to: 6.10 Fixes: QTBUG-137870 Change-Id: Ica74a236c6b1bb9d7ca9af29175cb2e84a93251b Reviewed-by: Fabian Kosmale <[email protected]> Reviewed-by: Joerg Bornemann <[email protected]>
* Android: auto-tests: Add missing lib to tst_qapplication Android apkKonsta Alajärvi2025-06-194-4/+38
| | | | | | | | | | | | | | | | | | | | | | | | | tst_qapplication is missing the modal_helper executable from the apk. Set the libmodal_helper.so as a target property for the tst_qapplication with QT_ANDROID_EXTRA_LIBS property. Change the name of qtbug_12673() test function to modalDialog(), I think this better represents what's being tested. The bug ticket representing qtbug_12673() can be found from the ticket linked to this commit. Construct a full path to the modal_helper.so and pass that to QProcess.start instead of relative path to filename when targeting Android. Add a shared utility function androidAbi() that returns the currently defined Android ABI. Change the function name in BLACKLIST file. Task-number: QTQAINFRA-6908 Pick-to: 6.8 6.9 6.10 Change-Id: I13904acda0f5608ea31df49bd95824e1412f2786 Reviewed-by: Assam Boudjelthia <[email protected]>
* Update CLDR to v47Mårten Nordheim2025-06-191-11/+11
| | | | | | | | | | | | | | Some of the changes required updating the tests. Like spanish separators and (English,France) now returning France instead of United States for territory. [ChangeLog][Third-Party Code] Updated CLDR data, used by QLocale, to v47. Pick-to: 6.10 6.9 6.8 Task-number: QTBUG-137782 Change-Id: Ic939666b9718d59ab28c51f65ac38cf84b97bf93 Reviewed-by: Ivan Solovev <[email protected]>
* QUrl: ensure setUrl() / operator=() erase any previous stateThiago Macieira2025-06-191-3/+54
| | | | | | | | | | | | | | | | | | | | | | QUrlPrivate::parse() did not clear all the state because it was designed for parsing from the QUrl constructor. The few conditions under which it retained some memory weren't obvious and weren't tested anywhere (it was the fragment and query). This will shed memory from the QStrings if we were the last reference, only to allocate again. There is some value in attempting to reuse their buffers by doing resize(0) and then appending in qt_urlRecode(), but that introduces complexity I didn't want to deal with. This incidentally fixes the qHash() inequalities too. Changelog in the previous commit. Pick-to: 6.10 6.9 6.8 6.5 Fixes: QTBUG-134896 Fixes: QTBUG-134900 Change-Id: I1885d0750ac1109aab61fffdbf7fad775706e61f Reviewed-by: David Faure <[email protected]>
* QUrl: fix comparisons of URLs with password but no explicit usernameThiago Macieira2025-06-191-0/+11
| | | | | | | | | | | | | | | | | | When a URL like "http://:[email protected]" is parsed, we will set the username field to "present", but if you parse "http://example.com" and then set the password, the field would still be marked as absent. This commit fixes that, while restoring its absence if the password is later removed. [ChangeLog][QtCore][QUrl] Fixed a number of bugs in QUrl where a URL modified using the setXxx() functions would fail to compare equal to itself after going through toString() and setUrl() round-trip. Pick-to: 6.10 6.9 6.8 6.5 Task-number: QTBUG-134900 Task-number: QTBUG-134896 Change-Id: I490cfd3d01260823ffdffffd4d9ac92dd42723b0 Reviewed-by: Ahmad Samir <[email protected]>
* tst_QShortcut: Test that modifier only shortcuts are not triggeredVlad Zahorodnii2025-06-181-0/+38
| | | | | | | | | | | | | | | | | | | | The QShortcutMap triggers shortcuts on key press. It's okay with normal shortcuts but modifier only shortcuts require extra care. Depending on the context, they can be triggered either on key press or key release. For example, for push to talk, they should be triggered on key press, but if a modifier only shortcut is assigned to a dashboard or something, then it should be triggered on key release so the dashboard is not accidentally opened when pressing another shortcut that starts with the same modifier. The QShortcutMap currently doesn't provide support for modifier only shortcuts. The proposed new test case verifies that a modifier only shortcut will not be accidentally triggered if there is a normal shortcut with the same modifier keys. Task-number: QTBUG-132435 Change-Id: I612d0239b29f8c1730016d10257def039b5e6cf1 Reviewed-by: Tor Arne Vestbø <[email protected]>
* QDBusMessage: add move-constructorIvan Solovev2025-06-181-0/+26
| | | | | | | | | | | | | | | | | | Since the class was not desigend to support a nullptr d_ptr, this change requires modifications in the destructor and copy-ctor. The change in destructor is straightforward - simply add a check that d_ptr is not null. The copy-constructor was using a qAtomicAssign() helper, which was relying on the fact that the passed pointers are not null, so we cannot use it anymore. Use copy-and-swap instead. The other methods do not require any changes, because the moved-from object can only be destroyed or assigned-to. [ChangeLog][QtDBus][QDBusMessage] Added move constructor. Change-Id: Ic8a0d913b9cf2f881369f7ad4f3a88c1f3fb345f Reviewed-by: Marc Mutz <[email protected]>
* iOS: implement file icon providerVolker Hilsheimer2025-06-181-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | Move the existing QCocoaFileIconEngine into a separate file in the darwin platform code, from where we can use it from both the cocoa and the iOS theme. Refactor the implementation for macOS to create and retain the NSImage as a member of the engine, and cache the QPixmap when it's requested, reusing it as long as it has the correct size. The iOS implementation is similar, except we need to go through UIDocumentInteractionController to get the icons for the file's URL. Explicitly make sure that we maintain the aspect ratio of the image we get. Augment the iconbrowser manual test to generate temporary files with certain extensions, and include those in the UI, allowing us to test that the icons we get from QAbstractFileIconProvider match the file type. Fixes: QTBUG-134239 Change-Id: I8fb63b3c518a6eb200f5948a1c38fd485e3b1c6d Reviewed-by: Tor Arne Vestbø <[email protected]>
* QJsonObject/QCborMap: Add asKeyValueRange()Johannes Grunenberg2025-06-182-0/+217
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds {QJsonObject,QCborMap}::asKeyValueRange() which returns a range over key-value pairs of the object/map (`pair<QAnyStringView, QJsonValueRef>` and `pair<QCborValueConstRef, QCborValue>`). This uses QKeyValueIterator under the hood. QJsonObject's iterator only iterates over the items, so using it in a range-based for loop won't give users access to the key. With `asKeyValueRange` one can iterate over both keys and values and conveniently use structured bindings. QCborMap's iterator already iterates over key-value pairs, so `asKeyValueRange` is provided for API symmetry. In `QKeyValueIterator`, this adds a fourth template parameter `Traits` to support custom `key()` and `value()` functions. This is specifically needed for `QJsonObject`, as its actualy key is a string view, but `key()` returns a `QString`. [ChangeLog][QtCore][QJsonObject] Added asKeyValueRange to iterate with a range-based for loop over key-value pairs with support for structured bindings. [ChangeLog][QtCore][QCborMap] Added asKeyValueRange to iterate with a range-based for loop over key-value pairs with support for structured bindings. Pick-to: 6.10 Change-Id: I68d97fada8b2d7ef7224f1beb5aa685aac3d1b16 Reviewed-by: Thiago Macieira <[email protected]>
* QScopeGuard: add commit()Marc Mutz2025-06-182-3/+17
| | | | | | | | | | | | | This method executes the wrapped function ahead of destruction, and can alleviate the need to hold QScopeGuards in optional<>s to emulate the functionality. Port such a case in tst_QEventLoop as demonstration. [ChangeLog][QtCore][QScopeGuard] Added commit() method. Change-Id: Ie2674e1c82e242bdeb1eeaf183607e5c71c1448a Reviewed-by: Thiago Macieira <[email protected]>
* Test QDBusMessage move-assignment operatorIvan Solovev2025-06-183-0/+77
| | | | | | Pick-to: 6.10 6.9 6.8 6.5 Change-Id: Ic7fec96c13c1a1b8c4b748070fbe656fdff6e24c Reviewed-by: Marc Mutz <[email protected]>
* moc: Fix invalid codegen for qualified propertiesFabian Kosmale2025-06-182-1/+22
| | | | | | | | | | | We must not add an enum qualifie if it is already emitted because it was part of the property signature. Amends dea21545b32cf04337ca470483991dc7da39ba5b Fixes: QTBUG-137850 Pick-to: 6.10 6.9 Change-Id: I07a27014023a60f07a97e323a7d7e5b9d233d555 Reviewed-by: Joerg Bornemann <[email protected]>
* wayland: Drop workaround to wait for seat name before adding devicesDavid Edmundson2025-06-181-1/+1
| | | | | | | | | | | | The wayland specification now states the seat_name should be sent before capabilities. Weston has also been changed. Reverts parts of QtWayland 4322496f73bc093d1ff97b24e90d6385f35189d8. Task-number: QTBUG-72167 Task-number: QTBUG-115207 Change-Id: If8373ea7a711c287dab0cd9d6a087a825d8239f6 Reviewed-by: David Redondo <[email protected]>
* tests: skip part of tst_QWindow::isActive() on WaylandLiang Qi2025-06-181-0/+3
| | | | | | | | | | | A nested window or a subsurface in wayland terms can't get focus. See also https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/236 , protocol: wl_subsurface will never be focused. Pick-to: 6.10 Task-number: QTBUG-137020 Change-Id: I2dbecbf112e5ad8918b283ef64d6bba9afc5e861 Reviewed-by: David Edmundson <[email protected]>
* I/O tests: make them not fail if the UNC server is not availableThiago Macieira2025-06-186-36/+95
| | | | | | | tst_qfileinfo still fails due to lack of symlink permissions for me. Change-Id: I94c621caed5c4167427efffdee59f20b03764714 Reviewed-by: Joerg Bornemann <[email protected]>
* CMake: Annotate some qt_find_package calls with MODULEAlexandru Croitor2025-06-172-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | A qt_find_package call first tries to find a Config package with the CONFIG mode option, and if not found, falls back to an arg-less mode which searches both Config and Find modules. For some packages, we know we want to find the Find module because there can't be a Config package, e.g our FindWrap modules or any of the other Find modules we carry in our cmake directory. So we should annotate these calls with MODULE. Aside from slightly faster configuration, there is another reason to do so. Future versions of CMake will automatically log find_package calls that have a state change (e.g. Not Found -> Found) into CMakeConfigureLog.yaml. Due to the Config-first logic in qt_find_package, we always unset the Foo_DIR variable if the Config package is not found. This means that there will be a constant build up of not-found messages in the log. Explicitly annotating the calls with MODULE will prevent this. Do that. Pick-to: 6.10 Change-Id: I465b015ac18f8a09b9a5c86cec7b6312a0bfbdf1 Reviewed-by: Alexey Edelev <[email protected]> Reviewed-by: Joerg Bornemann <[email protected]>
* QDataStream: add operator bool()Tatiana Borisova2025-06-171-133/+133
| | | | | | | | | | | | | | | | | | - Add operator bool() that checks whether the associated stream has no error status. This operator makes it possible to use streams and functions that return references to streams as loop conditions: `while (stream >> data)`. - Update existing testcases that use or can use the status of stream operations. [ChangeLog][QtCore][QDataStream] Added implicit conversion to bool, returning `status() == Ok`. Found in API-review (added for symmetry with QTextStream). Pick-to: 6.10 Change-Id: I3eb8251f40eba1a8164e088fa10de670564f428e Reviewed-by: Marc Mutz <[email protected]>
* Wayland: Skip tst_QWindow::geometryAfterWmUpdateAndDestroyCreate()Liang Qi2025-06-171-0/+3
| | | | | | | Pick-to: 6.10 Task-number: QTBUG-137020 Change-Id: I45c0d9ef07f65890d8b9ce82b856f7ce6fe86eaa Reviewed-by: Tor Arne Vestbø <[email protected]>
* QMenu: Fix transient parent for nomadic menusVlad Zahorodnii2025-06-171-8/+41
| | | | | | | | | | | | | | | | | | | | There are applications that reuse menus for different user interface elements. For example, a menu can be shown in the menubar or in a right click context menu. On the other hand, the QMenu currently locks on the first transient parent and doesn't change it even after effectively getting attached to another parent. This change addresses the issue by making the QMenu re-evaluate the transient parent on every show event and also ensuring that the caused widget takes the precedence over other heuristics. The caused widget is more closely related to the user input. Pick-to: 6.9 6.10 Fixes: QTBUG-137467 Change-Id: I4f968833380121be1300af1a44237735b9a97b17 Reviewed-by: Tor Arne Vestbø <[email protected]>
* tst_QPointer: don't use a std::vector for statically-sized dataMarc Mutz2025-06-161-7/+5
| | | | | | | | | | | | | | | The Golden Rule of container selection is "Never use a dynamically-sized container for statically-sized data." The number of threads is fixed, so we should be using std::array instead of std::vector. Minimize(s) the number of NUM_THREADS mentions, too. Amends 253f34082f526ff1ffd9eaefac73cc9aa616ab2a. Pick-to: 6.10 6.9 6.8 6.5 Change-Id: Ide69ad08abef9efdbc2ec11be5bd8fd3feb8973a Reviewed-by: Ahmad Samir <[email protected]>
* tst_qpermissions_app_with_usage_descriptions: Force sign if already signedTor Arne Vestbø2025-06-161-1/+1
| | | | | Change-Id: I319248354780a30811d11096699aaeee9b8ba109 Reviewed-by: Alexandru Croitor <[email protected]>
* Fix build of RHI stereoscopic rendering manual test when missing VulkanTor Arne Vestbø2025-06-162-0/+6
| | | | | Change-Id: I450eee9084d20951efdde3ae24a25d5ebcc2d5a2 Reviewed-by: Eirik Aavitsland <[email protected]>
* moc: handle enum / member name conflictFabian Kosmale2025-06-164-0/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | It is possible (and somewhat common on Windows) to have getters and types with the same name. This so far would cause issues in the moc generated code. To fix it, we remember all names of enums found in a class, and prefix references to such types with "enum". Note that this requires a new set to track them, as other parts of moc currently treat `eunm Foo { Val }` and `typedef enum { Val } Foo` the same, but `enum Foo` is only valid C++ for the former. A similar issue would also exist with inner structs, but that seems to be less common, so isn't implemented yet. We also use the opportunity to drop the typeNameForCast member in ArgumentDef, as we can't do the enum disambiguation with it easily. Instead, we do it on-demand, which should also give a beneficial memory/runtime trade-off in any case. Fixes: QTBUG-137452 Pick-to: 6.10 6.9 Change-Id: I07341f971c9ca65edecbea890ebc33e007087c43 Reviewed-by: Joerg Bornemann <[email protected]> Reviewed-by: Ulf Hermann <[email protected]>