64882 Commits

Author SHA1 Message Date
Alexandru Croitor
e16db6933c CMake: Don't recurse with qt-cmake-standalone-test in-source dirs
When the qt-cmake-standalone-test root project is configured in-source
in the source directory of a test A, where test A ends up being added
via add_subdirectory(A), this causes the SUBDIRECTORIES property of A
to contain itself for some reason.
Recursively iterating over the root project's subdirectories thus
causes an endless recursion.

Make sure to remove the currently processed directory from the
retrieved SUBDIRECTORIES property when the function is called
during qt-cmake-standalone-test configuration.

We limit it just for that script, so that we don't accidentally
increase the configure time when building all standalone tests, and
call list(REMOVE_ITEM) too many times.

Upstream issue filed at
https://gitlab.kitware.com/cmake/cmake/-/issues/25489

In a way, amends d08fa86e63448377dde4297bc94680a9d7daaaeb because it
exposed the issue.
Amends 1c82e92202c8c359872c08095670c121602094b8

Pick-to: 6.6 6.5
Task-number: QTBUG-119998
Change-Id: I6f92a07be105cde74ac4946523967791db7bf301
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 04a327f00a84b0c13cb4a4a6715b2ce86ea9f61a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-15 10:34:50 +00:00
Christian Ehrlicher
e4d533eb1e QStyleSheetStyle: pass dpr to QIcon::pixmap()
Pass the correct device pixel ratio to QIcon::pixmap() to make sure the
correct pixmap is returned on high-dpi displays.

Fixes: QTBUG-92016
Fixes: QTBUG-94203
Change-Id: I6809ae63b2c99bb60c705f6d78caa2b48f2c7473
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8f539ac85a19b6b96c3757ba59197a34315cfb01)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-15 10:34:50 +00:00
Volker Hilsheimer
97dd51e677 QAIV: reset state if removing index while editing or committing
If the commit of data to a model index result in that index getting
filtered out, then the editor will be removed as part of committing the
data, and the index that the editor is associated with becomes invalid.
The subsequent call to closeEditor() will find that the index for the
editor is no longer valid.

This should not warn, and it should also not abort the clean-up process
early. Instead, identify that the editor that we want to closed is
already hidden. In that case, skip the warning and most of the cleanup
process, and proceed directly to the EndEditHint handling further down.

Add a test that simulates the two scenarios where this can happen:
either the committing of data results in the index being filtered out
by the existing filter; or the filter changes while editing, and the
index being edited gets removed. In both cases, we don't want to see a
warning, and the state of the item view should be reset correctly.

Pick-to: 6.6 6.5
Fixes: QTBUG-115765
Change-Id: If247172fdac9a1a9279dae96c078d32553d4ee5d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: 🌴 Alexey Edelev 🌴 <alexey.edelev@qt.io>
(cherry picked from commit 04415264489cd96a4a542a2ae7db1c14558397a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-15 10:34:50 +00:00
Johannes Grunenberg
bcbeeb7a70 Windows QPA: Omit native virtual key in WM_CHAR
WM_CHAR doesn't send the native virtual key in wParam,
but it sends the generated UTF-16 code unit, so no assumptions
can be made about the pressed key.
lParam still contains the scancode.

Fixes: QTBUG-117903
Pick-to: 6.6 6.5
Change-Id: Iedc5936118936009db8f6b0c1ce6147db2739422
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit d53e42d974c90797d28511470d0b188dcab134fe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-15 10:34:49 +00:00
Allan Sandfeld Jensen
993db3ee9a Copy color table in QImage::transform paint path
A copy without pixel ratio was made, but color table not set.

Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-119902
Change-Id: I328f3faa70d7a1263061cbe51921999393e30801
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 15051e205facddd8bc3f290c65ad854ec1b25091)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-15 07:38:34 +00:00
Eskil Abrahamsen Blomfeldt
2243b815e0 Fix synthesized bold on Windows
There were a couple of problems with synthesizing boldness on
Windows: For the DirectWrite font database, this was not implemented
at all, so this change adds support for it.

For the default GDI font database, the font engine is correctly created
for a font with synthetic bold, but the function that retrieves the
contours from the font does not apply the transformation. So when
generating the distance fields for Qt Quick, we would get the
unemboldened contours. The fix for this is simply to fall back to
using DirectWrite for fonts that require any synthetization. This will
later become the default anyway.

