Commit Graph

61889 Commits

Author SHA1 Message Date
BogDan Vatra
76619eae4c Don't add prefix for BaseName
Adding the "assets:" prefix to BaseName leads to wrong names returned by
QFileInfo{"assets:/path/to/file"}.fileName().
Instead to return "file" it returns "assets:/file" which is not the
expected result.

Fixes: QTBUG-114576
Fixes: QTBUG-114219
Fixes: QTBUG-112261
Pick-to: 6.6 6.5 6.5.2
Change-Id: I574bf325300c0aedef68b1b183fa837144ad63c6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-06-16 22:54:36 +03:00
Edward Welbourne
77d0f37536 Return TZ time-zone backend's tranCache() as a const reference
Assorted code was iterating from tranCache().cbegin() to
tranCache().cend(), and getting away with it because CoW means
tranCache()'s two distinct returns were referencing the same pimpl,
but let's make tranCache() return a const ref so that these calls are
all accessing the same object (and we get complaints if we do anything
non-const with it via this method).

Axivion-Id: qt_qtbase_dev_linux:SV1685
Pick-to: 5.15 6.2 6.5 6.6
Change-Id: If43ccf37c2b27837e5462cb4a0eeb07f0045cbfe
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-06-16 21:37:11 +02:00
Edward Welbourne
3ccf2f8308 Examples: "About &Qt" should show info about Qt, not quit
A few examples seem to have copied and pasted a help action "About
&Qt" that triggered QCoreApplication::quit. This does not look like
best practice. Use QApplication::aboutQt instead.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I1887a3c999d752a24c7c4d3cabc4a5d63b29b966
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-06-16 21:37:11 +02:00
Edward Welbourne
59d2869765 Core examples: consistent #include order
Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: I014a895a8abeccc9d17b68fb67c00cea22957fed
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-06-16 21:37:11 +02:00
Alexey Edelev
28c9625d00 Fix CMP0099 impact - disallow propagating internal linker options
CMP0099 changes the way of LINK_ONLY genex works. With CMP0099 set to
OLD LINK_ONLY genex only links the exact library binary/archive without
propagating other interface options from the target. This feature was
exploited by PlatformXInternal targets to avoid propagating of their
linker options. Nowadays when CMP0099 is forced to NEW by Qt scripts,
including user-facing, we cannot rely on LINK_ONLY genex.

Introduce _qt_is_internal_target property that is set for all Qt
executables and explicitly limits the propagation of the linker
options from PlatformXInternal targets.

Pick-to: 6.5 6.6
Fixes: QTBUG-113641
Change-Id: I3a0ecddb65886e435073feb24c1b47035130ba70
Reviewed-by: Alexandru Croitor (OOO) <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-06-16 20:58:02 +02:00
Friedemann Kleint
408fbd3f2d QMessageBox: Remove include of qdebug.h
Move the implementation qRequireVersion() to prevent having
to include qdebug.h which pulls in many other headers.

Amends b5d874e36f.

Fix missing include introduced by
3a553507a1.

Pick-to: 6.6
Task-number: QTBUG-114214
Task-number: QTBUG-97601
Change-Id: Iba68ffca95061666d9458ffa5700d07c7669da5b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-06-16 19:42:12 +02:00
Laszlo Agocs
684070bc34 rhi doc: Fix a repeating typo
Pick-to: 6.6
Change-Id: I2025d559be357a6825cdcae4cb0f0931a89864ab
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-06-16 19:42:12 +02:00
Tobias Koenig
f7792d2b6d Schannel: Add support for proper listing of ciphers
Reworked the code to list supported ciphers for Schannel
backend to provide the proper cipher names and cipher
properties.
Note: restricting the used ciphers for a TLS connection
is only supported for TLS 1.2 yet!

[ChangeLog][QtNetwork][QSslConfiguration] Add support for
listing supported ciphers with Schannel backend.

