Commit Graph

15125 Commits

Author SHA1 Message Date
Vlad Zahorodnii
fb86c5a470 QGuiApplication: Remove .desktop suffix in setDesktopFileName
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>
2023-05-30 23:51:56 +03:00
Arno Rehn
07d6d31a4c QFuture: Gracefully handle a destroyed context in continuations
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>
2023-05-30 21:42:46 +02:00
Ivan Solovev
86c044176f Extend QFuture continuations tests
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>
2023-05-30 21:42:45 +02:00
Amir Masoud Abdol
574cf24a65 Replace AUTO_RESOURCE_PREFIX with RESOURCE_PREFIX in qt-cmake-project
Pick-to: 6.5
Change-Id: I53b9e8887e8e79c1c1e836c514171aece8cf35aa
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-05-30 10:38:33 +02:00
Laszlo Agocs
afe0bf0914 rhi: vulkan: expose the instance in the nativeHandles query
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>
2023-05-30 10:29:51 +02:00
Mårten Nordheim
57ba6260c0 Ssl: Copy the on-demand cert loading bool from default config
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>
2023-05-29 16:03:35 +02:00
Thiago Macieira
26dd7fe4ed CMake: remove "res_ninit" feature and collapse to just "libresolv"
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>
2023-05-27 12:57:16 -07:00
Ievgenii Meshcheriakov
4f65f91d6f QDBus: Fix typo in a function name
Rename connectionCapabilies -> connectionCapabilities

Change-Id: I07deff1b944b30404548181d5c930b76fb1a575c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-26 15:46:34 +02:00
Thiago Macieira
432d67b43f QDnsLookup: add TimeoutError for timeouts
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>
2023-05-26 06:46:33 -07:00
Volker Hilsheimer
bdbfa7757a QWindow test: Blacklist enterLeaveOnWindowShowHide
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>
2023-05-25 12:07:35 +00:00
Volker Hilsheimer
6a2b029138 QLabel: always show the context menu created by the control
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>
2023-05-25 14:06:57 +02:00
Volker Hilsheimer
16cf095bd5 Silence warning from unused variable in QObject test
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>
2023-05-25 14:06:55 +02:00
Volker Hilsheimer
833da1f31c QPauseAnimation test: add QNX to platforms that might fail
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>
2023-05-25 14:06:50 +02:00
Ievgenii Meshcheriakov
c968405455 QDBusAbstractAdaptor: Send signals using correct interface
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>
2023-05-25 11:30:40 +02:00
Christian Ehrlicher
048a68c1e9 SQL: Make QSqlDatabase::DriverDict creation thread-safe
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>
2023-05-24 17:27:55 +02:00
Mårten Nordheim
c891d16490 Skip diffie-hellman parameter test when not supported
Pick-to: 6.5
Change-Id: I0c21aeea813ee48f8c62689dafce6f7fb9620001
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-05-24 13:08:34 +02:00
Eskil Abrahamsen Blomfeldt
baba1f1b39 Change QFont::fontFeatures() -> QFont::features()
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>
2023-05-24 13:05:02 +02:00
Laszlo Agocs
413e74e9a5 Move qopenglwidget example to manual tests
Pick-to: 6.5
Change-Id: I76e6377008484a7b17c65e3c03139a0fb2fc5c34
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-05-24 12:58:27 +02:00
Thiago Macieira
282b078fca tst_QDnsLookup: add a test for setNameserver
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>
2023-05-23 21:23:43 -07:00
Thiago Macieira
bce7009f55 QDnsLookup: add support for setting the port number of the server
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>
2023-05-23 21:23:42 -07:00
Volker Hilsheimer
9526e8dc33 macOS: Extend accessibility testing of treeview
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>
2023-05-23 19:42:16 +02:00
Mårten Nordheim
ada2c573c1 Schannel: Reject certificate not signed by a configured CA certificate
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>
2023-05-23 14:29:59 +02:00
Giuseppe D'Angelo
313bb32364 QRegularExpression: match newlines when converting wildcards
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>
2023-05-23 00:03:37 +02:00
Thiago Macieira
c5221f6be0 QProcess/Linux: add a flag to re-enable the vfork()-like semantics
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>
2023-05-22 10:43:53 -07:00
Thiago Macieira
f9c87cfd44 QProcess/Unix: add setUnixProcessParameters()
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>
2023-05-22 10:43:50 -07:00
Volker Hilsheimer
6a4afebc5c macOS: Fix assertion in accessibility implementation for treeviews
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>
2023-05-22 16:45:28 +02:00
Volker Hilsheimer
b60c31de52 macOS: show the test function in the title of the test window
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>
2023-05-22 16:45:27 +02:00
Volker Hilsheimer
e4e186771e Fix warning, remove unused variable
Change-Id: I77167919a2382f38d10694ce14ccd209cc7c2377
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-05-22 16:45:27 +02:00
Axel Spoerl
980a499ad0 Implement color role AccentColor in QStyleSheetStyle and QCssParser
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>
2023-05-22 14:45:26 +00:00
Axel Spoerl
17c589df94 Shoehorn AccentColor into QPalette and keep existing 64bit resolve mask
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>
2023-05-21 18:36:37 +02:00
Laszlo Agocs
1dd8b5ceec rhi: Make it a QPA-style private but semi-public API
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>
2023-05-21 15:42:58 +02:00
Thiago Macieira
8566c2db85 QUuid: add support for 128-bit integers
[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>
2023-05-20 04:59:43 +00:00
Ahmad Samir
a2abca317a Moc: silence a GCC warning
It's already silenced for Clang, extend it to cover GCC too.

Change-Id: I212ca78d7a203d69d490c46e7ef4b78a60cabd80
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-18 22:39:16 +03:00
Marc Mutz
8712e35aec QVarLengthArray/QList: make assign() return a reference to *this
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>
2023-05-17 06:44:45 +02:00
Marc Mutz
782ccc6de5 QList: re-use the prepend buffer, if any, on assign()
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>
2023-05-17 06:44:39 +02:00
Thiago Macieira
37f1fb78ee QSemaphore: add QDeadlineTimer API
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>
2023-05-16 19:13:03 -07:00
Dennis Oberst
bbbe5f45c4 QList: add STL-style assign()
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>
2023-05-16 20:09:39 +02:00
Marc Mutz
d8bdb66e82 tst_ContainerApiSymmetry: fix spacing of template <typename
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>
2023-05-16 20:09:39 +02:00
Volker Hilsheimer
b7c15f7f24 Remove the "classwizard" example
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>
2023-05-16 18:33:18 +02:00
Volker Hilsheimer
11da92ba94 Convert "extension" dialog example into snippets
Pick-to: 6.5
Task-number: QTBUG-108751
Change-Id: I8ca4e058b832674dc0c8b84024cb70a667ee8db4
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-05-16 18:33:18 +02:00
Volker Hilsheimer
c113a7a796 QTabBar: Add testcase for tabs not scrolling
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>
2023-05-15 21:03:00 +02:00
Thiago Macieira
48b6c8503a QProcess/Unix: enable setChildProcessModifier for startDetached
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>
2023-05-15 19:10:03 +02:00
Thiago Macieira
fb40737b0d QProcess/Unix: improve the error message if the child modifier throws
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>
2023-05-15 19:10:03 +02:00
Thiago Macieira
ba05af82d3 QProcess/Unix: protect against stack unwinding in the child process stub
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>
2023-05-15 10:10:03 -07:00
Ahmad Samir
d2242c353f MOC: pass the erroneous Symbol as an arg to Parser::error() overload
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>
2023-05-15 19:20:21 +03:00
Tor Arne Vestbø
e95f03f989 Darwin: Remove QMacAutoReleasePool heap allocation detection
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>
2023-05-15 13:51:00 +00:00
Volker Hilsheimer
f4b338833e Move the addressbook tutorial into manual tests
The tutorial is building an elaborate UI around a QMap. It doesn't use
structured data, and it doesn't use model/view (which the dedicated
addressbook example in itemviews does).

