summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* CMake: Allow adding tools dependencies on INTERFACE librariesAlexandru Croitor20 hours5-1/+38
| | | | | | | | | | | | | | | | Rename the QT_EXTRA_TOOLS_PACKAGE_DEPENDENCIES property to _qt_extra_tools_package_dependencies so we can set it also on INTERFACE libraries with older CMake versions. Remove the check for is_interface_lib in qt_internal_create_module_depends_file so we can add tool package dependencies with qt_record_extra_qt_main_tools_package_dependency on INTERFACE libraries as well. Use the new feature in the StandaloneToolsPackage RunCMake test. Change-Id: Ia36acf785f5f8512580dfcd3e599a5e704f9422e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Allow creating a standalone Tools package without a moduleAlexandru Croitor20 hours8-0/+110
| | | | | | | | | | | | | | | | | Add a new qt_internal_add_tools_package function to allow creating a standalone Tools cmake package. It can be useful for a repo which might build e.g. an arch-independent java tool exposed by an IMPORTED executable, but has no associated C++ Qt module. Also add a qt_internal_record_tools_package_extra_third_party_dependency function to allow looking up additional third party cmake packages when finding the tool package. Change-Id: I46f5fb9f7a361ecf4018f0fc1ed0a1f8ecf12df3 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Revise comment on recently-changed test-caseEdward Welbourne21 hours1-1/+1
| | | | | | | | | | | | | | | Amends commit 3a711ad61926adfc3a57adf9fd83588efdf20b28 - CLDR v48 update. That changed a test-case to use an apostrophe in place of a right single quote as the grouping character for Swiss German (which thus now matches C++). I forgot the change the related comment on the test-case at the same time, leaving it still claiming right single quote. Updated now. Thanks to Sune Vuorela for spotting the omission. Test is new in dev so no need to pick back to older branches. Task-number: QTBUG-141949 Change-Id: I599bc8c9a302891a739ee247e675f899302e742a Reviewed-by: Mate Barany <mate.barany@qt.io>
* QImage: Don't truncate 16Bit PGM image data to 8BitWladimir Leuschner40 hours2-0/+261
| | | | | | | | | | Currently 16Bit PGM images are truncated to 8Bit data, which loses precision. This patch checks if the ppm data is 16Bit and stores the image data into a QImage with format QImage::Format_Grayscale16 Fixes: QTBUG-141995 Change-Id: Icfa0c4f59982c414195f64bf1f4a768b26f414a6 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QMetaContainer: Optimize iterator comparison a bitUlf Hermann41 hours1-0/+21
| | | | | | | | | | | If the iterator pointers are the same, then the iterators are the same and their distance is 0. No need to call any functions for this. This also makes empty container interfaces less dangerous. The resulting containers are simply empty, too. Change-Id: I64896fdaa391e97e46430233a74071aadf20f0ea Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QHttp2Connection GOAWAY overhaulMårten Nordheim43 hours1-0/+110
| | | | | | | | | | | | | | | | | | | | | | | | While trying to figure out what the problem may be in the linked bug report, it became visible that the GOAWAY parts likely haven't been exercised very well. For one, we are supposed to ignore incoming streams beyond what we told the peer was the last stream to be processed. But we also need to process certain frames, like DATA and frames carrying HEADER content, because they affect state for the entire connection, state that the peer cannot roll back on their side. There were also some bugs in our handling of a GOAWAY frame, such as always assuming it was a client on the receiving end and, following on from that, some issues with notifying streams that they have received a GOAWAY. Task-number: QTBUG-139692 Task-number: QTBUG-135049 Pick-to: 6.10 6.8 Change-Id: I0bc1f51787b7a9df81a6a9b855a390c8f8b30e5b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
* Blacklist a few tests for macOS 26 due to wrong mouse pos on enter eventTor Arne Vestbø43 hours2-0/+4
| | | | | | | Pick-to: 6.10 6.8 6.5 Task-number: QTBUG-142157 Change-Id: Ibf17be36062644d8410d7652301ecdffa80ea3f0 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Add security scoped file engine for Apple operating systemsTor Arne Vestbø43 hours5-0/+661
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Apple operating systems where the app runs in a sandbox, the application can not access files outside of its sandbox without explicit user approval. This applies to iOS and friends, as well as optionally for macOS (when the sandbox is enabled, which is a requirement for publishing apps to the macOS App Store). When the user gives explicit access to a file or directory, we need to manage this access at runtime by starting and stopping the access via startAccessingSecurityScopedResource and stopAccessingSecurityScopedResource, and these functions must be balanced, to avoid leaking kernel resources. The access unfortunately doesn't persist automatically when the application terminates (unlike takePersistableUriPermission on Android), so we have to manually persist the access via security scoped bookmarks. We store these inside the app's own sandbox, in a way that limits the access to only that application, so persisting them on behalf of the user should be fine. The persisted bookmarks are loaded in the background on application start, ready for when the application wants to open earlier accessed file or directories. [ChangeLog][Apple] Sandboxed applications on Apple platforms, (including macOS if opted in to) can now access files outside of the application sandbox (so called security scoped resources) for both reading and writing. Files or folders chosen by the user via file dialogs or similar native mechanism are automatically and transparently handled, including persistent access across application and device restarts. Fixes: QTBUG-120528 Task-number: QTBUG-117832 Task-number: QTBUG-120528 Task-number: QTBUG-141414 Change-Id: I90d94066cbf7cd74750049d5d1b990917fd10cad Reviewed-by: Doris Verria <doris.verria@qt.io>
* tst_Moc: port relatedMetaObjects{WithinNamespaces,NameConflicts}() away from ↵Marc Mutz2 days3-4/+4
| | | | | | | | | | | | | | | | Q_ENUMS Like relatedMetaObjectsInGadget() in a previous commit, these tests doesn't specifically check Q_ENUMS, but e.g. the use of another QObject's enum in a class not derived from the the first QObject. So port from Q_ENUMS to Q_ENUM, in order to help with the Q_ENUMS deprecation effort. Task-number: QTBUG-99060 Pick-to: 6.10 6.8 6.5 Change-Id: Ibdb58df188ab2fcbb15f3d1d13998e271180b564 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* wasm: Do not use emscripten::async() unless JSPI is in effectEven Oscar Andersen3 days1-1/+7
| | | | | Change-Id: I608ac46783ed9efb7841b6d0916fee035e338f42 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Blacklist tst_qguieventdispatcher::postEventFromThread on macOS 26Tor Arne Vestbø3 days1-0/+2
| | | | | | | | | It's flakey and failing often. Task-number: QTBUG-142185 Pick-to: 6.10 6.8 6.5 Change-Id: I5779e01c64203011786f4466b130f4884ea19858 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Android: expect fail for tst_Android::testFullScreenDimensions cases for ↵Assam Boudjelthia3 days1-5/+6
| | | | | | | | | Android 16 Amends 422ecf55309c833477f92f3392e17aed46dd6c29. Change-Id: I996321d7e5eb4f5eaabd114d2d6df62c4ae42711 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* tst_Moc: port relatedMetaObjectsInGadget() away from Q_ENUMSMarc Mutz3 days2-2/+2
| | | | | | | | | | | | | | This test doesn't specifically check Q_ENUMS, but the use of another Q_GADGET's enum in a class not derived from the the first Q_GADGET. So port from Q_ENUMS to Q_ENUM, in order to help with the Q_ENUMS deprecation effort. Task-number: QTBUG-99060 Pick-to: 6.10 6.8 6.5 Change-Id: I4363a05fe6d3ce4e825599151dc6626b8ef2b388 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* tst_QMetaObjectBuilder: complete port away from Q_(ENUM|FLAG)SMarc Mutz3 days1-4/+2
| | | | | | | | | | | | | ... to Q_(ENUM|FLAG). Amends 0e7de25c525fabb4df7cafb8825e65522c476752, which added the Q_ENUM w/o removing the Q_ENUMS, and forgot the Q_FLAGS port to Q_FLAG. Task-number: QTBUG-99060 Change-Id: I7ab645165a2611c156d0b94f9ea59fb6d98f55a3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QTabBar: Emit tabCloseRequested on middle click if tabsClosableXavier BESSON3 days1-1/+24
| | | | | | | | | | [ChangeLog][QtWidgets] Middle clicking tabs in QTabBar with tabsClosable set to true will now emit tabCloseRequested. Fixes: QTBUG-141519 Change-Id: I101e599b95683e5de4e951f7da3ae31264caa24c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* QTextDocument: fix repeated calls of unit testsTim Blechmann3 days1-0/+2
| | | | | | | | | | | | Tests may set the default resource provider. Calling the test multiple times results in a heap-use-after-free error/crash. So we need to unset the default resource provider. Amends ccf1a1a9536be7b904494f5b3243202d71a33b06. Pick-to: 6.10 Change-Id: I6bc1d67af54534e85fe95dc57236499bc2e7b923 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Include font features in QFont::toString()Vlad Zahorodnii7 days2-24/+90
| | | | | | | | | | | | | | | | | This ensures that font features, for example calt or liga, can be saved in QSettings using QFont::toString() and QFont::fromSettings() as expected. With the proposed change, QFont::toString() will append the number of font features followed by a list of key=value pairs specifying feature settings. The corresponding tests have been reworked a little bit because following the established patterns was slightly challenging. Task-number: QTBUG-141412 Change-Id: I7a80d5fe1d120b514797bfb515c3a6b0867a6ee5 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* QTableView: correct selection with moved columns/rows and spansChristian Ehrlicher7 days1-0/+46
| | | | | | | | | | | | When a column or row is moved and there are spans, the calculation of the correct row was not correct for the 'moved to' column/row because there was a mixup of visual and logical columns. Pick-to: 6.10 6.8 Fixes: QTBUG-138513 Change-Id: Ia3d1aa2c5376cb25ea56dc55b6a57a88edbfec30 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* forkfd: configure our signal handler to restart the syscallThiago Macieira7 days5-0/+141
| | | | | | | | | | | | | | | | | | | | | | | | This should help solve problems with other libraries that don't have proper EINTR_LOOP around their operations. Like most of <stdio.h> and thus <iostreams>. This change does not affect FreeBSD or Linux, where we don't install a signal handler in the first place. And obviously, it will have no effect if something else overrides our signal handler without this flag. If that happens, please complain to the piece of software that forgot the flag. This test has also revealed that Windows presents a similar wake up: if the grandchild process shares the child's stdin (which happens by default for startDetached()) the child gets woken up from WaitForSingleObject() when the grandchild dies and thus fgets() returns error. That has nothing to do with QProcess, and AFAICT is simply the way pipes work on Windows. Fixes: QTBUG-142041 Pick-to: 6.10 6.8 6.5 Change-Id: I5900f238ec4a85ed49affffd29fc4248cc272929 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Fix QTZLocale's parsing of non-BMP digitsEdward Welbourne8 days1-0/+3
| | | | | | | | | | | | Digit-parsing wasn't taking into account the width of digits. It thus failed where digits are encoded as surrogate pairs. Expanded a test to expose this failure. Take the width of digits into account. Pick-to: 6.10 Task-number: QTBUG-139223 Change-Id: I0e5497203d6657d04878f06b6a736a57c16edc2f Reviewed-by: Mate Barany <mate.barany@qt.io>
* Build with QT_NO_URL_CAST_FROM_STRINGAhmad Samir8 days2-6/+9
| | | | | | | | | | | Can't mark the whole repo with that macro, because in corelib that would take out the QString conversion operator which is BiC. Add a hard build-time error if QT_NO_URL_CAST_FROM_STRING is defined in corelib, as requested in code review. Change-Id: Ia0e302a2f82b86800e84d15e86ab138f78d45e4d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use Q_ENUM/Q_FLAG instead of Q_ENUMS/Q_FLAGSAhmad Samir8 days3-2/+4
| | | | | | | | | Q_ENUMS and Q_FLAGS have been deprecated since at least Qt 6.0. Task-number: QTBUG-99060 Change-Id: Ia8cbc607c34683dec99587571c0d04f1854e77c2 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QSslKey: do not use EVP_PKEY_cmp on ML keysTimur Pocheptsov8 days1-1/+4
| | | | | | | | | | | | | We do not setup pkey for QSsl::MlDsa, and as a result EVP_PKEY_cmp, starting from OpenSSL 3.5 is failing (retuns -2), essentially trying to compare an empty EVP_PKEY with something we read from a pem file. Previously we did not test those mldsa keys, thus the problem went unnoticed. Change-Id: Icfa8ab7b703e1f5ae10d91bcaf37f5772b7eacdd Pick-to: 6.10 Fixes: QTBUG-141723 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tst_http2: Drop 100ms cutoff for server startupMårten Nordheim9 days1-1/+1
| | | | | | | | | | The event loop already exits early when the server starts, the 100ms just causes flakiness. Pick-to: 6.10 6.8 6.5 Change-Id: Iea43f0f54dad95b6fb09ced12f9fd16a3b786939 Reviewed-by: Mate Barany <mate.barany@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QArrayDataOps: allow truncate(samesize)Thiago Macieira10 days2-0/+18
| | | | | | | | | | | | | | | | | | There's no reason to disallow truncating nothing. The alternative is to check the size before truncating, which is unnecessary extra branching. Instead, just let this function do nothing. Amends 15e3ae6b9da9b32236d3e3348ede86c3acf06fb4 ("Introduce QArrayDataOps::truncate") from Qt 5.0 but cherry-picking nowhere near as far back because nothing used it until assign() in Qt 6.8. QList does not have a truncate() function and both QString's and QByteArray's use resize() instead. Pick-to: 6.10 6.8 Fixes: QTBUG-141918 Change-Id: Ie3342e0ea9ee312bd5cbfffd4d4a83da27a838e6 Reviewed-by: Sune Vuorela <sune@vuorela.dk> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QArrayDataOps: reactivate arrayOpsExtra testThiago Macieira10 days1-20/+50
| | | | | | | | | | Amends commit b99271caa6231ad753bc796dae5202ebc1cb9440, which added the temporary QSKIP but forgot to remove. Pick-to: 6.10 6.8 6.5 Change-Id: I7d7a2658f607fe28d9a9fffd9ba5bd55fdc2f839 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* tst_QVariant: add a test to ensure relocatability changes do workThiago Macieira10 days4-1/+193
| | | | | | | | I'm not sure how far back this works. Pick-to: 6.10 Change-Id: I728eaee3841aefe5da39fffda6a8e1be0ff682cb Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Fix handling of non-BMP digits in milliseconds fields of timesEdward Welbourne10 days1-0/+7
| | | | | | | | | | | | | | | The code to trim trailing zeros from z (or zz, but not zzz) format correctly checked for whether the text ended with the locale's zero, but incorrectly chop(1)ed to remove the zero, neglecting the possibility that the zero is longer. Noticed while checking where else we used QLocale::zeroDigit() possibly naively. Add Fulah-Adlam tests for milliseconds, which confirmed the problem does actually appear. Fix dropping of trailing zeros from millis. Pick-to: 6.10 6.8 6.5 Change-Id: Id080f082b2890a102809ba8d0f687d55ac082357 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSslSocket::ephemeralServerKey - don't expect a specific ciphersuiteTimur Pocheptsov10 days1-0/+3
| | | | | | | | | | | To be negotiated during TLS handshake, as of OpenSSL v 3.5 despite requested specific ciphersuite, the one that is negotiated is different and thus test's expectation are failing in QVERIFY. Fixes: QTBUG-141722 Pick-to: 6.10 Change-Id: I3a000fc82692224b77edd48ee39bbcdb43e114c8 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Update CLDR to v48Edward Welbourne11 days2-2/+2
| | | | | | | | | | | | | This is just the plain upgrade without adding new languages. It required two changes to expected data in tests. [ChangeLog][QtCore][Third-Party Code] QLocale now uses v48 of the Unicode Consortium's Common Locale Data Repository (CLDR). Pick-to: 6.10 6.8 6.5 Task-number: QTBUG-141949 Change-Id: I8d3a299c602e6cd5ea76c6bc479028aeda8b8e50 Reviewed-by: Mate Barany <mate.barany@qt.io>
* Add binary compatibility file for 6.10Johanna Äijälä11 days1-0/+31363
| | | | | | | Task-number: QTBUG-140614 Pick-to: 6.10 Change-Id: I05d66682a13321135d741808dab05cdb8ff6f6c1 Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* tst_QString: add some tests for utf16()Ahmad Samir12 days1-0/+23
| | | | | | Pick-to: 6.10 5.8 6.5 Change-Id: Id9d4e8fd11b85fda1a694f28f52d1e9bbd43bce8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QRM: report the number of properties as column count in trees of gadgetsVolker Hilsheimer2025-11-142-0/+37
| | | | | | | | | | | | | | | | | | Instead of hardcoding the column count to 1 for one-dimensional ranges, use the row traits's fixed_size attribute, which reports the number of properties for rows that are gadgets. This was already correctly done for tables. To remove duplication, move the structure-independent part of the logic into a reusable helper in the base class. Add basic test coverage. Fixes: QTBUG-141885 Pick-to: 6.10 Change-Id: Ic10a8a61998184485acb89ca9db0d9c9be822f2d Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* tst_qdbuscpp2xml: replace Q_ENUMS with Q_ENUMAhmad Samir2025-11-131-1/+1
| | | | | | | | | | | | | This doesn't affect the test itself, see qdbuscpp2xml_data(). This tests revolves around the flags from the `QDBusConnection::RegisterOption` enum, so Q_INVOKABLE, Q_SCRIPTABLE, Q_PROPERTY, signals and slots. Q_ENUMS has been deprecated since at least Qt6.0. Pick-to: 6.10 6.8 6.5 Change-Id: I8232641337b5823c9951d00fcfae9c7a3b25ed88 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Tidy tst_LargeFile: split two long lines, purge a spurious blank lineEdward Welbourne2025-11-131-5/+8
| | | | | Change-Id: I765c8ce00d980ca257b00b328bfb8d08f8f56324 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Modernize tst_LargeFile: replace an enum with constexpr named valuesEdward Welbourne2025-11-131-12/+10
| | | | | | | | One member of the enum was a bool, the other an int; make that explicit by converting each to a constexpr of its type. Change-Id: I5a36a811feae7b23a363d091f0bf6a89cb312d74 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Use a scope guard to manage output previously routed via QVERIFY(false)Edward Welbourne2025-11-131-4/+9
| | | | | | | | | | | A test that QCOMPARE() didn't quite match did its own comparison using std::equal(), produced its own custom output and used QVEIRFY(false) where it could have used QFAIL() but had nothing more to say. Replace with a scope-guard to handle the custom output and simply QVERIFY() the std::equal() check, so that check will in fact show up in output. Change-Id: I1dfe233b0b69c507927f22d7fdb45af227824b43 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Modernize tst_LargeFile: use NSDMI for construction where possibleEdward Welbourne2025-11-131-32/+32
| | | | | | | | | | | | | | | | | | The QEMU special case only affected the QT_LARGEFILE_SUPPORT branch of the cascade of #if-ery on maxSizeBits, which can thus be constexpr in all other cases and const even in that case. Also record why it's limited to 28 rather than the 31 implied by the prior comment (previously only otherwise discoverable in git history). Mediate the complex #if-ery for the initial value of maxSizeBits by introducing a constexpr maxAllowedSizeBits set within such #if-ery, so as to simplify setting maxSizeBits itself. Note that this member is in fact varied by some tests, implying order-dependence. Move the member constants to before the constructor to make it possible to have a define that correctly controls inclusion of the QEMU tweak. Change-Id: Id6f8d55a34431d8f08f0e2b346c826bb49991423 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QRandomGenerator: remove direct use of HW instructionsThiago Macieira2025-11-121-15/+9
| | | | | | | | | | | | | | | | | | | | | The HWRNG instructions are not necessarily faster than what we can get from the OS. Moreover, the OS is able to collect entropy from sources other than the CPU itself. More importantly, this removes the need for Qt to deal with broken HWRNG, passing the buck to the OS (which may disable the CPUID bit, causing the application to fail to load). [ChangeLog][QtCore][QRandomGenerator] This class no longer directly uses a hardware random number generator on x86 systems, even if one is available. Instead, it will always use a generator provided by the OS (so performance will be OS-specific), though there should be no meaningful difference in the quality of the samples generated. Task-number: QTBUG-69423 Task-number: QTBUG-129193 Pick-to: 6.10 6.8 6.5 Change-Id: I5121c5a34d684983fa1dfffdbabd22de51966650 Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Remove QSKIP wayland tst_QGraphicsPixMapItem as no longer failingFrédéric Lefebvre2025-11-121-3/+0
| | | | | | | | Remove a QSKIP that was previously used in tst_QGraphicsPixItem on wayland as it is no longer failing consistently. Change-Id: I3b918fc3a9e2fa3b38dd0172e240774f04b07aee Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QRangeModel: implement autoConnectPolicyVolker Hilsheimer2025-11-123-11/+326
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A model that operates on a range holding items of the same QObject subclass presents the values of the properties of those QObject instances as its data. The property names will be used as the role names. It is then very convenient if changes to the properties in those QObject instances makes the model emit dataChanged() for the respective index and role. This requires that we identify the changed-signals for each property that corresponds to a role name, and connect to each of those signals for each object instance. This is an expensive operation, in particular for trees where we have to recursively traverse the entire sturcture. But a range holding QObjects is already quite expensive and therefore only reasonable for small models with dozens rather than thousands of items. At that scale, the overhead is acceptable, and we can store the respective meta data in a baseclass of our storage type, specialized for when the range's item type is the same QObject subclass for all columns. We know this already, as the default implementation of roleNames() uses that as well. Each connection goes to a functor object that stores the index and the role, which is the information we need to emit dataChanged. By storing the index as a QPersistentModelIndex, objects changing position in the model will automatically update the functor object. The public API for this is a policy property, with two values (plus the "None" default value): a Full auto connect iterates the entire model and connects all relevant properties. This is expensive compared to only connecting some objects and properties, but gives full coverage, and has no overhead other than the connection itself. The alternative is OnRead, which connects lazily when data is read for the first time. This is cheaper if it's unlikely that all objects and/or all properties are displayed, but adds book-keeping overhead so that we know when an object and role are already connected. If everything gets connected lazily, then this is substantially more expensive than doing a full auto-connect in the first place. When new rows or columns got inserted, and if autoConnectionPolicy is set to Full, then we need to connect the new objects after QAIM emitted rows/columnsInserted(). This gives clients a chance to populate the new cells with objects. When rows or columns are removed and the policy is set to OnRead, then we have to remove those connections from our book- keeping set. When objects are removed from the model (which means rows or columns are removed), then we need to break the connection to the respective objects. As the QObjects will likely be destroyed anyway, which will then break the connections, we disconnect lazily: we disconnect if our functor gets called for an object that has been removed. In that case, the stored QPMI will have become invalid. To break the connection, we need to store the QMetaObject::Connection in the functor object. However, we only get that connection handle as a result of making the connection, at which point our functor object has already been moved into Qt's QCallableObject data structure. In order to store the connection handle, we implement the move constructor of the functor to store the address of the move-constructed functor object in the moved-from functor object. This makes a moved-from functor act as a reference to the moved-to functor and we can use that to store the connection handle in the functor instance that is stored in the QCallableObject. Since a functor instance holds either the property data, or the address of the moved-to instance, we can use a std::variant to avoid overhead. Using a plain union would be even cheaper, but at this point, benefit from the guard-rails we get from std::variant. The context object for all connections is then a dedicated QObject, which we can simply delete to break all connections. [ChangeLog][Core][QRangeModel] A range model operating on a range that holds identical QObject sublasses for all items can now automatically connect the changed signals of all properties mapped to item roles to the model's corresponding dataChanged signal. This allows user code to change properties of the item-object directly, and model clients (like item views) will get updated. Change-Id: I742b57f0c90f705d8b7eb949ff0d026b8b4a52f3 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
* Add both required binaries to the android buildLauri Pohjanheimo2025-11-111-3/+4
| | | | | | | | | Now both modal_helper and desktopsettingsaware_helper binaries are included into the Android apk package. Task-number: QTQAINFRA-6891 Change-Id: I451a2fa6d2424f838e9d60b5908f4c9ce4c51e42 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* tst_QMetaObject: fix regex used in QTest::ignoreMessage()Ahmad Samir2025-11-091-14/+12
| | | | | | | | | | | | | '|' is a special character in a regex pattern, so it should be escaped. Amends e90705687f5faba41d9a8544c875d8c6b1cedbdc. Drive by, it's cheaper to reuse QRegularExpressionS (one state machine transformation per pattern). Pick-to: 6.10 6.8 Change-Id: I185953224aed7eadf73dd26f4d5e3c01f8a73ebe Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QSettings: split the testEscapes() test, testBadEscapeAhmad Samir2025-11-091-23/+31
| | | | | | | | | | | | Making it easier to debug. Use example.org instead of software.org, the latter is regitered and we shouldn't use it in tests. Pick-to: 6.10 6.8 6.5 Change-Id: I83cefa2eaffa86ccbaa237feeaaf4f54eab857c6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QSettings: split the testEscapes() test: testEscapedVariantAhmad Samir2025-11-091-20/+39
| | | | | | | | | | | | | | | | | Making it easier to debug. The original code explicitly compared the input QVariant with the variant-converted-to-the-underlying-type, most likely to test the conversion round-trip. This is already covered by QSettingsPrivate::{variantToString,stringToVariant}() which does the conversion internally. Use example.org instead of software.org, the latter is regitered and we shouldn't use it in tests. Pick-to: 6.10 6.8 6.5 Change-Id: Ic866f39af50370079bcfefc24c9093d733e32f9e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Android: expect testFullScreenDimensions on Android 16 to fail in CIRami Potinkara2025-11-081-2/+7
| | | | | | | | | | | | | | This patch changes expectation for one condition in CI to fail. Test or implementation needs later to be fixed, or test to be removed. Also the edge-to-edge support should be changed later to work in similarly at locally and at CI. Change is only done to dev, as similar fail has not seen in 6.10. Task-number: QTBUG-141712 Change-Id: I42452bdda0baa2b32d83b6f858b96cadb6c2f52e Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* a11y: Return correct string information for item viewsIngo Klöcker2025-11-071-0/+7
| | | | | | | | | | | | | | | | | This fixes the problem that accessible name was returned as string information for all types of accessible string information (except Description), i.e. Name, Help, Value, Accelerator, etc. This made some screen readers speak the accessible name multiple times when an item view got focus. After 9fa1b691c88a4b928d3c1814a15bcab0e329222e QAccessibleTable is a subclass of QAccessibleWidget(V2) which provides suitable default implementations. Remove the override of the text() getter. Fixes: QTBUG-141051 Change-Id: I443145b97d8546fc6c80689bae50cb896e29cfd1 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* a11y: Make QSidebar keyboard-navigableMichael Weghorn2025-11-071-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QSidebar::selectUrl calls QItemSelectionModel::clear, which clears both, the selection and the current index. After that, it was only setting the selection, but no new current index, i.e. no entry was considered as having focus. As a result, navigating between entries using the keyboard didn't work, because the logic in QAbstractItemView::keyPressEvent/QListView::moveCursor didn't have a valid index to start from and therefore always set focus to the first entry. Fix this by also setting the current index again in QSidebar::selectUrl. Move emission of the QSidebar::goToUrl signal from QSidebar::clicked down into QSidebar::selectUrl to ensure this gets called when the URL/current index is set programatically by calling QSidebar::selectUrl directly instead of indirectly via QSidebar::clicked due to user action. (As an example, tst_QFileDialog2::task251321_sideBarHiddenEntries calls this directly, and the emulated mouse click now no longer triggers the QItemSelectionModel::currentChanged signal as the current index was already set by the previous call to QSidebar::selectUrl, and therefore the connected QSidebar::clicked slot is also no longer triggered.) Adjust the existing tst_qsidebar tests related to the QSidebar::goToUrl signal to the fact that this now gets emitted from QSidebar::selectUrl. (Since QSidebar isn't part of the public API, there's no need to keep the exact semantic of when the signal gets emitted unchanged.) Also switch the test to use PMF-style syntax to e.g. simplify finding those occurences using an IDE's "Find Usages" feature in the future. Fixes: QTBUG-141644 Change-Id: I872698de81912225cd42a5df3752d2693ac6b9ee Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Don't emit QFileDialog::directoryEntered when not changing dirMichael Weghorn2025-11-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | In QFileDialogPrivate::enterDirectory, return early if the directory to enter is already the current directory. This prevents emitting the QFileDialog::directoryEntered signal when no new directory was actually entered. Extend tst_QFiledialog::directoryEnteredSignal accordingly. This prepares for an upcoming fix for QTBUG-141644 where the fact that QFileDialogPrivate::enterDirectory was called again with the same path resulted in the signal getting emitted twice and therefore causing the existing QCOMPARE(spyDirectoryEntered.size(), 1); check in tst_QFiledialog::directoryEnteredSignal to fail. Task-number: QTBUG-141644 Change-Id: I3359f9f8af3ce03c7b32c040a92d4bf09e065e85 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Http: Set error to 'TimeoutError' for a transfer timeoutMårten Nordheim2025-11-061-1/+1
| | | | | | | | | | | | | | | | | | When transferTimeout was added for QNAM it was implemented in terms of calling abort(), which is fine, it does what it needs to do. But it sets OperationCanceledError, which is correct but misleading since it's the same as for a user-initiated abort. [ChangeLog][QtNetwork][QNetworkAccessManager] The error set when a request times out due to QNetworkRequest::setTransferTimeout() has been changed to QNetworkReply::TimeoutError, to disambiguate from the previously used QNetworkReply::OperationCanceledError. Pick-to: 6.10 Fixes: QTBUG-96165 Change-Id: Ibb2f28637f034190fb125630f96aa004c3634fef Reviewed-by: Mate Barany <mate.barany@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>