Change-Id: Idfc17335ec489315387a3e84b7a76a263be22378
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-06-16 09:27:00 +02:00
Matthias Rauter
ef7d809eaf Send LeaveEvent as reaction to WM_POINTERLEAVE to reset hover states
Currently items can get stuck in a hovered state when all fingers are
lifted from a touchscreen. This is because we don't react to the
WM_POINTERLEAVE event from Windows. With this patch we translate a
WM_POINTERLEAVE event to a LeaveEvent to remove the hover state from
QtQuick items.

Fixes: QTBUG-62912
Pick-to: 6.5 6.6
Change-Id: I8a6fb6b7ec77457854a75e20277565d1eb89bab6
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-06-16 09:22:54 +02:00
Axel Spoerl
7993321e76 Update documentation of signal QDockWidget::visibilityChanged
The signal can deviate from QWidget::isVisible().

This patch clarifies the signal's documentation.
Since its name suggests that it is in sync with QWidget::isVisible(),
A TODO comment is added to consider deprication in Qt7.
It appears to be more reliable to listen to hide/show events.

Pick-to: 6.6 6.5
Fixes: QTBUG-48161
Change-Id: I43aa16c2ecb4877abd8effb7da8e07576438d6d2
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-06-16 09:21:34 +02:00
Mårten Nordheim
8da8126bae Update public suffix list
Pick-to: 6.6 6.5.2 6.5
Task-number: QTBUG-114548
Change-Id: I5857438aeb1902cd68ceffe4e5179e7bbdf9b44b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-06-16 07:07:19 +00:00
Marc Mutz
8d39b21655 RIP QBasicMutexLocker
This was used as a work-around for Q5MutexLocker's UB downcasting
QBasicMutex to QMutex, and for some unspecified performance
improvements.

Now that Q6MutexLocker is a template, the two are almost
token-by-token identical, so we can remove this work-around and use
QMutexLocker directly.

Partially reverts aea500d5d7.

Pick-to: 6.6 6.5 6.2
Change-Id: I57ef5c53999869aa3454fbbaad884c1d18591b2a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-16 09:03:43 +02:00
Thiago Macieira
166e792269 QProcess/FreeBSD: remove the workaround allowing undefined symbols
On FreeBSD, the environ variable doesn't come from libc, but is instead
inserted during linking. See ccf74b5928
(5.6) for more information.

But instead of allowing undefined symbols in QtCore, let's use a weakref
to environ so this one symbol is allowed to be undefined. It won't be,
but the linker doesn't know.

FreeBSD appears to be the only BSD to require this. We used to apply the
same linker option to OpenBSD in Qt 5, but neither the OpenBSD or nor
the NetBSD ports trees[1][2] carry a patch for this, so I don't think
it's necessary.

[1] https://github.com/openbsd/ports/tree/master/x11/qt6/qtbase/patches
[2] https://github.com/NetBSD/pkgsrc/tree/trunk/x11/qt6-qtbase/patches

Pick-to: 6.6
Change-Id: I63b988479db546dabffcfffd17661c839014771a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-16 01:07:33 +00:00
Fabian Kosmale
44b5ad01f0 moc: Handle attributes after meta-method tag
We so far only handled them if they came at the very start of the method
declaration.
This patch ensures that we also handle them after the meta-method tag
(but before the actual type).
Unifying parseFunction and parseMaybeFunction to avoid the need to
munally keep them in sync is left for another day.

Fixes: QTBUG-111330
Pick-to: 6.6 6.5 6.5.2 6.2
Change-Id: Ic94edb69f04b9150aea2c8e6d004a8b9e5cf12ec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-16 00:07:01 +02:00
Ilya Fedin
3025dc597f Update QIconLoader system theme names on QWSI ThemeChange
The GTK platform theme (and possibly others) emit theme change
when the named icon theme changes, but that was not propagated
to QIconLoader.

We now call QIconLoader::updateSystemTheme(), but note that
if a user theme has been set we ignore the system theme update
and will end up with a stale value, even if the user theme is
later cleared. This will be fixed in a follow up commit.