It's not a good way of building an application, and the individual APIs
for creating layouts, dialogs, or import/export are explained well
enough in other examples.

Pick-to: 6.5
Change-Id: Iffe47a0f6e04a933edb917c877ae845f50b74b4a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-05-15 14:52:17 +02:00
Edward Welbourne
4768fcf836 Fix case-sensitivity of exponent separator check in Cyrillic fall-back
When matching the locale's correct exponent separator, QLocale was
doing a case-insensitive match; but the Cyrillic fall-back was
matching case-sensitively, so failed to catch the case of lower-case e
and its Cyrillic equivalent, when used in a Cyrillic font in place of
the upper-case form of the other, where that's the locale's official
separator. So make this comparison case-insensitive.

Added some test-cases for the lower-case exponential separator.

Pick-to: 6.5
Fixes: QTBUG-113443
Change-Id: I18e22d7b3451fbb61e87d5b93661eadff3c7356e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-05-15 14:02:47 +02:00
Edward Welbourne
526ce669ed Clean up phrasing of --help-all and other help options
The options included by --help-all, although they are "specific to
Qt", are "specific" to all Qt applications, so - in the present
context, of QCommandLineParser - not specific at all. It's the options
described by -h that are specific, to the present command; the Qt
options are generic (in the present context).

So rework the help string for --help-all itself and the documentation
of the function. It had, in any case, an overly-complex first line,
that descended into too much detail. Updated test to match.

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: I06da0af41be60e6e1b7616984001ddb9ca33aad6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
2023-05-15 14:02:43 +02:00
Edward Welbourne
06e2719f73 Add test-cases for QDate::{start,end}OfDay() at QDateTime's bounds
Task-number: QTBUG-68855
Change-Id: Ic91cb5f9947ce5ee533fc77ae24a50376e139ab3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-05-15 14:02:41 +02:00