Pick-to: 6.6 6.5
Fixes: QTBUG-119995
Change-Id: I5b4e3b19d0d71c6599746172da0bee41e8fb3940
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 05de036a8855adbdd882942d2fb61c231b02bf5a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-15 07:25:30 +00:00
Thiago Macieira
b9268bef71 QBitArray: add mutation operators taking rvalue QBitArrays
Because we may be able to use the other side's storage and apply the
operation in-place. We reuse the storage of the one that can be
detached: even if we have to grow the buffer, QBitArrays are usually
small so there's a good chance it's just to the extra space QArrayData
usually overallocates or a simple, non-moving realloc().

Disassembly with GCC 13 and Clang 17 show the vectorisers did kick in
for all four functions (inverted_inplace included). I think a
hand-rolled version could squeeze a few more cycles, especially in the
tail section, but I don't consider its maintenance cost to be worth it.

Change-Id: I85b3fc2dd45c4693be13fffd1795bfb1b296caa6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 948fa2a427dbcdc2784abdcf87efc914417a0028)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-15 06:23:48 +00:00
Thiago Macieira
8247adeaed QBitArray: add rvalue binary bitwise operators
Now that the assignment-bitwise operators can reuse storage, we can make
these operators also be capable of reusing storage.

Change-Id: I85b3fc2dd45c4693be13fffd1795b893de65a5b8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 2b7908ac3ad437c209485dcf00d1e53c98d78cb3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-15 06:23:41 +00:00
Thiago Macieira
5c373fd229 QBitArray: improve memory allocation in the binary bitwise operators
Instead of creating a temporary copy of one of the two sides (which will
share QByteArray), create one with the correct target size such that it
is already detached.

Drive-by move them to hidden friends.

Change-Id: I85b3fc2dd45c4693be13fffd1795b74eeaf3be71
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 54c373faa4f9582fd09a802727821fd544a7b2c5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-15 06:23:27 +00:00
Christian Ehrlicher
27f73a90a1 QStyleSheetStyle: misc cleanup
Avoid some calls to detach() and use std::array instead raw c arrays.

Change-Id: I95cbfb130b6fe2509e5d87184c6612718b90dd63
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 51e682d5af955a2c1380f7f1c7014b091a577241)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 19:53:07 +00:00
Thiago Macieira
b0c031b51b Suppress clang-tidy mem leak warning on QMetaObject::invokeMethod
We don't leak, but clang-tidy is printing this warning. Possibly because
it sees a new with no matched delete in the same context, ignoring the
fact that the pointer was gifted to the called function.

Fixes: QTBUG-119972
Pick-to: 6.6 6.5
Change-Id: I6e2677aad2ab45759db2fffd17a06c57c3a463ba
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a337b8360f149313f5bf37dc5867413d846a3a97)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 19:53:04 +00:00
Volker Hilsheimer
3158aa546d QMessageBox: don't use a native dialog if a style sheet is active
With 6.5 we try to use the native message dialog if we can, but we
didn't account for the style sheet. This restores pre-6.5 behavior for
QMessageBox.

Other dialogs will continue to be native, even if a style sheet is in
use. While this is inconsistent, the other dialogs are substantially
more functional, so switching to the Qt version because of a style sheet
being active would be a significant change of behavior.

Pick-to: 6.6 6.5
Fixes: QTBUG-120054
Change-Id: I07eae609bc360140e096c5eb7ad004ffa4422123
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 1b71e2d894c2be7052518cdcb96020c9950e2dc7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 19:53:04 +00:00
Marc Mutz
ce87ff291a QtDBus: port away from QPair
Task-number: QTBUG-115841
Change-Id: I1eaba630f003df695412dbb2353ce4870f9b9782
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 400426acb2955447704821ab03df502dd5705be2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 19:53:04 +00:00
Marc Mutz
8dab969c97 tools: port away from QPair
Task-number: QTBUG-115841
Change-Id: If122a1c17b1b4092b115521cec814ce3b508cd80
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 2a0b9f0b9085b95bbadc2c46feba1ebd1a5d9c09)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 19:53:03 +00:00
Marc Mutz
c7f4939ab6 Q*Animation: s/QPair/std::pair/
Also port from qMakePair() to just braced initialization and CTAD.