Pick-to: 6.6 6.5
Change-Id: I40b537f3618f44d396db0c7ca67e515dfcdfba44
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-06-15 21:20:53 +02:00
Colin Snover
03bbad68ce Fix typo in QCocoaWindow comment
Pick-to: 6.6 6.5
Change-Id: Idea292bc2927ff9a534f06b054c26b4ab3ef1bea
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-06-15 12:30:32 -05:00
Mikolaj Boc
a73f41d657 Add test filter argument to wasm js test runner
Change-Id: I8e0c5d7b9049fb3c3248749db8dc8c616db293f0
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
2023-06-15 18:55:32 +02:00
Mikolaj Boc
ee23941c29 Introduce qstdweb::bindForever stub for submodule update
The qstdweb::bindForever function will be introduced soon for binding
callbacks with forever lifetime. For now, since submodules have to be
adapted first, introduce a stub function to port qtmultimedia which
uses Promise::make - it will have its interface changed with
relation to bindForever.

Task-number: QTBUG-112296
Change-Id: I578e1633574e11877a8f5ec14d0f00dfd7c766bf
Reviewed-by: Aleksandr Reviakin <aleksandr.reviakin@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2023-06-15 18:55:32 +02:00
Wladimir Leuschner
f5206b3812 Skip generation of glyphs for control characters
QFontEngine tries to generate glyphs for ASCII control characters. Those
characters have no glyphs and should therefore not be generated.

Task-number: QTBUG-113848
Change-Id: Ib15a50c642d8bc92bc007ab5522aebc5a7b2993d
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-06-15 14:55:07 +03:00
Amir Masoud Abdol
69d74afd43 Add TRY_RUN_FLAGS argument to customize the TRY_RUN command
Some of our tools don't have the `-h`, or `-v` flag, or it could be
that the `-v` flag also prints the entire `--help` as well, e.g.,
`androiddeployqt`. When running in Jenkins, this may lead to a message
box being shown and consequently stopping the build. By customizing the
flag per tool, and limiting the TRY_RUN to tools that support `-v` or
`--version`, we can avoid this.

Also removed TRY_RUN from `macdeployqt` which doesn't need it anyway.

Amend 41b32cd2c4

Pick-to: 6.5.2 6.5 6.6
Fixes: QTBUG-114530
Change-Id: I78e3344d2553c0050c285ae86f2310bd373c6c57
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-06-15 11:46:00 +00:00
Tor Arne Vestbø
f3c2cf47fc De-inline QIconLoader::themeName()
The method is more than a plain getter, so keep it with the other
logic of the class.

Pick-to: 6.5 6.6
Change-Id: I34aa185a51f04e3db3c1918f9723e53f33e5e9e1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-06-15 13:42:39 +02:00
Topi Reinio
ebc371de0d Doc: RSS listing example: Fix file quoting
The example was moved to qtnetwork but its documentation
still referred to old paths under /examples/corelib.

Add documentation dependency to qtwidgets as RSS listing
example's docs link to a number of widget classes.

Pick-to: 6.6 6.5
Change-Id: Ief1c9dc2ca38ba3da1fe3039500292147ec4cc7d
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
2023-06-15 11:34:17 +00:00
Mikolaj Boc
7264f141cf Add window painting testcase to the QWasmWindow test
The test checks whether windows repaint correctly by sampling the
background after their backing stores have been flushed.

Change-Id: Ib544457074d7d477a4acdc5c331ef83e5ba471d2
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-06-15 13:34:02 +02:00
Richard Moe Gustavsen
8393922e70 QComboBox: scroll the popup to the top before positioning it
If the style changes while a popup is open (or about to close),
the popup will change style as well before it's hidden. And
this can result in the popup window briefly ending up smaller
than what it needs to be, in order to fit all the menu items.
In that case, it will show 'up' and 'down' widgets in the
menu that auto scrolls it when hovered. And all this can
happen for a split second while the menu is about to close
(as a result of the user clicking on a menu item).

