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>
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: 3b0536bbe8.
Change-Id: I9441c4818106bf93e93a1a5d2d2d54c89d80e7b0
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
... and remove all previous function-level occurrences.
Pick-to: 6.5
Change-Id: I90df40922e3aed15efc04e885d9f54c577a948b6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
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
0c5135a9df.
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>
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>
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>
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>
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 ada2c573c1
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>
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 4a46ba1209 and
68b625901f.
Change-Id: Ib5ce7a497e034ebabb2cfffd1762c0afa2fac6e0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
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>
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>
Amends e718818745, 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>
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>
The noTimerUpdates test has been quite flaky since the optimization
of single shot timers in 87535e4e43.
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>
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>
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>
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>
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>
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>
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>
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>
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>
Commit 29b2fe40dc disabled it by reverting
commit d6bf71123d. 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>
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>
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 11ae55e918, 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>
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>
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>
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>
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>
[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>
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>
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>
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>
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>
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>
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>
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>
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>
This is handled by the Objective-C runtime nowadays, where it will
abort if the situation is detected, with the option to break on
objc_autoreleasePoolInvalid to debug the situation.
Pick-to: 6.5
Change-Id: Idf2c4aacc77e41a3deebf270303f4f13cfb0819b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>