As a drive-by, de-duplicate some code around a lower_bound(), and port
from `typedef` to `using`.

Task-number: QTBUG-115841
Change-Id: I3e907ad3bb10b5ca169422ad90d3a65b1b33f926
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 0d09b4f6b9cae84b78d59cecab6d6feb993b112a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 19:53:03 +00:00
Marc Mutz
3727e97f32 Add QT_NO_QPAIR
...and mark QtCore as free of QPair.

Task-number: QTBUG-115841
Change-Id: Ic6009d3cabbf72b3b3fe966e47d48a80a328b499
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 31f437e658c25523c284a404ac7be153e6e347c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 19:53:03 +00:00
Marc Mutz
d2dc1a1828 QMetaType: s/QPair/std::pair/
Also port from qMakePair() to just braced initialization and CTAD.

As a drive-by, use auto instead of various const QMetaType::*Function*
so statements fit on one line again, and port from `typedef` to `using`.

Task-number: QTBUG-115841
Change-Id: I6bd9747fb9eb34da08053927507f2008d9bbfb86
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 1a1735a7cf02d83cef58be41f68cec4a2764e890)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 19:53:03 +00:00
Axel Spoerl
b41fc4bedd QSplashScreen: Enforce visibility by processing events
A splash screen is usually shown during initialization, before the main
window is shown. At that point, an application might not spin an event
loop. The documentation therefore recommends to run processEvents()
periodically, in order to ensure that the splash screen is actually
shown. Async window managers (e.g. XCB) might require more than one call
to processEvents() for the splash screen to be shown. It can't be
guaranteed, that a specific number of calls to processEvents() make the
splash screen visible. Calls to processEvents() are not considered
good practice in application code.

QSplashScreen::finish() uses a copy of QTest::qWaitForWindowExposed(),
to automatically close the splash screen, when the main window is
shown.

=> Re-write the static inline waitForWindowExposed to wait for the
widget's windowHandle()->isVisible(). That ensures visibility to the
window system.
The previous version waited for isExposed() to become true. That
ensured exposure to the application, but not visibility.

=> Intercept QEvent::Show and process events, until the splash screen
becomes visible.

=> Remove references to processEvents() as a requirement to show the
splash screen from the documentation. It remains a requirement for
processing mouse and keyboard events.

=> Re-activate tst_QSplashScreen and test visibility in the constructor
test function.

Drive by:
- implement switch in event override
- factor out paint event handling in a function
- update documentation about calling processEvents() to enable mouse
handling.

Fixes: QTBUG-119225
Pick-to: 6.6 6.5
Change-Id: I07910705246b4e3234e01cc4896f5bc4b2c56772
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7835f9e60157987b4aafc9b860f925d775151b7c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 19:53:02 +00:00
Johannes Grunenberg
1df12820fe QLineEdit: Use existing selection when deleting a word
When using QKeySequence::DeleteEndOfWord or
QKeySequence::DeleteStartOfWord in a QLineEdit with an existing
selection, the selection was ignored which resulted in unexpected
behavior (see bugreport). This is fixed by only setting the selection
if none exists yet.
To prevent an entry in the history when the input is empty, the
selection is checked before calling del().

Fixes: QTBUG-120006
Pick-to: 6.6 6.5
Change-Id: I2e803c5eff1f0e289e93a77c58ecd78299241da7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1d953b2fbc3deccad6eb2a5ebe39b24908dbcf3e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 19:53:02 +00:00
Ed Cooke
a00c80e1ce Update the books example
Remove the .ui file and write the equivalent implementation.

Replace the outdated star icons with new star icons. 5 empty stars
are now provided and filled in depending on the rating. The new stars
are SVG, however, we do not use an SvgRenderer as we cannot use the
QtSvg API from QtBase directly. It is safe to assume the SVG image
loading plugin is present, the worst case scenario would be empty icons,
but it would still build. We instead use QIcon.

For the rating, draw the star icons in a combobox, replacing the old spinbox.

Update the layout by moving the table view to the bottom, and
arranging the input fields at the top.

The scrollbar policies have been set to Qt::ScrollBarAsNeeded for the table view.

Fixes: QTBUG-118476
Pick-to: 6.6 6.5
Change-Id: I27c13534ab06e17531d155469a1cc6e7e05197af
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 76b2852b7cff183ba31d6b09b00cbabdffb9ba71)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 19:53:02 +00:00
Christian Ehrlicher
794aee350f Doc: Update image in QSystemTray example
The old image was from windows xp so a new one from windows 10 should
not hurt.