A bug happens because of this if you click on the last menu
item in the list, and this causes the style to change. In
that case, the 'down' widget will end up directly underneath
the mouse for a split second, which will trigger an auto-scroll
timer to start. This timer will trigger a bit later, after
the popup has been hidden, and scroll the list view a bit down.
The result is that the next time you open the popup, it ends up
at the wrong place on the screen in a failed attempt to center
the current index on top of the combobox.

This patch will make sure that we always scroll the list view
to the top before we start calculating where the popup should
be placed on the screen. Otherwise the geometry ends up wrong
since the popup will anyway be resized (if possible) to fit
all the menu items before it's shown and should therefore not
take scrolling into account.

Pick-to: 6.6 6.5
Fixes: QTBUG-113765
Change-Id: I61b5b832904de471c2303fc67325feec322b1449
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-06-15 13:04:56 +02:00
Thiago Macieira
b86f368441 Long live futexes for FreeBSD!
Like commit 91f6460aff which added support
for Windows. This API is documented and has apparently been present in
FreeBSD for a long while.

The DragonflyBSD API is very similar, but I don't have one to confirm
that I've coded correctly. OpenBSD and NetBSD may have similar APIs, but
I haven't even researched them. We're open to contributions, though.

Change-Id: I63b988479db546dabffcfffd1766bc431fed614b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-15 04:04:56 -07:00
Thiago Macieira
96c76839f9 Switch futex support to QDeadlineTimer
This allows us to use absolute times on Linux (today) and FreeBSD
(soon), plus simplifies both QMutex and QSemaphore.

Change-Id: I63b988479db546dabffcfffd17675a182aa528fa
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-06-15 04:04:56 -07:00
Thiago Macieira
585db639a4 Split qfutex_p.h per OS
Makes it cleaner when I add more OSes.

Change-Id: I63b988479db546dabffcfffd1766bee2e6370b94
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-06-15 04:04:55 -07:00
Mikolaj Boc
fc4fca6d9d Support child windows on WASM
Setting parents for WASM platform windows is now supported. This means
that windows now reside in a hierarchical window tree, with the screen
and individual windows being nodes (QWasmWindowTreeNode), each
maintaining their own child window stack.

The divs backing windows are properly reparented in response to Qt
window parent changes, so that the html structure reflects what is
happening in Qt.

Change-Id: I55c91d90caf58714342dcd747043967ebfdf96bb
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-06-15 09:41:06 +02:00
Luca Di Sera
eb92d52dc7 Doc: Correct the expansion of the raisedaster macro for DocBook
QDoc allows code-expanding macros to be defined so that the user can
abstract away common code in a simple to use command.

Furthermore, macros allows for a different expansion based on the
currently generated format so that format-specific requirements can be
satisfied when required.

When format specific expansions are provided, QDoc considers the
resulting text as if it should be generated verbatim.

The "\raisedaster" macro is used to generate an superscript asterisk.

The macro is provided for both HTML and DocBook.
As the macro has format-specific expansions, the expanded code will be
read verbatim.
Nonetheless, while the HTML expansion expands to actual HTML, the
DocBook expansion expands to an equivalent QDoc code, which will not be
generated correctly.

To avoid the issue, the DocBook version of "\raisedaster" is modified so
that it produces the correct DocBook code.

Change-Id: I3a37838bda885af42f8d93b86ec08126d7146ff9
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-06-14 16:18:55 +02:00
Luca Di Sera
5e7106ecd3 Doc: Provide a DocBook version of the beginqdoc and endqdoc macros
QDoc allows code-expanding macros to be defined so that the user can
abstract away common code in a simple to use command.

Furthermore, macros allows for a different expansion based on the
currently generated format so that format-specific requirements can be
satisfied when required.

Due to a certain bug in QDoc, when generating the DocBook format, QDoc
would expand an HTML specific macro definition when a DocBook specific
one was not provided.

