summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* QVariant: Support emplaceFabian Kosmale2023-06-021-0/+98
| | | | | | | | | | | | | | [ChangeLog][QtCore][QVariant] Implemented in-place construction for QVariant. The constructor taking std::in_place_type<Type> constructs an object of type Type directly inside QVariant's storage, without any further copy or move operations. QVariant::emplace() does the same when replacing the content of an existing QVariant and tries to reuse previously-allocated memory. Fixes: QTBUG-112187 Change-Id: I16614ad701fa3bb583976ed2001bb312f119a51f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QByteArray: add STL-style assign()Dennis Oberst2023-06-022-0/+191
| | | | | | | | | | | | | | | | | Implemented assign() methods for QByteArray to align with the criteria of std::basic_string, addressing the previously missing functionality. This is a subset of the overloads provided by the standard. Reference: https://en.cppreference.com/w/cpp/string/basic_string/assign [ChangeLog][QtCore][QByteArray] Added assign(). Fixes: QTBUG-106199 Change-Id: I899b14d74e8f774face8690303efb8610ead95b5 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* tst_ContainerApiSymmetry: make assign_impl() more robustDennis Oberst2023-06-011-22/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor the 'CHECK' macro to eliminate the capacity check and explicitly verify that no reallocation occurred. The previous implementation had to pass constants to suppress the issue arising from differing growth rates between implementations. Additionally, improve the 'std::stringstream' versions of the test by incorporating the correct values. In the previous implementation, the usage of: auto tData = V(9); ~~~ std::stringstream ss("9 9 "); had several issues. Firstly, it used the wrong test data since the container's value_type of '(char) 9' resulted in a tab character '\t', which was not accurately reflected in the stringstream assignment. Secondly, this value caused problems in how stringstreams interprets it. To address these issues, let's make the following improvements: 1. Use a default test value of 65 instead of (char) 9. This value, which represents the character 'A', is less likely to cause errors and is more intuitive. 2. Use the tData variable for the assignments in the stringstream. This ensures that the correct data from the container is used. 3. Change the test value between the assign() calls to verify that the container's contents are successfully overwritten. These changes ensure, that the test cases are more accurate and reliable. Amends: 3b0536bbe8d6782f79e1bcc2b4f1925547c14c0b. Change-Id: I9441c4818106bf93e93a1a5d2d2d54c89d80e7b0 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* tst_QByteArray: add Qt::StringLiterals to the namespace scopeDennis Oberst2023-06-011-1/+2
| | | | | | | | ... and remove all previous function-level occurrences. Pick-to: 6.5 Change-Id: I90df40922e3aed15efc04e885d9f54c577a948b6 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Refine the rhi-based flush logicLaszlo Agocs2023-06-011-5/+55
| | | | | | | | | | | | Amends 244daf4cfc44587c8c7c87e481688e840cc21c77 Fixes: QTBUG-113557 Fixes: QTBUG-113652 Task-number: QTBUG-108277 Pick-to: 6.5 Change-Id: I9e369b0e1261ea37eb2dedd80083f82f5df97b30 Reviewed-by: Andy Nichols <andy.nichols@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QGuiApplication: Remove .desktop suffix in setDesktopFileNameVlad Zahorodnii2023-05-301-2/+2
| | | | | | | | | | | | | | | The desktop file name should not contain ".desktop" suffix, but some applications still specify it anyway because of the ambiguity in the documentation that was fixed in 0c5135a9dfa6140d23d86b001c3054891c22dcb9. This change makes setDesktopFileName remove ".desktop" suffix so desktopFileName always returns a desktop file name with correct format and its users don't need to chop ".desktop". Pick-to: 6.5 Change-Id: If5abccaf3bf976449cada8891fff887870e45b5f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QFuture: Gracefully handle a destroyed context in continuationsArno Rehn2023-05-301-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch relaxes the requirements on the context object of continuations. Instead of having to stay alive during execution of the whole chain, it now only has to stay alive during setup of the chain. If the context object is destroyed before the chain finishes, the respective future is canceled. This patch works by using QFutureCallOutInterface and signals instead of direct invocation of the continuation by the parent future, similar to how QFutureWatcher is implemented. If a continuation is used with a context object, a QBasicFutureWatcher is connected to the QFuture via a QFutureCallOutInterface. When the future finishes, QBasicFutureWatcher::finished() triggers the continuation with a signal/slot connection. This way, we require the context object to stay alive only during setup; the required synchronization is guaranteed by the existing event and signal-slot mechanisms. The continuation itself does not need to know about the context object anymore. [ChangeLog][QtCore][QFuture] Added support for context objects of continuations being destroyed before the continuation finishes. In these cases the future is cancelled immediately. Fixes: QTBUG-112958 Change-Id: Ie0ef3470b2a0ccfa789d2ae7604b92e509c14591 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Extend QFuture continuations testsIvan Solovev2023-05-301-0/+103
| | | | | | | | | | | | | Create tests to check that the continuations attached to ready futures are immediately executed, and that the proper handlers are selected. These checks were missing from the overall test set, which was detected while working on the linked issue. Task-number: QTBUG-112958 Change-Id: Iae97e4b9dfb1e016869693a5162f72e027ca7f5e Reviewed-by: Arno Rehn <a.rehn@menlosystems.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Replace AUTO_RESOURCE_PREFIX with RESOURCE_PREFIX in qt-cmake-projectAmir Masoud Abdol2023-05-301-1/+1
| | | | | | | Pick-to: 6.5 Change-Id: I53b9e8887e8e79c1c1e836c514171aece8cf35aa Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* rhi: vulkan: expose the instance in the nativeHandles queryLaszlo Agocs2023-05-301-0/+2
| | | | | | | | | | | | | | | Mainly for completeness, but it has practical uses: someone retrieving a QRhi instance from somewhere should be able to tell the QVulkanInstance, and so the VkInstance, used by that QRhi without resorting to investigating other objects (e.g. retrieving the instance from the QWindow). This provides symmetry to other 3D APIs and QRhi backends where just a single QRhi instance is sufficient to get the MTLDevice, ID3D11Device/Context, etc. i.e. all that is needed to work with the 3D API directly. Change-Id: I5a8b9871a543ea648c76b868bf6ff7be5f2098f2 Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io> Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
* Ssl: Copy the on-demand cert loading bool from default configMårten Nordheim2023-05-291-3/+21
| | | | | | | | | | | | | | | | | | Otherwise individual sockets will still load system certificates when a chain doesn't match against the configured CA certificates. That's not intended behavior, since specifically setting the CA certificates means you don't want the system certificates to be used. Follow-up to/amends ada2c573c1a25f8d96577734968fe317ddfa292a This is potentially a breaking change because now, if you ever add a CA to the default config, it will disable loading system certificates on demand for all sockets. And the only way to re-enable it is to create a null-QSslConfiguration and set it as the new default. Pick-to: 6.5 6.2 5.15 Change-Id: Ic3b2ab125c0cdd58ad654af1cb36173960ce2d1e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* CMake: remove "res_ninit" feature and collapse to just "libresolv"Thiago Macieira2023-05-271-1/+1
| | | | | | | | | | | | | Testing for "res_ninit" when WrapResolv.cmake has already checked for far more complex functions was pointless. Instead, just accept the library that was found by find_package() as good enough and rename the feature as "libresolv". Amends 4a46ba1209907796f4a14f6feb35ed4d70155d7d and 68b625901f9eb7c34e3d7aa302e1c0a454d3190b. Change-Id: Ib5ce7a497e034ebabb2cfffd1762c0afa2fac6e0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QDBus: Fix typo in a function nameIevgenii Meshcheriakov2023-05-261-1/+1
| | | | | | | Rename connectionCapabilies -> connectionCapabilities Change-Id: I07deff1b944b30404548181d5c930b76fb1a575c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDnsLookup: add TimeoutError for timeoutsThiago Macieira2023-05-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We were getting InvalidReplyError because it was simply unknown, which is not very useful. Previously, the Unix code used res_nquery(), which does not return timeouts as a condition. It returns -1 if a timeout did happen, but the content in errno could be a left-over from a previous timeout (see the "Not a typewriter"[1] problem). With the rewrite to using res_nmkquery() and res_nsend() from the previous commits, we can rely on errno being set properly by res_nsend(). $ $objdir/tests/manual/qdnslookup/qdnslookup @0.0.0.1 ; <<>> QDnsLookup 6.6.0 <<>> qdnslookup @0.0.0.1 ;; status: TimeoutError (Request timed out) ;; QUESTION: ;qt-project.org IN A ;; Query time: 10008 ms ;; SERVER: 0.0.0.1#53 Tested on FreeBSD, Linux, macOS, and Windows. [1] https://en.wikipedia.org/wiki/Not_a_typewriter Change-Id: I3e3bfef633af4130a03afffd175e31958247f9b1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QWindow test: Blacklist enterLeaveOnWindowShowHideVolker Hilsheimer2023-05-251-0/+2
| | | | | | | | | | | | | This test fails too frequently on Android and RHEL to leave in as significant. The bug report is already closed after timeouts were extended, so perhaps we just have to accept the status quo. No point in keeping tickets open for tests that we can't get stable on some platforms. Pick-to: 6.5 Task-number: QTBUG-102239 Change-Id: I54b8ae821e93b3e1f24acd67a2e84ef405388667 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QLabel: always show the context menu created by the controlVolker Hilsheimer2023-05-251-0/+39
| | | | | | | | | | | | | | | | | | | | Amends e718818745e6db8df09ea55c4071e116f00851c9, after which a context menu was only shown if the format was rich text and there was a link at the position of the click. We always want to leave it up to the control to create a context menu, so only return early if there is no control. The control will then respect content at the position (i.e. link or not) and text interaction flags, and create the menu based on that. I.e. a rich text label with selectable text should still show "Select All" in the context menu, also if not clicking on a link. Add a test case to verify that the context menu event got accepted as expected, which indicates that the label showed a menu. Pick-to: 6.5 Change-Id: Ib2b36286e4f1253d10489b5add83e8cdd7197a06 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Silence warning from unused variable in QObject testVolker Hilsheimer2023-05-251-1/+5
| | | | | | | | It's not needed, but makes the point for having a mutable lambda in the first place. Change-Id: I483862d6aee90bb62d4b5363c56a80bb05e14df7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QPauseAnimation test: add QNX to platforms that might failVolker Hilsheimer2023-05-251-1/+1
| | | | | | | | | | | | The noTimerUpdates test has been quite flaky since the optimization of single shot timers in 87535e4e4337596066258e361143cb9906e89512. Since we run QNX tests in QEMU, it's hard to guarantee anything that involves timers, so tagging that platform as one of those that have a bad timer resolution. Change-Id: I6567ea0dee859a207d4b9f659a02e805a2f87d63 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* QDBusAbstractAdaptor: Send signals using correct interfaceIevgenii Meshcheriakov2023-05-252-0/+36
| | | | | | | | | | | | | | | When forwarding a signal, associate this signal with its enclosing metaobject instead of its sender's metaobject. Those two may be different if the signal is declared in a base class. Add a regression test into tst_qdbusconnection. Fixes: QTBUG-33142 Pick-to: 6.5 Change-Id: I532ab3bb6c0671a480568f46d63fceff0c82c097 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* SQL: Make QSqlDatabase::DriverDict creation thread-safeChristian Ehrlicher2023-05-241-0/+4
| | | | | | | | | | Make the QSqlDatabase::DriverDict thread-safe and make sure it's properly cleaned up on destruction. Pick-to: 6.5 6.2 5.15 Fixes: QTBUG-112961 Change-Id: I1ff70e477579231754ef829fdede944d6042894d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Skip diffie-hellman parameter test when not supportedMårten Nordheim2023-05-241-0/+2
| | | | | | | Pick-to: 6.5 Change-Id: I0c21aeea813ee48f8c62689dafce6f7fb9620001 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Change QFont::fontFeatures() -> QFont::features()Eskil Abrahamsen Blomfeldt2023-05-241-1/+1
| | | | | | | | The 'font' is redundant here, and we don't prefix any other properties like that. Change-Id: Iee1f492b232e5bbcae399b472d7478406d8a81ef Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Move qopenglwidget example to manual testsLaszlo Agocs2023-05-2411-0/+1106
| | | | | | Pick-to: 6.5 Change-Id: I76e6377008484a7b17c65e3c03139a0fb2fc5c34 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* tst_QDnsLookup: add a test for setNameserverThiago Macieira2023-05-232-0/+156
| | | | | | | | | | | | | | | | I had to write a sample query test to ensure that those servers can be reached. They can't from the my corporate network, for example: QDEBUG : tst_QDnsLookup::setNameserver(normal) QHostAddress("8.8.8.8") discarded: "Network operation timed out" QDEBUG : tst_QDnsLookup::setNameserver(normal) QHostAddress("2001:4860:4860::8888") discarded: "Network unreachable" QDEBUG : tst_QDnsLookup::setNameserver(normal) QHostAddress("1.1.1.1") discarded: "Connection refused" QDEBUG : tst_QDnsLookup::setNameserver(normal) QHostAddress("2606:4700:4700::1111") discarded: "Network unreachable" This will also take care of ignoring the IPv6 servers on systems without it (as above). Change-Id: I3e3bfef633af4130a03afffd175de18af24add70 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QDnsLookup: add support for setting the port number of the serverThiago Macieira2023-05-232-6/+95
| | | | | | | | | | | | | | I couldn't make my Windows 10 or 11 query a non-standard port. It kept complaining about "The parameter is incorrect.", so as a result the unit test doesn't actually test the new feature there. I can't find a single example of this on the Internet; my speculation is that the backend API that DnsQueryEx uses does not support setting port numbers (DnsQuery_{A,W} didn't offer that option). [ChangeLog][QtNetwork][QDnsLookup] Added setNameserverPort(). Change-Id: I3e3bfef633af4130a03afffd175d60a581cc0a9c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* macOS: Extend accessibility testing of treeviewVolker Hilsheimer2023-05-231-8/+30
| | | | | | | | | | | | | | | | | | | | Check that we can navigate to rows and columns, and that we get the right text back for cells. We see API failures in CI on some macOS nodes, accompanies by the debug message: AXUIElementCopyAttributeValue( "AXTitle" ) returned error = AXError(value=-25201, name=kAXErrorIllegalArgument, description="An illegal argument was passed to the function.") On hosts where the test fails, we always see this warning, so extend the test helper with an errorOccurred boolean that we can test and if set skip the test. Pick-to: 6.5 Change-Id: Iacad4c41f8597243abeff36ca91cf290446c13a1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Schannel: Reject certificate not signed by a configured CA certificateMårten Nordheim2023-05-235-0/+193
| | | | | | | | | | | | | | | | Not entirely clear why, but when building the certificate chain for a peer the system certificate store is searched for root certificates. General expectation is that after calling `sslConfiguration.setCaCertificates()` the system certificates will not be taken into consideration. To work around this behavior, we do a manual check that the root of the chain is part of the configured CA certificates. Pick-to: 6.5 6.2 5.15 Change-Id: I03666a4d9b0eac39ae97e150b4743120611a11b3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QRegularExpression: match newlines when converting wildcardsGiuseppe D'Angelo2023-05-231-0/+4
| | | | | | | | | | | | | | | | | | A * or a ? in a wildcard pattern is allowed to match any character, including newlines. When converting a wildcard pattern to a PCRE, * and ? were converted to ., which by default does _not_ match over newlines (/s is necessary). There isn't a metacharacter that matches everything, so either we modify the returned pattern to enable dot-matches-all (for instance, by wrapping the returned expression in (?s:...)), or use a character class that includes everything. Picking this last approach for simplicity. Change-Id: I86703f654e3414783427c4c8e0bb018885b42e54 Fixes: QTBUG-113676 Pick-to: 6.5 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QProcess/Linux: add a flag to re-enable the vfork()-like semanticsThiago Macieira2023-05-221-2/+16
| | | | | | | | | | | | | | | | | | Commit 29b2fe40dc778ec73da7e5643fcfd8979d8ecebc disabled it by reverting commit d6bf71123d3ef073f25610345cb5dc920e4fb783. We now add the promised flag to opt-in. The flag is added to all Unix systems, but it really only applies to Linux right now. No ChangeLog because the whole UnixProcessParameters structure is new and has its own changelog. Task-number: QTBUG-104493 Task-number: QTBUG-111243 Task-number: QTBUG-111964 Change-Id: Icfe44ecf285a480fafe4fffd174d4effd3382495 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QProcess/Unix: add setUnixProcessParameters()Thiago Macieira2023-05-224-0/+185
| | | | | | | | | | | | | | | This commit adds those three flags that are either frequent enough or difficult to do: close all file descriptors above stderr and reset the signal handlers. Setting SIGPIPE to be ignored isn't critical, but is required when the ResetSignalHandlers flag is used, as this is run after the user child process modifier. [ChangeLog][QtCore][QProcess] Added setUnixProcessParameters() function that can be used to modify certain settings of the child process, without the need to provide a callback using setChildProcessModifier(). Change-Id: Icfe44ecf285a480fafe4fffd174d0d1d63840403 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macOS: Fix assertion in accessibility implementation for treeviewsVolker Hilsheimer2023-05-221-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In QAccessible's widget implementations, trees are treated as tables, with a rowCount implementation that is based on the view's current item content. That item content is the view's content, not the model's, and it changes when tree branches are expanded. The Cocoa bridge for accessibility allocates arrays of row data structures based on the rowCount implementation. Those data structures need to be invalidated and recreated when the view's content changes. To do that, emit an accessibility event for a model reset when laying out items changes the size of the view's item array. We don't know what changed during that layout process to makes this any more granular. Amends 11ae55e918082e8fdfc0c88c21049e877cc47b5b, but the problem with the data structure being stale and incorrect would have been there before that chain of changes optimizing. It didn't trigger an assert, but probably resulted in incorrect data being reported. To make trees testable, we need to actually expose them as AXOutline to the macOS accessibility framework. Until now, they have been treated like plain QWidget, e.g. AXGroup. This made them in practice in- accessible. With this change, VoiceOver works much better (although not perfeclty yet). Also remove an assert that could be triggered by an accessibility client asking for a cell for an invalid index (which can be reproduced by navigating around in a tree, following debug warnings from QAccessibleTree::indexFromLogical: invalid index). Pick-to: 6.5 Change-Id: I7650342aa0dcd7925a94ae6a36de5a0b344c467d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macOS: show the test function in the title of the test windowVolker Hilsheimer2023-05-221-2/+2
| | | | | | | | This makes it a bit easier to know what's going on when debugging. Pick-to: 6.5 Change-Id: I5955b9b590c7aea584748f36e4fe15d41fd05ac1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix warning, remove unused variableVolker Hilsheimer2023-05-221-3/+0
| | | | | | Change-Id: I77167919a2382f38d10694ce14ccd209cc7c2377 Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
* Implement color role AccentColor in QStyleSheetStyle and QCssParserAxel Spoerl2023-05-222-8/+24
| | | | | | | | | | | | | | | | | The color role AccentColor has been added to QPalette. This patch implements the new color role in QCssParser and subsequently in QStyleSheetStyle. The QBrush variable names used to populate brushes, have been changed into speaking names for better code readability. tst_QCssParser has been adapted accordingly. The test function accentColor() has been added in tst_QStyleSheetStyle. Documentation has been updated. Change-Id: Ib09ddc1b61868f2bb8f70f654e83ea1c35276d30 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Shoehorn AccentColor into QPalette and keep existing 64bit resolve maskAxel Spoerl2023-05-212-4/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is necessary to add an AccentColor role to QPalette. QPalette currently has 21 color roles and 3 color groups, which require 63 bits to resolve. The resolve mask is implemented with a qint64, which doesn't provide spare bits for another color role. The color role NoRole is used as a default value, marking that a role has not (yet) been defined. The enum value does not represent a valid brush, even though it can theoretically be stored in QPalette's shared data. This patch adds the enum value AccentColor to QPalette::ColorRole, increasing the available color roles to 22. To keep the resolve mask at 63 bits, AccentColor is mapped to NoRole in static constexpr bitPosition. As the enum range would exceed 64 bits without this tweak, 3 additional bits are substracted in the respective static assertion. With NoRole having no bit in the resolve mask, the following adaptions have been implemented: - QPalette::resolve() is adapted to explicitly ignore NoRole. - QPalette::isBrushSet() always returns false for NoRole. - tst_QPalette::setAllPossibleBrushes() to verify the latter - operator== ignores NoRole (documentation updated) AccentColor is added in tst_QPalette::roleValues and enum documentation is adapted. In QPalette's default constructor, the AccentColor brush is defaulting to the Highlight brush, it this is available. Otherwise it is made 30% darker or lighter than the Base brush, depending on dark/light mode heuristics. QPalette's data stram functions have been extended from QDataStream Version Qt_6_6. If earlier versions are de-serialised, the AccentColor defaults to Highlight. An autotest function dataStream() has been added to tst_QPalette. The QDataStream Version Qt_6_6 has been bumped to 21. tst_QDataStream has been adapted to the new version and the new color Role. Change-Id: I98bbf9de95fb83bda921e9614a0db3a3c0ebdf75 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* rhi: Make it a QPA-style private but semi-public APILaszlo Agocs2023-05-2124-123/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qrhi.h, qshader.h, qshaderdescription.h (and qshaderbaker.h from shadertools; done separately) become "RHI APIs", following the concept of QPA APIs. Mirror completely what is done for QPA headers, but using the "rhi" prefix for the headers. This involves updating syncqt to handle the new category of headers. (a note on the regex: matching everything starting with "qrhi" is not acceptable due to incorrectly matching existing and future headers, hence specifying the four header names explicitly) There is going to be one difference to QPA: the documentation for everything RHI is going to be public and part of the regular docs, not hidden with \internal. In addition to the header renaming and adding the comments and documentation notes and warnings, there is one significant change here: there is no longer a need to do API-specific includes, such as qrhid3d11[_p].h, qrhivulkan[_p].h, etc. These are simply merged into a single header that is then included from qrhi.h. This means that users within Qt, and any future applications can just do #include <rhi/qrhi.h> (or rhi/qshader.h if the QRhi stuff is not relevant), no other headers are needed. There are no changes to functionality in this patch. Only the documentation is expanded, quite a lot, to eliminate all qdoc warnings and make the generated API docs complete. An example, with a quite extensive doc page is added as well. Task-number: QTBUG-113331 Change-Id: I91c749826348f14320cb335b1c83e9d1ea2b1d8b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QUuid: add support for 128-bit integersThiago Macieira2023-05-201-0/+26
| | | | | | | | | [ChangeLog][QtCore][QUuid] Added support for converting between QUuid and quint128, on platforms that offer 128-bit integer types (all 64-bit ones supported by Qt, except MSVC). Change-Id: Id8e48e8f498c4a029619fffd1728c9553e871df5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Moc: silence a GCC warningAhmad Samir2023-05-181-0/+1
| | | | | | | It's already silenced for Clang, extend it to cover GCC too. Change-Id: I212ca78d7a203d69d490c46e7ef4b78a60cabd80 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QVarLengthArray/QList: make assign() return a reference to *thisMarc Mutz2023-05-171-4/+17
| | | | | | | | | | | | | While std::vector::assign() returns void, std::basic_string::assign() returns std::basic_string&. In Qt, we want to be consistent between {QVLA,QList,QString,QByteArray}::assign(), and returning *this is the more general solution, so do that. Task-number: QTBUG-106196 Task-number: QTBUG-106200 Change-Id: I2689b4af032ab6fb3f8fbcb4d825d5201ea5abeb Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QList: re-use the prepend buffer, if any, on assign()Marc Mutz2023-05-171-10/+95
| | | | | | | Task-number: QTBUG-106196 Change-Id: I62d8610529cab528ae1b114d29707133b4fc28dc Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QSemaphore: add QDeadlineTimer APIThiago Macieira2023-05-161-100/+0
| | | | | | | | This removes the last use of QtPrivate::convertToMilliseconds(). Change-Id: I6f518d59e63249ddbf43fffd1759fee2e00d36f4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QList: add STL-style assign()Dennis Oberst2023-05-162-0/+69
| | | | | | | | | | | | | | | Implemented assign() methods for QList to align with the criteria of std::vector, addressing the previously missing functionality. Reference: https://en.cppreference.com/w/cpp/container/vector/assign [ChangeLog][QtCore][QList] Added assign(). Fixes: QTBUG-106196 Change-Id: I5df8689c020dafde68d2cd7d09c769744fa8f137 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_ContainerApiSymmetry: fix spacing of template <typenameMarc Mutz2023-05-161-1/+1
| | | | | | | | This file, like the majority of qtbase, uses a space between template and the opening of the template argument list. Add it. Change-Id: I927cb2b1b9620ae108e913343d995373493e8981 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove the "classwizard" exampleVolker Hilsheimer2023-05-1613-0/+617
| | | | | | | | | | | | | | It adds nothing new to what the trivial and license wizard examples show, other than a bunch of somewhat messy and outdated code to generate C++ code files based on the input. The example is referenced in a few parts of the documentation, but there are equivalent snippets in the trivial and license wizard examples, so point at those instead, and add some relevant API usage where needed. Pick-to: 6.5 Change-Id: If1ff57e775bad28920d9e019aeccae69d1f4d127 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Convert "extension" dialog example into snippetsVolker Hilsheimer2023-05-165-0/+180
| | | | | | | Pick-to: 6.5 Task-number: QTBUG-108751 Change-Id: I8ca4e058b832674dc0c8b84024cb70a667ee8db4 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* QTabBar: Add testcase for tabs not scrollingVolker Hilsheimer2023-05-151-0/+26
| | | | | | | | | | | Verify that changing a tab's text doesn't scroll. Fixes: QTBUG-45381 Task-number: QTBUG-113140 Pick-to: 6.5 Change-Id: I02ace9d3fcaa20d8ff5d87ccca5d96a4114b0fb0 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
* QProcess/Unix: enable setChildProcessModifier for startDetachedThiago Macieira2023-05-151-8/+21
| | | | | | | | | | | | | | Do this by making the actual child-execution code common between startProcess() and startDetached(). It does mean we've moved the chdir() operation from the child to the grandchild process, though. [ChangeLog][QtCore][QProcess] The modifier function set with setChildProcessModifier() will now also be executed when the process is started with startDetached(). Change-Id: Icfe44ecf285a480fafe4fffd174d9aa57dd7dfff Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QProcess/Unix: improve the error message if the child modifier throwsThiago Macieira2023-05-151-2/+2
| | | | | | | | Functionality added for 6.5, but after translatable string freeze. Change-Id: Icfe44ecf285a480fafe4fffd174d984c5349e0cb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QProcess/Unix: protect against stack unwinding in the child process stubThiago Macieira2023-05-151-0/+29
| | | | | | | | | | | | | | | | | | | | | | There are two types of stack unwinding that can happen on Unix systems: C++ exceptions and PThread cancellations (on some systems, like Linux, PThread cancellations can be caught in catch(...) statements). We call a variety of PThread cancellation functions from inside the child stub, like close(). To avoid problems, we disable PThread cancellations completely before fork() or vfork(). The C++ exception case is simpler, because we can be sure of catching them with the catch (...) statement and simply transform them into an error message. This is also testable, which the PThread cancellation isn't. The error message isn't ideal because we're string-frozen. I'll improve it for 6.6. Pick-to: 6.5 Change-Id: Icfe44ecf285a480fafe4fffd174d97a475c93ff1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* MOC: pass the erroneous Symbol as an arg to Parser::error() overloadAhmad Samir2023-05-151-0/+9
| | | | | | | | | | | | | | | | | | | | We already know the Symbol while parsing, passing a reference to it to error() makes it simpler to construct the error message. This fixes an issue where reporting an error about "NONSENSE" in e.g.: Q_PROPERTY(Foo* foo NONSENSE foo) would be off-by-one and the error message would say: path/to/file.h:11:1: error: Parse error at "foo" instead of 'at "NONSENSE"', which is where the parser actually found an unexpected attribute. Fixes: QTBUG-36367 Pick-to: 6.5 Change-Id: Ief70e544af41f7575fbeea9b936fa8197c3ef43d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>