Pick-to: 6.6 6.5
Change-Id: Ia78f556e8603517d9e7339f0af2330bc2d4182d3
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit f5d192818dea30f1fbe53adc5211ff44563c16aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 19:53:02 +00:00
Volker Hilsheimer
6c726979f7 Turn the "concentriccircles" example into snippets, update screenshot
The example has a lot of code and documentation, but in essence shows
how to use float-based QPainter APIs and how to set a render hint. That
is two lines of code, which we can show as snippets.

Update the screenshot of the example with a higher-resolution version.

Pick-to: 6.6
Fixes: QTBUG-119983
Change-Id: Iafcb813dff6ab8c269176f7994c95947ebf5e559
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 33254fb41f29b510d3d74dbaab60f0a67ef56d46)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 19:53:02 +00:00
Amir Masoud Abdol
d173fda6e9 Use the correct CMake argument name for -libpng and -libjpeg
The qt_feature calls are for "jpeg" and "png".

Pick-to: 6.6 6.5
Fixes: QTBUG-120036
Change-Id: I43e69d9fd1e08383b5ddfbfe194eaa2f2ae52f50
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 8646010223c7a103fc53ff0705dece8904ee268c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 19:53:01 +00:00
Axel Spoerl
40cd1049a6 QDockWidget: Clarify documentation of floating property
QDockWidget::isFloating() returns true for single, floating dock
widgets. It returns false, if the dock widget is part of a floating
tab (i.e. it is a QDockWidgetGroupWindow child).

=> Clarify documentation.

Pick-to: 6.6 6.5
Change-Id: I3c5a4a86b89dcb001e7561de7dcc604bae0d9cee
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 92b5992a29e6a5463200157ab9934fae9a3ec8cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 19:53:01 +00:00
Morten Sørvig
e76a04d26c wasm: fix qtloader.js preRun usage
Emscripten documents that preRun should be an array
of functions, but also accepts setting it to a single
function.

qtloader.js was accidentally using this feature, which
works as long as qtloader is the single user, but breaks
if other code expects an array. A typical error in this
case is:

   "Module.preRun.push is not a function"

Fix this by creating and maintaining preRun as an array.

Pick-to: 6.6
Change-Id: Ie1382695f3f25839cb971ab4adc81984fc8c53ca
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit bf39bd8e06e9d66bfb9f01e83c743420e812b630)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 19:53:01 +00:00
Marc Mutz
41c9754b4c Itemmodels: s/QPair/std::pair/
Also port from qMakePair() to just braced initialization and CTAD.

As a drive-by, use emplacement instead of appending pairs explicitly,
rewrite typedef into `using`, and remove the qpair.h include from the
.cpp file (cannot affect other TUs and <utility> is considered
included in qcompilerdetection.h).

Task-number: QTBUG-115841
Change-Id: Ia985520dfce6b77b1c0fe7669fc92d2df97e1b06
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 91d341e560e9a54d201279d53701ff071256ad6c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 06:48:03 +00:00
Christian Ehrlicher
b63f92bb0f QWindowsCursor: create correct DDB in createBitmapCursor()
CreateCursor() expects a ddb and according the docs a ddb must be
word-aligned but we created a byte-aligned ddb which results in a
wrongly rendered cursor later on.

Pick-to: 6.6
Task-number: QTBUG-82434
Change-Id: Ie847865a0d868043571faf4b7f4fdf6a92fce448
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit af0edfbc7c33261d11b559cb4842045457adc4a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 06:48:00 +00:00
Santhosh Kumar
264dab9936 Fix hang issue during drag and drop in windows
During drag and drop operation, we used to get window under mouse and
process events for that window after the patch set
9ff5b886fade489b7cc268626f518145650f6b2c. But this sometimes cause hang
issue in GetMessage() when the respective window doesn't capture mouse
event and we are required to process mouse events.

This patch fixes this issue by considering whether the window under
mouse has capture.

Fixes: QTBUG-115260
Pick-to: 6.6 6.5 6.2
Change-Id: I748936e4ce23e60abce51d34c1326cfb105b06cb
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 6ef62f7dc4d6cb690fc297954b3cfcd1de415910)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:44 +00:00
Amir Masoud Abdol
9dbc0673c7 Allow space in emsdk path
Changing from Native path, to CMake path resolves the broken
execute_process call.