As this bug is now being fixed, the DocBook format will lose some of the
output that it was previously generating.

For example, the "\beginqdoc" and "\endqdoc" macros are defined, for
HTML, to expand to the beginning of block-comment text, "/*!" and ending
of block-comment text, "*/".

To avoid losing the usage of "\beginqdoc" and "\endqdoc`" when
generating DocBook, an equivalent expansion of the macro is now provided
for the DocBook format.

Change-Id: I45fb54f1f56077771c091323a69fd63e09a910eb
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-06-14 16:18:55 +02:00
Topi Reinio
fae72a8df4 Doc: Stop writing host-specific paths to generated .index files
By default QDoc writes filePath attributes for each entry in the
.index file it generates. The attribute value is an absolute path
that's only relevant or useful for debugging purposes.

Pick-to: 6.6 6.5
Change-Id: I3bc646104af74b67c74350912359cf65ac252992
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-06-14 14:18:55 +00:00
Topi Reinio
7df2fc0d29 Doc: Adjust \fn signature for QVariant::value()
Fixes QDoc warning: clang couldn't find function when parsing
\fn template<typename T> T QVariant::value() const.

Change-Id: I0e331c5895497bd2c9e691a580929e25cc14dc6c
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-06-14 14:18:55 +00:00
Luca Di Sera
5c66c08bed Doc: Add DocBook version of youtube macro
QDoc allows code-expanding macros to be defined so that the user can
abstract away common code in a simple to use command.

Furthermore, macros allows for a different expansion based on the
currently generated format so that format-specific requirements can be
satisfied when required.

Due to a certain bug in QDoc, when generating the DocBook format, QDoc
would expand an HTML specific macro definition when a DocBook specific
one was not provided.

As this bug is now being fixed, the DocBook format will lose some of the
output that it was previously generating.

For example, the "\youtube" macro is defined, for HTML, so that a
youtube video can be embedded by reference.

To avoid losing the usage of "\youtube" when generating DocBook, an
equivalent version expansion of the macro is now provided for the
DocBook format.

Change-Id: Id74155f2c30b80b5f4490f8451cd8d00535806d6
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2023-06-14 16:18:55 +02:00
Axel Spoerl
787b4c1506 QHeaderView: use correct mouse position for auto scroll
QHeaderView::mouseMoveEvent started autoscroll without propagating the
event's mouse position to QAbstractItemViewPrivate::draggedPosition.
This data member always containing QPoint() has lead to right drags not
causing an autoscroll at all. Left drags with a scroll offset just
kept scrolling until the offset was 0.

The missing propagation has been added.
As a drive by, dead code has been removed and the local variable pos
has been constified.

Fixes: QTBUG-113573
Pick-to: 6.6 6.5
Change-Id: I7b194dfc71abea6f2bbaaae18270c80eb15afb4d
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-06-14 16:18:55 +02:00
Alexey Edelev
4e74fa8119 Fix typo in qt_internal_add_global_definition
Fix the argument prefix that is used in the cmake_parse_arguments call.

Pick-to: 6.5 6.6
Change-Id: Ie02bdf7d2769ce084b0d173c1e8152ca6fc4fe53
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-06-14 16:18:55 +02:00
Venugopal Shivashankar
4af07d6e54 Doc: Mark QRasterPaintEngine as \internal
Most of the QWS (Qt Windowing System) classes from
the Qt 4 times are cleaned up in Qt 6. Any existing
QWS API documentation should be marked \internal.

Pick-to: 6.2 6.5 6.6
Task-number: QTBUG-35605
Change-Id: I24201406114feaf8af21403b09375a2ee9a4709e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-06-14 10:21:31 +00:00
Edward Welbourne
e54a7c5667 Move RSS listing example to networking
It's really showing how to request a resource and act on its becoming
available. The use of XML to do so is incidental; the use of
networking is central.

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ibcf438c7ef3b2464ddfa8b96a79fb15523e4a468
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-06-14 11:57:31 +02:00
Edward Welbourne
4b6986db32 Do XBEL example's last !QT_NO_... -> QT_CONFIG()
Amends commit 723e331f0a

Pick-to: 6.6 6.5
Task-number: QTBUG-111228
Change-Id: Ib9a094ab432a80b8b2dbbbecb497dca13d23a553
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-06-14 11:57:13 +02:00
Marc Mutz
ba501285b5 QDebugStateSaver: unexport
We should not export non-polymorophic classes wholesale. Only export
the non-inline functions instead.

There are no implicitly-declared special member functions in this
class that could cause problems, so we don't need to delay until Qt 7.

Pick-to: 6.6
Change-Id: I204d703498bf42465ea122d1f31c443ea439bd6e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-14 10:00:58 +02:00
Marc Mutz
2bd8e63690 QUuid: fix qSwap() use in constexpr function
I don't know why the compilers didn't shout here, but what _should_
have happened is:

- qSwap<quint64>() gets instantiated

- the unqualified swap() call inside gets resolved to std::swap()

- std::swap() is not constexpr in C++17, so qSwap<quint64>() silently
  gets its constexpr dropped

- error, due to the use of non-constexpr function qSwap() in constexpr
  function bswap()

There's no way through the function that doesn't hit the qSwap(), so
that is also not the explanation. And, indeed, replacing qSwap() with
std::swap() gets me the expected error...

Before compilers get the idea, rewrite the code to not require
swapping.

Amends 686c02224c.

Pick-to: 6.6
Change-Id: Ie1364bb2fd148bf995a8ffd321f77a6021176928
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-14 10:00:58 +02:00
Marc Mutz
30f87c86b4 QProcess/Unix: fix unsafe strncpy() use
GCC 11 complains:

    qprocess_unix.cpp:672:12: error: ‘char* strncpy(char*, const char*, size_t)’ specified bound 508 equals destination size [-Werror=stringop-truncation]
      672 |     strncpy(error.function, description, sizeof(error.function));
          |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

And it's correct: if description is longer than
sizeof(error.function), then error.function will not be
NUL-terminated.

While a quick check suggests that the user of the field performs a
qstrnlen(), thus avoiding falling off the unterminated end of
error.function, it's safer to always NUL-terminate. A single added
qDebug() << error.function would already be UB.

Fix by using _q_strncpy(), which is also more efficient, as it doesn't
write 0.5KiB of NULs in the likely case that description is short.

Amends 90bc0ad41f.

Change-Id: If5c2cb80fc4a3c92b8e78b680a635045bb14a30d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-14 07:12:02 +02:00
Lorn Potter
103ffe1b58 wasm: fix networkreply with empty data
Fixes: QTBUG-114078
Pick-to: 6.5 6.6
Change-Id: I78e6844ab1aa5d385d8c558c696299e7fa845f50
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-06-14 11:56:32 +10:00
Mårten Nordheim
fa256b242c Schannel: enable QStringBuilder
Apparently it is not enabled since the TLS backends became plugins,
which is unfortunate I wrote code in here that assumed it was.

Change-Id: I765435ce7d2c6fafa452d0453c705c27ff477be6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-06-14 01:25:29 +02:00
Mårten Nordheim
5c14fb274a Schannel: define QT_NO_CAST_FROM_ASCII
To avoid implicit, unintended, creation of QString

Change-Id: I50e1f83e8f6f13f38746ac03b65161cee96306cb
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-06-14 01:25:29 +02:00
Mikolaj Boc
8ab67c62d0 Fix jsHaveJspi so that it works without Asyncify defined
Change-Id: I3dd2ff16e41faae33c8095d7d8ea538da8c7d4d4
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-06-14 00:04:14 +02:00
Marc Mutz
123118f829 QOrderedMutexLocker: plaster with [[nodiscard]]
It's a RAII class, and RAII classes should be marked [[nodiscard]] at
the class as well as the ctor level.