Pick-to: 6.6 6.5
Fixes: QTBUG-120050
Change-Id: I6725d0efc215e4866677bf6a64e315752c3f2a1d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 6b09b515367b2c293e3d8284f37a6120d2f83019)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:43 +00:00
Amir Masoud Abdol
37e7f8246c Fix an issue where it was not possible to build iOS tests in tree
Before this, when trying to build iOS tests, CMake could not find the
`LaunchScreen.storyboard` in the source directory, and therefore the
configuration was failing.

In addition, QtPublicFinalizerHelpers module was missing in QtBuild,
resulting in another configuration failure when configuring iOS tests.

Change-Id: I592121892a2716973a92ec044414fa729fd3b15f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 0c3892bb261f0eebebdff4cf42169f49729956a9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:43 +00:00
Tinja Paavoseppä
39401a645f Android: Use TextureView when multiple windows present
The SurfaceView class is not the best option for when we
have multiple windows, as the created Surface can only
either be below the window or on top of it, it is not a
part of the view hierarchy.

Replace the SurfaceView with TextureView when there are
more than one window. This way the surface will be a part
of the view hierarchy, and will respect z-ordering.

When there is only one window, keep using the SurfaceView
approach to limit the effect on existing apps, as well
as enable some of the benefits SurfaceView has for e.g.
game and multimedia apps, such as HDR ability.

Move touch handling from QtSurface to QtWindow, so
touches are handled also when using TextureView instead
of QtSurface aka SurfaceView.

Task-number: QTBUG-118142
Change-Id: I37dcaf0fb656cfc1ff2eca0a3bfe7259f607411c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit cca81a663661ef1fce5f4a9f4c5a5f5fd1381325)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:43 +00:00
Tinja Paavoseppä
3475354a96 Android: Differentiate between standalone Qt app and embedded view
Add a helper method to tell whether the app is a standalone Qt for
Android app, where also the Context is created by Qt, or whether Qt
content is embedded as a View into a Context created by the user, i.e.
a "native" Android app.

Change-Id: I618ba1c8cb40c9b132fc12a7ee6d54c071efa983
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit c1a79b442ce0a50e176f72f3c738ea1263e8dd98)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:43 +00:00
Tinja Paavoseppä
5c4a79a53d Android: Fix touch events for child windows
In the touch dispatcher methods, all events were routed for the
top level window at the position, which lead to all the events
being delivered for the parent window.

Since the JNI methods already have a parameter for window ID, take
that into use and determine the window to deliver the events to
by ID.

Change-Id: I07ad7851c32a3e633ee748036d6818b6d0fa5588
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit b2e44a2d1d1fa109bb2971177a4fda1210637410)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:42 +00:00
Tinja Paavoseppä
030a60d681 Android: Add support for foreign window acting as embedding container
In the case when our foreign window is created to act as a parent for
embedding Qt content into a native Android app, we need a more "hands
off"
approach. If the foreign window represents an Android view which the
user
has created outside of Qt, we should not try to reparent it since it
already has a parent in the view hierarchy. Neither should we try to
remove it from the hierarchy, or set its visibility.

Change-Id: Iea496578a40f45ebdd73947a1bb0e46a7131108c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5ba91c9decb4d13d7f7176bc7ce29b40007a19c5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:42 +00:00
Tinja Paavoseppä
2112dfe313 Android: Make winId() return the underlying QtWindow jobject
Previously, winId() returned a simple integer ID, incremented by one
for each window, instead of a handle to the underlying window.

Note, if constructing a QWindow with fromWinId(), the passed jobject
will not be the same one returned by winId(), as the passed jobject,
assumed to be a View, will be wrapped inside a QtWindow to ensure
child windows can be added to it if needed.

Change-Id: I9d5d977eeb08d4cc3594f7339660fe94c3a55864
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 4376467169979ce6886d6f58944a2f50dcf77e51)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:42 +00:00
Oliver Wolff
188fac6453 Remove mentioning of UWP from windeployqt's configure summary
Qt's UWP port has been dropped for Qt 6.0.