Pick-to: 6.6
Task-number: QTBUG-104164
Change-Id: Ie88023ba7c57dad7c2116c1c19a80b908b3a9f4d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-14 00:04:14 +02:00
Timur Pocheptsov
c8473c0903 macOS: Use submenuAction: as action for sub-menu menu items
Having the generic qt_itemFired: as action would result in the whole
submenu tree closing if an item with a sub-menu was clicked on. This
is not how native applications behave. They respond by immediately
opening the submenu, or do nothing if the menu is already open.

By using submenuAction: as the selector we achieve the same behavior.

A complication here is that for some reason we defer associating the
submenu NSMenu to an NSMenuItem until QCocoaMenu::setAttachedItem(),
instead of doing it in QCocoaMenuItem::setMenu(), or even as part of
QCocoaMenuItem::sync().

As a result, AppKit's NSMenuValidation logic will conclude that the
item does neither have a submenu, nor a valid target/selector combo
to be validated, and will explicitly disable the item. This can be
debugged by passing -NSTrackMenuValidation YES to the application.

To work around this we explicitly enable the item once we have set
a valid submenu for the item.

Pick-to: 6.5 6.6
Fixes: QTBUG-114199
Change-Id: I7178e7687066b3fe082454c512ec9c7eab3bded4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-06-13 23:32:22 +02:00
Mårten Nordheim
230c53ad9d QNetworkInfo[win]: Explicitly link with oleaut32
Declaring it as an explicit dependency should hopefully make
the compilers order the object-files to be linked in the
correct order.

Task-number: QTBUG-114243
Pick-to: 6.6 6.5
Change-Id: I723fee468e58786f66d1bba50bc4086beb50adb1
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-06-13 22:24:42 +02:00
Vladimir Belyavsky
af8f9a2a6e QStringBuilder: allow to be used with 'auto' keyword
The idea is to store a concatenable in a QStringBuilder object by value
or by reference, depending on how it was originally passed into the
concatenation operator. So if it was passed by r-value, we treat it as
a temporary object and hold it by value (and use move-semantic if
available), otherwise we hold it by reference (as before).

To achieve this we first change concatenation operators '%' and '+'
to take their arguments by universal reference. Next we instantiate
QStringBuilder object with deduced types of the arguments, which will
be a "value type" or a "reference type" according to "universal
reference deduction rules".

Further we use perfect forwarding to pass arguments to QStringBuilder's
constructor. Thus arguments, initially passed by r-value reference
and which are move-constructible, will be "moved" to corresponding
QStringBuilder member variables.

So, to summarize:
1. Arguments passed by l-value reference - stored in QStringBuilder
   object by reference (as before).
2. Temporary objects passed by r-value reference - stored in
   QStringBuilder object by value. If a type is move-constructible
   (QSting, QByteArray, etc), the object will be "moved" accordingly.

Special thanks to Giuseppe D'Angelo for the tests.

Fixes: QTBUG-99291
Fixes: QTBUG-87603
Fixes: QTBUG-47066
Task-number: QTBUG-74873
Task-number: QTBUG-103090
Task-number: QTBUG-104354
Change-Id: I64f417be0de0815ec5ae7e35a1cc6cef6d887933
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Vladimir Belyavsky <belyavskyv@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-06-13 20:01:37 +00:00
Axel Spoerl
8d1304f4f2 QGtk3Interface: Explicitly add monospace font provider
In case the current GTK3 theme has no monospace font defined, a
monospace font requested by a Qt application can trigger a GTK warning
"Theme parsing error: <data>:1:0: Expected a valid selector".
The warning is triggered by Qt requesting "{font-family: monospace;}".

In this case:
=> ensure fallback to GTK standard monospace font
=> request "* {font-family: monospace;}" to avoid the warning

Task-number: QTBUG-112896
Pick-to: 6.6 6.5
Change-Id: I24a8da62908af9b153245f53026af60e63a600d7
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-06-13 20:00:31 +00:00