Pick-to: 6.6 6.5 6.2
Change-Id: I72f2cfbd1234110a0bd0c15669fa326328d4d08c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 3f680c14799c4cceefd96ed3d07dcc75725eb646)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:41 +00:00
Tor Arne Vestbø
122b4c21a0 macOS: Deliver focus change events for foreign windows
If a foreign window becomes or loses focus window status, we should
let QGuiApplication know about it.

Task-number: QTBUG-119287
Change-Id: I550d72fa13e1c38c9b89880857db9f9cbd7f6568
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 75a5605151d203fb4c2269001dddfd3db121ea2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:41 +00:00
Marc Mutz
3092406d79 moc: port from pair<> to a struct SuperClass
... with properly-named members.

This is in preparation of adding a new member in order to fix
QTBUG-101141 (namespaced base classes).

Pick-to: 6.6 6.5
Task-number: QTBUG-101141
Change-Id: I2309e425ac94ad275b54a898fd33a2891e5d1453
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit cbb4aea2132fc59cd1086ba42cc221d12b5ce9e8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:41 +00:00
Marc Mutz
debeb8878d HPack: fix incorrect integer overflow check
This code never worked:

For the comparison with max() - 32 to trigger, on 32-bit platforms (or
Qt 5) signed interger overflow would have had to happen in the
addition of the two sizes. The compiler can therefore remove the
overflow check as dead code.

On Qt 6 and 64-bit platforms, the signed integer addition would be
very unlikely to overflow, but the following truncation to uint32
would yield the correct result only in a narrow 32-value window just
below UINT_MAX, if even that.

Fix by using the proper tool, qAddOverflow.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I7599f2e75ff7f488077b0c60b81022591005661c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit ee5da1f2eaf8932aeca02ffea6e4c618585e29e3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:41 +00:00
Marc Mutz
a1ac034404 QVariantPair: cut the QPair middle-man
Use std::pair directly.

Task-number: QTBUG-115841
Change-Id: I4ca63c7b7f46f2b66f6f4f4ef4eba54537d5dc7a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 0a5a9c134ebc240a48d999d3cc3fd65d0c60c8a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:41 +00:00
Marc Mutz
f49980f0b7 QArrayData/Pointer: s/QPair/std::pair/
Also port from qMakePair to just braced initialization and CTAD.

Task-number: QTBUG-115841
Change-Id: Ifd7220ae88b101351e91d1488ce18715eb4880e5
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 95c7f88132646489bc17b8ea32facd76a19e19fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:40 +00:00
Marc Mutz
4e8e6a1526 QCbor/QJson: s/QPair/std::pair/
Also port qMakePair() to just braced initialization and CTAD.

Task-number: QTBUG-115841
Change-Id: I9eafb20ebc63bd33eb52661f4f14ad2db9fc0f00
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 4be8755151e3433357de6479d5c70582f83485e6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:40 +00:00
Mårten Nordheim
6b228565cf Fix the qopenssl_symbols.h copy in the autotest
It was forgotten when we originally fixed the hardcoded 1_1 version.

Pick-to: 6.6 6.5
Change-Id: Iff3148d79466dac2830fe9a63d954aead96fb0ac
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 46923f2648ba99b3d070ea077f04047172ba4923)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:40 +00:00
Tor Arne Vestbø
d26be2a206 macOS: Use CALayer backingstore when widgets request non-raster surface
When a non-raster widget is inserted into the widget hierarchy, widgets
switches into using RHI for flushing its backingstore, matching the
window's surface type with the non-raster widget that was inserted.

This happens for example when inserting an QOpenGLWidget, which switches
the surface type to QWindow::OpenGLSurface, or a QQuickWidget, which
switches the surface type to that used for Qt Quick.

In these cases, there might still be child widgets with their own
window handle, and as long as these child windows have the same
surface type as the window owning the backing store these child
windows are flushed through the same rhiFlush() code path as the
top level window.

For child windows with a different surface type, QWidgetRepaintManager
chooses the pain QPlatformBackingStore::flush(). Unfortunately, the
implementation of QRhiBackingStore::flush() bails out when flushing
child windows, so when we were using QRhiBackingStore on macOS for
non-raster surfaces we would end up not flushing these child windows.

The way to fix this is to use QCALayerBackingStore for the case
where we know the client of the backing store (QWidgetWindow) is
going to call rhiFlush() explicitly for non-raster surfaces. That
will lead us into QCALayerBackingStore::flush() for the child windows
with a non-matching surface type, typically QWindow::RasterSurface,
and we'll flush those child windows by setting the layer's contents
property.

Fixes: QTBUG-119309
Pick-to: 6.6 6.5
Change-Id: Ia7052b9e651d575d8e34942a25e17ab5a1f5ce05
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit f16f31ba3093f35134ceff6a784ad99c1867bfee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:40 +00:00
Arno Rehn
f89d80c902 QFuture: Don't use QFutureCallOutInterface for continuations
This patch replaces the QBasicFutureWatcher that was used for
continuations with context objects with a smaller QObject-based wrapper
that works directly from the actual continuation.
The idea stays the same: In order to run continuations in the thread of
a context object, we offload the continuation invocation to the
signal-slot mechanism.
Previously, we've hooked into QFuture with QFutureCallOutInterface to
emit a signal and trigger continuation invocation. However, it is much
easier and robust to emit that signal from the continuation itself.

This sidesteps the locking issues that QFutureCallOutInterface handling
presents. QFutureCallOutInterface basically requires any consumer to
only access the QFuture after all events have been posted and the
internal mutex unlocked, i.e. on the next cycle of the event loop.

Continuations do not impose this restriction; runContinuation()
explicitly unlocks the internal mutex before calling the continuation.

This fixes a deadlock when using QFuture::then(context, ...) where
the paren future is resolved from the same thread that the context
object lives in.

Fixes: QTBUG-119406
Fixes: QTBUG-119103
Fixes: QTBUG-117918
Fixes: QTBUG-119579
Fixes: QTBUG-119810
Pick-to: 6.6
Change-Id: I112b16024cde6b6ee0e4d8127392864b813df5bc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 59e21a536f7f81625216dc7a621e7be59919da33)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:40 +00:00
Marc Mutz
51cbcdab6e QSortFilterProxyModel: scope a variable tighter
The clear() will not preserve capacity, since the QList has been
copied into proxy_intervals already, so is shared. But then creating a
new QList is just as efficient, or more so.

Change-Id: I7ffd91bae8ded5ac28d58bcc545c479f6edc7c90
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit b6fdef44e46b97cf4dc5fee750f50054c65bf5ef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:39 +00:00
Marc Mutz
4f7efd4174 HPack: fix a Yoda Condition
Putting the variable on the LHS of a relational operation makes the
expression easier to read. In this case, we find that the whole
expression is nonsensical as an overflow protection, because if
name.size() + value.size() overflows, the result will exactly _not_
be > max() - 32, because UB will have happened.

To be fixed in a follow-up commit.

As a drive-by, add parentheses around the RHS.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I35ce598884c37c51b74756b3bd2734b9aad63c09
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 658607a34ead214fbacbc2cca44915655c318ea9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:39 +00:00
Assam Boudjelthia
775e2e8d04 CMake: add spaces between sentences of BUNDLE_ANDROID_OPENSSL_LIBS
Change-Id: I7c3603577805426eb1cd46ff9317b7a6f3ca7f93
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 53f3013b9ea75e2832618bb73a261130b60a4d98)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:29 +00:00
Assam Boudjelthia
75fc7a7251 AndroidTestRunner: log when timing out waiting for the test to finish
Leave a log message to know when the test runner timed out or the test
finished.

Pick-to: 6.6 6.5
Change-Id: If56ecaa5b0e3af22b3e26480a584e2d52ac97553
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f8724b9b7eb22b9abace1a67f652c0b6fc6c683d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:29 +00:00
Assam Boudjelthia
5ebce47ac4 CMake:Android:Coin: prioritize timeout from COIN_COMMAND_OUTPUT_TIMEOUT
... from CMake so that Coin doesn't end up killing the whole VM if aRows
test gets stuck and instead allow androidtestrunner to cleanup and fetch
the logs so we know what happened, and even potentially ending up re-run
the test and succeeding if it was flaky.

Also, since CMake sets the timeout during configuration time, coin needs
to set COIN_COMMAND_OUTPUT_TIMEOUT under the build target where tests
are configured, so this moves the setting of that env var from the test
target to the build target.

Pick-to: 6.6 6.5
Change-Id: I9883ea1e98c93f79a088067518d09ca8acd5fdfd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 3ee2ecd6bfdf3320e66628afa5d017783df2ee91)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-14 03:01:29 +00:00