Compare commits

...

1888 Commits
dev ... 6.6.2

Author SHA1 Message Date
Jonas Karlsson
dec1863c7d Improve KTX file reading memory safety
* Use qAddOverflow/qSubOverflow methods for catching additions and
  subtractions with overflow and handle these scenarios when reading the
  file.
* Add 'safeView' method that checks that the byte array view constructed
  is not out of bounds.
* Return error if number of levels is higher than what is reasonable.
* Return error if number of faces is incorrect.
* Add unit test with invalid KTX file previously causing a segmentation
  fault.

This fixes CVE-2024-25580.

Fixes: QTBUG-121918
Change-Id: Ie0824c32a5921de30cf07c1fc1b49a084e6d07b2
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 28ecb523ce8490bff38b251b3df703c72e057519)
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
2024-02-09 12:43:42 +00:00
Christian Ehrlicher
b47ad83d7c Q(Plain)TextEdit: don't crash when using a style sheet
When using a style sheet, Q(Plain)TextEdit::isReadOnly() might get
called during the initialization before d->control is properly
initialized which lead to a crash.
This amends 43ce457cbd093fc06d99b5ac833c789ef7c893d5.

Fixes: QTBUG-121697
Fixes: QTBUG-121790
Task-number: QTBUG-1857
Change-Id: I15c357c9eef7f6559bcc2ad89033a3d8e7fcbfef
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit c6af5b9c12e1ea4cec007c5efe869636ce97a9d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit e9b187a836974f05ba8f42eb72854a5effdc6c15)
(cherry picked from commit ff1f12d5a0f57143e0e3c8d781bb3fdc884af7bc)
2024-02-09 08:37:04 +00:00
Eirik Aavitsland
303586dd18 Update bundled libpng to version 1.6.42
[ChangeLog][Third-Party Code] libpng was updated to version 1.6.42

Change-Id: Ie41c2df610fcd456af2bc4dee05dde90c426602b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit a046bc19e451f6f2e42ac1fcddaf5ef3efc81f0d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit cd59980f726b5254bd56197acc6f0cbe6d5f1f46)
(cherry picked from commit 85ac5cb9796f40cd01cf585978a7ad54cc75f23d)
2024-02-09 08:36:49 +00:00
Eirik Aavitsland
f9537eda1d Update bundled libjpeg-turbo to version 3.0.2
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 3.0.2

Fixes: QTBUG-121737
Change-Id: I0085f0f859dd9c95ed203fd22bd9702fd1e9d721
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 972bd4ed46be6ad905f2cd8bd84776cf3f1f3220)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 27625a33c548e1330ad93f81567d357fe5f4d224)
(cherry picked from commit 027724d66e649f51fee8f96fe1a2e48892848307)
2024-02-09 08:36:40 +00:00
Alexandru Croitor
736d6300bb CMake: Fix undefined symbol: qt_resourceFeatureZstd issue
When cross-compiling, host rcc might generate zstd compressed
resources, even though the target might not support zstd
decompression.

To avoid that, we made sure to disable zstd compression when using
cmake api like qt_add_resources if the target platform does not
support it.
We did not do it for CMAKE_AUTORCC though.

In such a situation, the linker would fail with:
 error: undefined symbol: qt_resourceFeatureZstd

Add the --no-zstd option to AUTORCC_OPTIONS for targets that are
created by Qt CMake public API like qt_add_executable and
qt_add_library if the target platform does not support zstd
decompression (check via the QT_FEATURE_zstd variable).

This in turn applies to our own qt_internal_add_ API as well.

Allow opting out via the QT_NO_AUTORCC_ZSTD CMake variable.

[ChangeLog][Build System] Targets created with qt_add_executable
and qt_add_library will now add the --no-zstd option to AUTORCC_OPTIONS
when the target platform does not support zstd decompression. You can
opt out via the QT_NO_AUTORCC_ZSTD cmake variable.

Fixes: QTBUG-121948
Task-number: QTBUG-106466
Task-number: QTBUG-101353
Change-Id: Ibdcfecd9a4b1e206479a3f4588b1b624dd91e122
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 329dbfcc78d067d26b5a4dd99f4284900fd68f2c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 2cf327be826251ad4b82d07366ba32f76fd800d9)
(cherry picked from commit 3738a2dc6742fa3303f114537de65893103d7ca5)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-02-08 19:13:39 +00:00
Tor Arne Vestbø
fd1beb3e21 macOS: Don't condition deferred exec on specific NSAlert to be the modal window
When a QMessageBox is created with setModal(true), the user can in theory
choose to show() it, and then return back to the main event loop, instead
of calling exec(). We tried to support that case via a single shot timer,
called on the next pass of the event loop, that checked if the applications'
current modal window was the alert, and if not, showed it at that point.

That logic failed when there were more than one alert show at the same
time.

We do maintain a stack of the modal sessions and their windows in the
Cocoa event dispatcher, so we could use that to check if a modal session
had been started for the alert's window, but a similar solution is to
just check the alert window's visible state.

Fixes: QTBUG-121557
Change-Id: I6f52a53e8f678bb8a071e334a09ab30669d95bbf
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
(cherry picked from commit 7edff3f15ae21c2310437e0711f84442a21cb6a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit c967ee08c82aef011b319e5efacf5d1269c18e90)
(cherry picked from commit 7c782dc20a032a612271341b7a067b9397386502)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-02-06 09:44:57 +00:00
Shawn Rutledge
d1348ac94f Update md4c to 0.5.2
Followup to c29a235833410fde4cb4d502f89129bccd7403f0

[ChangeLog][Third-Party Code] md4c was updated to 0.5.2.

Task-number: QTBUG-121442
Change-Id: I097d9aa5f54c59c301a91fb824adf949daae3af2
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 16bcdba8e7adae79729c6347e711bd0a976dbbe7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit ff8928d3cbaa8366a861317f11cb49449dc49eda)
(cherry picked from commit 14671775ed868630e31104da89b423765092e7f6)
2024-02-06 09:44:37 +00:00
Kai Köhne
bda58a780c SQLite: Update SQLite to v3.45.1
[ChangeLog][Third-Party Code] Updated SQLite to v3.45.1

Change-Id: I8083d0750e52b1035919821c25cef9855afea2f9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 40a87ca1b421457fc2a31cf385eb5a0eda83486f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 2c53d990f7c5f77b58a2b5550c2bf6d0adc306a6)
(cherry picked from commit 5de945fb3c500f2a67d60f5ec71cd87c632aade4)
2024-02-06 09:44:30 +00:00
Eirik Aavitsland
1ac17f25fa Update bundled libpng to version 1.6.41
[ChangeLog][Third-Party Code] libpng was updated to version 1.6.41

Change-Id: I3285bfa11f61c571ffda1b365011a5c6a798ca68
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 528032c02771ddc35d054ff8d414b382904b607e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 03bf71b7ff505b683edd484892f429a21b52d201)
(cherry picked from commit 48b36d89c4b03e31d481c77b9383bd4517517c3b)
2024-02-06 09:44:26 +00:00
Axel Spoerl
1b23260624 QDialogButtonBox: Don't set focus in a dialog with StrongFocus children
A QDialogButtonBox with the first accept button becoming default, didn't
explicitly set focus on such a button in a QDialog.
d44413d526ec12ed83acd7343c2005782178c7ad implemented this missing
functionality. It set focus to the automatic default button, unless the
QDialog had a focusWidget() set.

That has caused a regression, in cases where
- the QDialog has a QWidget child with a Qt::StrongFocus policy, and
- the QDialog is not yet visible, so focusWidget() returns nullptr.

Amend d44413d526ec12ed83acd7343c2005782178c7ad:

Implement a helper in QWidgetPrivate, that returns true, if a child
with a given focus policy is found.

Do not set focus to a QDialogButtonBox's automatic default button, when
- not located inside a QDialog, or
- a focusWidget() exists, or
- the dialog has QWidget child with Qt::StrongFocus, that is not a
child of the QDialogButtonBox.

Add an autotest function.

Fixes: QTBUG-121514
Change-Id: I3c65ae36b56657f9af4a3a4b42f9b66e8bc5c534
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2024-01-30 19:03:49 +01:00
Axel Spoerl
0710865eed API Review Widgets: Remove QDockWidget debug operators
Adding specific debug operators for QDockWidget has introduced new
symbols in 6.6.1. Remove them again, we maintain forward binary
compatibility within a patch cycle.

[ChangeLog][QtWidgets][QDockWidget] Removed debug streaming operator
incorrectly introduced as a new symbol in Qt 6.6.1.

Task-number: QTBUG-119952
Change-Id: I1d5b96b442dc910d1782dbede6119708d8336991
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit fb92bb073e6e1dd327b9ee94bb1e5726e96396bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-01-30 04:21:18 +00:00
Alexey Edelev
de62bb90ec Revert "Add the support of the qt_import_plugins functionality to androiddeployqt"
This reverts commit 6763644c3fc151d6e7716af08531a386557d5a88.

Reason for revert: Breaks android automotive and blocks the release.

Pick-to: 6.6 6.5
Change-Id: I450dca047d7f105bd60bab3fb698806ef486e581
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2024-01-29 13:41:02 +00:00
Kai Köhne
bf196d0dd3 Doc: Update Copyright in md4c license text
Amends c29a235833410fde4cb4d502f89129bccd7403f0

[ChangeLog][Third-Party Code] Updated md4c (optional part of
Qt Gui) to version 0.5.1.

Change-Id: I7c41fc65fbc92670c1fe4bd0b6d2f46674bdb435
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit c92de95bedcd6f3487b254f37270e207ee7b9894)
(cherry picked from commit 73cf29184928ab8c40dc98f9ffc18e6db2ddb65d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 64736d2ece9d49bd62d0bd09d224be1b670ac79b)
2024-01-27 09:11:15 +00:00
Mårten Nordheim
f4457ba919 Http2: fix 401 authentication required w/o challenge
The code did not handle the path where we didn't have a challenge.
We cannot recover from that so we just have to fail the request.

Amends fe1b668861e8a3ef99e126821fcd3eeaa6044b54

Fixes: QTBUG-121515
Change-Id: Ie39a92e7439785a09cad28e8f81599a51de5e27f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit ffe0271a21e9574d1c9eab5fb9803573e17e0f22)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit d5cdfe33a246299fd4799a0b34691f19787b0dc1)
(cherry picked from commit 394114e6415689b54cfc868f30daf1da6b153884)
2024-01-26 18:15:25 +00:00
Timur Pocheptsov
aacf2ec03c QCocoaA(11)y: do not try to access an element if rowIndex == -1
This ends up in out of bounds exception.

Fixes: QTBUG-120469
Fixes: QTBUG-121008
Change-Id: Id895f311bbb59a3734ecadd0d2472a4018332e16
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 75a918d487aabacd2d377e1e79baea7d30deb5ac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 1e0a6b31603fdb95232e8210512c9ad92ef372af)
(cherry picked from commit b97d45c99dc2140c248c9b59727574cd21b7b81f)
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2024-01-26 05:18:07 +00:00
Mårten Nordheim
6914f7ce3b Update Zlib to 1.3.1
[ChangeLog][Third-Party Code] zlib was updated to version 1.3.1.

Task-number: QTBUG-121325
Fixes: QTBUG-121444
Change-Id: I0a72b7966916ccb825c7a8ae251e09b2914f0cf4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
(cherry picked from commit 1579f19cf71aa220da3e8f7417a22baeb87a0f65)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit af9bf8712e48b6da4e56d7b189e63b3e44cd5fb2)
(cherry picked from commit 1772c99267988366c68bc35fcdd3a238619dd675)
2024-01-26 05:17:57 +00:00
Shawn Rutledge
3fa20b8e55 Avoid detection of heading in tst_QTextMarkdownImporter::thematicBreaks
In md4c 0.4.8, three or more hyphens immediately after text were seen as
a thematic break:

some text
---

But in 0.5.1 it makes the text into an H2 heading (even though this
style of heading would normally have the text fully "underlined" with
hyphens). The CommonMark spec 0.30 says

  If a line of dashes that meets the above conditions for being a
  thematic break could also be interpreted as the underline of a setext
  heading, the interpretation as a setext heading takes precedence.
  Thus, for example, this is a setext heading, not a paragraph followed
  by a thematic break:

  https://spec.commonmark.org/0.30/#example-59

So the new behavior seems more correct. But rather than testing so
deeply, just disambiguate by adding a newline, since Qt may be expected
to work with various versions of md4c, and such minor behavior
differences are not expected to come up often in practice.

QTextMarkdownWriter already adds a newline when writing such markdown.

Change-Id: I5a4bf8720d994616274eb8534b4d7085399130fc
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 3bd4c1b670b8b973e8a782bcaec7078027f6ea36)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 2f5fe6a9a10f967622f9831e4bd06d633f105e20)
(cherry picked from commit 9aedd9413b1543699d24f80a0ebc91e052bf037a)
2024-01-25 16:18:11 +00:00
Shawn Rutledge
1e31dad8a2 Update md4c to 0.5.1
Fixes: QTBUG-121442
Change-Id: Ifa4d6d25a9ea967c520f84397906b0af5cde1722
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit c29a235833410fde4cb4d502f89129bccd7403f0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 72747668fc68cb1058688f9e52490aa99bb8e5e8)
(cherry picked from commit e39259c3f087379f4a801f873a97c6e9519991ea)
2024-01-25 16:18:01 +00:00
Volker Hilsheimer
137a325756 Revert "macOS: Don't crash when starting a drag with empty mime data"
This reverts commit 09afa7575276d7b500f17671a1ca9ca677767b44.
It broke Qt Designer, which creates QDrag objects without any mime
format. It's likely that user code does the same to support internal
drag'n'drop.

Task-number: QTBUG-119216
Fixes: QTBUG-121512
Change-Id: I8b74f2d9b89588cd35bca9ca20973810036a2635
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 97bb0ecfe628b5bb78e798563212adf02129c6f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit edc4e555454c34bad17e7a5fce338a966a3c57d1)
(cherry picked from commit f4e8177411edb5d2ee2b238bc5194660ef0edad9)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2024-01-25 16:17:51 +00:00
Tor Arne Vestbø
ed3d0ee5c0 QWidget: Clean up state that depends on QWindow from ~QWidgetWindow()
We were assuming that QWidget was in full control of QWidgetWindow
destruction, via deleteTLSysExtra(), and that we could limit any
cleanups to that function.

But in some situations QWidgetWindow is destructed from other code paths,
in which case we were left with dangling pointers to the QWidgetWindow
in both QTLWExtra, as well as the backingstore.

This can happen if there's a child widget hierarchy where there is not
a 1:1 mapping between QWidgets and QWindows, for example if the window
attribute WA_DontCreateNativeAncestors has been set. In this situation
our normal recursion into children in QWidget::destroy() stops at the
first widget without a window handle. When we then delete the top level
QWindow, the QWindow destructor will delete any child QWindows, which
includes our leaf QWidgetWindow.

We should probably fix up QWidget::destroy to continue looking for
children, even if we don't destroy the current child. But independently
of that we should make sure the QWidgetWindow cleans up when it's being
deleted, regardless of how it ended up there.

There's further room to clean up the deleteTLSysExtra() function and
friends, but that's been left for a later time.

Fixes: QTBUG-120509
Change-Id: Ib691df164d7c9c83cb464c0a6bf3bc2116e8ca43
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 12203e94f5a34b59b6a7389402c854e823135a35)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 4f4ffa8a67ac34396a0f16898ffd7b5987e0864d)
(cherry picked from commit 06a1e3b3cf47a103aea429053d273810ae576893)
2024-01-24 12:51:35 +00:00
Christian Ehrlicher
a619b6dd41 SQL/MySQL: Fix compilation with MySQL 8.3
With MySQL 8.3 mysql_fetch_field() was removed which was used in
QMYSQLDriver::record(). There is no real replacement function so we
use 'SELECT * from table LIMIT 0' to retrieve the schema information.
Additionally mysql_stmt_bind_param() was deprecated and needs to be
replaced by mysql_stmt_bind_named_param().

[ChangeLog][SQL][MySQL] Fixed compilation with MySQL 8.3.

Pick-to: 6.5 6.2 5.15
Fixes: QTBUG-121183
Change-Id: I149836bd5674d0784255baf416d437c424992f20
Reviewed-by: silverqx <silver.zachara@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 41c842d3f7eecdf736d26026427033791586c83a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit b9bcaae2266ec531d38552ea945deff0a6c58e7b)
2024-01-23 00:48:32 +00:00
Topi Reinio
c8c7dabb03 Doc: Update copyright year to 2024
Update copyright year in documentation template and
copy-notice paragraphs.

Pick-to: 6.5 6.2
Change-Id: I0ff70bbd5925078e80e6799ac80cfc8e6e68a2a0
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 091096fed7c69b8c61b313dc1b3b6fe40d42e0b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit aab6df9541f37c1160c1aa86f24796a25f81850e)
2024-01-22 18:53:19 +00:00
Thorbjørn Lindeijer
f7add7ad0f Increase precision for QGraphicsView::AnchorUnderMouse
* Use a more precise view center for views with odd width/height
* Use the QPointF version of mapToScene to avoid rounding
* Round instead of truncate when setting scroll bar values

These changes increase the precision of AnchorUnderMouse, which is
important when for example wheel scrolling is used to change the scale
of the view. Without these changes, the view shifts slightly with each
change in the transform.

[ChangeLog][QtWidgets][QGraphicsView] Increase precision for QGraphicsView::AnchorUnderMouse and QGraphicsView::centerOn

Task-number: QTBUG-96879
Change-Id: I8199196c671e4aa96732f382e8057468f676b8d7
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit d99b0cfed21e05f6e84b97fe8edb68271a34deb2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 4f1752a6b9072083ee8408c4cc7f3e821c9661a6)
2024-01-22 18:53:18 +00:00
Alexandru Croitor
3411f2984a CMake: Fix Threads global promotion issue when using static openssl
and an older CMake 3.22, which is shipped by default on Ubuntu 22.04.

If for some reason there's a static openssl library lying around in
the default sysroot (or any ssl search path), like in
 /usr/lib/libssl.a,
then CMake's _OpenSSL_test_and_find_dependencies
will try to find_package(Threads) because it assumes it has a
dependency on the Threads package.

Because we do qt_find_package(WrapOpenSSLHeaders) in
qtbase/configure.cmake
and we do qt_find_package(Threads) in
src/corelib/CMakeLists.txt,
we would create the Threads target in the root directory scope, and
then try to promote it to global in the corelib subdirectory,
which fails with

CMake Error at qtbase/cmake/QtPublicTargetHelpers.cmake:260
  (set_property):
  Attempt to promote imported target "Threads::Threads" to global scope
  (by setting IMPORTED_GLOBAL) which is not built in this directory.
Call Stack (most recent call first):
  qtbase/cmake/QtFindPackageHelpers.cmake:211
  (__qt_internal_promote_target_to_global)
  qtbase/src/corelib/CMakeLists.txt:4 (qt_find_package)

Newer versions of CMake's FindOpenSSL actually try to determine if
the Threads package is really needed.

To avoid the issue entirely, just look up Threads before we look up
the OpenSSL package.

Pick-to: 6.5
Change-Id: Ia3cde93e26ba004f64105a5b457098e1b9870885
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 85c462855be95afd2afebd345cb4655c00f9824e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 9348368772fb983d44b18864ce2e37af966cc977)
2024-01-22 18:53:16 +00:00
Axel Spoerl
7e789b2998 QFontEngine: Silence bogus gcc warnings
gcc warns about using uninitialized variables in
QFontEngine::getTrueTypeGlyphIndex. The warning is bogus, because all
variables subject to the warning are initialized by passing their
pointer to qSafeFromBigEndian().

Initialize them anyway to silence the warnings.

Pick-to: 6.5
Change-Id: I25e062f25e2b06701af5edca27a9e56b939daa79
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit e957ed97e0a7f6974db7d9f7ea52d94785464880)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 9e8761e8e9755eb9dd7461682d47a6c64b39d5c0)
2024-01-22 14:57:41 +00:00
Ed Cooke
a9d5e1efa5 QPushButton with a menu remains in sunken state after menu closed
Regression fix, introduced in:
7199498fb9cbfb5afc043ddb0e630c8ffad5240b

QPushButton with a menu will have a sunken state, QStyle::State_Sunken,
when the menu has been closed. Expected behavior is that the sunken
style is to be removed when the menu is closed.

A boolean called "menuOpen" is never set to false after being set to
true in the popupPressed() method. When this boolean is true, a sunken
state is painted.

Fixes: QTBUG-120976
Change-Id: I3e721da5dfbb6db200aa2de7366ac5dc73c873e0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 343551ffae66048599e5360085d1b77f64b9336e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit cb6cdad0789c641811542354bf1a4b1093cd5742)
2024-01-22 14:57:40 +00:00
Thiago Macieira
d01654ffb0 QProcess/Doc: clarify that started() may be emitted very early
On Windows, process creation is synchronous so we will always emit
either started() or errorOccurred() before QProcess::start() returns.
This condition doesn't currently happen on Unix systems, but we could do
that because we're now using vfork() on most platforms, so the child
process has either successfully execve()d or _exit()ed before
QProcessPrivate::startProcess continued.

Drive-by reorganization of the code to remove the one-line \note in the
middle of the docs.

Pick-to: 6.5
Fixes: QTBUG-120968
Task-number: QTCREATORBUG-30066
Change-Id: I4d0668e0fae5299551ff91480828a68e62fdacec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit 8e1f9169cac78b0df4dab17ed05765fdab842d07)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 078c68462ed443e4bd09581ed9bf9b4e720840ac)
2024-01-22 10:44:32 +00:00
Christian Ehrlicher
e2f3608443 QTextImageHandler: Use QUrl::toLocalFile to convert to local file name
Simply stripping away the first six characters does not work on Windows.

Amends 2d87c4d881b74619fef966ffb0d7a00cb4ccea50

Pick-to: 6.5 6.2
Fixes: QTBUG-120577
Change-Id: If48ba026785cab784f46109e34ac80e39a990b79
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 52a41bac775bea9057acbc4344a29bb7e63297e3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 66b732244a3e396dfc5028da82321f10ac73e45b)
2024-01-22 10:44:32 +00:00
Axel Spoerl
145e5d5787 tst_QMessageBox::staticSourceCompat(): improve diagnostic output
The test function casts QMessageBox::StandardButton variables to
integers, to pass them as arguments and verify expected buttons.
In case of a test failure, this makes it hard to figure out, why a test
was failing.

Add a local macro to cast int values back to the enum before calling
qCompare(). That way the enum keys will be displayed in the logs.

Task-number: QTBUG-118489
Pick-to: 6.5
Change-Id: I23e766d5026cff3e4775db56e58f808809709e4c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit fd710fbba3d24f6192625f586eea57309630f8ac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 16ab2eba720b1428e34c76381a0f09b6b70bf9e3)
2024-01-22 10:44:32 +00:00
Thiago Macieira
8da0980aef QMimeBinaryProvider: move CacheFile up in the file
Amends 329722a322a80d5ea8d6f9aa993c2fc4995b08a4 ("QMimeBinaryProvider:
manage m_cacheFile with a std::unique_ptr"), which added the
std::unique_ptr<CacheFile>.

This is required because in C++23 std::unique_ptr's destructor became
constexpr and is therefore instantiated more eagerly. The type must be
fully defined (not forward-declared) when the std::unique_ptr member is
initialised in the QMimeBinaryProvider constructors.

Fixes: QTBUG-121204
Change-Id: I76ffba14ece04f24b43efffd17ab9a861aff89b8
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit c8db469fd584cfd2bee34b572601b19bfb2cd921)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 7d12cf673a221cec92f080e3364cc939ab3dd34a)
2024-01-22 10:44:32 +00:00
Fabian Kosmale
6494137c6a QMetaObjectBuilder: Avoid arithmetic on null pointer
In Prepare mode, "buf" is a null pointer. We never dereference it, but we
still compute an offset from it to obtain a pointer to a (then unused)
QMetaObjectPrivater.
clang's UBSan complains about this, so initialize the pointer to nullptr
instead when in Prepare mode.

Pick-to: 6.5
Change-Id: Id9d78058f72bb1b44440d07f565374f3eb3c20fd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d3d224f546d933acef53f7592fea7d69072f7d55)
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-01-22 08:19:59 +00:00
Alexey Edelev
55e80eae91 Force CMake to look for static versions of xcb components
Add the USE_XCB_<component>_STATIC switches that force using the
static versions of xcb components if necessary.

The xcb components needs to be built with -fPIC option, to make the
static linking possible.

When Qt is built staticaly USE_XCB_<component>_STATIC needs to be
passed to the application command line, since in static case xcb
libraries are resolved and linked when configuring application, but
not when building Qt.

Pick-to: 6.5
Task-number: QTBUG-120769
Change-Id: I274e9cf4a6a111dc87ad84bb7f49cad76a3d364a
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 6ce6ff1c529a7a4a09f211980cc749c2b3aa0dab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit f9d97ee04aed519e78e0b9114866512f83c5a203)
2024-01-20 01:21:27 +00:00
Paul Heimann
abcf6dc36c iOS: Avoid category method name clash for UIResponder
As described in Apples documentation, own methods which are added to
existing classes should be prefixed to avoid category method name
clashes. This prefix was missing from the function
currentFirstResponder() which caused issues when closing the virtual
keyboard on some iOS devices.
(see https://developer.apple.com/library/archive/qa/qa1908/_index.html)

Pick-to: 6.5
Task-number: QTBUG-119601
Change-Id: I82fb8a8beeb0a3234594357f1e1db67b0ae3da36
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e51b2d70de65f2ac674afb9c7da2a10c7067f142)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 93ddf89037f290c70f986a794b1a34c0dc61d4c7)
2024-01-20 01:21:26 +00:00
Marc Mutz
5c94245249 QCalendarBackend: disable copying
Silences clazy-copyable-polymorphic.

The Q_DISABLE_COPY_MOVE() disables the implicit default constructor,
so bring it back with =default.

Amends aa8393c94fea01a4806b204fd3aa343a4e90666b.

Pick-to: 6.5
Change-Id: I44f0b19208d3865fb84e277bcaf65d7f4541d368
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit b211d8a8c0196a96b2aa324c9e3d991ae378c7f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 004ccc54d9d26a5215402a82e417ae7f36a07897)
2024-01-20 01:21:24 +00:00
Edward Welbourne
030fd4b2fa Make QLocale self-consistent on Windows
The constructor and update() method for the system locale were using
GetUserDefaultLCID(), where query() and the fallback locale first
checked the LANG environment variable, leading to inconsistent results
if the user set the environment variable to something different from
the system's configured locale.

Break out the logic of parsing %LANG% into a static helper, replace
the existing parsing with a call to this and add a helper to get the
right ID to use, possibly via it, using GetUserDefaultLCID() as
fall-back. Drive-by: initialize substititionType in its declaration.
Also look up %LANG% each time we want it; it's not that expensive,
given how rarely this code is called, and client code could change its
value at runtime. Partially inspired by a patch from Wladimir
Leuschner <wladimir.leuschner@qt.io>

Pick-to: 6.5
Fixes: QTBUG-120961
Change-Id: Ie706c7089bd2b3757a3eab627723ec34a5e2b07f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fcd2a219c4c222309152f1ea2a3124ddc17d4ea5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit cbc3c63633ad2c19ca4aa8fad302a0d1c30e7d7e)
2024-01-19 19:18:13 +00:00
Edward Welbourne
ed6fe4d06a Prepare to support taking CLDR data from its github upstream
We've previously used the zip-file form, but that's not been published
for CLDR v44.1 - the advice on the list was to use github
instead. That, however, has ↑↑↑ as a special value for fields, meaning
to inherit from a prent locale. So special-case that value. I have
verified that v44 from the zip file produces identical results to v44
from github, with this minor fix. As it happens v44.1 also produces
identical results.

Pick-to: 6.5
Change-Id: I6eb0aedda7556753cdc83bb9d76652fbb68dc669
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit bcdd51cfae24731a73d008add23d3c1e85bbd8d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit c112981789f5885e5db0daa4a081fa26708bafb0)
2024-01-19 19:18:11 +00:00
Marc Mutz
652ee1562f QMetaTypeModuleHelper: mark instances constexpr
Static and thread-local objects should be constexpr or constinit if possible.

Task-number: QTBUG-100485
Pick-to: 6.5
Change-Id: I29088798a50d6278252c9088e7c191c4214b2e5b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 88c3cd6e08c86bfb5bb676ceed4c92344f8ed91c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 7b5df411db438cf6f0e26212e33f1f804e6da9f8)
2024-01-19 14:32:24 +00:00
Aleix Pol Gonzalez
72bebc66e5 ibus: avoid a crash when context is not ready
This amends 84cf0e2be54d9ad183db063fd429b792c67edd18

Pick-to: 6.5
Change-Id: Ia560f785764d4ba0e4aa66943effb9f16a38e699
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Inho Lee <inho.lee@qt.io>
(cherry picked from commit 0d923c2097578682b8553707834ccf52d7cd52e2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 4f9c75901e1f02eda8fc8b3349b895779da9246e)
2024-01-19 09:55:39 +00:00
Thiago Macieira
e2598f175f QUuid: Fix Id128Bytes alignment on some architectures
This partially reverts eb0abd9789062d95bc62dbbc29b2038dc40472b1 so we
depend on __SIZEOF_INT128__ in this structure, not on QT_SUPPORTS_INT128
so the Id128Bytes union has a quad-word integer as a member at all
times, even in QtBluetooth's removed_api.cpp.

That's required because on some ABIs, the presence of this member causes
the type to be passed differently, usually in registers (we fixed the
stack problem with the alignas(16) in that commit).

The "Itanium Software Conventions and Runtime Architecture Guide" did
the same back in 2001; section 8.5.1 says integers from 65 to 128 bits
are passed "Next Even" and so are aggregates with alignment of 16 bytes.

This rule seems to also exist in the AArch64's AAPCS64[1], which says,
in rule C.10, that the type should be passed in even registers:
 C.10 If the argument has an alignment of 16 then the NGRN is rounded up
      to the next even number.
(NGRN = Next General Register Number)

It's unclear whether this applies to the union type as a whole or to its
individual members. If the latter, then Clang may be buggy.

[ChangeLog][Important Binary-Incompatibity Fixes] The QUuid::Id128Bytes
type had a loose definition that could cause it be passed incompatibly
between functions, in some architectures, depending on whether GNU
extensions were allowed. This is now fixed, but may cause code compiled
with Qt 6.6.0 and 6.6.1 to fail when recompiled with 6.6.2 or later.

[1] https://github.com/ARM-software/abi-aa/blob/main/aapcs64/aapcs64.rst#682parameter-passing-rules

Fixes: QTBUG-119248
Change-Id: I6e2677aad2ab45759db2fffd17a86a208f788cb7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 6f9db71154662a648f19a86ca86585eddbe2f9ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 8902ed8f896e2a5a54441af8a790a794c452742d)
2024-01-19 09:55:37 +00:00
Lorn Potter
f95458cb95 wasm: move keyboard input handling for touchscreens
It's better served where all keys are handled,
and fixes bug with modifier keys

Fixes: QTBUG-118503
Change-Id: Ic53d1b332bd918dbc4fdd27ea4e43ad1e1ecce82
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 75ac9adeda41194e1733c69b3176fc2a368a369e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 020a7e96d448caab86198f09d84b50be205da906)
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2024-01-19 10:41:41 +10:00
Axel Spoerl
7db3277cd7 Revert "API Review / QDockWidget: Remove const/ref debug operator"
This reverts commit ca2f46c04c26ed4649cb6c2c62d3b2e52cd8d5ad.

Reason for revert: <BIC in 6.6 found by Marc Mutz>

Change-Id: Ia5b8849e55ebccb514bc753ce1d31855d91e2406
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit b148a362c36a9b34b0c21c60530353d6bf6b92cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit be4f933c0ae30389869d74277982bd14a99fe11a)
2024-01-19 00:33:41 +00:00
Marc Mutz
be64808342 QMetaTypeModuleHelper: suppress cppcoreguidelines-virtual-class-destructor
Says clang-tidy:

   destructor of '(unnamed struct at qmetatype.cpp:966:14)' is public and non-virtual
   in file:src/corelib/kernel/qmetatype.cpp line:966 col:14

       static const struct : QMetaTypeModuleHelper

Yes, these classes are polymorphic (because the base class is). Yes,
the destructor is non-virtual (because the base class' one isn't, but
it's also protected, so fine).

But these classes are not used as base classes, so suppress the
warning.

Pick-to: 6.5 6.2
Change-Id: I75be86bca36a4a0e93d72acb1a0d2fe0dca1c505
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 11d153ae1ce3ce75e76a1fcac7bf99e4cff05716)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 256ac3994395e308337b5c6ef03a8191ae3690fc)
2024-01-18 21:12:39 +00:00
Mårten Nordheim
db447658b4 Http: Start more connections faster after determining network layer
Previously we would more or less wait for the first connection to finish before
initiating more connections. This was just happening by virtue of
calling startNextRequest when a request was finished.

Since we have already determined the preferred network layer, let's just
try to start more connections. In case we are using https this doesn't
make a difference because we will try http2 upgrade first before allowing
multiple connections. Unless, of course, http2 has been disabled.

Fixes: QTBUG-120619
Pick-to: 6.5
Change-Id: Id3c3be59fd07120bff574d63481119e5ed9eb88a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 88f5fc47ebf558fa72b7b447f8394a0d44b6bf9d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 0002ba47e63151e37c15b61f0c0b809aefb378e1)
2024-01-18 21:12:37 +00:00
Christian Ehrlicher
57e98a4136 SQLite: Update SQLite to v3.45.0
[ChangeLog][Third-Party Code] Updated SQLite to v3.45.0

Pick-to: 6.5 6.2 5.15
Change-Id: Ibf37acf5bcee4639766d445991f5265dc78593c4
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 24a95c22fc9f09ca4415946e965615d022704ca3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 6224c3b0dc1bd08e1c5fc0a184b2d22627c480dd)
2024-01-18 21:12:36 +00:00
Tor Arne Vestbø
0251fe61b2 Sync QWindow visible state during QWidget destruction
A call to QWidget::destroy() will end up in QWindow::destroy(), which
calls QWindow::setVisible(false).

A call to QWindow::setVisible(false) on a widget's window will under
normal circumstances end up in QWidgetPrivate::setVisible(), which in
turn recurses back into QWindowPrivate::setVisible(), via
QWidgetPrivate::hide_helper(), ensuring that the QWindow internal
state is updated, visibleChanged emitted, and show/hide events sent.

Durin QWidget::destroy() we end up in QWindow::destroy(), which calls
QWindow::setVisible(false), but in this case the widget no longer has
Qt::WA_WState_Created, so the hide_helper() call is skipped, and the
corresponding QWindow is not kept in the loop.

To work around this we could have checked for windowHandle() instead
of Qt::WA_WState_Created before calling hide_helper(), but that had
many other side effects, so we opt for a more targeted fix.

Pick-to: 6.5
Change-Id: I68f80e5f7df9ee811afcd274a7ee4de31a110da5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 5b09d9e6d694045a6cef15f8984bab63cf86402c)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 3bc3cf3ba95819c85fc94cb4bcd65ef6d6748efa)
2024-01-18 10:46:05 +00:00
Alexey Edelev
8c11609f44 Allow configuring the qtbase documentation-only build
Use the QT_SUPERBUILD procedure when configuring the qtbase
documentation-only build. This only makes sense for qtbase since we
disallow building it using existing Qt installation. Other repositories
should be configured using qt-configure-module script from the existing
Qt installation and simply run 'ninja docs'.

Fixes: QTBUG-120485
Pick-to: 6.5
Change-Id: Iafed5c17bea5c61edc239f08045922497215fb73
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 02a556674f0b3f04de5ab09dca53ed8e86a8ba06)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 4b662e9a921bd409c6e03bf7f13eabd3c54a87b2)
2024-01-17 22:48:48 +00:00
Liang Qi
46b2b5d2da tests: skip tst_QGuiApplication::topLevelAt() on Wayland
This amends 189f9873ae3f23377708fbf9880398fd6a078715 .

Pick-to: 6.5
Fixes: QTBUG-121015
Change-Id: I66d2a2b0162b9c7b488af840ff5d3a881b657782
Reviewed-by: David Edmundson <davidedmundson@kde.org>
(cherry picked from commit d4f7d2aeabe2e778224d64a65667aa09b9e42a70)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 2bcfe080d92654a1deb03380ffa20e73aae58cae)
2024-01-17 22:48:47 +00:00
Mike Chen
79e5cc7e13 Make sure hicolor is searched before dash fallbacks
Search full icon name from hicolor before dash fallback

Fixes: QTBUG-121030
Change-Id: I3e3ee142c33466203639f32857fce3ea1946a9f7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 0534a93ef04f38cf6dfc0d6c03827325d651a64c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 7b38b5e369f45132cc83732cc5852538ad6075e8)
2024-01-17 22:48:45 +00:00
Ghenady Kuznetsov
6bdff3c8a0 Fusion style: add clip region for groupbox title
Fusion style is missing clip region for the title in
QFusionStyle::drawComplexControl().
Without that region, the top line of the frame will be visible behind
the vertically centered title.

Fixes: QTBUG-121041
Change-Id: I3daf5854195e28a5ee3cb50343e2dd56e66ed940
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 9b4c35abff94a708139923a32c38a749cbdfd130)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 6affa9890d0acd51b0b4d63e4ac33323e392ee48)
2024-01-17 16:56:50 +00:00
Christian Ehrlicher
478deceb08 QImageReader test: add test image to qrc file
Add the test image to the qrc to make sure the image is available no
matter where the test is executed.

Fixes: QTBUG-120732
Change-Id: I24de59fd88fdc2a3317c91ac28cf81fd5511455f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 076026fd60dfa399158498e42ee1b5000174c65e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit b08c3af998b6ff72e68cdb1a1a02efc1882aa7ed)
2024-01-17 06:25:43 +00:00
Doris Verria
6e7dd65e07 QMetalRhi: Reset proxyData when swapChain is destroyed
When the swap chain is destroyed, we reset the swapchain’s layer
(set it to nullptr). However we were not resetting the proxyData which
would still point to the window’s (NSView) layer. This starts to become
a problem in  the cases where the swapchain’s associated QWindow is
closed (NSView gets destroyed) and reopened (a new NSView will be
created) because when the swap chain is recreated again, since the
proxyData already exists and points to the invalid old layer,
QRhi::updateSwapChainProxyData is never called. This led to an invalid
value being assigned to the swap chain’s layer.
To fix the issue, make sure to reset the swapchain’s proxy data when
destroy() is called.

Task-number: QTBUG-113498
Pick-to: 6.5
Change-Id: I02996ecf69ad9d183cac31c9188717ec36742531
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 948b93a847e1d6b78b5eee039281b3cd078fbabe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit b2eb82a42f3525db0f038b248312ba19e385371e)
2024-01-17 02:51:21 +00:00
Tor Arne Vestbø
3f19f80ab4 Remove note about QDockWidget::DockWidgetClosable not working on macOS
It does nowadays.

Pick-to: 6.5
Change-Id: Ie14a84460abfebd42c93e5ae41969d9e3b4c4f5d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit a99d31307600d6ca52890022605c7f1b10ccb7bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 4a1ba399ea19b069e1e3b31a98656bc8acd639e0)
2024-01-17 02:51:20 +00:00
Joerg Bornemann
c1ef2ae813 CMake: Fix user_facing_tool_links.txt for Apple platforms
User-facing apps that are app bundles on macOS weren't linked correctly.
For example, for Qt Designer we're creating now an entry like the
following:
    .../Designer.app/Contents/MacOS/Designer /usr/bin/designer6

Fixes: QTBUG-120487
Change-Id: I3eada15c4c5bf31b9b08829333d3c87f76ede7a2
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 2921a70e5d8de5bf3f4b56b90347983aa9b1342b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 06e9da856cae36eca2ab8c86390bba6fe620c37e)
2024-01-16 21:17:56 +00:00
Inho Lee
af64fd6d6b IBus: Support a property ClientCommitPreedit
IBus added the ClientCommitPreedit property to handle
preedit in case.
If this writable property is set,
ibus_engine tells the client whether current preeditText
should be committed or not in the client side when
focusOutEvent.
(Qt's old behavior is always committing in the client side.)

Fixes: QTBUG-109576
Fixes: QTBUG-58005
Pick-to: 6.5
Change-Id: I6bb78921ce04cdd3197cba9e2fb00376d5e0ac8b
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 84cf0e2be54d9ad183db063fd429b792c67edd18)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit c4dfea83b675625ee2e9a911d2e63835e26193ec)
2024-01-16 21:17:54 +00:00
Timothée Keller
418a5d1d4e Windows QPA: don't take dpi rounding policy into account when fullscreen
With some HighDpiScaleFactorRoundingPolicy, going fullscreen can end up
not filling the whole screen. In this case, ignore the rounding (only for
the window size, not its content).

Fixes: QTBUG-115954
Change-Id: Ie87196358ef28dbe2fcbc180b1740ed9f784b4a0
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit da473f3a80798d84d0f1bd9175158024a548ec68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 073340a6d8b947dd1974797868cb486d7bfc5a7f)
2024-01-16 20:55:35 +00:00
Tor Arne Vestbø
05aebea42f cmake: Explicitly generate Xcode schemes for executables and libs
Otherwise, Xcode will auto-generate schemes for all targets, including
internal targets such as foo_autogen and build-only targets such as
ZERO_CHECK and ALL_BUILD, choosing one of them at random when opening
the project for the first time.

If multiple targets get a scheme they will be sorted alphabetically.
We could prioritize them by generating a xcschememanagement.plist
file, but that would require teaching CMake about that feature.

This aligns the CMake behavior with qmake, where we also generate
schemes explicitly.

Pick-to: 6.5
Change-Id: I3756fced37a4ff7792370da10fc49169cc271ae8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 822dc75f1a0be988b25741a8f16ddc2fbeb48e77)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 87aa94008ba0f61f515827f302b718dc2ef3a6f6)
2024-01-16 20:55:35 +00:00
Timothée Keller
0fe4be1596 Windeployqt: also allow platform-type plugin selection
Including/excluding plugins of the platforms type did not work, since
windeployqt was only ever looking for 'qwindows'. Keep the default
behavior of deploying 'qwindows.dll', but also allow users to
add/remove platform-type plugins.

Change-Id: I4062a71939224d1462896d95a2541e8caced399d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit bca41b1832bf1ce76787109456094149520bc403)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 15cf52cd592a4758ee334148546aba485d703142)
2024-01-16 20:55:35 +00:00
Joerg Bornemann
eca2d7d258 Remove temporary exclusion from unity build
Commit db9fa4a61791794823e570f8aa7f6e5eed8c5f52 excluded
qelapsedtimer_mac.cpp from the unity build. The necessary patches have
been merged, and we can remove this exclusion from 6.6 on.

Change-Id: I85b353b202af1fd8eeea43753e5dc5ce18357d19
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 75f5eec2c904b5a3a274d9f1c70e14e687e6fa29)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 95770f1bd3c86afbfee638f2957bcd3e994d7ebb)
2024-01-16 20:55:35 +00:00
Kai Köhne
866733484e Remove foreach snippets from the documentation
We don't recommend foreach anymore, and have in fact
adapted two snippets already to use for(), but missed
the documentation text.

In any case, it feels a bit weird to give an example
how to iterate over QStringList in each of these methods,
so we might as well just remove this part.

Change-Id: If8744e48961661ad518f5f24781c38f371d981bc
Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 3b9f6b54b1cda08079ae97956478a4af55133803)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit fef7baaf119f64f63cca542c72a7a80f91917dd7)
2024-01-16 20:55:35 +00:00
Thiago Macieira
95017918c3 QStringBuilder: use data_ptr().data() instead of constData()
As the comment says, this allows us to skip the check for non-detached
strings and for null ones. We know that the one we've just created isn't
either, so long as len != 0. All QConcatenable::appendTo() calls do
nothing if len == 0, including not calling memcpy() at all.

Moreover, because it no longer references the QByteArray::_empty
variable, the GCC -Warray-bounds warning should be gone too.

Task-number: QTBUG-116763
Pick-to: 6.5
Change-Id: Ica7a43f6147b49c187ccfffd179eba2897ce2aff
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 06c724881c4227acf308e54ebd3db8235bb6b740)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 35ffe8749e7af31b70e3e7b993dceab75aa95633)
2024-01-16 10:01:36 -08:00
Ahmad Samir
502da47bc0 QMetaObject: change static objectClassName() to return a QBAV
QBAV has an operator==(), among other things.

Internally QMetaObject only supports Latin-1, however that is an
implementation detail that shouldn't be exposed in public API. Since
some public methods will be changed to take a view, a QBAV, use QBAV
internally too to keep the code consistent.

Also change QMetaObject_findMetaObject() to take a view, this is more
robust as it can work with other string data that isn't necessarlify
null-terminated (e.g. a sliced() view, which will happen in later
commits).

Change-Id: I346d7910ad8fa30951a7168e9b257f039f016298
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 56b8048ab98aae3780962fb84709b968a81f62ab)
2024-01-16 18:01:36 +00:00
Axel Spoerl
42cea86d0e Revert "QDockWidget: Always show dock widgets with the main window"
This reverts commit 4c60a11d8f935abb762a83b0ab99cefa6db3060c.

Reason for revert: Breaks QMainWindow::restoreState(). Dock widget is shown, even if restored into hidden state.

Change-Id: I9808de4e0fd48871c3b234ae9bbaf6c64c8e832d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0ea37300d111beea3bb353f036d6c747f63c88dd)
2024-01-16 14:58:41 +00:00
Alexey Edelev
e852376466 Document qt_import_plugins behavior for dynamic plugins
This describes how qt_import_plugins works for dynamic plugins.

Pick-to: 6.5
Task-number: QTBUG-118829
Change-Id: I7b30060c11c0d8c4a1fbae6782a047737ba7d454
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 2e328ca5a8242b0c3edec8e59d1cfa02d4596202)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 7700d8cb6117f51faede95134e6270017f282ecb)
2024-01-16 14:55:32 +00:00
Christian Ehrlicher
96bc1ae559 Doc: Remove wrong comment in QStyle::pixelMetric() doc
Pick-to: 6.5 6.2
Change-Id: Iebb5794a166899c986e1c408a254184b22bc276e
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit d0d5794a3decca8501d26387bc8281c61f0bd4ba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 7adfb315e51517b46504d1328d8c1a8fc70e6df4)
2024-01-16 14:55:30 +00:00
Eirik Aavitsland
3028e67fbe Fix the pdf testing in the painting baseline test
The pdf testing relies on the sips tool in macOS to render generated
pdfs into pngs. In recent macOS updates, that tool has changed
behavior, and no longer produces the desired output. Fix this by using
a custom pdf page size, instead of relying on cropping behavior in
sips.

Pick-to: 6.5
Change-Id: I9b2e947424774bb4456a6aefe04288b84401a9b7
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit ec324fd4afd1bf843ea601447f40c1e375efe659)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit ca705abe06fcaa293fa41da09218bb678e6bddea)
2024-01-16 02:09:16 +00:00
Timothée Keller
f33405782b Windeployqt: add output for determining plugin/module relation
Windeployqt has a pull all in approach to plugins. This can require some
modules to be deployed despite being unrelated to the application's
dependencies. An output is added to provide information to better reflect
what windeployqt is doing in this regard.

Task-number: QTBUG-117910
Pick-to: 6.5
Change-Id: Iabf89e0faca862a90c0fcd46e5675dd43655be1d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 40cff9e93c36edcab49c08fa65760c22dc935992)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 2dc02a2aeb546a57965e420a2a7ea6e6354fc651)
2024-01-16 02:09:14 +00:00
Christian Ehrlicher
8a0c94a117 Widgets: pass widget to QStyle::pixelMetric()
Make sure to pass the widget to QStyle::pixelMetric() as some styles
might use this (e.g. the new windows styles) to determine the correct
pixel metric.

Pick-to: 6.5 6.2
Task-number: QTBUG-1857
Change-Id: I5c32f5af8b284749732b610e56b4e3d8c8ed1946
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 43ce457cbd093fc06d99b5ac833c789ef7c893d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit a7f052319bb6b718172c00afe1e98862db835d9a)
2024-01-16 02:09:11 +00:00
Lorn Potter
f7426395af wasm: provide isValid implementation for QWasmOffscreenSurface
Fixes: QTBUG-120350
Change-Id: I0cb2ba66a2d27f3d96a4a6a1cb85695f6b305178
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 139d57a7e906b84672024661a58628918ceff928)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 417cf07c5dfdb07ddb547dfe3e7529fee700cc79)
2024-01-16 00:51:06 +00:00
Thiago Macieira
2795ab16f7 tst_QStringView: don't go through the QString constructor
Amends d351a97e85e5ed8acd7ad1357ef76dc2e0ad639f.

Pick-to: 6.5 6.2
Change-Id: I5201966b308e48989c06fffd17a9aa4d086e6039
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 80df23bc7b966c0c0f984ff20d5d0dc1e0b2e025)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 1bb0cc0923196ab311369022eb95d0b4efd74ef6)
2024-01-15 14:23:18 -08:00
Thiago Macieira
59a273d152 QString::arg: don't pass nullptr to memcpy()
A null QString / QStringView has a null begin pointer stored as its
array beginning (something we hide a little in the QString::data()
function, but not in QStringView::data()). We've been passing a null
pointer to memcpy() every time someone passed a null QStringView for
QString's single-argument arg() call, though not the multi-string arg()
version (which is the only one QStringView offers).

Commit f5021835dfb4b0bf974794b598cbdf9f0f95898d made this worse by
making QStringViews created from null QStrings retain the nullness (as
was intended).

Fixes: QTBUG-120624
Pick-to: 6.5 6.2
Change-Id: I6e2677aad2ab45759db2fffd17a870639b19340b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit d351a97e85e5ed8acd7ad1357ef76dc2e0ad639f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 923918c66b98457a854b8b1c1c1f3850ec4b9880)
2024-01-15 22:23:16 +00:00
Thiago Macieira
f0e4f50fd1 QProcess/Unix: detect ASan and TSan dynamically
Fixes: QTBUG-117533
Fixes: QTBUG-117954
Task-number: QTBUG-104493
Change-Id: I09c3950e719e4b259bc7fffd1793ee472c5d5a9a
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 7c4e271fe73f4775d308d5851c07bc21cdd08570)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 9962441bfd0cbb347cb24a685f14a932c0849bd9)
2024-01-15 14:23:02 -08:00
Ahmad Samir
1dc98ca985 QFileInfoGatherer: add some API docs
Task-number: QTBUG-99750
Change-Id: I908e1135b895dbf6116b1dce7416b14905b886b2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0cda986eb6cdf681cb64811b416c413645cb0f3d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit af9b70c5edc2a46bba18ef3753022adb5810292a)
2024-01-15 18:09:48 +00:00
Tor Arne Vestbø
d909a8ed67 Document how to process deferred deletes in a plugin-scenario
When Qt is not driving the event dispatching, the event loop level
of the thread will stay 0. As a result, we will not automatically
bump the deferred delete event's scope level to 1 when the deferred
delete happens from a code path that doesn't raise the scope level
via QScopedScopeLevelCounter, leaving the event with loop and scope
level 0.

As we only process these 0+0 deferred delete events automatically from
QCoreApplicationPrivate::execCleanup(), which is not going to be called
when the app doesn't call QCoreAppliction::exec(), we were failing to
process the deferred deletes both during the application's runtime,
as well as on shutdown.

Task-number: QTBUG-120124
Fixes: QTBUG-117975
Pick-to: 6.5
Change-Id: I2b8accb432517a48370923ee2d760f8e2e4a8055
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 7fac2fac9a512cef2d5cdefd9837d76f8be7de05)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-01-15 16:53:21 +01:00
Laszlo Agocs
4601674da6 rhi: gl: Pretend 4x MSAA is always supported when cannot query
With ES 3.0 and up the GL_MAX_SAMPLES query is available and is
guaranteed to be at least 4.

With ES 2.0 there is no such query.

While what we report from supportedSampleCounts() has little
significance with OpenGL (for the window's color buffer it is
anyway the QSurfaceFormat that decides, not QRhi), QRhi users
such as Qt Quick may rely on supportedSampleCounts() returning
real values and may, for example, warn if the value attempted
to use is not in the supported list. (even if MSAA is fully
functional)

Avoid getting such warnings on a pure ES 2.0 implementation
with 4x at least.

Pick-to: 6.5
Fixes: QTBUG-120474
Change-Id: I8a34a8bc9ce37ce951fdf7794247e8db44435d41
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 520d755d324a32c97cb9e25b617e99d0ab93d666)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 149da3331b3339dfda66437a1b62c98a43987ef7)
2024-01-15 14:00:19 +00:00
Tor Arne Vestbø
cab9a6166b macOS: Show extensions in file dialog when filtering on multi-part extension
File extensions with multiple parts, such as as ".tar.gz" are not natively
supported on macOS. Asking NSSavePanel to only allow file types with such
extensions confuses it severely, so we work around it by reducing the
native file name filter to the last component of the extension.

In this situation, we explicitly tell the NSSavePanel to show the full
filename, including the extension, so that the user can more easily
see what the final file name will be.

However, as part of 7f8a80ebf87cccb57da316202e5350eb5eca9d5d we ended
up changing the logic to count the number of possible extensions for
a given file type filter, not the number of parts in the extension.

The logic has now been restored, but moved to init, so that it applies
even if the initial filter is not a multi-part extension.

Task-number: QTBUG-109877
Pick-to: 6.5 6.2
Change-Id: I244cea1cc2977f8adf7e359ea7116bbfad0e1059
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit fd817c28a03f8b6743ea678c9edf3f8f047db627)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit b814f73fb6d837e7743620521d9d91dd624ccb3f)
2024-01-15 14:00:17 +00:00
Florian de Gaulejac
4f57f76a96 syncqt: always use absolute path in the generated headers
The relative path + source path can be tool long for windows

Fixes: QTBUG-120758
Pick-to: 6.5
Change-Id: I42ed4f3bbf39d31bf37a5bc76eb18f473661346b
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit b4246a5c28472de3c4b6a85a3daf4a1d578894ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 8e424eba741f882d3fc79c97910217b5bcfd2a3b)
2024-01-14 21:19:26 +00:00
Giuseppe D'Angelo
1759fee357 QImageIOHandler: doc tidies
Remove a "." after the enumerator names that would end up in the docs.

This work has been kindly sponsored by the QGIS project
(https://qgis.org/).

Change-Id: I6db1e83331552a58f77479166a67b88bb25f2d6e
Pick-to: 6.5 6.2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit e366a47d65c782055a9e361ad7e18bda6cd33780)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 2c10bc7e12ac170c6ae87f592682538bd12213c8)
2024-01-14 21:19:26 +00:00
Axel Spoerl
9720c6c00e Stabilize tst_QMessageBox::hideNativeByDestruction()
The test was flaky, because of qWaitForWindowActive() after show().
It is not guaranteed, that a window has focus after show().
Use qWaitForWindowExposed() instead.

Task-number: QTBUG-118489
Pick-to: 6.5
Change-Id: I1eb8a73f2beafec00c4a6f6b34bfd36a8d6e4d93
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 599328845c7e77bc7b4fd5b4f2de000bb463a814)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 49bfdf7e67e16281a5bf33b2c7aa1fac9525777b)
2024-01-14 21:19:26 +00:00
Ahmad Samir
8db678128e QObject: clarify docs wrt. member access following Q_OBJECT and co
The macros expand to declarations that end in a private: section, which
means everything following them is private. As Fabian said in the bug
report, this is obvious when Q_OBJECT/GADGET ...etc are used in a class,
but might be a bit surprising when used in a `struct`.

Fixes: QTBUG-120297
Pick-to: 6.5 6.2 5.15
Change-Id: Iacdfc4eb3bab3554cc1142f682b11b32c3868b8f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit eb2db79064bd6e74d0b3485a650e4025d0a39c96)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 9fb14df81428a23d0fd63f2b532d047bb754c775)
2024-01-14 15:40:40 +00:00
Axel Spoerl
0ecb6b0180 tst_QHostInfo::reverseLookup(): code cleanup
Remove redundant curly braces.
Use constFirst() instead of first() on a temporary list object.

Task-number: QTBUG-120460
Pick-to: 6.5
Change-Id: Id643b20dfa5a541fea56abfdbcf933245a8a3c9d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3c5e37fe0ff761bd4ee4eeea67881ec7b8eadad5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 744313ae79e53d618dbc8dd6f02787d2d1c0d22b)
2024-01-14 12:44:56 +00:00
Andreas Eliasson
ecd3b57257 Doc: Add code example to describe targeting precompiled libs
Fixes: QTBUG-120263
Change-Id: Iba7e3bf68e4fc48764e4a751e14c398355a94173
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Orkun Tokdemir <orkun.tokdemir@qt.io>
(cherry picked from commit d9d48280122609b90db74bc9ac4e8e83f0b8b958)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 38cd31b0334b1b58caaf50d6d1edfe47b970adf6)
2024-01-14 12:44:54 +00:00
Axel Spoerl
467eb86559 QGenericUnixTheme: Rename ColorTheme enum value to ColorScheme
ColorScheme is used in Qt as a name for dark/light desktop mode
properties.
The enum value was named incorrectly.

=> Fix it.

Pick-to: 6.5
Change-Id: I2aa72f81e36c0997127dd6de0e23d4773509ba40
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit c4bd6ac4e5a0782d8771af1485a3b78733180785)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 8e67c782a65bcfad4bef0b8e43fd2b28359f2a01)
2024-01-14 12:44:53 +00:00
Andreas Eliasson
f91a8d006c Doc: Wrap arguments to \inlineimage in curly braces
Wrap the arguments to \inlineimage in curly braces so that the
describing image text doesn't show on the page.

Fixes: QTBUG-120572
Pick-to: 6.5 6.2
Change-Id: I00f4befc64c20fb6de1dd5ddcb6ca2573fa7c355
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 5358d7a5fe394a37435a947484f1efb7ce297fa2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 58d6b0a1af98a46a7b1ad67a7aca05acd10a17f2)
2024-01-14 12:44:51 +00:00
Kai Köhne
25935beeef Doc: Remove dead links to Concentric Circle Example
Amends 33254fb41f29b510d

Change-Id: I81fee9ba277fdc6f3609440ddcf69cf7c3924c70
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit efcfda3d84d0fb7e4b3270a7d96b3b95db8d522c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 4348debfb4f003bc4de2f25648fd48dd85faa74a)
2024-01-14 12:44:50 +00:00
Axel Spoerl
e4f1d7cdf3 API Review / QDockWidget: Remove const/ref debug operator
Remove the debug operator taking a const QDockWidget & argument.

Leaving the override taking a pointer.

This amends bbeff2a3350dd3396400865525d509b784c2d93e.

Change-Id: I0fbca6ea7dbffe6269c70e5e9eb29af9f84c3600
Found-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Task-number: QTBUG-119952
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit ca2f46c04c26ed4649cb6c2c62d3b2e52cd8d5ad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit f83ba9d3cf80512fa11dff12ba932c457952c9cf)
2024-01-14 12:44:48 +00:00
Axel Spoerl
88ba334429 Remove dead code from tst_QMessageBox::staticSourceCompat()
Remove if (0) clause.

Task-number: QTBUG-118489
Pick-to: 6.5
Change-Id: Ie1c72e9c7cacb90d9e4d85763cd2f6967a7572cd
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 09eb99f0116b459a9ce5f720ee1a6d9715f157ad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit b30f21468172f795798cbcccebee2e8a6d479230)
2024-01-14 08:36:45 +00:00
Thiago Macieira
a9e435eb84 QUrlQuery/Doc: fix resulting query with ( and ) delimiters
There's no final ) because there's nothing there to be delimited.

Pick-to: 6.5
Change-Id: I6e2677aad2ab45759db2fffd17a4ce4aa902e140
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 88e41fd03481d490e7fcf9429849c8fa5a5743e5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 0523b04216b9d0660ee903fb5275abfba4d5d155)
2024-01-13 18:18:13 +00:00
Volker Krause
ec35827669 Fix opening temporary content: URIs from application content providers
e5d591a0d09 focused on document or tree URIs you'd get from the file
dialog, but we can also get ones via Intents from application-specific
content providers (e.g. opening an attachment from an email client).
Those need to be handled like a single document here, parsing them
like a tree URI results in a bunch of Java exceptions down the line.

Change-Id: I19cb1075fd6a3ccad927543f8bc5a63566f4877e
Pick-to: 6.5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 9d4a34bbbe7ec39ef594b07aae06fc1029cc6e3d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 33b4c2d4af90d255b59ac79175c145f0e3299915)
2024-01-13 17:53:57 +00:00
Thiago Macieira
634e0cd675 QDataStream: add missing #include <iterator>
For std::distance() and std::next().

Amends 003c29511de5979fba526acd62f2a4c7c356b982.

Pick-to: 6.5 6.2
Task-number: QTBUG-114583
Change-Id: I6e2677aad2ab45759db2fffd17a7318d396cbc4d
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 44b7b1d11b7c83b1f19df915577224f97371c655)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit a13d7d6596c66098f6ca11e402d4e4c07c493714)
2024-01-12 23:05:00 +00:00
Alexey Edelev
ee59f65df6 Use target-specific android-build directory
This fix allows using multiple executable targets in a single
CMakeLists.txt when building for android. Previously artifacts for both
targes were collected in a common android-build directory, that led to
artifacts overlaping and broke the deployment process.

Users need to set the QT_USE_TARGET_ANDROID_BUILD_DIR to TRUE to enable
the new android-build directories naming.

This change need QtC adjustments that will take a new directory naming
into account.

Task-number: QTBUG-117443
Pick-to: 6.5
Change-Id: I47568798e2a2e8550ddab1990a33611967183761
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 5f0575256a4af14c1f2f9a846e40cd9490c12b56)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 5d9c9fe8f729e3782b11a48534d065050913bf82)
2024-01-12 23:04:49 +00:00
Jarek Kobus
b06525ddbb QObject: Make it clear we don't install duplicated event filters
Pick-to: 6.5 6.2 5.15
Change-Id: I3048b50700880dd2445a5a65823fef02b196ce7d
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 43de84644292978f2b8bce209830cf14d5384904)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 31a94ee00dbe95217b3b5ec4267f2304ec2b5631)
2024-01-12 23:04:41 +00:00
Alexey Edelev
9378db0f78 Disable AUTOGEN for resource object targets
It looks like resource object targets don't need AUTOMOC as well
as other AUTOGEN tools. The only source file skips autogen explicitly,
but AUTOMOC requirement is added to the resource object targets anyway.

This disables all AUTOGEN related properties explicitly for all
resource object targets.

The problem occurs when building top-level Qt with the static library
that uses resources in tree.

Pick-to: 6.5 6.2
Change-Id: I5c968a3e34c881e7fbc5589626ab02b3b1e53968
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit dd4c14104cfab6330b31937acf2b2f120ef940a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 273f1ffbf63ddc115e52b443fe20c2e88a6bcb8f)
2024-01-12 21:01:21 +01:00
Christian Ehrlicher
3011891fb4 QFusionStyle: fix painting handle with tickmarks enabled
The handle was drawn outside of the widget's rect when tickmarks were
enabled (TicksAbove/TicksLeft).

Pick-to: 6.5
Fixes: QTBUG-83604
Change-Id: Iff3a1a330317576a759e3fd6795d0b4849e2044b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 574692e5ac95e1f2061812a43f14d325c077b7c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit eb31663d038185661854b854e7765d2947121664)
2024-01-12 19:51:43 +00:00
Christian Ehrlicher
ed68a6ba41 QComboBox: ignore hidden items when calculating popup size
The popup size depends on the max visible items property. But the loop
did not ignore the hidden items which results in fewer items in the
popup than allowed.

Fixes: QTBUG-120574
Pick-to: 6.5
Change-Id: Ic3c503a5272d6839aee158740e096405ca8887d6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 742be5254c9919e8c743b8b489c054d778ee4850)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 8e6b46fa65968664159d3aa619c2ed9d53f39ceb)
2024-01-12 19:51:41 +00:00
Topi Reinio
619710e828 Doc: Fix documentation issues for Qt Core
* Fix \sa links to specific overloads of QFileInfo::fileTime().

* Remove references to 'Custom Type Example' (example has been removed).

* Fix linking to 'JSON Save Game' example.

* Fix references to 'Queued Custom Type' example.

* Fix linking to QCryptographicHash::Algorithm.

* Fix undocumented parameters in qHypot().

Change-Id: If9eb9978a14e147f003672a682972b319454c311
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 96740ea3fed8a7837dc282135661723858fff198)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 26c10a88636d89c64830fdf226abd380eb7e6360)
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-01-12 15:46:21 +01:00
Marc Mutz
239ded94d6 tst_moc: DRY QProcess success verification
While the code that checked that exitCode() == 0 was still consistent
between all the callers, when it comes to checking stderr, there were
several competing implementations, incl. checking the exitCode and
dumping stderr to qDebug(), and using QCOMPARE to QByteArray(),
presumably in order to get more detailed output on error. Alas,
QCOMPARE's toString() truncates output pretty early, making it
impossible to see what's going on on failure.

So write a small macro that checks the exitCode _after_ it checked
that stderr was empty (printing it in full if it was not), so we
consistently get the error message instead of a truncated version, or
just "exitCode() != 0" without further details.

Pick-to: 6.5 6.2 5.15
Change-Id: Ic8547fda3b02c645901962887c6ed7aad01f6ea4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 93af86bad566bf4c2c0a5fa7f64e84daaa20a311)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 22f0d3164e5358ae0d0c089160a0a42de38a0915)
2024-01-12 14:32:04 +00:00
Marc Mutz
8ac80ab149 tst_moc: fix some -Wunused-* warnings on MinGW
Found while inspecting a recent MingWG log file from the CI.

Amends da284ef10e0ef80776b9fc9b7bb0e6dc8d71ba63.

Pick-to: 6.5 6.2
Change-Id: Ife10118710079e60c581314fa857be42452fe810
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 56ca2595526360f98d7824d815552635f87f178f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit ea57719d56024e2327289f924f31a6fbf3a91cb2)
2024-01-12 14:32:02 +00:00
Marc Mutz
e617d7cf0b Fix some -Wunused-* warnings on MinGW
Found while inspecting a recent MingWG log file from the CI.

Amends a2551c45d496c23045eb8451e080e75b2f8b42c1.
Amends f992402f15fd117bb5ccf9a484bf31fd4f4967e2.

Change-Id: Icf56ddc19ac7b40718ec3f429d14cbcb1a2e164f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9aaf1a031befc39244290c63f3905896934f6082)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit bae8ce371abf2cbcbaedf51cfef4179e4caa4b5c)
2024-01-12 14:32:00 +00:00
Ivan Solovev
f8c5af9ef4 QFuture: immediately delete watcher after the context is destroyed
We used deleteLater(), which was triggering ASAN use-after-free error.
Apparently, what could happen is that after the context was destroyed,
we called deleteLater(), but if at this point the previous future got
finished, we still tried to emit watcher->run() to execute the
continuation. And then the watcher got deleted.

This patch replaces deleteLater() with a plain delete call. This looks
safe, because the watcher is only accessed while holding the lock.

Amends 59e21a536f7f81625216dc7a621e7be59919da33.

Fixes: QTBUG-120302
Change-Id: Ia32f20bfe8daea2e2346f3d446c978ae305d2f68
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 11333a097290e4247b27adbfd024d5aa964bed35)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 7f6b62f3fcf2fccf0b97457c64fb20a0377cb958)
2024-01-12 14:31:57 +00:00
Volker Hilsheimer
3ef97639ff Doc: complete the snippet for a dialog with extension
Add the setting of the layout's size constraint to 'fixed' back to the
snippet, so that the dialog automatically resizes when the extension
gets hidden. The user won't be able to resize the dialog, but allowing
the user to resize the dialog and to show and hide the extension anyway
leads to unpredictable results for the user.

Amends 11da92ba94570e5eec01597fe09f0a9a48acc677.

Change-Id: Ie74ca36eaa1a8e9567e0d5826f91f8633e5cbc05
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 51a1dfe72ddd922cd6caf28d532b3311db767989)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 82105e82e553f9f8dbcdbaac177318fd590e40ab)
2024-01-12 14:31:55 +00:00
Artem Dyomin
bdaada6062 Add an opportunity to grab via QOpenGLCompositor to FBO
The feature is needed for screen capturing Qt multimedia in order
to have better performance of getting frames
(avoid recreating fbo). In QtMM, we're going to create FBO
and use it as a hw frame (or just render it to image on the first stage)

Pick-to: 6.5
Change-Id: Id08a86b76447faa0f341c6967c2dad8f34c84959
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit b96160191fc79514173b202bf6325553a798926d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 12fb9c4dbba1f393feb8d7f99713a76ed6eda63b)
2024-01-12 14:31:54 +00:00
Marc Mutz
e98f7b448d [docs] Remove references to C++11 feature availability
QVersionNumber, e.g., was added for Qt 5.6, the last Qt version that
didn't require C++11. So it made sense that the original documentation
stated that certain functions were only available in C++11 mode.

But already Qt 5.7 required C++11, so these historical anecdotes are
no longer pertient to today's Qt users, so remove them from the docs.

Pick-to: 6.5 6.2 5.15
Change-Id: I5c732d3b9b33e1fb6947eff4fac546476c8379f2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4f3142bfce0c64d023299f142d14e60ec577b698)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 5b856ba18f0316e9886a0d1048c9e1bb5e2b9fa1)
2024-01-12 14:31:51 +00:00
Marc Mutz
155f97a0a2 tst_QHashFunctions: extend the consistency() test with mixed-signedness int types
Looking good, because all signed integral qHash overloads are implemented
by casting to the unsigned type before hashing.

Pick-to: 6.5
Change-Id: I8372eb6d4a57b40c2371db58d1b5aeabe9a3951a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7d1f29df795e3e1635204b656b368582ed6942ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 68deb79e2d9a26ebfd97b2b2887b31e65bf12991)
2024-01-12 14:31:49 +00:00
Alexey Edelev
6763644c3f Add the support of the qt_import_plugins functionality to androiddeployqt
qt_import_plugins allows to control application deployment on
non-Android platforms. This adds support for the pre-defined plugin list
that is computed using the qt_import_plugins input.

Pick-to: 6.5
Task-number: QTBUG-118829
Change-Id: Iaa9c3f600533a4b5a3079ab228fabf212d9ce5a5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 438837ce274fdc1457b66179b25df40f33b23a15)
(cherry picked from commit 4dfaabce579c42443a8f9b4425b62c20fe275052)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-01-12 14:31:47 +00:00
Allan Sandfeld Jensen
82fff69aaa Fix premultiply of RGB64 formats
Alpha was also multiplied, leading to wrong alpha values.

Change-Id: Ic452b21f5f02898074552afd68440193b60799c1
Pick-to: 6.5 6.2
Fixes: QTBUG-120614
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit c0a448d5c38557adac915342034263ae8a4908e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 2f59eee2bcf1a5bff73773298970eb30486676cf)
2024-01-12 14:31:44 +00:00
Ivan Solovev
e632241386 Fix QThreadPool::maxThreadCount() usage
The docs claim that QThreadPool always creates at least one thread.
However, the user can (usually by mistake) request zero or a negative
number of threads.
The maxThreadCount() function is simply returning the value, that was
requested by the user.
Since it's a public API, it is used in several places in QtConcurrent,
where it is assumed that the value is always positive. This can lead
to a crash if the user sets zero as a maxThreadCount.

Update all such places with std::max(maxThreadCount(), 1).
Prefer this approach over changing the return value of
maxThreadCount(), because its behavior is documented and tested.

Amends 885eff053797d56f2e295558d0a71b030fbb1a69.

Fixes: QTBUG-120335
Pick-to: 6.5 6.2
Change-Id: Id3b2087cec7fbc7a2d42febca6586f2dacffe444
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 936e72d18075b79c8d29353618dfbd052ae59dae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 41a605e0f2251db78cb852bb161dd0020c63c935)
2024-01-12 14:31:43 +00:00
Milian Wolff
a18292e906 Fix potential leak of QPropertyAnimation in QLineEditIconButton
When startOpacityAnimation is triggered and the animation doesn't
finish, it might get leaked during shutdown as shown by valgrind:

```
==133963== 600 (16 direct, 584 indirect) bytes in 1 blocks are definitely lost in loss record 2,326 of 2,356
==133963==    at 0x4841FA3: operator new(unsigned long) (vg_replace_malloc.c:483)
==133963==    by 0x12698E2D: QLineEditIconButton::startOpacityAnimation(double) (qlineedit_p.cpp:437)
==133963==    by 0x1269900D: displayWidgets(std::vector<QLineEditPrivate::SideWidgetEntry, std::allocator<QLineEditPrivate::SideWidgetEntry> > const&, bool) (qlineedit_p.cpp:459)
==133963==    by 0x126A1084: QLineEdit::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_qlineedit.cpp:276)
==133963==    by 0x152D781E: void doActivate<false>(QObject*, int, void**) (qobject.cpp:3935)
==133963==    by 0x1269AB01: QLineEdit::textChanged(QString const&) (moc_qlineedit.cpp:447)
==133963==    by 0x126A0EF8: QLineEdit::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_qlineedit.cpp:255)
==133963==    by 0x152D781E: void doActivate<false>(QObject*, int, void**) (qobject.cpp:3935)
==133963==    by 0x126A1A94: QWidgetLineControl::textChanged(QString const&) (moc_qwidgetlinecontrol_p.cpp:273)
==133963==    by 0x126A4C35: QWidgetLineControl::finishChange(int, bool, bool) (qwidgetlinecontrol.cpp:736)
==133963==    by 0x126A4F05: QWidgetLineControl::internalSetText(QString const&, int, bool) (qwidgetlinecontrol.cpp:772)
==133963==    by 0x12698AF4: setText (qwidgetlinecontrol_p.h:251)
==133963==    by 0x12698AF4: QLineEditPrivate::setText(QString const&) (qlineedit_p.cpp:277)
```

Note that the line numbers above are potentially slightly off as that
backtrace was recorded on Qt 5.15.9.

Pick-to: 6.5 6.2 5.15
Change-Id: Ie79744d98d2783e4644e18ec51892c0bc43c1557
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 76845e1d31a61735a0f0261fbc15ed7ea5ff71dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 45f5991e60e26c2682a65afd16038ffff49d3025)
2024-01-12 14:31:41 +00:00
Christian Ehrlicher
00c1ceb368 QWindowsSystemTrayIcon: use high-dpi icons for notifications
Do not downscale the icon used for QSystemTrayIcon even though the msdn
documentation states that SM_CXICON/SM_CYICON should be used as the
size to avoid blurry icons in the notification.

Fixes: QTBUG-103825
Change-Id: I2d466e895254aa3c41682290cc7864632c57d5d7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 94809cdec004611bdb8531304e6c74761014876b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 7c22796a976e354357191f43fb21ae5b9239425b)
2024-01-12 13:34:22 +00:00
Christian Ehrlicher
63487e9566 CommonStyle/QSlider: don't modify outline color
The outline color was modified under some conditions but used afterwards
independently from this condition which lead to a wrong tickmark color.

Pick-to: 6.5 6.2 5.15
Change-Id: I45baf9127aea96bfe84a7410dd592a084f14f13c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit e9438da42a2ce3c470df01f82245dbfa7901f8db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 5278624b62f0a4cfacff3aebc358672665ab3be3)
2024-01-12 13:34:20 +00:00
Sune Vuorela
c60c1dcf5f Don't show mnemonics in dockwidget titles
One might want to add an accellerator to dockwidget titles to be used in
contexts that isn't directly the title, but still uses the title.

Dockwidget title accelerators doesn't work in dock widgets, so don't
show them.

They are still available in e.g. a right click menu on a dockwidget to
hide/show, and here the accellerator might come handy, and also if a
dockwidget is tabbed.

Change-Id: I196e1aa92a5c53fed735b598653c267509f788b8
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
(cherry picked from commit cc67b25579c1bb5ea9f5c1ca4c9b7997e66f19b9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 5f55f6c8abf4154c5d816a39fc979409a422df44)
2024-01-12 13:26:10 +00:00
GHENADY
4f43990f7d Fusion style: QGroupBox title vertical alignment
Take vertical alignment into account in QFusionStyle::subControlRect().

Fixes: QTBUG-67708
Change-Id: I9da23a4689565c8dba9fed9ef75d3c640ce77e3f
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 2e625c55b346a727b39b8c5cddc37839b49ba5a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 8b567e90be95ae21d3814653742e68099dc20349)
2024-01-09 15:06:44 +00:00
Kai Köhne
c745ed94a4 Doc: Fix linking to QFileDialog::NativeFileDialog
Pick-to: 6.5
Task-number: QTBUG-119551
Change-Id: I1c698673873e5534b6d7867f8bc752115c254241
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Inkamari Harjula <inkamari.harjula@qt.io>
(cherry picked from commit 1edc866878926d3fba31fc9ee0d9c9abc52cc8a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 84365c0b60648a924d072a399a586d5d5b980006)
2024-01-09 15:06:33 +00:00
Mårten Nordheim
431201f3cb tst_http2: increase testing for authenticationRequired
Make sure the reply is marked as finished and that the body is received
even if we didn't succeed.

In a real scenario that would include some text like Access Denied.

Also, no longer clear() the authenticationHeader in the server, since
that meant the server would not send the header again if the client
failed to authenticate. Luckily this wasn't actually causing any
problems before, since we only tested the expected www-authenticate
header.

As a drive-by: clang-tidy complained about not using const-ref for a
lambda.

Pick-to: 6.5 6.2
Change-Id: Ia4452fff7d9370d7d460433257d84eff0a6f469b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit f4c8e11ad7a2c24da15aecefd0965fcc8af25349)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-01-09 16:06:26 +01:00
Mårten Nordheim
98f743ca47 QLocal8Bit::convertFromUnicode[win]: fix code unit pairing
When we restore a high surrogate from the state, we need to make sure
that the next code unit is a low surrogate. And if it is not then we
should at least not throw it away.

Amends d8d5922f16f1710b66caf718c302b633d2f78b0b

Pick-to: 6.5
Task-number: QTBUG-118185
Task-number: QTBUG-105105
Change-Id: I64afa0d323d73422128e24e16755e648a8811523
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f3d074b6b0dbf80dfec28de50d36928904e7ac0e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-01-09 15:06:12 +00:00
Timur Pocheptsov
bf01a8d6f9 Cocoa plugin: make sure popups' collection behavior knows about spaces
It is possible to have several desktops on macOS, and even more - assign
an app to one particular desktop. Then, moving such an app to a different
desktop and using Qt's widgets like combobox may result in a strange
behavior: since it's not a native 'combo button', we create a popup
to show contents (list of items) of Qt's combobox and this popup
may open on a 'wrong' desktop (the one to which the app is assigned to).
To address this, combine the existing collection behavior for popups
with NSWindowCollectionBehaviorMoveToActiveSpace.

Pick-to: 6.5
Fixes: QTBUG-113507
Change-Id: Icbbc930fd1fc91089774340793e4bc452b939c1c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 360152bdcd0e4045b558e2bf598eabbf8a16abe8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2024-01-09 15:06:00 +00:00
Ahmad Samir
8cde7151ad Moc: don't make variables inside an unnamed namespace static
Because an unnamed namespace, and variables inside it, have internal
linkage[1]; and the variable is constexpr in this case so static
redundant.

This fixes a clang-tidy warning:
readability-static-definition-in-anonymous-namespace

[1] https://eel.is/c++draft/basic.link#4

Change-Id: I95600214cd51b03872ee22995d93d1b5658d5a18
Fixes: QTBUG-112870
Pick-to: 6.5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 5a523981f46550034bb354075ff36444a860109f)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-01-08 20:15:14 +00:00
Eskil Abrahamsen Blomfeldt
30995a6e7c 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.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>
(cherry picked from commit 2243b815e06027f38da9c08aec7e43e8d1c85557)
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2024-01-08 08:43:29 +01:00
Shawn Rutledge
a599c69dc5 wasm: Handle stylus events by generating QTabletEvents
Fixes: QTBUG-120327
Change-Id: I37a92b9850385712b638c30f9a43028d8134f416
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit bc578ec6efcf667e0be2ea5c3d68bd22135cadd0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit d7bc61ac518f2b780f60e895327e21c24a4e21e9)
2024-01-06 20:16:51 +00:00
Lorn Potter
6983f0326b wasm: fix single thread build
Fixes linking of apps

Change-Id: I9bbec9b63af8ae2801643fe124aeda8b25abeca5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit ae3506d80e11068957af38897e451cddb18bbe70)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 6c4fe5766e26bdedf8085816eeeecaa8f75c3d9c)
2024-01-05 22:00:29 +00:00
Lorn Potter
a78d5c8559 wasm: prevent native mobile keyboard from popping up always
also fix misspelled 'inputMode' which seems to work.
we need to re focus to the canvas when window is raised
which will automagically close the native keyboard
when user clicks on non edit area.

Fixes: QTBUG-101404
Pick-to: 6.5
Change-Id: Iced9abc7b23e079b1060d2474a139aa653a8ca01
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
(cherry picked from commit d784c14d101ebb1c357cf3096d99e7e9be274931)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-01-05 22:00:13 +00:00
Lorn Potter
c2bcf9c2fb wasm: fix Pen input
This also adds the ability to distinguish between a Pen and a Touch.

Fixes: QTBUG-116989
Change-Id: Iffc5d20c9b46c1746a03c45dd12017d5dd5172a5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 0367aace14b61e72433fa7cb7aab18b3def0030c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 82a32ac7ab78d449531f3d5681c1dc943e681d00)
2023-12-28 22:37:40 +00:00
Piotr Wiercinski
129ab89c5d wasm: Fix handling of promise pool in WebPromiseManager
Promises are registered upon entry to the pool and
unregistered upon exit. If all promises are in a 'pending' state,
new promises can't be processed. Upon completion of a registered
promise, it is unregistered, allowing space for a new promise.

The code path responsible for unregistering promises when they
resolve runs each time a promise's callback is called.
Unfortunately, there's no guarantee that the callback will be
invoked upon the promise's resolution. For instance, promises
registered with only a 'catch' callback may never be triggered
when the promise resolves correctly.

This commit ensures that a final callback is always registered,
even if the user did not provide one.
This guarantees that promises are always unregistered upon resolution

Fixes: QTBUG-118161
Pick-to: 6.5
Change-Id: Ifea93d692464a6ef40c4bcad60f840ca0cb650c9
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 1e6841245dca3bda5dee050fc841c7129142dd9f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit a625d521f70c4897ba4ebeb7f1c7195e571290fb)
2023-12-28 19:08:01 +00:00
Jaishree Vyas
ee0b32d77f Doc: Rearrange best practices and how to documentation
Change the best practices to how-tos, which are categorized
now on a new page.

Fixes: QTBUG-118044
Pick-to: 6.5
Change-Id: I78dba2a1fde03b346f110ecd54e11485a0869540
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 7372b3ab6748b68f1c5fba1f61df8083ce719bc5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 605f9413aaff43dfcd6de47c247295d5d13eb568)
2023-12-28 19:08:00 +00:00
Christian Ehrlicher
2af50f6c81 QSqlRecord: style fixes
Misc style fixes in preparation for the new overloads taking
QStringView.

Pick-to: 6.5
Change-Id: I3b838543aefd08bf115488e571b1bb6eec8d968d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit ddad911f9be71d3a1396e28261ffe386e880aa69)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 41eb8893525733bd65fd2b4d7a7abf100bf78516)
2023-12-28 19:07:58 +00:00
Axel Spoerl
dd1bddaf36 QPlainTextEdit: update viewport, when placeholder text disappears
QPlainTextEditPrivate::updatePlaceholderVisibility() issued a full
viewport update, when the document became empty and the placeholder text
needed to be shown. No update was issued, when the placeholder text was
replaced by a first text character entered.
That relied on the assumption, that the placeholder text would disappear
with the first text line being rendered (even if it has just one char).

When the placeholder text covered multiple line, only the first of them
disappeared.

This patch adds a boolean to remember, that the placeholder text is
shown. If that is the case and the first char is entered, a full update
is issued, to remove all lines of the placeholder text. The boolean flag
is cleared thereafter, to avoid unnecessary viewport updates.

isPlaceHolderTextVisible() is renamed into placeHolderTextToBeShown(),
because the method returns an instruction, rather than a state.

tst_QPlainTextEdit::placeholderVisibility() is adapted to test the
boolean flag, hence the real visibility of the placeholder text.
That extends its scope to the bug at hand.

Fixes: QTBUG-119808
Pick-to: 6.5 6.2
Change-Id: I07a7059ae619dc85d0c21247d829120e6afa7115
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 729e23f15f366f013da8e149fa95e618c9a95e13)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit d19d32a9126f40ce9e55a7bcd976df32a675db0a)
2023-12-28 11:23:11 +00:00
Alexey Edelev
091b5a2bb4 Fix the qtliterals documentation
Use QString as inheader record as the place of definition of both
Qt::Literals and Qt::Literals::StringLiterals. Previously mentioned
headers never exist.

Fixes: QTBUG-120379
Pick-to: 6.5
Change-Id: I104f73b338a144ef5f296500a9a4368cd3791750
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8081c618827403b2658236d6fefbca0e88517303)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit c257e2bf9917d828d22756dc25cdf12e50614c77)
2023-12-28 08:18:53 +00:00
Kai Köhne
709814d41e Use BSD-3-Clause license for CMake files
Pick-to: 6.5
Change-Id: I7012a7b6424c395dfbf37af48561169ecf138af8
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 44ae4b13854de56ab2ec43ebb362ae714f0aff25)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit e853c83491b49ca73ff19b3647b67a5e86fc2d39)
2023-12-26 07:48:55 +00:00
Laszlo Agocs
de230ea9bd rhi: Enable registering cleanup callbacks with a key
And the ability to deregister.

Going to be required by QRhiWidget.

Change-Id: If185cbed2faa042098ac1f6bb1d6daaffd834377
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 84873c898cb4cc433f05d3161cad1e458d26c2e9)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-23 16:37:33 +00:00
Ahmad Samir
a40ca88b63 QObject: assert connection type isn't UniqueConnection for lambdas
An assert is harder to miss than a warning, which makes it more likely
to get fixed. Thanks to Mårten Nordheim for the idea.

Add the assert in inline code so that users compiling their code in
debug mode (or with -DQT_FORCE_ASSERTS) can hit the assert even when
built agaist a release build of Qt (not everyone compile their code with
a debug build of Qt). Thanks to Giuseppe D'Angelo for the idea.

Pick-to: 6.5
Task-number: QTBUG-115125
Change-Id: I2935d32ea5a2c288d7a836abbae66ac53cb5ab2f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit afddb327bd866ac693e475901d4d10acc6c83757)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit fd664000625bca62db20f0954240e0dcbd32cad5)
2023-12-22 21:19:05 +00:00
Alexey Edelev
a47c5e3e43 Fix encapsulation of qt_build_internals_add_toplevel_targets
The function uses external non-cache variable that is set in different
cmake macro. It's better to pass the value as argument.

Pick-to: 6.5
Change-Id: I282bd506cf2dcd998a0ddd7deaad244fab34a8db
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 0d7cda9cdaeefe8363f44204b0cb7384ec990dc8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 8bed1089c51a0281a3fdb128b6275c120e32cca2)
2023-12-22 21:19:02 +00:00
Alessandro Portale
d8805f56b9 Doc: Give offline-dark.css ".qmlextra" a visible text color
.qmlextra's text color #254117 is too dark. Let it inherit a better
suited text color.

Amends: 436467134e6087ec5a0e360e1837aac4da2ce9ca

Pick-to: 6.5
Fixes: QTCREATORBUG-30117
Change-Id: Ia9e0567b0b00f2e7c1359ac85f10c72cece3c087
Reviewed-by: hjk <hjk@qt.io>
(cherry picked from commit 7b27a5b137e9b874928cebf2740520a0d98df282)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 7d4aaa9af833737ea428e2fcec48391360d63f23)
2023-12-21 20:43:51 +00:00
Jarkko Koivikko
4af7cf13c9 printpreview: Avoid rendering artifacts while scrolling zoomed view
Fixes: QTBUG-120107
Pick-to: 6.5
Change-Id: I4de062c9ded47cc911abc0aebf1b1b7f57ed7e09
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit f83e14b13a32b2cddff45dfdbce8e819c02aa9ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit dfc5e3f215706bd2f83954e133db6328d6017038)
2023-12-21 20:43:50 +00:00
Marc Mutz
2e50fbc30a Http2: fix potential overflow in assemble_hpack_block()
The function is given a vector of Http2::Frame's and flattens it into
a vector<uchar>. While each Frame can contain a maximum of 16GiB of
data (24-bit size field), one "only" needs 257 of them to overflow the
quint32 variable's range.

So make sure any overflow does not go undetected.

Keep the limited uint32_t range for now, as we don't know whether all
consumers of the result can deal with more than 4GiB of data.

Since all these frames must be in memory, this cannot overflow in
practice on 32-bit machines.

Pick-to: 6.5 6.2 5.15
Change-Id: Iafaa7d1c870cba9100e75065db11d95934f86213
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 1e6bb61af3ae29755f93b92f157df026f934ae61)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit af8a9874c32c6b1af8998be9487170b6269dbe1f)
2023-12-21 20:43:47 +00:00
Thiago Macieira
06618fbebe QDataStream & QResource: document their lack of security-hardening
Pick-to: 6.5
Fixes: QTBUG-120012
Task-number: QTBUG-119178
Change-Id: I6e2677aad2ab45759db2fffd17a06af730e320d6
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e696bec76e4f852cb28f27c50c95d3504fba559e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 60d60dba77f77d603b42b7a42c9f5c9aec280e89)
2023-12-21 20:43:45 +00:00
Santhosh Kumar
adb47b7f73 Skip 'off-by-one' adjustment in block length during undo operation
The adjustment of block length with 'off-by-one' affects content
length during undo operation. The issue occurs when we perform undo
operation for a set of group blocks that have same fragment
position. Since their positions are same, group block change
(QTextDocumentPrivate::documentChange) with respect to insertion
doesn't affect document block length and further adjustment to
'off-by-one' without considering this leads to incorrect document
content change information (such as invalid information with regard
to characters removed).

This patch skips adjustment of group block length during undo
operation.

Amends 8fbedf2196a292fe2affcf83ddc846b9c852772a

Fixes: QTBUG-113865
Pick-to: 6.5 6.2 5.15
Change-Id: I315dcf01ba5b2f4ed6d95e9d6910d82848374aef
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 8a725084396da5872fa020212b3cb09ee40a91df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 3999908ae5ea9e86b1785f7352d31fb11cc8d21e)
2023-12-21 20:43:43 +00:00
Lucie Gérard
42af812dcd Add qtbase modules to ./configure -list-features
Task-number: QTBUG-64984
Change-Id: I78964581118b258fb1cf5ddea8097fd3b9a5df02
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 0ba15348cf9c0b3702541c18070d8311aa7cc6a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 56f4d1f0e9a19ce6791dcdf40a77115653b80911)
2023-12-21 17:46:48 +00:00
Yansheng Zhu
19a473137a Fix Maximized frameless window painting wrong with WS_THICKFRAME
In Qt versions greater than 6.4.2, when using Qt:FramelessWindowHint and
WS_THICKFRAME simultaneously, and handling the WM_NCCALCSIZE message to
draw a frameless window, the right and bottom sides may extend beyond
the drawable boundaries.

This is because in the previous commits, the calculation for margins was
skipped for windows with Qt:FramelessWindowHint set. This is correct for
non-maximized windows. However, when a window is maximized on Windows,
its actual size is slightly larger than the drawable area to avoid users
from dragging the border to resize the window. When window was maximized
, the code for calculating geometry should remove the margins instead of
skipping its calculation.

The fixed code determines whether to skip the calculation of margins and
frame by checking whether the window is maximized during the calculation
[ChangeLog][QPA][Windows] Adding a check for the maximized state of the
window during the calculation of margins. Margins calculation will not
be skipped for maximized windows.

Task-number: QTBUG-120196
Pick-to: 6.5
Change-Id: I63c8dbc8f65ff28cc581be261acfd3f675b027c4
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 5f7b4c045f4347b9e47849d15d5932df45626c51)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 2b18f6c7b837202c72bfc9346d1e8a4477388255)
2023-12-21 17:46:45 +00:00
Nodir Temirkhodjaev
57f02a814a qfilesystemmodel.cpp: Fix building with -no-feature-filesystemwatcher
Fixes: QTBUG-120062
Change-Id: I2d4d0ff06b8088af81330ed0956b86f292c21cac
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 38dbd751640399a7887cf91fed73688df209a38d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 95acccea1ffd175a4b3ffdd364e9628a38e1ec27)
2023-12-21 10:32:30 +00:00
Volker Hilsheimer
060cb0be9f Minor updates to the "Touch Knobs" example
Turn on anti-aliasing, and update screenshot.

The example is still not great and under-documented, but at least it
doesn't look horrible anymore.

Task-number: QTBUG-120291
Change-Id: Ie709cb51d64c535d7cd0aa1451b3c5bb901324cb
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 2b9d021ba5487f7f5f67b958a17160c4cf468561)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit d8b113f46f11dd6d7229df0cb58f56dccfc70eb5)
2023-12-21 04:52:18 +00:00
Assam Boudjelthia
442f2d4d4a Android: fix typo in androiddeployqt command
Task-number: QTBUG-115020
Change-Id: Ia82c6a421a148bb462d67be5757f73068aa6d382
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit 1f609e47803097ddadaf5f26dc76135ae0cd211d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit d5ff601da74a1eb71a33cdab686b4f18c6818e65)
2023-12-20 22:58:48 +00:00
Assam Boudjelthia
69308e7438 CMake: don't set TIMEOUT_SIGNAL_NAME for Android target on Windows host
TIMEOUT_SIGNAL_NAME and TIMEOUT_SIGNAL_GRACE_PERIOD are not supported
on Windows.

Amends 4a3936c33cb2ab9fee2e93cbe99d31daf1cd0cc8.

Pick-to: 6.5
Task-number: QTBUG-106479
Change-Id: Ifa00a9183750454960b1ff24e1a0048224feff4b
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 1a7db3ab11ef9500e9c6bf111d7525cacca2f867)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 8f9543e0aaee15c5d51377f708451f3f2aa73956)
2023-12-20 22:58:46 +00:00
Assam Boudjelthia
04e3c9987f Examples: Add Qt6::Gui editabletreemodel and simpletreemodel tests
Android needs the Gui dependency.
Amends 283cdcd3d5fad368c9df1bcae69cbfbf9ade623f.

Fixes: QTBUG-120257
Change-Id: Id02b03b9fa08546bc5a126b3e71e67bdd65f8b66
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 4d7ac732557f397cc24c47bc5469db60a0c2a2cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit c27163cd7dd1533b16cb88028b2018490d1e2f2c)
2023-12-20 22:58:44 +00:00
Jan Arve Sæther
ea8aaf2bc3 Do not assert when preferred{Width|Height} is infinity
There's two alternative strategies for fixing this:

1. When fetching the preferred sizes from an item, the number is bounded
   to a smaller (but still very large) value - not subject to overflow.
   In practice this will result in the correct layout, but the
   consequence is a small inconsistency: The preferred size of the
   layout will be less than infinite despite that one of its items have
   a preferred size of infinite.

2. Do not bound the fetched preferred sizes from items, but instead
   let the rest of the code handle infinity.
   This will result in the correct layout, and also a correct preferred
   size of the layout.

This patch uses the second strategy, by applying a bound when needed.
Autotest will be submitted to qtdeclarative, since QGraphicsLayouts are
not affected by this.

Pick-to: 6.5 6.2
Task-number: QTBUG-116577
Change-Id: I49f79d288370bd93831ac9eda623ce4bbf587796
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit 2a95ecf7e81fbdcfad50f8a1dd5c62b120e2ec27)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit c8df6e18df76a1a60986bfa2266e5c00789059bc)
2023-12-20 22:58:42 +00:00
Christian Ehrlicher
55d4ee6586 QFileDialog/win: pass only filename to IFileDialog::SetFileName()
One more place were we should only pass the filename instead the full
path to IFileDialog::SetFileName()
Amends 19c701d370512e81d1b934f899b03ae0c2e6953f

Task-number: QTBUG-47159
Change-Id: I3ac36eb2b6b6fe84fe6985590da882b1d5733efa
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 2643210bd6e07aa1d8ae78c109592bdc2545b074)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 3252ef72d4bb14d1175495ed0be1381fd3b7ec2a)
2023-12-20 15:35:47 +00:00
Volker Hilsheimer
b791b19d3d Update Sliders example
Simplify the "responsive layout" implementation. Just use a QBoxLayout
with changing direction instead of repopulating a QGridLayout, and
change the orientation of one set of sliders instead of creating two
sets in a stacked layout.

Simplify the resizeEvent() implementation accordingly.

Update the documentation snippet text to match the code, and document
the resizeEvent() override.

Fixes: QTBUG-119977
Change-Id: I73a1bb215c956fa283291ebf0ea45ff9a975c727
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit f3fb89ba298e1741320d8bfac9cbd0d503373bff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 2d3ee8ac34bdf30ffc14054a8aeb64ba292bb96e)
2023-12-19 20:18:34 +00:00
Cajus Pollmeier
493c596a6c Fix CMake extraction of sub architecture test
The length check is hard coded to the length of the string under test.
As the STRINGS match only filters out non printable characters, we've
no guarantee that the characters before the == position are printable
or not. So _pos may be > 1 and then string length check will be broken.

Replaced this by a pattern match to see whether there's something after
the ":".

Fixes: QTBUG-120125
Pick-to: 6.5
Change-Id: I24971b3bc83ea05841dae21667fbbae3416cfcf9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit e7457ff171255148d92254316433d39ef1bd3d28)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit fa41643a7edc89f035ea63d024b68fb7dd585a15)
2023-12-19 20:18:32 +00:00
Volker Hilsheimer
ca977a1c65 Blacklist QEventLoop test on QNX
Both the GUI and core version of that test is flaky on QNX.

Task-number: QTBUG-119359
Change-Id: Ied7013e04bdd12270a84ab32d2bd4e45c52136c3
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
(cherry picked from commit 240ea74b25469ca00ef39a0a3a00db12e3d387ed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 6c36e48ed882bf291a4374195904fefb3e6516b7)
2023-12-19 04:17:48 +00:00
Alexander Volkov
062e1bfacd Don't search more generic icons in Applications and MimeTypes contexts
According to the specification
https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html#guidelines
1) "the dash “-” character is used to separate levels of specificity in
   icon names, for all contexts other than MimeTypes"
2) "the “Applications” context should not use this method of falling
   back to more generic icons"

Change-Id: Ia3536141158a4b6c1c4f85db8ad890514cf19e84
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit e0c435cbfeaf1b82f759910fbf05d13e55d4f95f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 79aa84aec200b3287e7948aa6c32c1ccb848c4d9)
2023-12-19 04:17:48 +00:00
Joerg Bornemann
30d093b0e8 CMake: Prepare deployment of projects using QtWebEngine
Store the locations of INSTALL_DATA and INSTALL_LIBEXECS in
.qt/QtDeploySupport.cmake which is generated for every project.

This information will be used to locate the helper binary and resources
of QtWebEngine.

Pick-to: 6.5
Task-number: QTBUG-119077
Change-Id: I2fb6f9b31fd1dcd872365d020c8ac71db426fdec
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 32940a8ea42cb6d6edea662187ebc9146cbc9e29)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 640204df7b251d917ed9dcb2a6b3f3a3af874111)
2023-12-19 04:17:48 +00:00
Tero Heikkinen
effbf6aa56 Coin: Add native MSVC ARM64 instructions
Task-number: QTQAINFRA-5855
Change-Id: I95a3b5f44c2513becb0bdbd5f56c0a5e36e889d9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit 8dffb3c5e3cf419d8428b09d433d199e5dbff904)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 364bffd2c46bacb01a9935c3bb41badf105b9aa1)
2023-12-19 04:17:48 +00:00
Joerg Bornemann
8a00f0e175 CMake: Add deployment hooks for the generic deploy tool
Add a way to run code after qt_deploy_runtime_dependencies has finished
its job.

Motivation: To deploy QtWebEngine-specific assets we must call a
QtWebEngine-specific deployment function that is defined in the
QtWebEngineCore module.

Qt modules (and other code) can now register a deployment hook with
_qt_internal_add_deployment_hook(my_hook). The function my_hook will be
called at the end of _qt_internal_generic_deployqt.

The function my_hook will be called with all arguments that were passed
to _qt_internal_generic_deployqt plus a list of resolved dependencies.
The hook can use this list of dependencies to decide whether to deploy
files.

Pick-to: 6.5
Task-number: QTBUG-119077
Change-Id: I07ab2f6b3a0ea399b43409b4a0498dbf2f52664f
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 21bf313ce65e248793f36363a510539f6e658771)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 5065fb780f4ef15fe0a2a41fd40359f6ac0287c2)
2023-12-19 04:17:48 +00:00
Kai Köhne
09609103b4 Doc: Do not translate company and product names in footer
Change-Id: Iccd4ca02f5474763591bf11a3887ccf4e38a32be
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 0bf7d64ebdff44586f9023e811b2b4fd3142ca57)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 073fc0ed5c86a813959f97d6b9dcc634a952686b)
2023-12-18 20:23:44 +00:00
Kai Köhne
43a100eb6d Doc: Remove references to Qt 4 in Qt 5.0 in Qt Core documentation
Change-Id: Ide0c1ed441c923753f1e81141460719161662c15
Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
(cherry picked from commit a659dcf031e6c4ce112a9ec2e6d8f94f3ce96992)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 3d36e673bc9961a3b4c849f0ac718f788919f2e5)
2023-12-18 20:23:44 +00:00
Michael Weghorn
f6db4f9804 a11y: QComboBox: Reset all model connections when setting model
When setting the model either directly for the combobox
itself or for the combobox's view, disconnect from the model
signals and connect to them anew. Always set the model for the
view first before connecting the combobox's own slots to the model's
signals. Since slots are activated in the order in which they are
connected [1] and both of them are connected to the
QAbstractItemModel::rowsInserted signal, this ensures that the
QAbstractItemViewPrivate::rowsInserted/QListView::rowsInserted
slot will get activated before the QComboBoxPrivate::rowsInserted one.
(QAbstractItemView::setModel connects its slots to the model's signals.)

Activating these slots the other way around is problematic
as described in more detail in
ecef7046245f3adee9366d3543e4ed2a09f65735 and QTBUG-120121.
(macOS accessibility bridge depends on
QAbstractItemViewPrivate::rowsInserted to
update its table representation, which may be necessary
before activating other slots; ATs or platform a11y caches
may depend on correct event order.)

In a quick test, this commit fixes the QTBUG-119526 crash reliably
reproducible after 5093e517b924074ab6e63658c87237be315a17e6
even without the previous fix ecef7046245f3adee9366d3543e4ed2a09f65735
in place. However, leave that one in place, too, as
relying on the order in which the connected slots are called
is quite fragile (s. the discussion in the Gerrit change
for ecef7046245f3adee9366d3543e4ed2a09f65735).

[1] https://doc.qt.io/qt-6/qobject.html#connect

Fixes: QTBUG-120121
Task-number: QTBUG-119526
Pick-to: 6.5
Change-Id: If75fef661f7fcfc1e30e90ec851a2555cf25a65d
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 7120859fdb34cb7d80a183f1a8327b88d0fa7e10)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 6d4c847c33e20cd477dad3d06859a526a945bae4)
2023-12-18 20:23:44 +00:00
Timothée Keller
0056998ba8 Windows QPA: don't override user-removed margins
When calculating margins, added a check to see if the window rect and
the client rect are the same size. If they are, we return early, to
avoid overwriting user-defined specific margins.

Fixes: QTBUG-117704
Pick-to: 6.5
Change-Id: I9947feab4cb900293fb6be6cf09c56268f38d64a
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 03a4164206d64151da7e0b0f850063e501bdea57)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit d2881ae09b0a5e06b9c223e51a61a99655b4036f)
2023-12-18 20:23:44 +00:00
Alexandru Croitor
f04bf38d54 CMake: Deploy correct arch files when cross-compiling to arm Windows
When cross-compiling a user project from x86_64 to arm64 MSVC Windows
target, during deployment we need to deploy arm libraries.

By default because we use an x86_64 windeployqt, it always deploys
x86_64 libraries.

Make sure to pass the path to the target WoA qtpaths.bat file to
windeployqt, so it deploys arm libraries.

Pick-to: 6.5
Fixes: QTBUG-119619
Change-Id: Ib3b5498ae906726d1f9e0919333c102898b48ea9
Reviewed-by: 🌴 Alexey Edelev 🌴 <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 571201603acc731330c9af42a3aca9cda41d38fd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 01d12a2d98c5bcda5b15d2ebfe6d32b872e8f6e6)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-12-18 16:34:11 +01:00
Mårten Nordheim
3d53016d1b Fix FindWrapResolv on systems that complaing about uninit vars
The compile test would fail on certain systems due to usage of
uninitialized variable.

Amends 4a46ba1209907796f4a14f6feb35ed4d70155d7d

Fixes: QTBUG-120141
Change-Id: I4ebbd9dcc820a26c4f8cec0460c5dacbd85c4d4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 75964763660cb131a0afe7b0bc051fd901939821)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 79d32d5b02fa038c95553bdbcd5ec977d1684fce)
2023-12-18 02:06:04 +00:00
Marc Mutz
f5912990ed tst_qxp_function_ref: check that function_ref's are trivially copyable
Mandated by P0792R9 already, but we never checked and P0792R14 has
user-defaulted assignment operators showing up in the synopsis now,
so make sure we don't accidentally break this going forward.

Amends 29b65c98e720056e87334ce88a683969e57efd3d.

Pick-to: 6.5
Change-Id: Ief9c5ff30895f8bfccec1c24d1777d3dab76c95a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 4271114dc6b6c699efe11dc1a2b8946d2bbbb241)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 61566fa52d260e9246a2c487ba9048222ceed24f)
2023-12-17 12:53:13 +00:00
Marc Mutz
d2f7177d42 qxp::function_ref: simplify the constraint on op=(T) = delete
Drop the remove_cvref_t (T is already decayed by way of take-by-value)
and apply De Morgan's Law.

No functional change, just fewer templates to instantiate.

Amends 29b65c98e720056e87334ce88a683969e57efd3d.

Pick-to: 6.5
Change-Id: I0c0f8c4a288145d05636fb053cc260a917fcc4c5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0d0cd1fe2c4f2d90a8184ce88383bdf1ff35b338)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 0f675e0f62d03aeb3d6718147954b0368d955c71)
2023-12-17 12:53:12 +00:00
Marc Mutz
b8a8367e5f qxp::function_ref: reuse a constraint for the deduction guide
No functional change, just using the already-existing named constraint
instead of more enable_if fiddling.

Amends 29b65c98e720056e87334ce88a683969e57efd3d.

Pick-to: 6.5
Change-Id: Idae4962834f14e2a5273099b5611ebcbb2a54447
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 41c41b4ba58ee4a7d5f66d8f03d40b8631ba7547)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 672448c712ba7cfba41100ad79416cfd6de5756f)
2023-12-17 12:53:11 +00:00
Christian Ehrlicher
c507e2f33e QHeaderView: rename private 'offset' to avoid clash with QAIVP::offset()
QAIVP has a function named 'offset()' which is hidden by QHVP::offset
variable. Therefore rename the QHVP::offset to headerOffset

Pick-to: 6.5
Change-Id: Iadb18b8f18197925daa72af243483a044c1d94e7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 15884aba8fc697ce3c2b9b5f7dea14093f037f03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 13198306c8a64cc4a1d17f028aac744437c773b7)
2023-12-17 09:53:36 +00:00
Christian Ehrlicher
93ed05edfa QFileDialog/win: pass only filename to IFileDialog::SetFileName()
When calling QFileDialog::selectFile(), the file is passed as QUrl to
the underlying functions. Then this url was converted back to a local
file and the full path (with wrong path separators on windows) was shown
in the filename edit box in the native dialog. There was already a
comment to use QUrl::fileName() but it did not exist when the code was
written and later it was forgotten.

Fixes: QTBUG-47159
Change-Id: I478dfd0e4943277c0ac78ebf4e138257e7ea8662
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 19c701d370512e81d1b934f899b03ae0c2e6953f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 4938b234ad251c5b2480bb9e28b3482fb4425345)
2023-12-17 09:53:34 +00:00
Christian Ehrlicher
4883d2f591 QHeaderView: fix calculating dragPosition
The dragPosition was calculated without taking the scroll offset into
account as it's done within QAIV.
Amends 787b4c1506aba7e83d861e178329a18c6ec34322

Pick-to: 6.5
Fixes: QTBUG-120055
Task-number: QTBUG-113573
Change-Id: I0e20065f797a1a3f7df07583fccfa029b636fead
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 64a283a98894705fe51c9423812bbeb634138850)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 36f01b7f56fe3421c890600bc10103f6904754a5)
2023-12-17 09:53:33 +00:00
Santhosh Kumar
b492b6da6f 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.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>
(cherry picked from commit 264dab9936a223602f03390acfedc9a590454e96)
2023-12-17 09:52:46 +00:00
Volker Hilsheimer
89055bf038 macOS a11y: rebuild table model if out-of-bounds cell is requested
While it is the itemview's responsibility to keep the accessibility
bridge updated about changes in the view's structure and size, we
have experienced a number of assertions getting triggered when that
wasn't done correctly.
Instead of an assert (or hard crash in release builds), recreate the
table representation in the accessibility bridge when a cell that is
out-of-bounds for the current representation is requested. Emit a
warning message to inform widget authors, and improve the debug
message with information about the column count as well.

Amends 52c2b82082b535123c0eecafe1ec1e4e4190df2a.

Change-Id: I19c20a932153268a5176d7378c485277088f10bf
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c81e31461fd5a5bd2fe959f26b2e6d134b9a71e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 0cb01b87c04925dffae11269b0e94e16a5d2b2be)
2023-12-16 22:28:54 +00:00
Volker Hilsheimer
7e7b502e36 Try harder to clean up the file info gatherer without blocking
QFileSystemModel uses a QFileInfoGatherer, which is a QThread, to
populate itself with the data from the file system. Some of the system
calls we make for that might block, e.g. on Windows a disconnected
network can easily result in 10 minutes of timeout.

Destroying the QFileSystemModel destroyed the QFileInfoGatherer class
member instance, and the QFileInfoGatherer destructor, being a QThread,
had to wait on itself to avoid QThread asserting when being destroyed
while still running. This means that shutting down a Qt application that
was using a QFileSystemModel, e.g. through the non-native QFileDialog,
would hang practically indefinitely instead of shutting down.

To fix this, explicitly manage the life-time of the QFileInfoGatherer.
Manage it in QFileSystemModel through a std::unique_ptr instead of as a
direct class member so that we can control its destruction. In the
QFileSystemModel destructor, signal the gather to terminate and wait
one it for one second. If that fails, schedule the gatherer for later
deletion through deleteLater(), and release it from the unique_ptr.

The QFileInfoGatherer instance might then be alive with the
QFileSystemModel destroyed. When it receives the DeferredDelete event,
try again to abort the process and wait on the thread, this time for
5 seconds.

If that also fails, then we have to make a choice. We cannot destroy
the QThread object while it's still running, so we have to either
wait indefinitely, terminate the thread, or accept a memory leak by
ignoring the deferred delete event.

If the QCoreApplication is shutting down, then we terminate the thread.
To make this safe, explicitly control when termination is allowed in the
thread - disallow it while the thread is holding a mutex, allow it while
the thread is performing I/O operations.

If the QCoreApplication is not shutting down, then we connect to the
QThread::finished signal, and delete the object in response to that.
This might or might not happen, in which case we have to accept that
there's a memory leak.

Fixes: QTBUG-120062
Change-Id: I1e4243265879d61cf406b4eeb0b11b9d59b006ad
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0786c17bbc556a0f494fc825af47c604a9dc0241)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 4c864a0e89f786491512ffa20de8a0a879cf1d58)
2023-12-16 22:28:52 +00:00
shjiu
5a57419964 Fix build error with lambda on GCC 9.2
This patch is specific to the return type of updatePtrSimd function as boolean to avoid the bug of GCC 9.2.

Fixes: QTBUG-112920
Pick-to: 6.5
Change-Id: I21cb1f6dda34448b2290ab72ec280b6b2a3732c9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b404930e122013e76ba8fe165f3432288c051438)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 32fa63f650be5b2d5d2c219d9150f994c761bd75)
2023-12-16 04:50:41 +00:00
Alexandru Croitor
8304e20809 CMake: Export additional target info props for object libraries
For some reason when building a user project in Release mode, when Qt
was built with -DCMAKE_CONFIGURATION_TYPES=RelWithDebInfo;Debug on
MSVC, will result in linking of Debug object libraries into the user
project.
This does not happen in the same configuration on macOS.
My guess is there is a difference in the logic on which configuration
to choose between the platforms, perhaps based on package lookup order
or something else.

This was observed with qtgrpc's
ProtobufWellKnownTypes_type_registration object library (which is only
built on Windows as an object library).

The issue can be fixed if we explicitly generate per-config imported
location information for object libraries, just like we do for regular
libraries.
That way we'll have uniform build type information for all target
types.

Fixes: QTBUG-119708
Change-Id: I9020b7743cea65bbd92cadd5f570b7e38e999bd4
Reviewed-by: 🌴 Alexey Edelev 🌴 <alexey.edelev@qt.io>
(cherry picked from commit 3b71f9dc297f73d140f3c185c67476df5e0266a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 88662fa7e4b3909eb1037299882c63616a368440)
2023-12-16 04:50:40 +00:00
Santhosh Kumar
c662dadd4a Set correct content size for tool tip label
The tool tip content size uses an incorrect content margin, when it's
constructed. This content margin has been reset to correct value when
tool tip is positioned using placeTip(). But after that, the content
size not been recalculated.

This patch triggers updatesSize() to calculate content size with
updated content margin values.

Fixes: QTBUG-119752
Pick-to: 6.5
Change-Id: I454c8528505686f2724b897e4002f78f3049149a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e977a629277796880d1557e4841f731d1ef27c06)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 8dcb5814e09adb540fb5df69d759d1fdbfabe287)
2023-12-16 04:50:38 +00:00
David Faure
f981cdc31d QCommonStyle: fix focus rect drawing, don't fill the background
Regression in the previous commit, 5ef5f2f1b9

Change-Id: I03786264d064b7d0cf2b88a5d06aa63ffb19ae8b
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit ebed890b51e920533087ecaffc7219890a708738)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-16 01:34:21 +00:00
Samuel Gaist
1bd40b3e94 examples: update local fortune example to use transaction
The local version of the fortune server and clients were not using the
transaction paradigm yet. This patches fixes it and makes the example in
line with the network version.

Pick-to: 6.5
Change-Id: Ieb68f67e2921f46acd682f81dfa5dc5b040c88f5
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit fd1405e61b9939e2630c751367413e07fdc76408)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-16 01:34:21 +00:00
David Faure
03ac42cd8e Doc: QIdentityProxyModel::itemData() should be reimplemented too
This is a "regression" (voluntary, known) from commit
c27d2a57a441f9a1ce760e71635bd4c96882249d which changed
QAbstractProxyModel::itemData() to call the source model's itemData(),
so our data() reimplementation is no longer used.

Of course this only matters if itemData() is actually called, which
isn't the case in Qt itself. People will likely skip this if they don't
care - but if itemData() is used in the project, then this shows how
to reimplement it correctly.

Change-Id: I3acea16c05d30d7526bac32fd6cce42b5ad4b617
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit abc739600447af06befaca8ae616dd607b99b184)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit bbd868ff682c991bbd6cb88a9cf363e04871472b)
2023-12-16 01:34:20 +00:00
Amir Masoud Abdol
c3c461d8ee Allow space in emsdk path
Changing from Native path, to CMake path resolves the broken
execute_process call.

Pick-to: 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>
(cherry picked from commit 9dbc0673c7d84785ddb8b41b0d9ffd97fdffc3e7)
2023-12-16 01:34:20 +00:00
Piotr Wierciński
6384c1f18d wasm: Proxy emscripten_fetch() to the main thread
Calling emscripten_fetch() on worker thread which never yields control
back to the browser, will leave the fetch request pending forever.
This can be a problematic for example in QML Loader, which tries
to load resource by network.
Proxy this function call to the main thread, so it can be processed by
the browser.

Fixes: QTBUG-118225
Pick-to: 6.5
Change-Id: I969d73f6a66670c4135960e08d2eedc8d2a6e5c3
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit f2f2b6ef18907a76461b54e110618e7840971fa7)
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
2023-12-16 01:34:20 +00:00
Joerg Bornemann
f2d7272df7 Remove build machine path that was baked into the qmake binary
Remove the __FILE__ preprocessor macro that contains the full path to
the current source file. This is needed for reproducible builds.

The macro was only used for two debug messages. It's enough to mention
the file name - if at all.

Fixes: QTBUG-96281
Pick-to: 6.5
Change-Id: I7940ec090b570ec0105196a881e4c73c279bd248
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7cc55822fb94dcbba4e686664ebfca233513b20e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit cce1222cc0ff92875a6034ef128383ed7f9dabcc)
2023-12-16 01:34:20 +00:00
Michael Weghorn
20b5a25eaa a11y atspi: Add null checks in table iface methods
Add null checks to cover the cases where
QAccessibleTableInterface::cellAt returns
nullptr (which happens e.g. when called with
invalid indices via AT-SPI) or where the
cell object doesn't implement the
QAccessibleTableCellInterface, which
would previously result in crashes.

Fixes: QTBUG-119167
Change-Id: Ieb42617b32ca829af09ae1d54f5de9ec029e3ab2
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit d91d53c951144255349e5d246353b598179ce967)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 10b480f1d8d2f08f2132d23f1325fa945ca71aad)
2023-12-16 01:34:20 +00:00
Volker Hilsheimer
acfe26b167 Examples: fix touch handling in painting examples
On macOS, we don't deliver a press event for the first press on the
track pad (Qt::WA_TouchPadAcceptSingleTouchEvents is not set by default,
so Qt doesn't deliver a single-press on the track pad as a touch event -
that makes some sense or at least maintains compatibility). Because of
that, point 0 is never added to the finger-mapping hash.

When point 0 is then released, we didn't check if we found a valid
iterator for that point ID, and the example crashed.

Fix this by checking that we have a valid iterator before dereferencing,
and by handling Stationary events in the same way as pressed (add the
point to the mapping if it's not already there).

Pick-to: 6.5
Fixes: QTBUG-110266
Change-Id: I32337b801aaabf9b821a97ddc15ad78747b5e6a2
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit 9d8473cdf63537dee65e9c235249b4e4901baa1a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 7378c709f527749493bc15e66a566e1bdfc09fd3)
2023-12-16 01:34:19 +00:00
Esa Törmänen
d19037271c Doc: Improve QLineEdit documentation
Edited the text based on MS Style Guide, added a few new sections
under Detailed Desccription and a link to the Line Edits Example
topic.

Task-number: QTBUG-119552
Change-Id: Iecaa142628019118e271e392a3e332841a7b5af2
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit f6566dd4c6aafa60c134fa40e2c48c6706724363)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 218eec49a740170842ff8a5dbe50c341b9f1de78)
2023-12-16 01:34:19 +00:00
Oliver Wolff
2f96047a8c Remove mentioning of UWP from windeployqt's configure summary
Qt's UWP port has been dropped for Qt 6.0.

Pick-to: 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>
(cherry picked from commit 188fac6453c748695ff7ca0d564ee1c43235917a)
2023-12-15 21:57:38 +00:00
Allan Sandfeld Jensen
4c674c8bde Copy color table in QImage::transform paint path
A copy without pixel ratio was made, but color table not set.

Pick-to: 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>
(cherry picked from commit 993db3ee9a1759a858c1968f831339f8a6130d88)
2023-12-15 18:07:56 +00:00
Tor Arne Vestbø
4ba4525b5a 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.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>
(cherry picked from commit d26be2a2062e4b24a5177a7ee92403c58ffa718e)
2023-12-15 18:07:56 +00:00
Johannes Grunenberg
cf96ad4e98 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.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>
(cherry picked from commit bcbeeb7a70479bda3eaba382019303d40a70c141)
2023-12-15 14:25:16 +00:00
Volker Hilsheimer
298c57bb91 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.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>
(cherry picked from commit 97dd51e677779f73d75171acba00e4ea1ae7c8aa)
2023-12-15 14:25:14 +00:00
Christian Ehrlicher
a2ab5cabb6 Doc: fix links in QString::toLocal8Bit()
\l must not be preceded by \c - qdoc will ignore \l otherwise.
This amends 349bd4db22d057f3fc633f5522c53ad0bfb7bd6f

Task-number: QTBUG-111443
Change-Id: Ia1ab7c6bfe88c288ea14ee307c6a39c1c304ee6f
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit cd081991b196e65440138379ea23321397c40b9f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit b2cf019b98a1aeb2a90f84ee5fefe9832aecc3a5)
2023-12-15 14:25:13 +00:00
Alexandru Croitor
fa3c1a0205 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.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>
(cherry picked from commit e16db6933c09245e8f5b31cc4489d9e8d7bab9b5)
2023-12-15 14:25:11 +00:00
Thiago Macieira
6c43c86f6b 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.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>
(cherry picked from commit b0c031b51b870fc52701f0c445718375a682cb84)
2023-12-15 09:57:54 -03:00
Eirik Aavitsland
ad2164f6dd Raster painting: Correct the coordinate rounding in drawPoints()
When using the cosmetic stroker (i.e. plain pens with effective line
width of 1), drawing points with fractional coordinates >= 0.5 would
fill the wrong pixel.

This is a long-standing bug where the drawPoints() code in the
cosmetic stroker code was missed during the painting coordinate system
shift for Qt 5.0. Prior to that, coordinates were interpreted as the
upper left corner of a pixel, so rounding fractional coordinates to
the closest integer would be the correct way to determine the pixel to
be filled. From Qt 5 onwards however, coordinates instead designate
the center point of the primitive to be stroked. In order to determine
which pixel is most covered by the unit square centered in the given
coordinates, fractional coordinates must be rounded downwards
(floored).

This fix makes the behavior consistent between the cosmetic and
non-cosmetic stroker, so that drawPoints() with e.g. penwidths 1 and
1.01 in practice fills the same pixels.

Fixes: QTBUG-119306
Change-Id: I39cb7ad55229553dda098e6fbc9ee449b1fd9664
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 7706c2a28ea5995f828144e39b8d1662aa263aa2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-15 09:26:14 +00:00
Marc Mutz
b5594a4df5 tst_containerapisymmetry: remove the extra push_back
... and make sure it cannot happen again by using Extract Method to
let the compiler do the counting between the resize and the
sequence-of-push_back alternatives, because this author clearly can't.

Amends 3c0fdd7341ed4bff9b5f041e9f4646265d142303.

Pick-to: 6.5
Change-Id: If18f30d60f556e5e668876a38423f3e519fb79b0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0a86a77e5f145f8aa4b79b645030a79f896bdb66)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-15 05:43:44 +00:00
Volker Hilsheimer
04dda6cae0 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.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>
(cherry picked from commit 3158aa546d3a8e0430f079e0d8b2da0f330628d1)
2023-12-15 00:52:27 +00:00
Morten Sørvig
783f7edf4c 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.

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>
(cherry picked from commit e76a04d26c95c5c2486cdbfe81681f5dfc3ea5c3)
2023-12-15 00:52:27 +00:00
Axel Spoerl
87c81931b9 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.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>
(cherry picked from commit b41fc4bedd50760d838e7bacb5b4b648806551de)
2023-12-15 00:52:27 +00:00
Johannes Grunenberg
01546825ae 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.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>
(cherry picked from commit 1df12820fe17681e8fc372648d8a4fed0621d72c)
2023-12-15 00:52:27 +00:00
Axel Spoerl
4a598c7908 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.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>
(cherry picked from commit 40cd1049a6993db76d4b3ffb5fe6b48122b2c683)
2023-12-15 00:52:27 +00:00
Amir Masoud Abdol
3bc39a6026 Use the correct CMake argument name for -libpng and -libjpeg
The qt_feature calls are for "jpeg" and "png".

Pick-to: 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>
(cherry picked from commit d173fda6e9954a0f44966f8f0049f6d12b964123)
2023-12-15 00:52:26 +00:00
Ed Cooke
c4366e477d 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.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>
(cherry picked from commit a00c80e1ce1f0a901cdbe10366321c25e3135751)
2023-12-15 00:52:26 +00:00
Christian Ehrlicher
de628f93a0 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.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>
(cherry picked from commit 794aee350f718a0a7a5da5b469050138f7dfeb38)
2023-12-15 00:52:26 +00:00
Volker Hilsheimer
f35eae4b79 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.

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>
(cherry picked from commit 6c726979f744e85dc1284374ef1663a85647365e)
2023-12-15 00:52:26 +00:00
Mårten Nordheim
db1710d418 Fix the qopenssl_symbols.h copy in the autotest
It was forgotten when we originally fixed the hardcoded 1_1 version.

Pick-to: 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>
(cherry picked from commit 6b228565cf10368c0d931d4e731622d0ba168989)
2023-12-15 00:52:26 +00:00
Marc Mutz
811b9eef6d 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.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>
(cherry picked from commit debeb8878da2dc706ead04b6072ecbe7e5313860)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-12-15 01:52:26 +01:00
Marc Mutz
13c16b7569 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.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>
(cherry picked from commit 4f7efd41740107f90960116700e3134f5e433867)
2023-12-15 00:52:25 +00:00
Marc Mutz
a4817f47fd 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.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>
(cherry picked from commit 3092406d79eef7a9b7b4915112074ea130737ce0)
2023-12-15 00:52:25 +00:00
Christian Ehrlicher
e6204b12cd 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.

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>
(cherry picked from commit b63f92bb0fc75880ce0b90cce7ef9c6a092bbc2c)
2023-12-15 00:52:25 +00:00
Assam Boudjelthia
97e4f9902e 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.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>
(cherry picked from commit 5ebce47ac417c51e0a2a027eb873a91f1c703e16)
2023-12-15 02:52:25 +02:00
Assam Boudjelthia
96527507c4 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.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>
(cherry picked from commit 75fc7a7251b421534a5523e565abc257ffe16e99)
2023-12-15 02:52:25 +02:00
Assam Boudjelthia
3d2265b333 AndroidTestRunner: uninstall the test when interrupted
If the test runner was interrupted, stop waiting for the test
to start or to finish, go fetch the available test results
and logcat and uninstall the test app.

Also, set CMake TIMEOUT_SIGNAL_NAME to SIGINT and
TIMEOUT_SIGNAL_GRACE_PERIOD to 10 seconds to allow enough
time to fetch the logs and uninstall the test app.

Task-number: QTBUG-106479
Pick-to: 6.5
Change-Id: I4820cfe58f05d15179b4af819caa92e475881634
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 4a3936c33cb2ab9fee2e93cbe99d31daf1cd0cc8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit aecf64eb7b896285d66b22fd725cb11e83f5e807)
2023-12-15 02:52:24 +02:00
Marc Mutz
b1aa12b3de tst_QtEndian: rewrite the ENDIAN_TEST macros to support FP
No functional change, yet. Just dissociating the data name from type
name, so we can add tests for FP types in a follow-up step.

Pick-to: 6.5
Change-Id: I98fdebb49cca614ab27db146c4bacafd190e7d9b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f25804b3955d0b621ac8ff26470f950dbd1e3337)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 8f77dffb39d01e5f23164de7c9308c395a42b20f)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-12-14 16:05:15 +01:00
Arno Rehn
d5528cdeca 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
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>
(cherry picked from commit f89d80c902957f22c8d8f18f234347407ed96b91)
2023-12-14 08:44:10 +00:00
Christian Ehrlicher
e3e3ab5633 qt_imageToWinHBITMAP(): properly delete object on error
Properly delete the handle created by CreateDIBSection() with
DeleteObject() in case of error.

Pick-to: 6.5
Fixes: QTBUG-18057
Change-Id: Ibf40f6afb255bc5a7d7bf39939f5eb3dfcd19f84
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b37b8eb7ea0a809c6e96189e8f9e834d6763e170)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit ce44d63bc3de7e6f95726f943e095c9f34f94365)
2023-12-14 04:38:59 +00:00
Safiyyah Moosa
ca9b9d6099 Doc: Add AcceptMode info to DontConfirmOverwrite
When QFileDialog::DontConfirmOverwrite is in the false state (default state),
it requires QFileDialog::AcceptMode to be set to QFileDialog::AcceptSave.
This information was not stated in the documents and this fix adds this
information to the docs.

Fixes: QTBUG-49720
Pick-to: 6.5
Change-Id: I1017252980810e712f2710751c8852dd12eaeef7
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 76a1c7690fd9f8e747a2bbdd5d910bebd6ef162c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 30e0dc908c5211f31667b62666998415837b0a38)
2023-12-14 04:38:59 +00:00
Eskil Abrahamsen Blomfeldt
7a5aee806f Fix regression when selecting emojis using VS-16
This amends 58907dfa812de8ce6c63295589f644bdf4257d15,
which tried to make sure we select a color variant of a
character when combining it with the VS-16 symbol, the
emoji selector (and vice versa with VS-15).

This is something which is not well-handled in Qt, and
the original work-around assumed that any font supporting the
conversion of Unicode characters to color glyphs would include
the VS-16 character in its map. This was true for the symptomatic
font on macOS, so it solved the problem there.

However, if you manually select a color font and then request a color
glyph, the font system should just pass it on and accept this. No
need for any magic adaptation. Same if you select a non-color font
and use VS-15.

To avoid regression, we detect this case and disable the behavior
introduced in 58907dfa812de8ce6c63295589f644bdf4257d15 when the existing
font selection is already meeting the criteria.

This is admittedly very hacky, and the plan is to do a larger refactor
where sequences of emojis are separated out ahead of time so that the
font selection can pick from a curated emoji font list for these.

But to fix the immediate regression, this will basically just return
to previous behavior for some cases which are currently prone to break,
so despite the added layer of conditions, it does improve the situation
temporarily.

Pick-to: 6.5
Task-number: QTBUG-111801
Fixes: QTBUG-118642
Change-Id: I1a3ca711426a042b22003b887883646132335a9f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 35266dc3080dc13641616ed20e257d7b4c57778c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit e56db0394a8e1a658a48e4f4f2fff6b35d95aa7d)
2023-12-14 04:38:59 +00:00
Audun Sutterud
35af63a03d examples: Update content of "draggabletext"
Qt Quarterly was shut down long ago.

Fixes: QTBUG-119982
Change-Id: I910b03ab11bf9aa728cc23d736a6f13902b6fcfe
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8d0d520cd313a653226f734ef819021f83e66721)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit e978d4046a424585f9f4dcd2595b36b980a1b26f)
2023-12-14 04:38:59 +00:00
Christian Heimlich
c3fe2cb931 Windows QPA: Always process system sound events
1b96c75661f678632485513d1323166bc6d74e5c reduced event noise by
dropping accessibility events if Windows UI automation has not been
activated; however, this did not take into account that some widgets
(e.g. QMessageBox) rely on accessibility event processing to emit
certain system sounds.

Change notifyAccessibilityUpdate() so that system sound related events
are processed regardless of accessibility activation.

Pick-to: 6.5
Change-Id: I22f1516e8fbb3727b065ecc2c30b272b2d6fd1c0
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit ce5aaf1e434b6e2e482347b40524edeccecb1665)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 6de0a610153fc0c9403ec0d7518ccf3d7b855bb7)
2023-12-14 04:38:58 +00:00
Volker Hilsheimer
1d70ba5cab QMainWindow: don't crash when restored state is modified before applied
Amends 32edae5e268b968aff82f0713612eff2feffb4e1, after which we keep a
copy of the restored state if the state couldn't be applied yet. Since
making a copy of the entire state results in multiple copies of layout
item pointers, we might end up with dangling pointers if the layout
structure is modified while we keep the copy. This can happen if methods
such as tabifyDockWidgets or splitDockWidget get called; e.g. tabifying
dock widgets will destroy the layout items that were added for them.

Unfortunately, the layout items do not have a pointer back to the layout
they live in, and the items in the stored state might not yet live in a
layout anyway. So we cannot remove the items from their layout in a
QDockWidgetItem destructor implementation.

Instead, we have to forget the stored state. Add a helper function that
writes the stored state back to the actual state, and deletes the stored
state afterwards. Call this function when the layout might get modified
programmatically.

Add a test case that reproduces the crash without the fix, and passes
with the patch.

Fixes: QTBUG-120025
Pick-to: 6.5
Change-Id: I8f7e886f3c4ac38e25f9b8bc194eea0833e5974f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 9ea9e2476d72ae67178d55df99419f202b36131f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit cc5e154914c2a1e128bb9a61e47dd2544fd03925)
2023-12-14 04:38:58 +00:00
Tor Arne Vestbø
28ac7a4e63 macOS: Don't reset focus window to top level window when becoming key
The NSWindow becomes the "key window" when it's the window that currently
receives keyboard events. This happens when switching activation between
windows of the same app, or when the app is made active, restoring the
key window status.

Since the keyWindow property only applies to top level windows we were
skipping child windows when processing the event callback, but we then
proceeded to pass the top level window() to handleFocusWindowChanged,
instead of the QWindow of the key window's first responder (the view
that receives key input sent to the top level key window).

To fix this, we let each platform window send its own focus change
event, if it's the first responder, instead of relying on the top
level window to send it on behalf of possible child windows. This
decoupling ensures that we also send focus changes when we're not
part of a view hierarchy Qt controls.

Task-number: QTBUG-119287
Fixes: QTBUG-119054
Pick-to: 6.5
Change-Id: Iac06fe800291e243432335169c52db7685e173df
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit cf9b143cb3076a5d3ad8beec8ecf5175be925ae9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 56592330652137805da69ccd32b77f1b470596d8)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-14 04:38:58 +00:00
Tor Arne Vestbø
9a38001737 macOS: Use single truth to track file dialog current directory
Unfortunately we can not rely on the file dialog panel for this,
via the directoryURL property, as that property has not yet been
updated during a panel:directoryDidChange: callback, resulting in
the directory reported to the user being the previous directory.

Since we already have to store the current directory for the case
where we haven't yet created the file dialog panel we re-use this
variable as the single place to store the current directory.

It's not clear whether we still need to normalize the strings
we get from the NSSavePanel, but the code has been left in,
even if the old callback code didn't normalize the path that
we then emitted as directoryEntered().

Fixes: QTBUG-119371
Pick-to: 6.5 6.2
Change-Id: I379a47053302e73d5e06a2b941f40365c17390d5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a81395f2c604c84cd0e6f18165c766419f26b7ba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 4075ffa498634c38771290275a3162df2c5c5e5b)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-14 04:38:58 +00:00
Ievgenii Meshcheriakov
14ee331052 QAbstractProxyModel: Emit headerDataChanged() signal with valid data
This amends commit a0bcad39033bddd9b9d14a524b829513105913d3.

Delayed signals emitted by the previous commit may have
invalid parameters if the source model was updated several
times before entering the event loop. This commit fixes that
by evaluating the section range immediately before emitting
the signal. This commit also ensures that the signal is
emitted only once after entering the event loop.

Fixes: QTBUG-119155
Pick-to: 6.5
Change-Id: I9e84703cca26fde8464a6b9a414bb7462cbb9abd
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 734354c0bae543795222a47cca2a013352d49745)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit f77af7014848d1ebba96a932b4b836efd963582f)
2023-12-14 04:38:58 +00:00
Marc Mutz
e92a7e4fa0 qarraydata.h: don't rely on transitive include of qflags.h
The QFlags header came in via qpair.h and broke when we tried to
remove qglobal.h from qpair.h.

Pick-to: 6.5 6.2
Change-Id: I335b84cc1d73303f8f2497427a21fba255ee11f9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit b2288de7cdb32e622da09163d4c373439760b221)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit cc6f8dc980553346d6c551a2e6a62ba2f67f0da3)
2023-12-13 22:06:53 +00:00
Marc Mutz
54efd2e09f [docs] QDeadlineTimer: remove docs of a function that exists no more
The _q_data() function was removed before 6.6, but the docs
remained. Presumably qdoc doesn't care about non-existing \internal
\fn's.

Found while hunting for QPair uses to eliminate.

Amends eac30fcb827e9bb1372e46290c060c833bd8ea67.

Change-Id: I73fdfe69d4158977a6a80eb2a5e790ada09fe85a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 04d0c4e81cef0bb649ae839b6a9b290745408d95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit eab3faad6c78c14d2c30c7ca66ca7cbaadc63228)
2023-12-13 22:06:49 +00:00
Marc Mutz
8aad42ea47 Replace QPair with std::pair in the docs
QPair _is_ std::pair. It's confusing that debuggers consistently show
the real name, std::pair, while the API and docs continue to maintain
the illusion that there is such a thing as QPair.

Use std::pair everywhere.

Pick-to: 6.5
Task-number: QTBUG-115841
Change-Id: I009e2fc415a79a74b583a13cf11e4ff9483a7f6b
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit ec67d0c942a7756afbb6e21c76e835efd3557427)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 8cba66e91dcfa9de7c286cbca214d9d5a0ab8669)
2023-12-13 22:06:46 +00:00
Carl Schwan
9995e90519 Adapt QMutableHashIterator to change in QMultiHash
QMultiHash doesn't inherit from QHash since Qt 6.0 so we can't use
QMutableHashIterator anymore with QMultiHash.

Pick-to: 6.5
Change-Id: I9e755899e0a1e331f452a618b6d8a127715c54d4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1c592199afa77247df84d66fc92a8455dd6ce988)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 76d47dce1b61afca376578557aab18062f3c841e)
2023-12-13 22:06:43 +00:00
Christian Ehrlicher
83d87c956c QAbstractFileIconEngine: reimplement isNull()
QPixmapIconEngine as base class of QAbstractFileIconEngine implements
isNull() by checking if there are pixmaps available. As
QAbstractFileIconEngine does it's own caching mechanism, that check is
failing. Since we can assume that the os returns a valid icon for every
file, QAbstractFileIconEngine::isNull() can always return false.

Pick-to: 6.5
Fixes: QTBUG-119797
Task-number: QTBUG-118667
Change-Id: I713a3cda6a4d14bb3dea374b40d8e8219278e5db
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2bccacab21a02a07e4af9673ad48c9c36c934bb8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-13 19:31:08 +00:00
Tor Arne Vestbø
80c8bb28b6 macOS: Handle NSNull when file dialog directories change
For some directories, such as the 'Recents' entry in the native file
dialog, the panel:directoryDidChange: callback will report a NSNull
for the NSString path, which results in an exception when trying to
compute the length of this null entry.

Pick-to: 6.5 6.2
Change-Id: Ic9cddb54ea713b8fbdcaf0f4fb506ac96e90c9fe
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3bf7e0693ec1df01d2d27e28ab38f553beaa9c82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit c8d2158bd243e236102c7b4e4fa4cf2433bd5931)
2023-12-13 06:55:57 +00:00
Fredrik Ålund
c8a9a3b7e1 Build the QtSql plugin for Mimer SQL on macOS in universal binary mode
With the new provisioning scripts the QtSql plugin for Mimer SQL can now
be built in universal binary mode on macOS

Fixes: QTBUG-111219
Change-Id: Iefc45b510bd17822aa7782a2c42860941eb19fc8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d557718d68184f6b56b17a3b5b54d1d5511a5294)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit fbee3c4864d58d6e490c8d3c8223c7f9d2932cdc)
2023-12-13 06:55:57 +00:00
Oliver Wolff
781a17d783 windeployqt: Proper error message when qtpaths.bat/.exe could not be run
If qtpaths cannt be found windeployqt should complain about that fact.
Previously it complained about "Unsupported platform".

Pick-to: 6.5
Change-Id: I4db954633c31ceac69c4d3c0e55cbe942c3272fd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit bf2f4678b0c1a17ad8d18809335cfb69d2c6527a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit b876d260b698b3f942796a28cca517761f26f530)
2023-12-13 06:55:57 +00:00
Marc Mutz
cf26c939d7 Fix return value of qbswap(qint128)
Should be qint128, not quint128.

[ChangeLog][QtCore][QtEndian] Fixed return type of qbswap(qint128)
(was: quint128).

No tests for this exist, so no wonder it fell through. Added them.

Amends befda1accab417ce5f55cb11816e6ded51af55e3.

Change-Id: Ibf87724b1d500081caca46af1c598975964e04c0
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 7a829eaf51853e0852db28b8b8223e1a62a3db0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 377066e40799fe64cd823d1d69aea7cd539d04b4)
2023-12-12 07:56:25 +00:00
Michael Weghorn
dcdf76ac69 a11y: Only send focus event when item has focus
When the current item in an item view has changed,
only send an accessible focus event when the item view
actually has focus.

Sending a focus event when the item doesn't actually
have focus is incorrect and breaks focus tracking in
assistive technology, like the Orca screen reader.

With this change in place, the focus event for the
newly selected item/child still gets sent when
changing the item using the keyboard or
by clicking on it using the mouse (since the item
view has focus in those cases), but not
when it gets changed programmatically
while the keyboard focus is somewhere else.

Fixes: QTBUG-118800
Pick-to: 6.5
Change-Id: I5540cdfce6d0ed076d4bb871e5862fddcdf05941
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a149b3fd533525d0b260893019b41b300a554f8d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 9cd1b8a28d4f24e9f25ce071421e2b61c96de1f5)
2023-12-12 07:29:58 +00:00
Marc Mutz
4d8b7b584a QDuplicateTracker: test with std::string, too
std::string is a nice value_type for when you want to track short
strings (because of its SSO). Check that it works, incl. in case
the implementation falls back to QSet in the absence of std::pmr
support in the stdlib.

Pick-to: 6.5
Change-Id: I2406258355295c2b1300c4ae8001cead59bb27d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fe8c8e0fceec09b6ac6f358d522aeae9a5550bd0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 3446ece05671b050f2fa520a966c98a0c30c6615)
2023-12-12 07:29:56 +00:00
Friedemann Kleint
cbb0dabc4c EditableTreeModel: Add a test
Add a test running QAbstractItemModelTester on the model.

Change-Id: I40c141c7e754ca05234da611534bd65e456be2fb
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 283cdcd3d5fad368c9df1bcae69cbfbf9ade623f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 11:56:57 +01:00
Friedemann Kleint
a51ee84a61 EditableTreeModel: Polish TreeModel::setupModelData()
- Use QStringView.
- Use a list of a pair-like struct to represent the state instead of
  2 lists.
- Use qsizetype.
- Use constLast() to avoid detaching.

Change-Id: I5ff8a17a4d583a7d2a0a11a52c29b9117280382c
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 5134b3ad54743e3a997ff27af112df79821e5ce1)
2023-12-09 11:56:56 +01:00
Friedemann Kleint
b1039a405a SimpleTreeModel: Add a test
Add a test running QAbstractItemModelTester on the model.

Change-Id: I6ea5d34308357409b9a13eb0271392c8d171addd
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit d9c71b834ccd815b85e9589f21eba1f51c48614a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 10:56:56 +00:00
Volker Hilsheimer
7e28513c28 QComboBox: inform accessibility about model change before selecting
QComboBox implicitly selects the first item that gets inserted into the
model. This happens in response to the model's rowInserted signal, at
which point the item view might not have handled the rowInserted signal
yet. Because of that, the view couldn't update the accessibility bridge,
so informing accessibility about a row being selected that doens't exist
in the bridge's representation of the table yet will result in data
being out of sync, and depending on the bridge implementation trigger
asserts.

Fix this by explicitly updating the accessibility bridge before
implicitly selecting the first row.

Fixes: QTBUG-119526
Fixes: QTBUG-118585
Pick-to: 6.5
Change-Id: I2830c00751b3f18feb5d9252b23823c80229fed1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit ecef7046245f3adee9366d3543e4ed2a09f65735)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-12-09 11:56:56 +01:00
Marc Mutz
fff2117f38 QSpan: fix an MSVC warning-turned-error:
qspan_p.h(35): error C2220: the following warning is treated as an error
  qspan_p.h(35): warning C4245: 'initializing': conversion from 'int' to 'const size_t', signed/unsigned mismatch

Add an explicit (functional-style) cast to silence it.

Change-Id: Id29fda3def1c60415b3e0fe72eaf82c8bc57d363
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5885db33e33079072ae7f34dd1547b92da81e688)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 08:06:26 +00:00
Marc Mutz
3ff26d77eb QString::indexOf(): fix UB (signed integer overflow) in negative from handling
The `from` value is not constrained, so the code must be able to
handle all values, incl. `Min := numeric_limits<qsizetype>::min()`.

But the result of negating `Min` is not representable in qsizetype, so
it's UB to try.

Fix by multiplying both sides by -1 (which flips the relational
operator).

This works because the size() of a string is always non-negative, and
the negation of all such values is representable in the same type. Add
a comment to avoid a "fix back".

Amends f9b867216ba2728ff993020599f5062e2f023de1.

Pick-to: 6.5
Change-Id: I10d2e400b86f07a6a6c0a61080a27f41a16b3517
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 72422d7d1b2a1f71415b5662724f88f490eadaf8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 08:06:20 +00:00
Marc Mutz
c3c171c234 QTest: Extract Method writePrettyUnicodeChar from toPrettyUnicode
Easier to reason about by separating the concerns into separate
functions.

Pick-to: 6.5
Change-Id: I34666766ac2879577faea17bbd2b700bcb803f51
Reviewed-by: Jason McDonald <macadder1@gmail.com>
(cherry picked from commit f395934419e5fa68007a23a8a547c6df18e09b32)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 08:06:14 +00:00
Marc Mutz
0b73a07805 tst_QString: explain TransientDefaultLocale better
A default-constructed QLocale gets initialized with the
currently-active default locale, and apparently retains that setting
henceforth. That is why the `prior` member is not explicitly
initialized, which is confusing at face value.

Explain the mechanism better, and explicitly default-initialize the
member, so the next reader of the code saves the time to research
this.

Amends 76dfda1ad12cc42cdd832aed1edbe5f76b0cbb2d.

Pick-to: 6.5 6.2 5.15
Change-Id: I1d1171f8564c70a971938b92b809f63ba5637d3a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 6c60117d0140e5b70ced78f4dc246ed285273f8c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 08:06:09 +00:00
Marc Mutz
4cccd3d3dd QByteArray: bring end() into idiomatic form
For contiguous containers, end() is always begin() + size(), so use
that instead of data() + size().

Centralizes what it means to be an iterator in just begin() now, which
will simplify a follow-up commit of Thiago's.

Pick-to: 6.5
Change-Id: I53ca1a335910bdea3d46b9496ba39bc1a2d3fd93
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9dd19532187bd6a5465e6c98a554d24dad1d06d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 08:06:04 +00:00
Marc Mutz
66cd58b2a5 tst_bench_QImageReader: add a benchmark for raw QFatoryLoader operations
This is Eirik's QtCore-only QTBUG-114253 reproducer added to the
nearest fitting existing benchmark.

Done-with: Eirik Aavitsland <eirik.aavitsland@qt.io>
Pick-to: 6.5 6.2 5.15
Task-number: QTBUG-114253
Change-Id: Iba68bedebae908af497267860e2b230db269787e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit a5bcb41678ad7fe78ad3fac066094f6a614b6906)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 08:05:11 +00:00
Marc Mutz
cfb44f3b3c QDebug: remove QPair streaming docs
QPair _is_ std::pair. If this wasn't a fake-definition under #ifdef
Q_QDOC, the compiler would have complained long ago.

Pick-to: 6.5
Change-Id: Idfe589ff13115d3d908572a17b849f634ec86787
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 9d54b5c57e6f8d8a7fee160ed899809135cd5866)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 08:05:01 +00:00
Marc Mutz
f1ceddde07 QUrlQuery: s/QPair/std::pair/
They're literally the same, QPair is an alias for std::pair, so this
is both SC and BC.

Also port from qMakePair to std::make_pair, so we can later drop the
qpair.h include (not done here to avoid breaking 6.6/6.5 users
relying on this transitive include for qMakePair().

Pick-to: 6.5
Change-Id: I593ca3fee5f330992b46170bb660b1b33a663427
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 8f44ec2e486e8fd5a5cd2b8165cc738e059d1502)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 08:04:53 +00:00
Marc Mutz
ed53eb67fe tst_QGlobal: work around ubsan issue in toString(qint128)
Found a problem on GCC 9.4 where asan/ubsan seems to break
std::numeric_limits<int128>::min():

    runtime error: negation of 0x80000000000000000000000000000000 cannot be represented in type '__int128'; cast to an unsigned type to negate this value to itself

This is the -i _after_ we've already checked for ::min() two lines
above. It works with Q_INT128_MIN, though, so use that.

Change-Id: I778980baf4e7eea9f8de06697d792241314acacd
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 28f1eb6c838529675613f05f990255d3b0a22f3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 06:08:34 +00:00
Jarkko Koivikko
0025362dd1 pagelayout: Fix inaccuracy in marginsPixels and paintRectPixels
Do not use rounded value for conversion, which gives inaccurate result.

Example case: typical margin for A4 paper size is 8.4 pt. At 600 dpi,
the old code was using rounded point value of 8, which produces an
incorrect result:

8 / (72.0 / 600) = 67 pixels

The correct margin is of course:

8.4 / (72.0 / 600) = 70 pixels

Change-Id: I44b2eeabb82fd3bf8e2dcfcba66ae96cde763875
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit e28a664ae12e22a2cecbd669d3d8562c742eb4a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 04:11:18 +00:00
Jarkko Koivikko
0aaa84b714 pagesize: Fix pixel overflow in QPageSize::sizePixels and rectPixels
This update addresses an issue in converting page size from points to
device pixels. Previously, rounding the result could lead to an
overflow beyond the physical pixel capacity.

Example case: A4 paper size at 600 dpi:

- points to pixels: 842 pt / (72.0 / 600) = 7016.666666666667

However, the physical pixel height for an HP printer:

- GetDeviceCaps(hdc, PHYSICALHEIGHT)) = 7016

This fix prevents pixel size from exceeding the physical print area,
avoiding unprinted pixels.

Change-Id: I66eabc628d3374d9cfb19b0eb5928f83afbc13dc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit c49fd15a4253a79d70ae2b26ac4cc04454ffd7a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 04:11:18 +00:00
Jarkko Koivikko
b3fdb93ba9 print: QPageLayout: Fix pt unit conversion
This patch corrects the miscalculation in point unit conversion,
ensuring correct margin updates.

Previously, non-pt units were rounded to two decimal places. When
converting back to pt, rounding was to zero decimals, making the result
always less than the original. This could result in margins falling
below the minimum allowed.

Example:
original_points = 8.4
multiplier = 2.83464566929
mm: qRound(8.4 / multiplier * 100) / 100 = 2.96
new_points: qRound(2.96 * multiplier) = 8 // wrong!

The fix rounds back-converted values up to two decimals, ensuring they
are never less than the original and thus stay above minimum margins.

new_points: qCeil(2.96 * multiplier * 100) / 100 = 8.4

Also, remove unused function qt_convertPoint.

Change-Id: I6109f8d381aec96db1ce04cc167f7b73c1c0b9a8
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit d420c1e25a0fb3b25ba4c572f2938701ce8494ec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 04:11:18 +00:00
Thiago Macieira
85e7b700d9 QMetaType: fix typenameHelper() for types in the QtPrivate namespace
GCC at some point decided that it wouldn't include the full namespace
expansion in __PRETTY_FUNCTION__ for any type that is in the same
namespace as the template function being expanded (that is, the
QtPrivate) namespace. I don't know how long this behavior has been in
place, but it can be seen with GCC 13, where the expansion of that macro
inside QtPrivate::typenameHelper<QtPrivate::ModelIndex>() is:

 constexpr auto QtPrivate::typenameHelper() [with T = ModelIndex]

This can be easily worked around by using a different namespace.

Fixes: QTBUG-119650
Pick-to: 6.5 6.2
Change-Id: Ica7a43f6147b49c187ccfffd179df309e43a70cb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit ead408ca1b0b689bea269543117d89316ab23d0b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-09 04:11:17 +00:00
Marc Mutz
2923a29b59 Rename EINTR_LOOP -> QT_EINTR_LOOP
This non-namespaced macro was defined in a header, and while that
header is private, we shouldn't define non-namespaced macros in our
headers.

The macro also clashed with one of the same name defined in forkfd.c,
which broke unity-builds including the forkfd_qt.cpp TU. This rename
fixes that, too, so we can now remove forkfd_qt.cpp from
NO_UNITY_BUILD_SOURCES.

Pick-to: 6.5
Change-Id: Ic4bb4e4d7a632ca87905e48913db788a7c202314
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f96a17225f088a5790655c01eaab9578c81a19f2)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-12-09 02:14:49 +01:00
Thiago Macieira
52cc586a65 Re-do the namespace fix for the linker scripts
This amends and corrects b63045477ea05c17f9abe9434e6d824453e3935a. The
fix there was incorrect for two reasons:
1) it missed one symbol in QtCore (the QFutureInterfaceBase one
   added in 0f0371c8304bd7354a3c43f9fac6b85bd3e9a3f1.
2) it only worked for namespaces that were 15 characters long

Instead, just use a wildcard where the namespace should be for Qt
symbols (note: an extra wildcard appears for plain types because they go
from <N><type> to N<N><namespace><N><type>E).

Change-Id: Iae41eb8991e349ceb836fffd179d6e709d6632f8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
(cherry picked from commit 93233516957f71054c42ba843cdd57216834acd7)
2023-12-08 15:50:09 -08:00
Alexey Edelev
2ad8e19a03 Make sure that the result variable is empty in _qt_internal_collect_buildsystem_targets
Add the inside-recursion marker to the
_qt_internal_collect_buildsystem_targets function and reset
the result variable only in the top-level function call.

Amends 1c82e92202c8c359872c08095670c121602094b8

Pick-to: 6.5
Change-Id: I34b1e1edbb8a799900b95f67b80151b372073d2c
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit ea3289460b6c9a6c4f17af06871936f105514b66)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-08 19:06:43 +00:00
Friedemann Kleint
c75746a10a Polish the EditableTreeModel example
- Fix/silence most clang-tidy/compiler warnings
  * unsigned/int comparison
  * Avoid repeating return / default parameter types
  * Use auto * for pointers
  * Streamline code, use ternary operators
  * Move constructor parameters
  * Observe rule of 5 by using Q_DISABLE_COPY_MOVE
- Add some bells && whistles, resize properly, expand all

Change-Id: I1721458ff66dcba123ff3a2cf50e7d15387a4e8b
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit d50b56b47544ad2b72811045f64df24eaaf0cf59)
2023-12-08 14:52:37 +01:00
Ahmad Samir
48c78b2a3a examples/: fix compiler (GCC) warnings -Wsign-compare
Change-Id: Ie4965e3ce3113e9c7a5d5d5eba4cab143ef1c806
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0b3390f33d4f995273289ccc49ce235619c2903d)
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-12-08 14:52:33 +01:00
Carl Schwan
2b250954d3 Modernize EditableTreeModel
- Use unique_ptr instead of manual memory management
- Improve consistenty in variable name with the simpletreemodel
  childrenNumber -> row, m_ prefix for member variables

Change-Id: Iface30c2224c2b1db7c623a9e6fcbb449c556f3e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 604b2feca751c5eb43b20e180c175acc2a87099e)
Reviewed-by: <carl@carlschwan.eu>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-12-08 14:52:29 +01:00
Rym Bouabid
280a60ebe9 Add documentation for the private API QAtomicScopedValueRollback
Task-number: QTBUG-115107
Pick-to: 6.5
Change-Id: Icdb09d803f1d789b91ae5c1806470d71adb59067
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 4b666553b8510fa12d0905cd10d6782e09ac5f56)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-08 07:43:02 +00:00
Christian Ehrlicher
a06b26814d QIconLoader::actualSize(): respect entry.scale on returned size
entryForSize() might return an entry with a scale != 1 (e.g. when
requesting the actual size for 32x32 it might return an entry with
size=16 and scale=2) but the returned size is not multiplied with this
scale so it returns a wrong size and in the case of QTBUG-114849 to a
wrong painting rect.

Pick-to: 6.5
Fixes: QTBUG-114849
Change-Id: I311e7401e61425efb20b37d13cc95c4b22d47e76
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7cb25eb33c7875c913b4cb0154afd741e602d8aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-08 05:12:17 +00:00
Marc Mutz
cb09b3967e corelib/CMakeLists.txt: restore lexicographical order of SOURCES
Amends 8d367dec156c1aa63544bd851809caa7e72d307e.

Pick-to: 6.5
Change-Id: Ia1fd819ebabf6df143c06f56624365d3e37fa1c9
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b6ff86e5568d5ce715de4153a1ab34dc2c278fc9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-08 02:18:42 +00:00
Marc Mutz
7270e2ab75 Fix QStringConverter::encodingForName() for trailing -, _
The (internal) docs say that - and _ are ignored, and they're ignored
everywhere, except as suffixes. If the old code only ignored them as
infixes, fine, that would make some sense, but it ignored infixes and
prefixes, so there's no reason for it to not ignore suffixes, too.

Fix by continuing the loop until both input ranges are exhausted, or a
mismatch was found.

[ChangeLog][QtCore][QStringConverter] Fixed a bug where
encodingForName() failed due to trailing characters (`_`, `-`) that
ought to have been ignored.

Pick-to: 6.5
Change-Id: Iec21489d988eda7d33c744c170f88cd665b73f34
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 5f775e671973b1549a48ae8c69c5db7494f6a6d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 20:35:35 +00:00
Marc Mutz
319089dd7f Improve tst_QStringConverter::encodingForName_data()
Add more tests and DRY the code using the usual row() lambda trick.

Pick-to: 6.5
Change-Id: I810fba0ab2a96e740e67392155f9507675fe57ae
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit ddce99989fcc956cb59df722eea0e788a867bd7a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 20:35:35 +00:00
Marc Mutz
8d4807da5c qxp::function_ref: try to work around compilation failure on VxWorks
Task-number: QTBUG-115777
Pick-to: 6.5
Change-Id: Icda59c33ae8c92460c7cb06e204c6b1926b82f66
Reviewed-by: Krzysztof Sommerfeld <krzysztof.sommerfeld@siili.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 062718a7d32b683035055e28864729bc097b1d09)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 20:35:35 +00:00
David Faure
525b05599c QMimeDatabase: fix glob-deleteall support for the binary providers
This fixes the recently added QEXPECT_FAIL about glob-deleteall
in a local directory (with a binary cache). Before adding a glob match
we ask the more-local (higher-precedence) directories if they have
a glob-deleteall for that mimetype, and skip it then. This "asking"
is a virtual method, implemented for both XML and binary providers.

Change-Id: I6e4baf0120749f3331fd2d9254bea750a322b72d
(cherry picked from commit 1f0bc1ade316547d01100dcca4f3f7187485f917)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 21:35:35 +01:00
David Faure
705118a554 QMimeDatabase: collect glob patterns from all locations
A QMimeTypePrivate used to belong to a single provider, which would
provide the complete data for it.
But since the redesign in commit 7a5644d6481a3c1a741677, each provider
represents is a single mime directory, and the merging happens at the
QMimeDatabase level. So we need a QMimeType[Private] to be just a name
(a "request" for information about this mimetype) and the information
for that mimetype is retrieved on demand by querying the providers
and either stopping at the first one (e.g. for icons) or merging
the data from all of them (e.g. for glob patterns).

The XML provider was using QMimeTypePrivate as data storage,
give it its own struct QMimeTypeXMLData for that purpose instead.

Task-number: QTBUG-116905
Change-Id: Ia0e0d94aa899720dc0b908f40c25317473005af4
(cherry picked from commit 4e9944e6c8a456353d243ab268cb0f01ff006faa)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 21:35:35 +01:00
David Faure
37cff48a27 tst_qmimedatabase: move local override to the specific test method
When running tst_qmimedatabase with the full shared-mime-info test suite
(which unfortunately requires local setup so this is easy to overlook),
we need *.webm to still be associated with video/webm.

So to test glob-deleteall, do that in installNewLocalMimeType(), with
other similar tests.

This however unearthed the following bug: the handling of glob-deleteall
is only correct when the local dir has no binary cache. It's broken
when using a binary cache. Added a QEXPECT_FAIL for now because this is
going to be fixed as part of a major redesign, coming up.
I also found out that neither xdgmime nor gio do this correctly...

Change-Id: Ib075fcdb792f60a859f23db8c2d7e1c6524f9050
(cherry picked from commit 994311a66bd31983bec5d75d87f5e03f53f14def)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 21:35:35 +01:00
David Faure
6bc35430f9 tst_qmimedatabase: separate xml files for Global and Local tests
For historic reasons, the test had a single list of override xml files
to copy first into the global dir, and then into the local dir.
But glob-deleteall only makes sense in the local dir (as per the MIME
spec). Having two definitions for the same mimetype in the same dir
is undefined behavior, so the test was working by chance only, and
my upcoming refactoring/fixes caught that.

Change-Id: I4717683b4b3f9ba69f1fd815669460789700e877
(cherry picked from commit 251ab925fe8e3dfbc8a8e5f9ed999777d3f6af99)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 21:35:34 +01:00
Thiago Macieira
c88e1caf3b qsimd_p.h: fix build with Clang 17 & -Werror,-Wconstant-logical-operand
Amends 39d3af0c29147ff319e89c0be602d99af0af0996

qsimd_p.h:235:18: error: use of logical '&&' with constant operand [-Werror,-Wconstant-logical-operand]
  235 | static_assert((1 && 1 && 1 && 1 && 1 && 1 && 1), "Undeclared identifiers indicate which features are missing.");

Pick-to: 6.5
Change-Id: Ia930b1a2ed1e465a826ffffd179c5c21b4f4e288
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit d677a454b208dfccc16c845d114575a414ca284f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 20:35:34 +00:00
Jani Heikkinen
a5c9e10894 Revert "OpenSSL: remove support for 1.1"
This reverts commit 28bdd104fd33acf74a76f7ce74e9382b7ba5faf1.

Reason for revert: Based on discussions this isn't something we can do in patch level releases. We can (and should) keep this in 'dev' but needs to be reverted from '6.6', '6.5', '6.2' and '5.15'

Change-Id: If1fea8557f97e4bae8313b701f974f18853ec0f2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-12-07 15:21:33 +00:00
Ivan Solovev
9eb1eb10c1 Move the definition of a native float from qfloat16.h to qtypes.h
... and put it into QtPrivate namespace as NativeFloat16Type.

Keep the qfloat16::NativeFloat definition for SC.

This is in preparation of Qt::compareThreeWay() for NativeFloat16Type
(where available and mis-classified as non-is_floating_point).

Amends 99c7f0419e66692260be56c0385badeacb3f6760.

Pick-to: 6.5
Task-number: QTBUG-104113
Change-Id: Ie12c42c86f8dc9e233fe39776b0f0e28088de9e2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 43d3d037605bac4e13a1282c4eb363cdee98eb74)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 12:37:50 +00:00
Tor Arne Vestbø
4f979ec945 iOS: Allow raising and lowering child windows
If the view's superview is not our own QIOSDesktopManagerView
then it's either a child window, or the view of a view controller
that's not our own. In both cases we can skip the logic to include
the window level, as that only applies to Qt top level windows.

Pick-to: 6.5
Change-Id: If8bbf2a79f3be0cbaf6979455b0626b36da71068
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 09cca9539c0a22ee31f048269a274ba81fdbea8c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:51:00 +00:00
Axel Spoerl
478ce004af QMainWindowTabBar: make destructor public
Was private by mistake => make it public.

Pick-to: 6.5
Change-Id: I6b07a19687ddf84e8456aa70bc34b1cc714a299e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d462c7b09c07b366ee5cea00116e32a4b7fedac6)
2023-12-07 10:51:00 +01:00
Marc Mutz
e08534c4b6 QSysInfo: sanitize /etc file parsing [1/N]: properly check endsWith('"') in unquote()
When 3535f46374ccf8ad966e4b266c0dbd919646fded dropped the
Q_ASSERT(end[-1] == '"') by reviewer request from the original
767beb7fff6f08f5574a193967f8f814970ac289 change, it didn't replace it
with some other check, leaving the possibility open that we'd be
passing an invalid range (end < begin) to QString::fromUtf8(), with
unknown consequences.

While technically a security problem, this has very low impact, since
the files being parsed should contain "trusted content", being
supposed to be owned by root, and not writable by mere mortals. I
hasten to add, though, that the code doesn't check permissions of the
files it reads.

The bug existed with the original Q_ASSERT, too. Namely in release
mode. And in debug mode, it would be a DOS.

Port to QByteArrayView to get the more expressive API and as a
prerequestite for follow-up (non-security) patches.

Pick-to: 6.5
Change-Id: Ib79cdad8680861d1f11b6be9234695273d0a97c2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c39bd86766ae4e9faa3eda89a486bd5534816b0d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:51:00 +00:00
Marc Mutz
008072cffd QSpan: ensure interoperability with std::span
We accepted QSpan as a NIH-type instead of waiting for C++20 and
std::span, because we said that there's no impedance mismatch between
the two, as they both implicitly convert into each other.

But we actually never checked that they do.

Fix this omission by adding constructors that treat std::span exactly
the same as QSpan itself, and adding the respective static_assert()s
to tst_QSpan to check that (within the constraints imposed by the
standard on std::span), they actually do convert into each other.

The only two problematic cases are that fixed-size std::span
constructors are explicit, so span is only constructible, not
convertible, from QSpan. Likewise, for an rvalue QSpan to be
acceptable to the std::span constructor, QSpan needs to opt-in to
enable_borrowed_range (while we're at it, do enable_view, too).

We so far have rejected adding these opt-ins for our own container
classes because we wanted to avoid the compile-time overhead of
including the huge <ranges> header into such central headers as those
that define our containers.

But std::span itself has to specialize these traits, and its range
contructor has to use them, so they must be available from <span>,
too, possibly the stdlib puts the definition into a much smaller
header. So just assume we can specialize it after including just
<span>, provided __cpp_lib_concepts is also defined.

Change-Id: I2202869b60c98047256b0fbcb12336f5d8e550ba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7f5b795f757ee62af71d8d47ccad19cbf681e0eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:51:00 +00:00
Marc Mutz
010ce12a82 QSpan: don't truncate QSpan::extent
My notes inform me that my intent was for QSpan::extent to be size_t,
for compatibility with both its template argument and
std::span::extent.

So fix it to be size_t instead of qsizetype. While extents that go
beyond numeric_limits<qsizetype>::max() will be unusable in practice,
QSpan doesn't actually allocate memory, so declaring one should be
possible, if only for compatibility with std::span, without getting
into a situation where E != extent.

Change-Id: Ic8ae3a1c03801b4a23b7ba56388372cac64f9e5e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d6969b76a5281d5dcadc6ef722594d6ba2effd68)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:51:00 +00:00
Marc Mutz
1945c5f40c QSpan: check conversion from initializer_list
The docs at cppreference.com hint at a corresponding ctor being added
for C++26 (though I don't see it in eel.is/c++draft, yet).

Even so, replacing former initializer_list functions with QSpan ones
is definitely one of the upcoming use-cases, so test it.

Can't use from_container_impl() here as initializer_list<T> is already
immutable, so QSpan<int> is not compatible, only QSpan<const int>.

Change-Id: Iecdf29e629d48313edd5e56d358b9137da76deb6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c851fb2456a87d7b19e7fb9a5a61a3b631970026)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:51:00 +00:00
Marc Mutz
89e8253de5 QSpan: make it a bit more QDoc-friendly
Hide the base class; the documentation isn't supposed to show this
implementation detail.

Don't use auto return types for the begin/end family of member
functions; QDoc doesn't resolve them, but just shows auto, which,
without seeing the implementation, is pretty useless.

Change-Id: If75cc1e7de9c5c1490cb37241739449df4e5d0c2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 3814174faefef4f0a00a97d980d97312d73d132b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:51:00 +00:00
Marc Mutz
283ec1055b tst_ContainerApiSymmetry: check value_types with a const member
QVarLengthArray is the only Qt container currently known to be fine.

std::vector is supposed to be fine, too, since C++14. Turns out that
libstdc++ gets resize(n, v) wrong, though, because it never
implemented the resolution to wg21.link/lwg2033. Known issue, linked
in code comment. Worked around for the time being. Keeping std::vector
in, though, because in this test suite we do cross-check with
std::vector, and other platforms, and most of GCC's std::vector
functions, adhere to the standard.

Pick-to: 6.5
Change-Id: I26e11c4a100695c604cebcf7e14a1ae5078d9ec7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 3c0fdd7341ed4bff9b5f041e9f4646265d142303)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:50:59 +00:00
Marc Mutz
d4eae78e6b Check that QMulti{Map,Hash} (still) store in reverse insertion order
It's wrong, but let's not break it unconsciously.

Pick-to: 6.5
Change-Id: Ic3daa7df4db2ef34ff5d08fddecf9a932ad92156
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 2d052b038d5c3e8ec55ca12b3ba531208a6d3cf1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:50:59 +00:00
Mate Barany
c688fc9f51 Create class documentation for QNtfsPermissionCheckGuard
...and document the related functions as well.

Fixes: QTBUG-116350
Change-Id: I038d59f6af46b29e2123bc8b6c24ff4ffea78bbf
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit fa79b56bd82df6852aab6819dc31b359ee7b24e7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:50:59 +00:00
Christian Ehrlicher
8fc4a796ba QTabBar: properly calc tab positions when changing tab position
The previous attempt to fix this bug did not work out well since it
tried too hard to avoid double calculations. Therefore restore the old
behavior and fix makeVisible() instead.
This amends 1082038bd89d0bbba4df0d9b3f8af3cd0a2f96f2

Pick-to: 6.5
Fixes: QTBUG-119366
Change-Id: I738a3cd3537ecf0983480d2f961f45f81d101bd9
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 4e6f7ad26c31fe484421e873cf0de0fad0c878ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:50:59 +00:00
Friedemann Kleint
4e9051417f SimpleTreeModel: Polish TreeModel::setupModelData()
- Use QStringView.
- Use a list of a pair-like struct to represent the state instead
  of 2 lists.
- Use qsizetype.
- Use constLast() to avoid detaching.

Change-Id: Icc3586451f081f6166fece52675d5379160f51da
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 1c06f86d255d3d92201b1092794a4c1ea403c24d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:50:59 +00:00
Friedemann Kleint
e19f344460 Polish the SimpleTreeModel example
- Fix/silence most clang-tidy/compiler warnings
  * unsigned/int comparison
  * Avoid repeating return / default parameter types
  * Make functions static/use static invocations
  * Use string literals everywhere
  * Use auto * for pointers
  * Streamline code, use ternary operators
  * Move constructor parameters
  * Observe rule of 5 by using Q_DISABLE_COPY_MOVE
- Add some bells && whistles, resize properly, expand all

Complements 25027444a9b53d61a6257dc5f5ce0ffdb3b06f98.

Change-Id: I78f48d187981ecabf69a5d4d42715bad026fa9e6
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit a3e20df03d522bd1b07ac7a85578401f36f290b9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 09:50:59 +00:00
Christian Ehrlicher
5c8e47d2dd SQLite: Update SQLite to v3.44.2
[ChangeLog][Third-Party Code] Updated SQLite to v3.44.2

Pick-to: 6.5 6.2 5.15
Change-Id: I4da6370cf1e320813b9ba807101ce188d3a09fa0
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8220173b020fd28fdf9635fbd46c9505b9d9442a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 07:05:21 +00:00
Marc Mutz
a0ac17891b Remove unneeded toString(QPair) declaration
It's literally the same as the std::pair one that immediately follows
it, because QPair these days is just a template alias for std::pair.

Wasn't flagged as an error because it's just a declaration, not a
definition.

Pick-to: 6.5
Change-Id: I5b47572f6e2a71edb47cbe224801a719ff1e060d
Reviewed-by: Jason McDonald <macadder1@gmail.com>
(cherry picked from commit 85842da95b5a7821b44d83e5d26922a3d07ef6cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-07 00:37:28 +00:00
Axel Spoerl
9557d1ca92 QDockWidget: Fix group unplugging
A floating dock widget could either be a single QDockWidget object,
or a QDockWidgetGroupWindow with a single QDockWidget child.
The former could be dropped on the latter. Dropping the latter on
the former caused a crash.

The existence of QDockWidgetGroupWindows with a single dock widget
child was accepted to be by design.
Previous fixes, such as  9ff40b59da58160dc26c54204a615a2456e07405,
attempted to wrap all single floating dock widgets in
QDockWidgetGroupWindows.

These attempts fell short, because of the manifold programmatic and
manual options to create a floating dock widget:
- drag a single dock widget out of a main window dock area
- drag a dock widget out of a tab bar on the main window
- drag a dock widget out of a floating tab
- call `QDockWidget::setFloating(true)` in any situation
- create a new QDockWidget, that floats from the beginning

Whenever a QDockWidgetGroupWindow with a single QDockWidget child
was hovered and/or dropped on a QDockWidget without a group window,
crashes or screen artifacts were observed. Previous fixes made them
occur less often.

QDockWidgetGroupWindow is not designed to hold a single QDockWidget
child. Such a state is inconsistent and may only exist, while a
QDockWidgetGroupWindow is constructed.

The reason why such invalid QDockWidgetGroupWindows started to exist,
is a bool trap: QDockWidgetPrivate::mouseMoveEvent() starts a drag
operation, when a dock widget is moved by mouse.
It called startDrag() with no argument, which defaulted to
startDrag(true) and caused a group drag.

This assumption is
*correct*, when a tabbed group of dock widgets is dragged out of the
main dock as a whole, to become floating tabs.
*wrong*, when a single dock widget is dragged out of a docked group,
to become a single floating dock widget.

In the second case, the dock widget was wrapped in a new, floating,
invisible QDockWidgetGroupWindow. Looking like a single, floating dock
widget, the group window caused a crash, when attempted to be dropped
on another dock widget.

This patch eliminates all cases, where a QDockWidgetGroupWindow with
a single QDockWidget is created:
(1) Implement QDockWidgetPrivate::isTabbed().
This enables mouseMoveEvent to determine, whether the move relates to a
group of tabbed dock widgets, or to a single dock widget.
startDrag() can therefore be called with the right argument. It will no
longer create a QDockWidgetGroupWindow with a single QDockWidget child.

(2) Change QMainWindowTabBar::mouseReleaseEvent
When a dock widget was dragged out of a tab bar and became a single,
floating dock widget, it was still parented to the group window.
That is wrong, because it has no more relationship with that group
window.
=> Reparent it to the main window, just like any other single floating
dock widget. That enables QDockWidgetGroupWindow to detect, that the
2nd last child has gone and no more group window is needed (see next
point).

(3) React to reparenting, closing and deleting
If the second last dock widget in a floating tab gets closed (manually
or programmatically), reparented or deleted, also unplug the last one
and remove the group window.

(4) Amend 9ff40b59da58160dc26c54204a615a2456e07405
Remove the code path where a QDockWidgetGroupWindow with a single
QDockWidget child was created 'just in case', to make it compatible
others, created by (1), (2) or (3).

(5) Change QMainWindowLayout::hover()
When the hover ends without a successful drop and a temporary group
window with a single dock widget child has been created, remove the
group window.

The patch fixes smaller inconsistencies, which have not become visible
due to assertions and crashes earlier in the chain.

The patch finally extends tst_QDockWidget, to cover all 4 cases.

- Creation of floating tabs
The creation of floating tabs is extracted from floatingTabs() to
the helper function createFloatingTabs(). In addition to creating
floating tabs, the helper verifies that dragging a dock widget out
of the main window doesn't accidently wrap it in a group window.
This covers case (1).

- tst_QDockWidget::floatingTabs()
The test function verifies now, that both test dock widgets have the
same path before plugging them together and after unplugging them from
the floating tab. This covers case(4).

- tst_QDockwidget::deleteFloatingTabWithSingleDockWidget()
This test function is added, to cover cases (2) and (3).

- tst_QDockWidget::hoverWithoutDrop()
This test function hovers two floating dock widgets hover each other,
and returns the moved dock widget to its origin before releasing the
mouse. This covers case(5).

This fixes a lot of long standing bugs, making the author of this patch
modestly happy :-)

Fixes: QTBUG-118223
Fixes: QTBUG-99136
Fixes: QTBUG-118578
Fixes: QTBUG-118579
Fixes: QTBUG-56799
Fixes: QTBUG-35736
Fixes: QTBUG-63448
Fixes: QTBUG-88329
Fixes: QTBUG-88157
Fixes: QTBUG-94097
Fixes: QTBUG-44540
Fixes: QTBUG-53808
Fixes: QTBUG-72915
Fixes: QTBUG-53438
Found-by: Keith Kyzivat <keith.kyzivat@qt.io>
Found-by: Frederic Lefebvre <frederic.lefebvre@qt.io>
Pick-to: 6.5
Change-Id: I51b5f9e40cb2dbe55fb14d769541067730538463
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e6d85cf28bc4f750b69c33b72c006b067ae1190f)
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-12-06 17:52:17 +01:00
Ahmad Samir
10b5590ce0 QFileInfoGatherer: fix narrowing conversion warnings
Found by using -Wshorten-64-to-32 clang compiler flag, or adding that
flag to the flags clangd uses.

Drive-by changes:
- Refactor a small while loop
- Use reverse iterators
- Move instead of copy while constructing a QList
- Replace QPair by std::pair (see QTBUG-115841), and also for its CTAD,
  otherwise I'd have to spill the types out:
  updatedFiles.emplace_back(QPair<QString,QFileInfo>{translateDriveName(driveInfo),
                            std::move(driveInfo)});
  otherwise the clangd complains:
  Alias template 'QPair' requires template arguments; argument deduction
  only allowed for class templates

Task-number: QTBUG-115841
Pick-to: 6.5
Change-Id: I942459f039f6db23f7c1928fe758c6dbf339cd2b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3cd69050ff3187dad8c3a9b50dcc9ac9d5b60f84)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-06 16:06:05 +00:00
Axel Spoerl
4ec05ee2ad QXcbWindow: protect access to m_mapped with a QMutex
QXcbWindow::requestActivateWindow() is called from the main thread,
while handleMapNotifyEvent() is called from the XCB event thread.
In a data race, handleMapNotifyEvent sets m_mapped to true, before
requestActivateWindow() checks if it is false and sets
m_deferredActivation to true.

If that happens, a window activation is skipped until the next window
systems event is processed.

This is harmless in a normal application environment, where each mouse
move causes window systems events to be processed. In an autotest
environment, it causes flakiness, because an expected window activation
may or may not happen.

As a workaround, QApplicationPrivate::setActiveWindow() is frequently
called after QWidget::activateWindow() or QWindow::requestActivate(),
to set the active window on application level. In essence, this is
setting expected outcome of a skipped deferred activation by force.

This patch protects access to m_mapped and m_deferredActivation with a
QMutex in both methods. That prevents the data race and ensures all
deferred activations processed.

Calling QApplicationPrivate::setActiveWindow() after activation on
window/widget level becomes redundant.

Task-number: QTBUG-119287
Pick-to: 6.5
Change-Id: I2eee69292afe0ef6381880a10d4e8483c2c7cbfa
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 2f6fe3a26843ff68c5d3f9af0a2fc3cce6caac22)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-06 16:06:05 +00:00
Axel Spoerl
36fadb4c13 QMainWindowTabBar: Add destructor
QMainWindowLayout re-uses tab bars. A QSet and a QList member are kept,
to track used and unused tab bars.

Corner cases upon application close down leave dangling pointers in
those containers.

=> Add a destructor to QMainWindowTabBar
=> remove the tab bar from used and unused tab bar containers, if
not directly parented to the main window.

=> No longer reparent unused tab bars of a QDockWidgetGroupWindow
to the main window. Let them be destroyed as a group window child,
and its destructor remove it from the used/unused tab bar container.

Pick-to: 6.5
Change-Id: If2388cf878553dc89583dbc8585748fad65bbab2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b6b489db6968fbc3b4aab3755d0166ee09712ff0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-06 13:28:25 +00:00
Mårten Nordheim
80925cf84f ASN1: speed up parsing of certificate timestamps
By parsing QDate and QTime separately it will internally parse the
values as-if-by UTC. This means we avoid the overhead of figuring out
what the local timezone is repeatedly for each certificate.

On Windows, with Schannel, this brings QAsn1Element::toDateTime
from consuming more than 97% of the test time to below 10%.
The test being tst_QSslSocket::systemCaCertificates. It also goes
from taking 1 minute in debug, to 1 second.

As a drive-by: add a (currently) failing test for Feb 29 2000, which
fails because we decode the date as 1900 before adjusting it to 2000.
But there is no 1900-02-29, so it returns an invalid date. As spotted
by Eddy.

Pick-to: 6.5
Change-Id: Iefa73a01d710129faf6412c4fa8bc2b5d7c98bbb
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 731b759c00ce17072e3f93fdd7044490e51171ca)
2023-12-06 11:36:45 +01:00
Marc Mutz
23ea13f9d9 QTest::toPrettyUnicode: remove magic numbers
Derive them from the chosen output buffer size instead, itself a
symbolic constant.

Pick-to: 6.5
Change-Id: I33aa351ba358b106b448f886b92e952e53bc75f9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
(cherry picked from commit a14d3a49f0abed1d430edb96a272ca05a73f7dc5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-06 09:47:14 +00:00
Marc Mutz
5d2fab5663 tst_tostring: support computed expected values
We need an owning container to keep the data alive when the _data
function computes the expected value instead of passing it as a
literal string, so replace the QByteArrayView we used so far with a
const QByteArray.

If a test failed, print the tail ends of the failing strings. This
is useful when toString() implementations printing the operands of
the failed toString()-under-test result comparison decide to
truncate the output. It works around the fact that we both test
toString() and use toString() to report any failure.

As a drive-by, add a missing blank line between function definitions.

Amends a2551c45d496c23045eb8451e080e75b2f8b42c1.

Change-Id: I0b217aeb1a6d475df8e8b9fb821046f1cceb1a3e
Reviewed-by: Jason McDonald <macadder1@gmail.com>
(cherry picked from commit 3a57885c3766d4ae203650d60881988c374e4148)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-06 09:47:06 +00:00
Marc Mutz
754683dfe9 QTest: simplify toString(tuple)
Use C++14's std::index_sequence instead of our home-brewed
QtPrivate::IndexList. I used make_index_sequence<sizeof...(Types)>
instead of index_sequence_for<Types...> to avoid having to resolve
another type-dependent template alias.

Remove the helper's vacuous \internal qdoc block.

As a drive-by, rename the helper function to prevent it from
participating in QTest::toString() overload resolution, and
fix spaces around &.

Pick-to: 6.5
Change-Id: I5981a9b1a99fbe741e75820a6954d066ced9573d
Reviewed-by: Jason McDonald <macadder1@gmail.com>
(cherry picked from commit ba44a714067468684ffabe0c9f37bf1cb0785c3c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-06 09:47:04 +00:00
Timur Pocheptsov
6834089845 QSslConfiguration: remove example
It uses the ciphersuite name which smart tools one day will mark as
weak (i.e. https://ciphersuite.info/cs/TLS_DHE_DSS_WITH_AES_256_CBC_SHA/
in our example), names in the example are not in the standard notation,
+ it is and always was OpenSSL-specific example.

Pick-to: 6.5 6.2
Fixes: QTBUG-119464
Change-Id: Ic6f095ff2c861582de756bf220e2e74106b88e83
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 66a5f9fdd40485a4e64d447f84046698b7cacae3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-05 19:40:35 +00:00
Orkun Tokdemir
e4c396f254 _qt_internal_create_moc_command: Fix genex parse
The function was replacing the `>` character in generator expressions coming from `add_compile_definitions`. This was creating generator expression syntax errors. Discard generator expressions from character replacing.
Add tests for the three cases.

Amends 5bb745f62ba1aa63e4bbd107b279d96bd06dffda

Fixes: QTBUG-111717
Fixes: QTBUG-119716
Change-Id: I694d2908738085fdf15112834f20183a9f393422
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit bc0c44d4cd634c574307920968f0ab1bf6cd8305)
Reviewed-by: Orkun Tokdemir <orkun.tokdemir@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-12-05 17:32:16 +01:00
Safiyyah Moosa
dc86b61d77 Docs: Add stereoscopic example to OpenGL examples
This fix uses the \ingroup command to add the stereoscopic example to the
examples-widgets-opengl group.

I also elaborated on the hardware requirements.

Fixes: QTBUG-119280
Pick-to: 6.5
Change-Id: I6d5b992e533b897d84100f0f897aae97ef89290f
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 11c522495d40cca0d76e47cfd1a726d07d3a97ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-05 16:29:15 +00:00
Alexandru Croitor
c98a4863dd CMake: Fix Apple max sdk version check
We need to warn only when using a major version that is the next one
after the 'max supported version'.

Add an assertion that the max sdk version specified in .cmake.conf
needs to be just the major sdk version, without a minor or patch
version component, otherwise the '+1' math expression will fail.

Task-number: QTBUG-119490
Change-Id: Ib30abe7157c2ccbe0ad7a98e81fc241685a141a8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit a0bdd2195f24d8a7d880ba506afc16b41337218e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-05 16:28:32 +00:00
Kai Köhne
68b0fca6eb Doc: Settle on 'function' instead of 'method' in QMAC documentation
Function is the more popular term in the documentation. Method is
also a tad confusing, because QCryptographicHash calls the algorithm
'method'.

Change-Id: I9922f837b04311a4ef45e1c6de6b8e12a32e4f1e
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit b831693365b37cab0c4534776ac2f431283c6b2b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-05 16:28:24 +00:00
Alexandru Croitor
88f25422aa CMake: Refactor sdk / xcode check to support both warnings and errors
The minimum sdk / xcode version is a requirement, so if the minimum is
not met, we should generally error out.
Changing the behavior in the already released 6.6.x series is not nice
though.

Refactor the code to support both a warning-first and error-first
approach. Keep the warning-first behavior as-is in this change and pick
it to all relevant branches.
A follow up change will switch the default to the error-first approach
for as-of-yet unreleased Qt branches.

To support both approaches, there are now two variables to flip the
warnings into errors and vice-versa depending on which is the default
for a particular branch:
- QT_FORCE_FATAL_APPLE_SDK_AND_XCODE_CHECK
- QT_FORCE_WARN_APPLE_SDK_AND_XCODE_CHECK

The maximum SDK version check remains a warning, because building
against the newer SDK might still work, even if it isn't yet marked as
supported.

Amends a29bff3d80219f54d0837b0e6e0577192011dea1

Task-number: QTBUG-119490
Change-Id: I92dedd69efc266dfc1c8cf15c93887be74fc99d8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 248f8bff16e7b49f9ac946b78a0577051480be58)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-05 16:28:22 +00:00
Axel Spoerl
ccca14cdd8 Harden internal documentation of QDockWidgetGroupWindow
QDockWidgetGroupWindow was documented by a few lines of code comments,
omitting the most critical part of its design: It must not become able
to acquire focus (i.e. be dragged or dropped) while having only one
QDockWidget child.

=> replace legacy code comments by structured internal documentation.

Pick-to: 6.5
Change-Id: I410ebf2e4c20c7479038417a4d8448dce8ab995f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3591ea900b720ff48aace14cd81c8ec9d22b5c73)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-05 11:52:47 +00:00
Axel Spoerl
b5f5af3543 QMainWindowPrivate::layout - use QPointer instead of bare pointer
qt_mainwindow_layout(mainWindow) returns the pointer to a stale object,
if the layout has already been deleted.

Most users of qt_mainwindow_layout() assert the returned pointer, or
handle nullptr explicitly. If the mainwindow layout has already been
deleted, they will still access it. While this has not lead to (known)
issues yet, a UAF exception is thrown in an ASAN build.

=> Use a QPointer instead of a bare pointer.
=> Add missing nullptr check in QDockWidgetPrivate::endDrag()

Pick-to: 6.5
Change-Id: I3484b53e0e2213b82085ceed3ffa66913947189f
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 1914f62c317075e30489701fd2efc87f3aa9367a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-05 11:52:47 +00:00
Tor Arne Vestbø
b0130e82ca Prevent reparenting of foreign window embedding container
A foreign window used to embed a Qt window into it should not end up
with changes to its own parent, as its only job is to give the embedded
Qt window a parent handle.

Change-Id: If1bc89658fedf449d266bc0cc750c90b6a841a68
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit c3a1fe7bd754abc1fc1370e574567aa79b237e31)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-05 11:52:47 +00:00
Tor Arne Vestbø
6adf78c511 macOS: Implement QPlatformServiceColorPicker via NSColorSampler
The default behavior for QColorDialog is to use the native dialog,
but for clients that implement their own color dialog we should
provide the plumbing to do the actual color picking. The fallback
path for this on macOS involves grabbing the screen, which brings
up the permission dialog. The NSColorSampler API does not have this
issue.

[ChangeLog][macOS] Non native color dialogs now use native color
picking when picking colors from the screen.

Change-Id: Idd08a90a3747546fd9825431ab7a4f5b5fa40784
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit 9590ed6ba6dfc565832acddb69c69a3c8bf5e2e6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-05 11:52:47 +00:00
Kai Köhne
8156334674 Doc: Change deprecation of QFuture::makeReadyFuture to 6.6
The compilers will only warn about using makeValueFuture from
Qt 6.10 onwards. Anyhow, for the documentation, it makes more
sense to deprecate it right now, as an alternative API is
available. So deprecate in documentation for Qt 6.6, but
mention that the compiler warning will only be shown in Qt
6.10.

While at it, also make sure the deprecation messages are
proper sentences (end with a dot).

Fixes: QTBUG-116898
Change-Id: Iff90441372b788f9ea42634866d97068275bf0ca
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e11cbf206fdbc018bb475bca495c182a7a91e652)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-05 11:52:47 +00:00
Kai Köhne
ac0e037f90 Doc: Improve documentation for QMessageAuthenticationCode
* Mention 'HMAC' as something people will search for
* Change description to actually reflect code snippet
  (where the key is passed to the constructor)
* At least mention that the security of the HMAC depends
  also on the length of the key, as the code snippet
  uses an artificial/short key. Not sure whether we
  should further expand on this, or link to some other source?

Pick-to: 6.5
Fixes: QTBUG-119499
Change-Id: I2768d9a9d553957e1a778c798d82a73468bee16f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 21eeef83f642d8c34f7ab3bbcd3171c267cff09f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-05 11:52:46 +00:00
Laszlo Agocs
daedbdbba7 QVulkanWindow: sync surface size logic with QRhi
The legacy QWindow convenience subclass does not have the
robust logic that was later implemented for the Vulkan backend of
QRhi. (i.e., never trust the QWindow; problem with QVulkanWindow
is that it half-trusts those values still, which leads to the
classic pixel-size-differs-by-one problem)

Pick-to: 6.5 6.2
Fixes: QTBUG-118568
Change-Id: I5f83999e86a9907efe08b38ca069bae20152a4e0
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 149f178d3fc01b84a92be63a7ba11529c7d769b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-05 11:52:46 +00:00
Joni Poikelin
122a117c8d Silence a warning in release build
Pick-to: 6.5
Change-Id: I6059b560872ebd97874c2dc80e3ad17cf887d8dc
Reviewed-by: Jason McDonald <macadder1@gmail.com>
(cherry picked from commit 402a17cfc8156bf65dfc02a18d68dfc116c90df7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-05 09:13:41 +00:00
Alexandru Croitor
a7f81d8514 CMake: Don't run sdk / xcode version checks on non-Apple platforms
It was an oversight.

Amends a29bff3d80219f54d0837b0e6e0577192011dea1

Change-Id: I696d7a2650c336dc93df01245065bcbb61ca1d6b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit ffa79f5e0c3c8a443721ca6211f5b7876c7c1742)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-05 09:12:46 +00:00
Volker Hilsheimer
76f55b7324 Blacklist tst_Http2::duplicateRequestsWithAborts on QNX
It fails frequently. Might have to blacklist the entire test case, or
even skip when running on qemu, if this doesn't help.

Task-number: QTBUG-119616
Change-Id: I446612c0fb5b2afc021aeb2fab9be010ac071acd
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
(cherry picked from commit 3156d7b7784e624479dbed1ebf7f0f84ea4e4fda)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-05 09:12:25 +00:00
Jaishree Vyas
7432118e42 Doc: PainterPaths-Graphic&Multimedia-Example typo in the documentation
Changed the brief and some grammatical errors.

Fixes: QTBUG-119602
Change-Id: Ib64abeb735899b0ae1cee64709ad3d7f8f440d9e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 1202594db6b8b5ec801989d06004c39b725a67a0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-01 22:24:29 +00:00
Marc Mutz
6710ec26de QProcess: work around GCC 13 -Wmaybe-uninitialized in -unity-build
When in a unity-build GCC 13 sees the implementation of
forkfd_wait4(), called dfrom forkfd_wait(), it can prove that there
are paths that do not initialize *info: Those paths are the returns
following fcntl() in system_forkfs_wait() in forkd_linux.c and read()
in forkfd_wait4().

To work around the issue and unbreak unity-builds, initialize info = {}.

Task-number: QTBUG-119081
Pick-to: 6.5
Change-Id: I1b3504e7f83c766ebccc851233d4c3e677bf2acd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 635774fc324f079a41e2cecbcfdb700bf171ab6c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-01 17:50:37 +00:00
Edward Welbourne
c298d56993 Change POSIX current time query to use clock_gettime()
As noted on its man-page, POSIX.1-2008 marks gettimeofday() as
obsolete, recommending the use of clock_gettime(2) instead. So do
that. Also check the return value - albeit all we can do on failure
(which should not happen) is assert.

Pick-to: 6.5
Change-Id: Id5d6922c974b87f09531d549d692b051c32388ee
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4366487e79f84fb381e33207cbc7c28107aea561)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-01 10:46:58 +00:00
Assam Boudjelthia
ca80d4ff09 AndroidTestRunner: fix failure to acquire test runner semaphore
Currently, if the test runner is interrupted by SIGINT and SIGTERM,
the semaphore is never released and thus consecutive test runner
executions will wait forever. To fix that, a signal handler for the
former signals is added to release the QSystemSemaphore. Also,
remove RunnerLocker and simply use QSystemSemaphore directly,
and explicitly release the semaphore at the end of the test runner
execution.

Fixes: QTBUG-115298
Pick-to: 6.5
Change-Id: I4f6cc0e4d837460de9a66248e09d3cbaf24ce959
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
(cherry picked from commit 20643d17bfe6266ff6582c944ccd9d35fbbe5048)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-01 10:46:57 +00:00
Assam Boudjelthia
751d80f126 AndroidTestRunner: pass testlib env vars to the test app
Check if the common testlib environment variables are set on the
host and pass them to the test app. This include any env variable
starting with "QTEST_".

Fixes: QTBUG-106478
Task-number: QTBUG-106479
Pick-to: 6.5
Change-Id: I99e1b314b106cda20a66e3cac9a92b463b94f5c9
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 0d5fe9c3d7a1af873e800453306b1a5116812966)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-01 10:46:55 +00:00
Alexandru Croitor
85bc252224 CMake: Compute dynamic timeout for androidtestrunner
Pass a CMake test TIMEOUT argument to androidtestrunner, using
a value of 95% of that timeout to allow time for the test runner
to do any cleanup before being killed.

If no test argument is provided, use the value from CMake property
DART_TESTING_TIMEOUT or CTEST_TEST_TIMEOUT. If that's not provided
default to 25 minutes which is the default for DART_TESTING_TIMEOUT.

Along the way set the default androidtestrunner timeout to 10 minutes
and fix the wrong timeout in the help menu.

Fixes: QTBUG-106479
Pick-to: 6.5
Change-Id: I12cd531583dd94954caf8044c37c22382d53d43c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit d2c29aee41d06d59024ef72eb50bb9f25909e922)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-01 10:46:52 +00:00
Andreas Eliasson
4874dd826b Doc: Match descriptive text with code snippet
The code snippet reads QDataStream::Qt_6_5. Change the post-descriptive
text to match this.

Fixes: QTBUG-118907
Pick-to: 6.5
Change-Id: I3b3d03e9095a6ba6febfb652b3bc7173ed4ccfa4
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 0201d5e2324539ddb4f017411ea2019b47bb1941)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-01 09:42:50 +00:00
Kai Köhne
f735ac936a Doc: Fix wrong markup in QStandardPaths::findExecutable
Change-Id: Ia9b9752a7d73b8695f2be227d7fe78e6da927a2e
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 321718af88a1a3fd31e0a2d90b1c964f575cde49)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-12-01 07:00:04 +00:00
Alexandru Croitor
d84133fac8 CMake: Warn when configuring Qt with an unsupported Apple SDK or Xcode
The warnings are shown when configuring any Qt submodule or top-level.
The warnings are NOT shown when configuring a user project with CMake.

Opt out CMake cache variables can be set to silence any of the
warnings:
- QT_NO_APPLE_SDK_AND_XCODE_CHECK
- QT_NO_APPLE_SDK_MIN_VERSION_CHECK
- QT_NO_XCODE_MIN_VERSION_CHECK
- QT_NO_APPLE_SDK_MAX_VERSION_CHECK

The warnings can be upgraded into errors by configuring with
-DQT_FORCE_FATAL_APPLE_SDK_AND_XCODE_CHECK=ON

The platform version requirements that qtbase specifies in .cmake.conf
are saved in Qt6ConfigExtras.cmake so that they can be used when
configuring other non-qtbase submodules.

The code is added to the public CMake files, so that in the future we
don't need to move code around if we enable the checks for public
CMake projects as well.

The version extraction helpers were moved out of QtAutoDetectHelpers
into QtPublicAppleHelpers.

Task-number: QTBUG-119490
Change-Id: Ic840e1013aeb607bf23247a9cb43471dde802e9d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
(cherry picked from commit a29bff3d80219f54d0837b0e6e0577192011dea1)
2023-11-30 10:18:33 +01:00
Alexandru Croitor
e45d618002 CMake: Move QtAutoDetect.cmake functions into a separate Helpers file
And automatically include and install it in all qt builds.
We will use some of its functions for enforcing apple sdk
requirements when building Qt.

For the 6.6 branch there was a conflict that vcpkg integration is
always ON, but was changed to be OFF in 6.7.
We keep the 6.6 behavior, aka vcpkg integration will be ON.

Change-Id: I46383bc857430d35314dfa2ebef9eb342fb63560
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
(cherry picked from commit ba9d45088f966430a814e7af36a8e7657d61e6db)
2023-11-30 10:18:26 +01:00
Alexandru Croitor
26b2961717 CMake: Remove deprecated PUBLIC_LIBRARIES option in wasm tests
Tests should only use the LIBRARIES option.

Pick-to: 6.5
Change-Id: I3c1e4a563448e8f97219c10566cea921a2807abc
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 832eda3beb4c6c3618f101f15acbb9e315282932)
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-11-30 10:18:04 +01:00
Alexandru Croitor
e86dc821d1 CMake: Create wrapper scripts after global feature evaluation
Otherwise we don't have access to the 'debug' and 'debug_and_release'
features to decide whether the install script needs to strip binaries
or not.

Amends 09fdddeb326d0c79d080bdb50a92a839038baea7

Fixes: QTBUG-118070
Change-Id: I4f1b8463fa369edd38c1110d1d69e7fa7a45de63
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
(cherry picked from commit 830c4041befb6897c33d972c8eeb7231dfe24f74)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-30 09:17:04 +00:00
Wladimir Leuschner
397c4d57c2 Fix signed integer overflow in handling WM_SIZE message
The width and height of WM_SIZE parameters in LPARAM are unsigned ints,
but were extracted as signed ints with GET_X_LPARAM and GET_Y_LPARAM,
leading to signed integer overflow when using big window sizes.
The width and height are now extracted with LOWORD and HIWORD.

Fixes: QTBUG-119424
Change-Id: Ie68716a08a686739b6464ce76319dc659fede336
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
(cherry picked from commit 5aff671eea43c1c28990591a8e7d65af05496755)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-29 21:20:10 +00:00
David Faure
0361ff8939 QCommonStyle: draw focus rect using qDrawPlainRect
A non-aliased drawRect(r.adjusted(0, 0, -1, -1)) no longer does the job
in Qt6: hi-dpi is now enabled automatically, which scales the painter
and leads to horrible (non symmetric) rendering.

I doubt any actual widget style calls into this code (which draws
a focus rect with a plain line) but it's still a useful example
and fallback when writing a widget style.

Change-Id: Ib407a7355033258be568b4826fe01c110f02c018
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 5ef5f2f1b9d90264df02277884e5e18f8c1fc783)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-29 12:01:52 +00:00
Thiago Macieira
5344baee29 QFactoryLoader::instance(): don't fully parse static plugins' data
Commit d9766ddc3d525cf08acec4c3483e61d86c9899a8 (Qt 5.12) replaced the
use of the old binary JSON format with CBOR, which is more compact and
standard, but requires actual parsing instead of just a quick size
verification. For regular, loaded plugins, the metadata is stored in
parsed QCborValue format, but for static plugins, we were re-parsing
each staticplugin's metadata for every single call.

This avoids a full parsing and only parses the CBOR header to find the
IIDs (moc always outputs the IID first).

Fixes: QTBUG-114253
Change-Id: I8bd6bb457b9c42218247fffd179750ec6c9e3252
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 4a432a7617d9dd84cc66cd5cffc8469d34001eb9)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-11-29 13:01:52 +01:00
Assam Boudjelthia
06e46b77ec AndroidTestRunner: use ndk-stack to pretty print crash reports
Use ndk-stack [*] tool provided by the Android NDK to pretty
print crash stacktraces to contain <source-file>:<line-number>
lines for calls, making debugging crashes much easier.

The ndk-stack path can be provided with the new param --ndk-stack,
otherwise, it would be deduced using ANDROID_NDK_ROOT env var.

If the tool is not found or the unstripped libs path cannot be
obtained, the default crash report is printed instead.

[*] https://developer.android.com/ndk/guides/ndk-stack

Task-number: QTQAINFRA-5928
Pick-to: 6.5
Change-Id: I22c3ba131a44050c8fcbfd176d5ced096761d229
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 58fc33239e54ca429e41d0b5be8a1c6f917671e2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-29 08:17:39 +00:00
Christian Ehrlicher
9c84620d4b QPushButton: fix QPushButton with icon in rtl mode
In rtl mode the text was not aligned right so a gap between the text and
the icon occurred. This was due to the fact that the textFlag given to
qt_format_text() was modified based on the application wide rtl/ltr mode
and so our Qt::RightToLeft was reverted to Qt::LeftToRight. Therefore
only set the textFlag to Qt::AlignRight when the button layout direction
does not match the global one.

Fixes: QTBUG-64373
Change-Id: I283a99de8f59bc3db53c4150f417ffef9ff68db7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit b03557287fef291fc0a79ba2dc7c0f8bb3a0547b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-29 07:59:57 +00:00
Inkamari Harjula
5be3bf0598 Doc: Modify unreadable tables
Added breaks in List of Stylable Widgets table.
Changed List of Properties table into sections.
Added list of Qt-specific properties in beg of List of Properties chapter.
Moved snippet comments to different rows.

Task-number: QTBUG-118446
Change-Id: I494401058c7982c0a0ada18c8c94429beabba348
Reviewed-by: Mats Honkamaa <mats.honkamaa@qt.io>
(cherry picked from commit c39844c78ea79960c9181ddea50a1c65b5283a73)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-29 05:17:41 +00:00
Timothée Keller
8b9cd97eb9 Windeployqt: Fix -v/--version option
While the version option was already there, it had no output attached
to it, and simply generated the whole help text. Make sure that if the
-v/--version option is set, only the tool version is outputted.

Fixes: QTBUG-119511
Change-Id: I59ee620333c02eb0a031cd05ac3170216cd034fa
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 0e528f2976a64d0348fe0bebfb97293eae5bac73)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-28 21:44:37 +00:00
Amir Masoud Abdol
bd46f7a5ad Detect vcpkg after everything else
In order to use multiple toolchain, e.g., when we are cross compiling,
we need to load the detect, and load vcpkg's toolchain after our
toolchain file.

Change-Id: I7f3374363f725a634356788e22ac21835505c4b0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 044cc7c90b80f5696656565aa6ae4de2b3b09822)
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-11-28 17:19:52 +01:00
Amir Masoud Abdol
24d7487984 Set VCPKG_CHAINLOAD_TOOLCHAIN_FILE to supplied_toolchain_file
Just a minor change, so that it's clear that we are setting the supplied
toolchain as the VCPKG_CHAINLOAD_TOOLCHAIN_FILE.

Change-Id: I10b35f04e7ad684015062066f67117ce4a964c1c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit ab89b9cab3d5644a81735f594b5a83ac9e441d47)
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-11-28 17:19:51 +01:00
Alexandru Croitor
1b86f3c348 CMake: Dynamically include and install Helpers and other files
Instead of duplicating file names that need to be include()'ed
in two different places if the files are meant to be used
in both Qt builds and public user projects and then also mention the
name when installing, extract the file names into lists returned by
functions.

Call these functions where needed to iteratively include() the files
as well as install them, without having to remember updating multiple
code locations.

The new functions return the following list of file names:
- upstream cmake modules that need to be included during a Qt build
- public (Qt build and user project) cmake helpers that need to be
  included and installed
- private (Qt build only) cmake helpers that need to be included and
  installed
- public files that need to be installed, but not included
- private files that need to be installed, but not included

We also generate the list of public files to include in
Qt6Config.cmake.

Task-number: QTBUG-86035
Change-Id: I1e7287f4e1d041c723f144ba9626b34f873c4891
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 8c14b0c02f3e4b06a9aa4ea7608360149be4a50f)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-11-28 17:19:46 +01:00
Alexandru Croitor
a57412878c CMake: Mostly unify includes into a single location
Make the QtBuildRepoHelpers and QtBuildRepoExamplesHelpers files
that were previously loaded as part of BuildInternals package instead
be loaded when qt_internal_include_all_helpers is called.

Load all the helpers as soon as find_package(QtBuildInternals) is
called rather than when qt_build_repo() is called.

This is a behavior change, but because including the Qt's Helpers
should have no side-effects aside from defining functions,
it should be fine.

This lets us have a unified location where to include Helpers files,
instead of thinking whether it needs to be done in QtBuildInternals or
in QtBuildHelpers or some other place.

Move also some additional inclusions into the same function.

Note that including some upstream CMake files like CMakeFindBinUtils
does have side-effects, but we've been doing it already anyway,
so moving it to the top should not make a difference because any
modifications we would do to the globally assigned variables would
have come later when we actually called our own functions.

Task-number: QTBUG-86035
Change-Id: I33f36f7e8db69d504c34a4d4a094b98f6fa50ee4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 2b1f2338631ae24614637b90c45f2778c3c77e37)
2023-11-28 17:19:44 +01:00
Alexandru Croitor
acf72dd323 CMake: Include QtAndroidHelpers and QtWasmHelpers unconditionally
They don't have side-effects, so no need to keep the checks.

Task-number: QTBUG-86035
Change-Id: Ic2c3aee1b19d8b1727936582bfe366c8277d11c2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 381d2fb014c93489d39a41436183bdbe14270621)
2023-11-28 17:19:42 +01:00
Alexandru Croitor
2a20ca0ae2 CMake: Move qt_internal_read_repo_dependencies into QtBuildRepoHelpers
Previously qt_internal_read_repo_dependencies had to be defined
before QtBuildInternalsExtra.cmake was included because the file
called the function.

Instead of calling the function in QtBuildInternalsExtra.cmake, just
call it later after the Helpers have been loaded. We can do this
because the function is always called unconditionally, so no point in
doing it in the generated file.
This lets us move the function into the QtBuildRepoHelpers.

Amends 98e8180e56322ce065e39cc1ef1d65b54caa8c25
Amends a804ac3d881fb036619f323f64e778a9e00b181d

Task-number: QTBUG-86035
Change-Id: Idffed8f2eb9d728c779b77b31eba0d24d85752ea
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit b8f9252507f813fb27982fe72677756bdeedb585)
2023-11-28 17:19:40 +01:00
Alexandru Croitor
44dcf0dfd0 CMake: Split and refactor QtBuildInternalsConfig.cmake
Move most of the code into two new files:
- QtBuildRepoHelpers.cmake
- QtBuildRepoExamplesHelpers.cmake

Task-number: QTBUG-86035
Change-Id: I48c4e7c64f0ffb600118172b8e69b26018f36ffb
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 720b8ee6732f6fc8df5fb7133b569851356641b7)
2023-11-28 17:19:38 +01:00
Alexandru Croitor
4e69f0ced5 CMake: Split and refactor QtSetup.cmake
Split all code in QtSetup into separate functions and macros, put them
in more appropriate files, and call them in
qt_internal_setup_build_and_global_variables.

A new QtBuildOptionsHelpers.cmake is created which takes care of
computing the default values of user-customizable options that are not
pure configure features, like the cmake build type, whether to build
tests / examples, whether to enable ccache, etc.

The new function calls added in
qt_internal_setup_build_and_global_variables
try to preserve the previous code flow when QtBuild was included
in-between the code that was run in QtSetup.

Macros that have dependencies on various global variables were marked
as such with inline comments for easier navigation and comprehension.

After this change, QtSetup.cmake just includes QtBuild.cmake. We leave
it to exist for easier git blaming, but new code should not be added
to it unless really necessary.

The intent is to merge a variant of this change to 6.6 and 6.5 as
well.

Task-number: QTBUG-86035
Change-Id: I3409c2d3ea8ee19a69104b12ab2692966ba5f9cf
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 098a774998c85e10696bbde13b28af517548fe84)
2023-11-28 17:19:36 +01:00
Alexandru Croitor
6574bc915c CMake: Split QtBuild.cmake into smaller files v2
My motivation to do this:
- it got big and tangled again
- sometimes functions need to be added to QtBuild.cmake rather than
  to a separate file because they need to be called before some of the
  global variables are set, to determine the value of those global
  variables (in my case install paths needed to be modified when
  building with xcframework support)
- some of the global variable assignments have dependencies on other
  variables already being set and it's hard to keep track where that
  happens

Split the contents of the file into smaller functions and macros
and place them into pre-existing files when appropriate, or
into new files. The new files are:
- QtBuildHelpers.cmake
- QtBuildPathsHelpers.cmake
- QtMkspecHelpers.cmake

The idea is to have Helpers file only define functions and never call
them, so it's easy to include the file where needed without being
scared of side effects.
QtBuild.cmake will just include the helpers and call one entry point
function to set up everything that was done by the file before.
QtBuild.cmake is not merged into QtSetup, to make it easier to git
blame (it's hard to blame a removed file).

No new features were added as part of the refactoring.

Some function names were renamed (but not all of them) to include
the qt_internal prefix.
Some lines were reformatted so they don't pass 100 chars limit after
the code was placed into a function / macro.
The Helpers includes were re-sorted.
Some function calls were re-ordered where the order call didn't
matter.
Some of the code in QtAndroidHelpers.cmake was wrapped into a macro
so that including the file does not cause side-effects by default.

I'd like to follow up with similar changes for QtSetup.cmake and
QtBuildInternalsConfig.cmake where possible, because having a few
"entry points" into building a Qt submodule is also confusing,
especially for those that aren't familiar with the build system and
why certain things go into certain places.

The intent is to cherry-pick this also to 6.5 and 6.6.

Amends 44cce1a2ea9dadd8b2de93f40de34269dda703c0

Task-number: QTBUG-86035
Change-Id: I02ceff8ceb9b6e9c78bc85d6a42deb02fca3e46b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Orkun Tokdemir <orkun.tokdemir@qt.io>
(cherry picked from commit 10735d68b939b90c431c2d38e40be9c8fb4607b3)
2023-11-28 17:19:34 +01:00
Alexey Edelev
4136de36b7 Make sure that tests use the module build directory but not install path
If we configure module that is already installed it's expected that
tests use the build directory to resolve all the depdencies, but not
the install directory. This is especially sensetive if the module cmake
scripts were changed.

This changes the order of find_<package|dependency> PATHS that are
used to locate Qt package. QT_EXAMPLES_CMAKE_PREFIX_PATH now is used at
first, so we guarantee that we look into the build directory at
first place. This trick only works if build directory is added to
CMAKE_FIND_ROOT_PATH. The reason for that is the internal CMake logic
that tries to relocate the search PATHs and put the paths that are
subdirs of or exact CMAKE_FIND_ROOT_PATH higher in search list.

Fixes: QTBUG-115730
Change-Id: Icab721f0a6eac7301c626350ab214cc4545b368b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d4eda5d34d29c965e625300e2136250fabd0aee5)
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-11-28 17:19:32 +01:00
Joerg Bornemann
d5b3e174e3 CMake: Fix early exit in qt_build_repo_post_process()
This is a macro. We cannot use return() here or we're skipping code at
the call site.

This commit amends b6849849392cf14ead014833976d1926504985d2.

Task-number: QTBUG-88264
Change-Id: Icf6dd06338584239873bf4d66a4bbceef9071399
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
(cherry picked from commit b1aa6c2bc89a597300776ef6d372a55de5c43f5a)
2023-11-28 17:19:30 +01:00
Joerg Bornemann
f513c4cade CMake: Rename QT_EXAMPLES_CMAKE_PREFIX_PATH
...to QT_BUILD_CMAKE_PREFIX_PATH, because the variable is now used for
examples and tests.

Change-Id: Ie6d32a0c99f46407f2771e12638456078c59fb18
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit d5c4d6eb776b4b5e5299de519deb17af66048008)
2023-11-28 17:19:27 +01:00
Joerg Bornemann
94f75e6067 CMake: Allow find_package(Qt6 COMPONENTS Foo) in tests
In prefix builds of non-qtbase repositories, calls to find_package(Qt6
COMPONENT Foo) did not work in tests, because the find_package calls in
Qt6Config.cmake use NO_DEFAULT_PATH, and thus CMAKE_PREFIX_PATH is
ignored.

Non-external-project examples had the same problem. This was fixed by
ffe088941378e32ea30c142cca7e63c537a41ff1 which introduced the variable
QT_EXAMPLES_CMAKE_PREFIX_PATH as additional parameter in all relevant
find_package calls.

We now set this variable in qt_build_tests where it should be local to
the tests directory and its children.

We cannot use QT_ADDITIONAL_PACKAGES_PREFIX_PATH, because it's value is
read once and cached in Qt6Config.cmake - we would have to clear the
internal cache variable.

It would probably be good to rename QT_EXAMPLES_CMAKE_PREFIX_PATH to
reflect that it's not just used for examples. However, my naming skills
are drained for today.

Task-number: QTBUG-88264
Change-Id: I8bcfe9b7f2ee1f1b75dc725977924d09cb36822c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 2ab80a2c18f23dd8b26fbf9880500cd9abc36f6b)
2023-11-28 17:19:25 +01:00
Joerg Bornemann
ae7c92c46a CMake: Fix find_package(Qt6*Tools) in non-qtbase tests
Tests in non-qtbase modules could not find_package their own Qt6*Tools
packages, because add_subdirectory(tests) was called before the config
files for Qt6*Tools were created.

The creation of tools config files is done in QtPostProcess.cmake, which
was included in qt_build_repo_end(). Move that include into its own
macro, qt_build_repo_post_process() and remove it from
qt_build_repo_end(). Call qt_build_repo_post_process() before the
'tests' directory is added in qt_build_repo().

Every call site of qt_build_repo_end() must now be adjusted and call
qt_build_repo_post_process().

Task-number: QTBUG-88264
Change-Id: I80d60a1b5c0e9b715c298ef4934b562f815432d1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b6849849392cf14ead014833976d1926504985d2)
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-11-28 17:19:23 +01:00
Joerg Bornemann
8af4ad568e CMake: Don't create superfluous qtrepo_XXX_for_examples targets
Only create a qtrepo_src_for_examples target that examples, built as
external projects, can depend on.

Change-Id: I334bc67b9b78f49d5c345cb256132f42dc2c5f5e
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit e05b779c88c63b3efc15b5cb29f3c13ec22f1c48)
2023-11-28 17:19:21 +01:00
Alexey Edelev
3ec24c695c Allow using custom CMAKE_<CONFIG>_POSTFIX when building Qt
Do not override CMAKE_<CONFIG>_POSTFIX if it's specified by user.
Using custom CMAKE_<CONFIG>_POSTFIX can potentially break qmake,
since qmake relies on pre-defined postfixes that are set by Qt build
by default. Building Qt with CMAKE_<CONFIG>_POSTFIX different from
default one will now warn about potential issues. Assume that we
still doesn't support setting of CMAKE_<CONFIG>_POSTFIX, but also
don't force our default values.

Fixes: QTBUG-115045
Change-Id: I75a34913189eae77062afa10d384eccf4edfc849
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 8c41125118768ce037698e0605755128b2da705d)
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-11-28 17:19:19 +01:00
Eskil Abrahamsen Blomfeldt
49ab1b8756 Fix cache cost on DirectWrite font engines
In Qt 6, we deferred getting the ascent/descent of the font
until requested. This was used to calculate the cache cost
of the font engine, so as an unintended result, the DirectWrite
engines were seen as extremely cheap in the font cache, and
we would accumulate thousands of them before triggering a flush.

The cache_cost is just a heuristic and does not need to be accurate.
For most engines, we should just flush when the number of cached fonts
exceed 256, so we use the basic em square of a lowercase letter as the
cost here instead.

Pick-to: 6.5
Change-Id: I73a65cab38adfd9ef56e436f311a7d1a2d7fbf41
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit db6f7908d01134eb2f20e9b2122d4d47456db6c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-28 12:13:47 +00:00
Assam Boudjelthia
203f75c923 AndroidTestRunner: don't fail waiting for the app to start/finish
Currently, under waitToFinish(), we wait for the app to start and if
it doesn't start or starts and exits too quickly for the test runner
to catch it, it fails. The test runner tries to get the pid of the test
after it detects the app has started. However, we don't really need to
fail, the test runner could simply continue the execution and assume
the test was run and finished, and proceed to fetching the test results.
Since, the results fetching don't anyway rely on the pid, the test
runner can let that operation decide whether to fail or not (if not
output is found).

Also, along the way, instead of issuing a different command to get the
pid (i.e. adb shell pidof), we can use the same "adb shell ps" command
that is used to check if the app is running, to obtain the pid.

Fixes: QTQAINFRA-5928
Fixes: QTBUG-88508
Pick-to: 6.5
Change-Id: Ice945fcb686c4ef21b5f1c143aa22922ae928333
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 4bc3f700ff86459a2a77ef211f9e727e245a0e20)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-28 08:00:24 +00:00
Assam Boudjelthia
f3c1bad7e5 AndroidTestRunner: print logcat and crash stacktrace when a test fails
For better debugging for test failures, print both logcat and crash
stacktrace (since the start of the current test only), to have an
immediate idea of the reason of the failure or crash if any.

The crash report and the logcat for Android before level 23, is fetched
from the device's time of the app start since those two cases don't
have an option for filtering by pid.

Task-number: QTQAINFRA-5928
Fixes: QTBUG-114898
Pick-to: 6.5
Change-Id: I7760985032f342da4165cdb7573d4cfe5369ae03
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 518ac20dcb3cebf0956a399f40cbf51e9f3c188e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-28 08:00:17 +00:00
Assam Boudjelthia
f0b9a812f0 AndroidTestRunner: split androidtestrunner output retrieval failure log
To make debugging easier, print a log for each step in the test
output retrieval process instead of one error message that cover
multiple potential error cases.

Task-number: QTQAINFRA-5928
Pick-to: 6.5
Change-Id: Ia68c15e34cf4b0f8e2b0d351af785bb753807721
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
(cherry picked from commit 9d830f4591528632ab33de1fcddec710fbab6e9f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-28 08:00:11 +00:00
Assam Boudjelthia
37c29fca7d Android: Register a default keyboard
When QWindowSystemInterface::handleKeyEvent() is called under
QtAndroidInput's keyDown() JNI native method callback, it throws
the following warning:

 W Gallery : QObject: Cannot create children for a parent that is in a
different thread.
 W Gallery : (Parent is QGuiApplication(0x707968a2e0), parent's thread
is QThread(0x70d6477280), current thread is QThread(0x70d18ff790)

when no keyboard QInputDevice has been registered, this behavior is
present at least on Android Emulators.

Task-number: QTBUG-46412
Fixes: QTBUG-106928
Fixes: QTBUG-118421
Change-Id: Iec1c6e3a599e1e553d049df3021653a0d4197e7d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit d48e81f7a46e7cf968fa5bc88296eb8de8dc77c5)
2023-11-28 08:00:05 +00:00
Christian Ehrlicher
25d0afd3f9 QApplicationPrivate: remove unused wheel_scroll_lines
wheel_scroll_lines is no longer used so it should be removed.
Superseded by QPA/WheelScrollLines.

Change-Id: I98fa58d5ad32d26ce3b8b8068b244a5a1789ad4f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit dacd0f457443b4f040a78870ebf51997fcbee722)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-27 18:59:48 +00:00
Morten Sørvig
ef1e2fdaa4 wasm: manage wakeUp state correctly
We were losing wakeups in cases where wakeUp() was
called during processPostedEvents(), since wait()
was unconditionally resetting m_wakeUpCalled.

Fix this by setting m_wakeUpCalled to false before
processing posted events, and then checking if it's
still false before waiting.

We don't hold the mutex while processing events so that
can still race with wakeUp() calls, but this should
now be harmless since at worst we'll spin and check
for posted events one extra time before waiting.

Pick-to: 6.5
Fixes: QTBUG-118416
Change-Id: I0183747c4d1f128bb6a46ba9c68f4eeb4d35a138
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 55ce50cf4dd3c1d1dac8c5d938ed587be4d4b4cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-27 18:59:48 +00:00
Christian Ehrlicher
037aa20b37 QPpmHandler: fix reading ppm files
The ppm spec allows 1-bit ascii ppm files to have no spaces bitween the
single bits. Therefore we have to adjust read_pbm_int() to stop after
reading one digit.

Fixes: QTBUG-119239
Change-Id: I161038076c5dee4662aa66a1215822fc75e6a19e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 975b3d5d530b647ba665459bef2fb3ee6ab5ccc1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-27 18:59:48 +00:00
Morten Sørvig
901515fe03 Fix off-by-one surface pixel size on Android
m_window->size() may have been rounded for devices
with DPI which results in a fractional DPR (e.g.
650 DPI / 160 DPI = 3.5 DPR). In this case scaling
by devicePixelRatio does not give the correct result.

Instead, use QPlatformWindow geometry and DPR to determine
the device size, without using the (possibly) rounded
device independent window size.

Fixes: QTBUG-87334
Pick-to: 6.5 6.2
Change-Id: I280236a06516cdb2a1a259fd0cfa8084c1ce7f46
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 96d0f2af75aa069f2b6973a621b3bf6ebaafc9a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-27 18:59:48 +00:00
Tor Arne Vestbø
81f9c77c3c Apple: Use namespaced category name sandbox helper
Pick-to: 6.5
Fixes: QTBUG-119338
Change-Id: I8a62b3fff0c1f3de2b6ae3332f6a1ecc7b1561e5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit c8cd9017f6c9696d79c3e7b7f0b71748839c263f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-27 18:59:48 +00:00
Mårten Nordheim
d3def622ea QLocal8Bit::convertToUnicode[win]: Pre-2Gi changes
Prepare the code for the upcoming changes to support strings longer
than 2GiB.

We will have to loop from start to end, and increment the pointer
whenever we succeed, rather than assuming there is a single success
before we return.

This also means the error-handling code goes into an else-branch and
gets indented.

Pick-to: 6.5
Task-number: QTBUG-105105
Change-Id: Ibe49cc661f582fd54ce36ad466cf798a62b5c4c6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e579cdceb8b54fea02c1ed9bfae8b5ef74902270)
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-11-27 19:59:48 +01:00
Mårten Nordheim
d6cdaa1c6b http2: Fix authentication code and race
By attempting to get credentials and potentially emitting error
during header parsing we may not have gotten the DATA frames yet
which would leave us emitting error() and finished() without any
body.

Pick-to: 6.5 6.2
Change-Id: Ibc5fb78193af80ddabaca2c9e4149bbcac9789a1
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit fe1b668861e8a3ef99e126821fcd3eeaa6044b54)
2023-11-27 19:59:48 +01:00
Edward Welbourne
14f5eaaf58 Implement a TODO: cache the list of MS TZ IDs
The MS TZ-backend's lookup of available Windows IDs included a TODO
advocating caching the result, since it is unlikely to change at
runtime. Given that MS's time_t functions don't believe in times
before 1970 and two-digit year parsing (such as the ASN.1 parser does,
apparently many times, during SSL handshakes) assumes the 1900s (and
certs in use today have mostly been issued this century), SSL involves
DTP falling back repeatedly to lookups of local time's offsets from
UTC (before it discovers it shouldn't have been using local time
anyway) via the system timezone object, this cacheable list can be
accessed many times. (A user has reported thousands per SSL socket
created.) So let's implement that TODO and trust that updates to the
registry's set of available zones aren't a common occurrence at
runtime.

Pick-to: 6.5
Change-Id: Iefe235c71da1bf5c3372c52dba89ad0657e06c0b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d59e539b3a1252aa22783c4fdf1e22b35e5a4292)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-27 13:44:01 +00:00
Alexandru Croitor
170d903a7e CMake: Fix doc building when current prefix is different from original
When qtbase + qtools is built with -DCMAKE_INSTALL_PREFIX=/opt/foo
and then qtsvg is built with -DCMAKE_INSTALL_PREFIX=/
building docs will fail to find the installed .qdocconf files with an
error like:

 qtsvg/src/svg/doc/qtsvg.qdocconf:1: (qdoc) error: Cannot open file
 '//doc/global/qt-module-defaults.qdocconf': No such file or directory

That's because we pass QT_INSTALL_DOCS=/ (pointing to the new prefix)
as an env var to qdoc and it uses that to try and include various
qdocconf files.

Instead of passing the currently specified CMAKE_INSTALL_PREFIX, use
QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX which points to where
qtbase was installed (and thus all previous .qdocconf files).

This was already in the code but we preferred CMAKE_INSTALL_PREFIX
when it was set, so just remove it.

Change-Id: Ibe326132b9504341fa998d9e772ea2bea79727c0
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 72be53ca28905f49973767677ad18af7c4208740)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-27 08:29:39 +00:00
Christian Ehrlicher
62f32c7e18 QCommonStyle: Adjust painting arrows in high-dpi mode
PE_IndicatorArrowUp/Down/Left/Right was drawn using integer coordinates
for the three edges which lead to artifacts in high-dpi mode. Fix it by
using QPointF instead.

Fixes: QTBUG-114539
Change-Id: I03cbff2ef789e8cee0f3a0d84138d94516340669
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3936d254ca0e7259cd97238c31df8413d03fd475)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-26 21:45:18 +00:00
Ahmad Samir
55e6822bc8 Fix a compiler warning (GCC 13.2.1) -Wpessimizing-move
src/testlib/qpropertytesthelper_p.h:204:38: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
  204 |     if (std::unique_ptr<TestedClass> helperObj = std::move(helperConstructor())) {
      |                                      ^~~~~~~~~

Amends f5a5c59918021b0bf9a43e6130df2a3f02ea5b97.

Pick-to: 6.5
Change-Id: Ie050aa4294289df34347c8f6cbcdce7ff2b784a9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 6335685a1b4b16d179264d27227881cffcf9cae9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-26 11:52:57 +00:00
Thiago Macieira
f2dc25239e QCborStreamWriter: correct the QCbor{Array,Map} size limitations
Increased due to qsizetype.

Pick-to: 6.5
Change-Id: I85b3fc2dd45c4693be13fffd179662c8b898fb79
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 1261fa7654a827793a1f73b25e783ade32d47cfc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-25 02:27:17 +00:00
Giuseppe D'Angelo
28bdd104fd OpenSSL: remove support for 1.1
OpenSSL 1.1 reached EOL last September [1]. We will only support
OpenSSL 3.

Cherry-picking aggressively, as there's no purpose at keeping maintained
Qt versions work with an unmaintained library given the security
implications.

[1] https://www.openssl.org/blog/blog/2023/09/11/eol-111/

[ChangeLog][QtNetwork][SSL] Support for OpenSSL 1.1 has been dropped. Qt
now only supports OpenSSL 3.

Change-Id: I51a231a9ca17804739acbd2f22c478d2a8ff9b3b
Fixes: QTBUG-119330
Pick-to: 6.5 6.2 5.15
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit d201c0a2184881a226bce76528047707e9062856)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-24 23:48:48 +00:00
Fabian Kosmale
a8c1c38f94 Moc: don't stumple over inline namespace in more places
Ignore the 'inline' in case of nested namespace with another
nested inline namespace.

Amends 5222df2be7d10bf44dfc2971774eadcb526b7a13

Fixes: QTBUG-117765
Pick-to: 6.5
Change-Id: I87f2649606f63c818f225f8cc5ec914920763c5f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit d39353085e4079ca1eadd787039f7746335225e8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-24 10:02:44 +00:00
Thiago Macieira
580969bcbe IPC: Un-deprecate the "legacy" key API
This the API that has been around since Qt 4.5. We decided not to
deprecate them individually. Instead, we'll deprecate the whole class.

Change-Id: Ia930b1a2ed1e465a826ffffd179a1b7b3250fd89
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 905593a40b6e161189ab3da663d037f0b47e04b0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-24 04:32:06 +00:00
Christian Ehrlicher
59a2d5bdba SQLite: Update SQLite to v3.44.1
[ChangeLog][Third-Party Code] Updated SQLite to v3.44.1

Pick-to: 6.5 6.2 5.15
Change-Id: I156472b14dcf37b8632b948118ef95e62cf0118e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 11d82002491ab0b1499aa715382928db7d52cff8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-24 00:28:33 +00:00
Lauri Pohjanheimo
c6a86b6164 Fix Japan locale not showing japanese fonts correctly
Fallback font determination did not take locale into account when
Japanese locale was used. Android devices show Chinese fonts instead.
Fixes the problem by prepending japanese defaut "Noto Sans Mono CJK ..."
type font before other fonts. Does same for Chinese and Korean locales.

Fixes: QTBUG-111528
Pick-to: 6.5 6.2 5.15
Change-Id: I70994c0059c3819eeb09dacb9bbe6634490ecf37
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 476e8f8aef52592d3908b9d5cf6711af7a7d631d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-24 00:28:33 +00:00
Axel Spoerl
2c58f1770a QMesageBox: add Q_ENUM and sync assertions
Add Q_ENUM to StandardButton and ButtonRole.
Add static assertion to enforce sync with QDialogButtonBox.

Task-number: QTBUG-118489
Pick-to: 6.5
Change-Id: I38a7367d6287ab7fa5e5ca0c94ea6daa0f95fc52
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 773f9ab0189bbb439c3066695c947b11a20c484f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-23 17:58:42 +00:00
Christian Ehrlicher
b141b20668 QTabBar: properly calc tab positions when changing tab position
When changing the tab position, the scroll offset is calculated wrongly
because the calculation is done before the size of the tabbar is
recalculated. Therefore wait until QTabBar gets the resize event and
calculate the new tab positions there.

Pick-to: 6.5
Fixes: QTBUG-119366
Change-Id: I261a91bb584409b9b0dac4339a32894f47540bcf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 1082038bd89d0bbba4df0d9b3f8af3cd0a2f96f2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-23 16:05:17 +00:00
Jan Arve Sæther
3bdf033458 a11y: Fix bug where some characters were not spoken while moving cursor
The problem occurred when we moved the cursor to the penultimate
character of the string, because the boundary condition was wrong. It
is important to realize that the offsets are moved *between* each
character (and also before and after the whole string), just like you
would move a cursor. This means that the offsets can be in the range

  [0, len]     (closed interval)

The problem could only be reproduced with JAWS.

Pick-to: 6.5 6.2
Fixes: QTBUG-115156
Change-Id: I0c5f05fa391e6c7744ab22d71afe8904b49e89bc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
(cherry picked from commit bc8141d286727e7c7b21d61556852ee78acd56c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-23 16:05:12 +00:00
Alexandru Croitor
72e04df0d6 wasm: Fix compilation failures when not using precompiled headers
Various headers files were missing includes. Compilation only worked
because precompiled headers were used.

Pick-to: 6.5
Change-Id: Ic1b434da53f89d4b4207a22bf171bd966db856ac
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 1126a590f92b2642d52d51787c4bee8866f1b685)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-23 11:11:48 +00:00
Christian Ehrlicher
92fea25e96 QComboBox: don't eat non-printable key strokes
QComboBox in non-editable mode passes all keyboard input to the internal
item search. This was done regardless if the character is printable or
not and therefore e.g. '\t' composed by Key_Tab + ControlModifier was
accepted and not passed to the parent (in the bug report to the
QTabWidget which could not switch tabs due to that).

Pick-to: 6.5
Fixes: QTBUG-118605
Change-Id: If39423587460a70231c735df4912b72c5ae77475
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1ffd12a8dc783b8e0806b839a3015b4fb9298bad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-23 10:33:37 +00:00
Axel Spoerl
3033e78033 Refactor tst_QDockWidget::closeAndDelete()
The test function was temporarily blacklisted on Ubuntu, but also
failing on other Linux platforms (e.g. openSuSE).

It tested, whether closing all dock widgets and the main window, would
close the application as well. It used one single shot timer, to close
the windows and later one to check, whether the application was shut
down.

While that mechanism must work in an application environment, it is not
guaranteed to work in testlib. More specifically, I could happen that
the XCB / glib event loop continued to spin and wait for events.

=> Check the signal QGuiApplication::lastWindowClosed() instead. If the
signal is fired, it is proven that all windows have been closed and
the application would quit in a production environment.

The underlying test case was: Application didn't quit with the last
dock widget closed, because there was a dangling
QDockWidgetGroupWindow.

=> finally: Clean up BLACKLIST

Pick-to: 6.5
Change-Id: Ic5fde5967fc8dde70ab64dc30cc7367c908b5c51
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0b10b7476cf9d41086063ec49555425c6871041c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-23 01:38:10 +00:00
Laszlo Agocs
9c9bb25c72 rhi: d3d12: Try without debug layer when failed
This matches what the D3D11 backend does: if the debug device (D3D11) /
debug factory (D3D12) is not available, we retry without the flag and
if succeeded, continue without the debug layer while printing a log
message. This way create() succeeds even when the debug layer is
requested but is not available at runtime (because the necessary SDK
or Visual Studio components are not installed, which can happen
on an end-user PC not set up for development)

Task-number: QTBUG-119240
Change-Id: I02e3bf45728e74b8fe196e880372f584de7aa5d2
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit 1248979968435c9d35db4c5ca53282a31f40bb51)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-23 01:38:10 +00:00
Tor Arne Vestbø
7524899cf2 Disable tst_ForeignWindow::embedForeignWindow() null-parent check on Linux
It's flakey, so let's unbreak the build while we investigate further.

Change-Id: I9f7559803dd3ebc80946e5e5c5d31292101cd36f
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit b232af95838a5a4321b52c1d6ba4af1426fc8f3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-23 01:38:09 +00:00
Volker Hilsheimer
3cec57d9c4 Mime type conversion: clarify and clean up documentation
The converters need to be instantiated (which implicitly registers)
after QPA has been initialized, i.e. after QGuiApplication has been
instantiated. Clarify this in the documentation of the types.

Remove the dead documentation for the explicit registration function.
The API does not exist, and the documentation was never generated for
Qt 6 either. The function does not need to be called as long as new mime
converters are instantiated correctly (after QPA was initialized).

Pick-to: 6.5
Task-number: QTBUG-119216
Change-Id: I4e31b3773e88f7a6d579265f093bab46847cb028
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 0b60450eeeae0d6b3b5cf62e2684134984929c4c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-22 21:26:56 +00:00
Volker Hilsheimer
e1b5baa21c Blacklist tst_QGuiEventLoop::processEvents on QNX
The test log shows flaky failures of this test several times a day on
QNX, so blacklist it.
To do that, we need to be able to isolate the "GUI" mode of this test.
To do that, add a single data tag that depends on whether the test
project is built for GUI or Core, and blacklist only the "gui" data tag.

Task-number: QTBUG-119359
Change-Id: I91c2380de0a3febedcf781f27fed4a1fa6aa5515
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit d2c6e9ab99f3c4ad6f9b896e0684b0369d5e944d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-22 20:15:53 +00:00
Eskil Abrahamsen Blomfeldt
ab868f18b0 doc: Remove outdated comment about DirectWrite
Qt 6 does not support any Windows versions without DirectWrite
and no special configuration flag is needed to build it anymore.

Pick-to: 6.5 6.2
Change-Id: I6553c4d1c70e5616f8cb3ec8fe6343c600a74462
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 4162a46378528e21ca443dba2e5fdf68596af809)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-22 20:15:52 +00:00
Vladimir Belyavsky
10d88ca9db QTest: make failOnWarning() functional on temp objects destruction
We need to be able to handle warnings that may occur when temporary
objects, that were created in a test function, are destroyed.
For example, now we miss all warnings that might be triggered from
the object destructor, if the object's deletion was delayed (e.g. via
deleteLater()). Also we miss all the warnings that were triggered on
the test's cleanup() call.

To fix this we need simply move QTestLog::clearFailOnWarnings()
from QTestResult::finishedCurrentTestData() to the later stage,
i.e. into QTestLog::clearCurrentTestState() which is actually called
in appropriate time from QTestResult::finishedCurrentTestDataCleanup().

Same for QTestLog::clearIgnoreMessages(), since they are interrelated,
so we need to clear them at the same time.

We need this change for QML tests in particularly, to be able
fail on warnings that might be triggered from Component.onDestruction()
of some temporary test object.

Pick-to: 6.5
Change-Id: I58a57691f20761619f56bd1bea3a862f2c26f569
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 18aa36cf878a52b8fe991392098e9445c3d3bfe3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-22 20:15:51 +00:00
Jaishree Vyas
90ff2bc5c6 Improve the documentation of compare() overloads for string-like types
Also update the QCollator::compare() docs for consistency.

Pick-to: 6.5 6.2
Task-number: QTBUG-114822
Change-Id: I5fca896cacedd93ce5a4a1a8aead1986a21f6993
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 19b17667da951799506abbb9cc7dc29c724b22c1)
2023-11-22 14:21:02 +01:00
Piotr Wierciński
18ff5201c9 wasm: Respect maximum window size in QWasmWindow
Currently we are only checking if windowMinimumSize is not violated,
and we dont check windowMaximumSize at all, which may results in
windows being bigger than they ought to be.
When the sizeHints are updated, call the setGeometry() function which
makes sure that size constraints are respected and will resize window
if needed.

Pick-to: 6.5
Change-Id: I703bddec85ba6e02eea74a39e06d1f70d59e1677
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 969bef94549d5bceacd68f7524ce9122d5c7ccae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-22 13:21:02 +00:00
Christian Ehrlicher
b1d277ddfd QDockWidget: use pmf-style connect syntax
Use pmf-style connect syntax for the three connections within
QDockWidgetPrivate.

Change-Id: I091a210d6a822903f0cc183f9090e03b124875e6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 7b96f3934c0a4331c4ca7bd4521b945f81a8ed21)
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-11-22 07:46:51 +00:00
David Faure
66c0f88ff6 QDBusConnection: output error message from findSlot
This helps debugging why an adaptor's method fails to be called.
Example output:
QDBusConnection: couldn't handle call to LaunchCommand: Type not registered with QtDBus in parameter list: QByteArrayList

tests/auto/dbus/qdbusmarshall/tst_qdbusmarshall shows many warnings
after this commit, since it's testing many cases of "no such slot".

Pick-to: 6.1 6.0 5.15
Change-Id: Ic4ddcd91d005555a02d531fc8960aea2c809e20b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6ea2a12e27ecf5ab2190c33ca66ab08f23c72350)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-22 07:46:51 +00:00
Volker Hilsheimer
90b033d777 macOS: Don't crash when starting a drag with empty mime data
As with all drag'n'drop code, we can't auto-test this as the test would
enter a blocking event loop.

Task-number: QTBUG-119216
Pick-to: 6.5
Change-Id: I7bab4a4fe7f5b315cdaec61636ded6186d9f75b4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 09afa7575276d7b500f17671a1ca9ca677767b44)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-22 07:46:51 +00:00
Friedemann Kleint
9d1cf49872 QWin32PrintEnginePrivate: Properly initialize flags and fields of DEVMODE
- Set the respective flags of dmFields in
  QWin32PrintEngine::setProperty()
- Properly initialize newly allocated structs

This is merely for completeness, the allocation code paths are
not currently hit since the DEVMODE from the current printer is
used, which also has most dmFields bits set.

Task-number: QTBUG-114604
Change-Id: I880d9faef9b1d491db4accd53d0d75b718f7f244
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit dc7eb46352374f811841fda87c58c7dc1d52d787)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-22 07:46:51 +00:00
Friedemann Kleint
6b8c573422 QWin32PrintEnginePrivate: Brush up the code
- Use nullptr
- Use member initialization
- Remove C-style casts

Task-number: QTBUG-114604
Change-Id: I6f9519010bfbd7c5afa07d9a8752b40c3b29673e
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 9f7d2fc7f96fff0c8adc8c815a8cd9850073bd7b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-22 07:46:51 +00:00
Alexandru Croitor
14c4da28f1 configure: Make sure the configure script exits with cmake's exit code
The configure script always returned exit code 0 even if the
underlying cmake call failed. Make sure to exit with the same exit
code that the cmake process does.

[ChangeLog][Build System] The configure script on UNIX systems will
now exit with the same exit code that the underlying cmake process
exited with.

Pick-to: 6.5
Change-Id: I2cb43e162bb96f4e60320522895aac9bb5c5bc9e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 2dc0c01449c0c55468957f7553813ca7f97989d4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-22 07:46:51 +00:00
Tor Arne Vestbø
7e34539e75 macOS: Guard QCocoaWindow access when handling application activation change
The platform window may in some cases be gone, without its NSWindow yet
being deallocated, and if we receive an application activation event at
this point we would try to dereference a null-pointer.

Fixes: QTBUG-119219
Pick-to: 6.5 6.2
Change-Id: I72bb2482059d1a256e448705b132e4a8f22ec297
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 778acfe122baf5a65c1001e78050f333106a840d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-22 07:46:50 +00:00
Tor Arne Vestbø
d1e7e4b02c Stabilize tst_ForeignWindow::embedForeignWindow()
We only care about no longer being a child of the old parent window,
not what the system does when we reparent to nullptr.

Change-Id: Ibd670432f0fd2595195d3951014a570dfdb7a998
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 340b9729953faa12ed889630ffb9f2eeca228649)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-22 07:46:50 +00:00
Alex Henrie
9ceb7cb555 QMimeDatabase: handle buggy type definitions with circular inheritance
This fixes an infinite loop reported by a user who had both the
definition of text/javascript from shared-mime-info 2.3 and the
definition of text/javascript from shared-mime-info 2.4 installed at the
same time. In 2.3, text/javascript is a subtype of
application/ecmascript, but in 2.4 application/ecmascript is a subtype
of text/javascript. Having both at the same time resulted in circular
inheritance.

https://gitlab.freedesktop.org/xdg/shared-mime-info/-/merge_requests/258#note_2167707

[ChangeLog][QtCore][QMimeDatabase] Added code to detect and break
circular inheritance loops in the MIME data, which were causing infinite
loops

Pick-to: 6.5
Change-Id: Ic207b1593a49c7bb88e4fd810d8f88aa630087ce
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 54656da9ace06caf4a0eeb1832989c0ab211a4a0)
Reviewed-by: Alex Henrie <alexhenrie24@gmail.com>
2023-11-21 16:14:58 -07:00
Jan Arve Sæther
7608a0be37 QGuiApplication: Fix condition for when doubleclick events are triggered
QGuiApplicationPrivate::processMouseEvent() requires the following
conditions to be met in order to trigger a double click event:
1. The same button should be pressed (kept in mousePressButton member)
2. The time between two press events should not exceed doubleClickInterval
3. Movement between presses shouldn't be bigger than doubleClickDistance

Unfortunately, when we are processing *synthesized* mouse events (from
touch), in order to check criterion 2) we cannot rely on
QPointingDevicePrivate::pointById(0)->eventPoint.pressTimestamp();
because this was already updated in QGuiApplication::processTouchEvent(),
so it does not any longer reflect the *previous* press timestamp, but
the current one.
Therefore we could not reliably calculate the time between the previous
press and the current press (in fact, it never exceeded the
doubleClickInterval condition)

I suspect this occurs with all touchscreens, but at least it was
reproduced with e.g. a NVIDIA Terra / Thinkvision touch screen on
Windows 11 and Dell Express SVC touch screen on Windows 11.

=> Since QGuiApplication is a singleton, add a static local variable to
remember the time stamp of the last processed press event.

Autotesting has been modelled in PS7. However, QTest::touchEvent is
unable to synthesize hardware specific detection latency and stray
touch events, which actually reproduce the issue.
=> Not adding an autotest.

Fixes: QTBUG-112479
Fixes: QTBUG-119032
Fixes: QTBUG-100688
Pick-to: 6.5
Change-Id: Idc97fb9d49ed334f56d702d420451fc062e9b5a9
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 4bb230f65e9e27984479c07288a71797c8651b66)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-21 23:14:57 +00:00
Marc Mutz
5eee84bc9f QPartialOrdering: mark isOrdered() as const
Because it is.

Amends 405244fe301ac18d20aae245ba2faafaec74e453.

Pick-to: 6.5
Change-Id: Icc7bb1a000e89b63254ca5c306325d01603eb1d4
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ccc46d8f89226b6a89f7c1a63e44d4605483b1cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-21 23:14:57 +00:00
Kai Köhne
97978d8b0c Doc: Fix highlighting of serialization converter example
Example got renamed in a9c47dde501d0e

Pick-to: 6.5
Task-number: QTBUG-117220
Change-Id: Ia0f04332b189c163c6da38eee2aded4837512376
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 68bbbe28b2642e50da9c3ed2b0cb027224062012)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-21 10:57:50 +00:00
Matthias Rauter
f1b35da63d Refurbish the shaped clock example
The shaped clock example has the appearance of the analog clock, which
was refurbished with 619ec1a6406a8be7bfa9d96b9e693e7a3323d8dc. This
change applies the refurbished design to the shaped clock.

Task: QTBUG-118871

Change-Id: Ibcfc8e9fb239a1c6f7ea685f6cab1e50b2060a53
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f6e7fdd4ad868e5d17ffa7502ed934985df938a6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-17 22:36:47 +00:00
Jøger Hansegård
d9784148cb Remove ambiguity in handling of registry keys from setupAPI.h
QWindowsScreen uses setupAPI.h's SetupDiOpenDevRegKey function to read
EDID data for monitors. This function is documented as returning
INVALID_HANDLE_VALUE in case of failure.

The QWindowsScreen code was ambiguous in the sense that it considered
both nullptr and INVALID_HANDLE_VALUE as being invalid handle values.
This inconsistency is likely not a bug, but makes the code harder to
understand.

This patch removes this ambiguity, and QWindowsScreen now follows the
documented behavior when SetupDiOpenDevRegKey fails. In addition, we
replace use of unique_ptr with the new QUniqueHandle template class
because HKEY is a handle type, not a regular pointer type.

Pick-to: 6.5
Change-Id: Ia863bda504077e59833f6f7a0f855e7915e4edd9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 55141c59cdc9144cd3aa9f5085df9db523f54736)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-17 22:29:13 +00:00
Rym Bouabid
f0130fd591 Doc: Improve documentation for QObject::findChild
There is a difference between findChild() and findChild("") that was
not explained in the documentation. So, add a sentence to clarify it.

The object's search when there are several direct ancestors was
documented as "undefined". Change it to "first child in children()".

Task-number: QTBUG-103986
Pick-to: 6.5
Change-Id: I25cb01b87d3b24af498ad494b3f353840ee78807
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 80cdd4e5bbe15ef3235b1269b3781f8e4b19a5fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-17 22:29:10 +00:00
Liang Qi
0abe21de9d xcb: only set base size when it's valid
In rare situation, base size could be (-1,-1) or (-2,-2) for high
dpi, it will be converted into huge positive numbers.

https://tronche.com/gui/x/icccm/sec-4.html

If a base size is not provided, the minimum size is to be used
in its place and vice versa.

Pick-to: 6.5 6.2 5.15
Task-number: QTBUG-117702
Change-Id: I900ed82f2291fb454d7e34a0dee27459d0a57240
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 25720f5a6365125d77400a26f11dbcfc950e5c5f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-17 21:32:37 +00:00
Morten Sørvig
91b6436de8 Don't update DPR on de-expose events
There is no need to run the catch-all DPR update if
the window is not visible.

Fixes: QTBUG-117762
Change-Id: Ib4e235fed4b21e5aa2ecafa960ab0900e2b68295
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 299dfef52c0cc12de223798c5a100350c0622acb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-17 21:32:35 +00:00
Axel Spoerl
567bd61dbc Remove bool trap in QDockWidgetPrivate::endDrag()
endDrag(false) meant to end a drag with a dock location change.
endDrag(true) meant to abort a drag without a dock location change.

Replace this with a meaningful enumeration.
Define a dummy enum for builds w/o QDockWidget.

Task-number: QTBUG-118578
Task-number: QTBUG-118579
Pick-to: 6.5
Change-Id: I786f4210f5a3ee67ffcf0dc9285f77a480148569
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 17372faf3f5e4a9c2577007ed5b38275e64bad89)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-17 21:18:13 +00:00
Ahmad Samir
3327a8bab8 QMdiArea: fix initial single-sub-window in TabbedView
This is somewhat of a corner case, where there is a single sub-window,
setViewMode(TabbedView) is called before addSubWindow(), and the latter
is called before show(). The sub-window would be active, i.e.
subwindow->d_func()->isActive is true and QMdiArea::aboutToActivate() is
emitted, but QMA::emitSubWindowActivated() is never called for that
sub-window, resulting in that sub-window shown as
unmaximized/with-a-title-bar instead of as maximized/tabbed as is
expected in TabbedView.

Pick-to: 6.5
Fixes: QTBUG-114188
Change-Id: Ia7b2cfd07c51867707866a1f99f70129bbdc0e3e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit c94bcecb22bce80101de79f4b3c0aff143ff34b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-17 21:18:12 +00:00
Joerg Bornemann
f68df3ff34 Fix running CMake test projects in prefix builds
Consider the following situation: There are CMake tests in
qttools/tests/auto/cmake that configure and build CMake test projects,
essentially as external projects. One of those test projects does
find_package(Qt6 COMPONENTS LinguistTools). This call fails in a prefix
build, because Qt6LinguistToolsConfig.cmake is not installed yet. It
merely exists in qttools-build/lib/cmake/Qt6LinguistTools.

We must adjust CMAKE_PREFIX_PATH to be able to find Qt6LinguistTools. We
also must adjust QT_ADDITIONAL_PACKAGES_PREFIX_PATH to be able to find
the LinguistTools component of the Qt6 package.

Use the prefixes setup from the support for building examples as
external projects and use it for CMake test projects as well.

Task-number: QTBUG-84884
Change-Id: I1bd5d5084cf931196bdb014cd75ca7578cd9decb
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit ba9623860056cbb75e426e27905f9c29b687cefa)
2023-11-17 22:18:09 +01:00
Axel Spoerl
de5925b159 QDockAreaLayout: implement widget based add() and remove()
The item_list of a QDockAreaLayoutInfo has abstraction methods for
reading the item list. Adding to and removing from the item list is
done directly, by using the QList api.

Implement an abstraction, that takes a QWidget *.
The argument may either be a QDockWidgetGroupWindow or a QDockWidget.

Task-number: QTBUG-118578
Task-number: QTBUG-118579
Pick-to: 6.5
Change-Id: Ib2ccd7557a21a43b68f184fe4575018f2a97004b
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 2c96f517714eb67a9af821141a90eed68b8714ed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-17 07:45:37 +00:00
Axel Spoerl
65f59d96c7 QMainWindowLayout: remove redundant #ifdef'ry
Remove #if QT_CONFIG(dockwidget) nested within each other.

Pick-to: 6.5
Change-Id: I6c662909676ffada3ac52e41a9c2d8b9fd491689
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 0e435b7f13619106d61c9701e53803d3c488fea3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-17 07:45:32 +00:00
Axel Spoerl
b8879bb17b QDockWidget: call raise() when a dock widget starts to hover
When dock widget (1) starts to hover over another floating dock
widget (2), the latter animates a rubber band, to indicate to the user
that it is ready to accept a drop.

The creation of a QRubberBand moves (2) one position up in the Z order.
The consequence is a visual glitch: While
- the mouse cursor dragging (1) is still outside (2) and
- the visual rectangle of (1) starts overlapping (2)
(1) hides behind (2).
As soon as the mouse cursor enters (2), (1) suddenly comes on top and
(2) hides behind (1).

=> raise() 1 as soon as it starts hovering. That brings it on top of
the Z order, which is expected behavior.

Pick-to: 6.5
Change-Id: I1140fc6ff109c7a713e7e2617072698467375585
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 1ab91b7bdbcced6ea4cc176da1d18e6b789208ae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-17 07:45:13 +00:00
Axel Spoerl
cb465195f1 QDockWidget: Always show dock widgets with the main window
QMainWindow::show() also showed its dock widget children. When a main
window with dock widget children consumed a show event for another
reason, hidden dock widget children remained hidden.

If a dock widget application went to the background, e.g. because it
was hidden behind another application gaining focus, a klick on the
dock widget application's app icon would not show its dock widget
children. Unless the dock widget application provides shows them
explicitly, they can never been shown again by the user.

=> show all dock widget and group window children, when QMainWindow
consumes a show event.

Pick-to: 6.5
Change-Id: I7e8b59f021ec4ec5679d0d08d0eeda1e3225a385
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 4c60a11d8f935abb762a83b0ab99cefa6db3060c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-16 23:49:25 +00:00
Matthias Rauter
ee0ec5df23 Refurbish the clock example
Fixes: QTBUG-118871
Change-Id: I0a1a6444cb381d49adbc39e73d7862c9cfe61dce
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 619ec1a6406a8be7bfa9d96b9e693e7a3323d8dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-16 19:05:30 +00:00
Tor Arne Vestbø
33584b7572 macOS: Always place input panels at NSPopUpMenuWindowLevel or above
Implementing NSTextInputClient.windowLevel to return the level of the
current input client window is not sufficient, as there may be other
windows visible with a higher window level than that.

For example, QCompleter's completion is shown using a Qt::Popup
window, which has a NSPopUpMenuWindowLevel.

Ideally we'd hide the QCompleter's completion when the IM is
in the process of compositing, but as a first step, and as
safeguard for other similar scenarios, we now return a minimum
window level of NSPopUpMenuWindowLevel for our text input
client.

Fixes: QTBUG-102831
Pick-to: 6.5 6.2
Change-Id: Id74a6350595bd136027a9af470f6700ee90f52a7
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit cc4834c0b975300e9405fa001f917199dd41139c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-16 19:05:30 +00:00
Ws ShawnWoo
e5b46f3ea7 macOS: Implement NSTextInputClient.windowLevel
Without this optional NSTextInputClient method the input methods
will assume it's safe to place the input panel somewhere above
NSFloatingWindowLevel.

But our NSWindow level can potentially be higher than that, if
set via QWindow::setFlags(), or directly on the NSWindow.

In practice this can be observed by setting a level higher
than kCGDockWindowLevel on the NSWindow.

Account for this by returning the true window level.

Pick-to: 6.5 6.2
Change-Id: I77d9ac3c59e2f6de9b768c7519b2bc0f1e5fda1d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 709d2848e1d33be70c2b9a9ff0219a3bba1a5114)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-16 19:05:30 +00:00
Tor Arne Vestbø
1c207ae1c5 macOS: Work around [NSApplication setWindowsMenu:] out of bound access
The implementation of [NSApplication setWindowsMenu:] seems to look
for the last item in the menu, but doesn't guard the check for the
menu having items. Instead it guards on another array being non-empty,
and in some situation this array has items of type NSWindowMenuItem
while our window menu is empty (FB13369198).

To work around this we insert a hidden dummy item into the menu.

Fixes: PYSIDE-2525
Pick-to: 6.5
Change-Id: Iaa9dbc9454249f4eb34f8a338d0cc23685f0025a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 0a0f7b864b0902fcedcc8cd26dd28779d36242ff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-16 19:05:30 +00:00
Tor Arne Vestbø
d6cc0fbd57 macOS: Take window mask into account when computing QCocoaScreen::topLevelAt
Although not explicitly documented, this is the behavior in practice
on XCB and Windows, and we rely on this behavior in our implementation
of QApplication::widgetAt(), where we punch a temporary hole in the
widget using a mask if it has Qt::WA_TransparentForMouseEvents set.

Pick-to: 6.5
Fixes: QTBUG-41696
Task-number: QTBUG-119092
Change-Id: Ie7abc31b6930ee6b56fcdf391befc625c1ddf502
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 189f9873ae3f23377708fbf9880398fd6a078715)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-16 19:05:30 +00:00
Liang Qi
eb7df2d77b xcb: update WM_TRANSIENT_FOR on transientParent native window recreation
It follows f9e4402ffeef791e66b7b2f2cc332000df7f5cd4.

Fixes: QTBUG-105395
Pick-to: 6.5
Change-Id: I399c448517b7dbdc28ba33f75ae43102836a8998
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f2c5b846e092270e1f43b0625db26789a5f77ba6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-16 19:05:30 +00:00
Michael Weghorn
d79e52be22 a11y atspi: Ignore malformed text attr instead of crashing
If the attribute does not follow the required
"name:value" syntax, ignore it, rather than crashing
if it doesn't contain any colon.

Same issue as spotted by Jan Arve Sæther during the review
of a QTBUG-118106 related change that would have introduced
the same issue in UIA code.

Pick-to: 6.5
Change-Id: Id391502ed7aec7f09ef2826a456f2e4737af045e
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit b0bcf475694114bf503167bd11f14647880cd6b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-16 19:05:29 +00:00
Alexey Edelev
5e5e5911e0 Make sure we initialize moc rcc and uic for manual test targets
If manual test target is created using the standard Qt API but not
qt_internal_add_manual_test command, we need initialize autotools
for these targets. Add the generic functionality that ensures that
autotools are inialized for all manual tests.

Pick-to: 6.5
Change-Id: Ic048760390174d1be2f01096d70e84458f1c870f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 1c82e92202c8c359872c08095670c121602094b8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-16 19:05:29 +00:00
Liang Qi
42338ad4b9 xcb: make QXcbWindow inherit QObject
Pick-to: 6.5
Change-Id: I418305f1e66bdf90b8bda724976916e320012961
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5896314ff3e46849b6ff7e1069f2273cc6508cf7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-16 19:05:29 +00:00
Friedemann Kleint
2ee11d3e01 uic: Prepare for encountering fully qualified enum values in new .ui files
This means checks have to be rewritten using endsWith().

It mainly affects the QSizePolicy handling whose values originate from
different sources, including numbers. To address this, refactor the
code to deal with unqualified enum value names and introduce a helper
function that fully qualifies the enumeration when writing out.

Pick-to: 6.5
Task-number: PYSIDE-2492
Task-number: PYSIDE-1735
Task-number: QTBUG-118473
Change-Id: Iccbb884777aa9c696fbf48f9d7329353ef945b0f
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit 2e82796022b9eaeeb3a231713603c39ae7b2099d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-16 19:05:29 +00:00
Mårten Nordheim
bccbc7e716 qopenssl: fix accidental pessimization
The toLatin1 wasn't necessary, the argument should be QString.
The plugin isn't currently built with the ASCII ctors disabled,
so it passed through CI unnoticed.

Amends 3159b337f01767412f51c649d30a72ac8417989b

Pick-to: 6.5
Change-Id: Ib63ccaffacc46e5a313551f1e7c0e02ae09b1a01
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 5565ed24e1f81cef499f7f6e6d8a24db333c8810)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-16 19:05:29 +00:00
Mårten Nordheim
4a1f511779 Schannel: change UNREACHABLE into error-handling
Because it happens in some (unknown precondition) cases.

While it would be nice to know what the client is doing to trigger this,
it's not worth crashing over in the meantime.

Fixes: QTBUG-118458
Pick-to: 6.5 6.2
Change-Id: I261a17578e7cd3a95e591a3228b33561000fd336
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 668ce80e9e0c37823312c4ebf3d11194a509f0ff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-16 19:05:29 +00:00
Marc Mutz
07ee02f3f6 Rename QImageReader benchmark to tst_bench_
Helps finding it, e.g. in QtCreator, as it's now disambiguated from
tst_QImageReader, the auto-test.

As a drive-by, remove all empty functions.

Pick-to: 6.5 6.2 5.15
Task-number: QTBUG-114253
Change-Id: Icb0a3627488bbf4cb0c9d6bc9890f31a88096afd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 47325e01b72dca38d315a4b955085a4295772e11)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-16 19:05:28 +00:00
Ivan Solovev
6dc08d982d Add QCborValue(StringLike) constructor benchmark
... to test the impact of migrating the underlying implementation to
QAnyStringView.

As a drive-by: use [[maybe_unused]] instead of Q_UNUSED in the
benchmark for operator[].

Task-number: QTBUG-101707
Pick-to: 6.5 6.2
Change-Id: I4bae7deadbe9bbd6f267364d78e94ea4541c1339
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 6658ccf5a1a0ef298fde1884e449c062faf011e3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-16 19:05:28 +00:00
Marc Mutz
043d7accae tst_QFactoryLoader: remove unused member variable
Commit 862f42e806dce4051fd1a58c6ad2844a45223807 removed the last use
of the Android-only `directory` member, but didn't remove the member's
definition.

Remove it now, probably fixing a Clang -Wunused-private-field warning
on Android.

Pick-to: 6.5 6.2
Task-number: QTBUG-87438
Change-Id: I67a1d97f29a0dde20ff29fb9b5bbaa5611cb9e17
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 54c25c7c3163f751ef6453ca197622b6d0314af5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-16 19:05:28 +00:00
Marc Mutz
d1d8d03b7d [doc] QBENCHMARK_ONCE: fix typos
... and remove a prematurely-ending parenthesized remark.

Pick-to: 6.5 6.2 5.15
Change-Id: If0a2f482c45128739ed6cea1d8385ea34f45b094
Reviewed-by: Isak Fyksen <isak.fyksen@qt.io>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
(cherry picked from commit e6febd05d963939a354162bf647b939ad7aca64f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-16 19:05:28 +00:00
Jani Heikkinen
dc0d1b6250 Bump version to 6.6.2
Change-Id: Icd39de8fc2cd43839316013dd4dc92e27ac57cdb
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2023-11-16 15:02:15 +02:00
Carl Schwan
0774d5abff Modernize SimpleTreeModel example
Use std::unique_ptr to manage items tree memory allocations. This also
use the new string literals operator.

Change-Id: Iab002b5dc612b75cef0be10862e263c6c6c013c1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 25027444a9b53d61a6257dc5f5ce0ffdb3b06f98)
2023-11-16 06:30:56 +01:00
Tasuku Suzuki
c3042d2efa Fix build with -no-feature-dockwidget
Pick-to: 6.5
Change-Id: Ie6d4e9a2dcfa6da5392bfb2507aafc57b6511ba3
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit d5dbafca1f83ef97f65c588af2d98c894503df27)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-16 02:31:24 +00:00
Eskil Abrahamsen Blomfeldt
67637f2c40 Upgrade to Harfbuzz 8.3.0
Pick-to: 6.6.1 6.5 6.2 5.15
Fixes: QTBUG-119150
Change-Id: I80f21f6f27cce14a1e91e822c3681ec491491ff1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 98ca28f7a65b2d4e0a90e2d74448ad6992260a1c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-16 01:55:20 +00:00
Mårten Nordheim
2f7438611f securesocketclient: Update meta info
Change-Id: I34b11cd73c80dc3033de8731bd8edc0db3ed4a12
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit d3526c166c51dc8594d782762a636e20dbe8327a)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-15 14:45:47 +00:00
Alexey Edelev
cd2acd85fb Fix the broken condition of -fno-reorder-blocks-and-partition flag in QtGui
The condition was wrongly converted while qmake-to-cmake porting.

Pick-to: 6.5 6.2
Change-Id: I8b8de7c9b2ca079609ed466cf91f1a3dd0d22aa9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 0d07725f6beb7916a46a01e067e3c7303d0a0b85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-15 08:07:15 +00:00
Jøger Hansegård
2168b0b18a Add QUniqueHandle - a general purpose RAII wrapper for non-memory types
When interfacing with C-style APIs, such as the Windows API, resources
are often represented using handle objects. Lifetime management of such
resources can be cumbersome and error prone, because typical handle
objects (ints) do not give any help to release resources, and to manage
ownership.

Although std::unique_ptr can be retro-fitted with a custom deleter, and
helps transfer of ownership, it is inherently a pointer type. It can
therefore be clumsy to use with C-style APIs, particularly if the
invalid (uninitialized) handle value is not a nullptr. Also, the
std::unique_ptr does not work well when an allocating function returns
the handle as a pointer argument.

The QUniqueHandle addresses these issues by providing a movable only
value type that is designed as a RAII handle wrapper.

A similar handle wrapper exists in the Windows SDK, as part of the WRL
library. Unfortunately, this is Microsoft specific, and is not supported
by MINGW.

Since the QUniqueHandle is platform independent, it can be used also
with non- Microsoft platforms, and can be useful with other C-style APIs
such as FFmpeg or SQLite.

Pick-to: 6.5
Change-Id: Ibfc0cec3f361ec004febea5f284ebf75e27c0054
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 8d367dec156c1aa63544bd851809caa7e72d307e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-15 06:36:27 +00:00
Ahmad Samir
49bd0a8190 QStandardItem: add note about reimplementing data/setData() wrt. flags
Extend the unittests.

Drive-by change: add missing include, otherwise static analyzers
(clangd) complain.

Fixes: QTBUG-105150
Pick-to: 6.5 5.15
Change-Id: I312133d5b35119e2e51002dfefe0e141c0708e3d
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 85eebedb16da67d9f2caeb14ed45c2dae8f82837)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-14 21:45:06 +00:00
Wladimir Leuschner
72331b450d Fix setting SysTrayIcon visible after explicitly hiding it
After hiding the QSystemTrayIcon explicitly with .setVisible(false)
resetting visibility with .setVisible(true) does not generate NIM_MODIFY
message and thus preventing the tray icon from being visible again.

Fixes: QTBUG-118133
Pick-to: 6.5
Change-Id: Ic2b1d0f293c92fec7ec697b2fe3d1da9fd0d0e44
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
(cherry picked from commit 77e0e7c414b7547a36734cfea3e5b237329c93ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-14 18:37:04 +00:00
Michael Weghorn
37750aa8d1 Don't reuse iterator var to avoid -D_GLIBCXX_DEBUG crash
For a CXXFLAGS='-D_GLIBCXX_DEBUG' build, running the
examples/corelib/ipc/sharedmemory/sharedmemory
example and clicking on the "Load Image from File..." button
would result in a crash:

> usr/include/c++/13/debug/safe_iterator.h:492:
> In function:
>     bool gnu_debug::operator!=(const
>     _Safe_iterator<std::_Rb_tree_const_iterator<std::pair<const
>     QSettingsKey, QVariant> >, std::debug::map<QSettingsKey, QVariant,
>     std::less<QSettingsKey>, std::allocator<std::pair<const QSettingsKey,
>     QVariant> > >, std::forward_iterator_tag>::_Self&, const
>     _Safe_iterator<std::_Rb_tree_const_iterator<std::pair<const
>     QSettingsKey, QVariant> >, std::debug::map<QSettingsKey, QVariant,
>     std::less<QSettingsKey>, std::allocator<std::pair<const QSettingsKey,
>     QVariant> > >, std::forward_iterator_tag>::_Self&)
>
> Error: attempt to compare a singular iterator to a
> singular (value-initialized) iterator.
>
> Objects involved in the operation:
>     iterator "lhs" @ 0x7ffe8e811550 {
>       type = std::_Rb_tree_const_iterator<std::pair<QSettingsKey const, QVariant> > (constant iterator);
>       state = singular;
>     }
>     iterator "rhs" @ 0x7ffe8e811670 {
>       type = std::_Rb_tree_const_iterator<std::pair<QSettingsKey const, QVariant> > (constant iterator);
>       state = singular (value-initialized);
>     }
> Aborted (core dumped)

This may be a libstdc++ bug, but still avoid/work around the issue
by just using two separate variables for the iterators here.

While at it, simplify the code a bit and replace the use
of const_cast and pointers with the use of const references.

Many thanks to Giuseppe D'Angelo for the analysis of
the underlying problem and reporting a bug for GCC/libstdc++ [1] !

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112477

Fixes: QTBUG-119044
Pick-to: 6.5
Change-Id: I00a8cc35033cf3ab4ba1f071cccabdef8ef52f9c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 5db48d584e626a15bf436a56aa2165dfe9dfde1d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-14 06:43:41 +00:00
Tor Arne Vestbø
66888203f6 Ensure foreign window can be reparented out of contained window again
A foreign window embedded into a Qt hierarchy must also support
being removed from that window hierarchy.

Change-Id: Id4d08079ff19d67a8989937bc72602e8bd14b31b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit db33628452c5ccbf07b901405fba74525f7192c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-14 00:32:55 +00:00
Tor Arne Vestbø
4c0918edf1 iOS: Fix foreign window auto test
Change-Id: Iae3a0f9805b02f935009d800dec00d9e2ceb008d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 93077dd1f237730a26714d77bb7e91542f96affc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-14 00:32:54 +00:00
Tor Arne Vestbø
dc109894d2 tst_QWindow::setVisibleThenCreate(): Fix unused argument warning
Use the arguments to call the parent class implementation.

Pick-to: 6.5
Change-Id: I602a66447fb8681b3ec9ef8e2e281828612d178c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit df834fde521419c9e0eedce703312a964aabf43a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-14 00:32:53 +00:00
Vladimir Belyavsky
7ea394eed6 QSystemTrayIcon: properly disconnect old menu in setContextMenu()
Amends 121a30ccef3b6306c1da4f415fe1305dbf2dd901
Fix the unfortunate mistake where oldMenu was not properly disconnected
from the contextMenuRequested() signal. This could lead to a situation
when several menus are displayed at the same time.

Fixes: QTBUG-78737
Pick-to: 6.5 6.2 5.15
Change-Id: Ice59841724207192eacd5a52b644f83159e09913
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b71aa3c661797a916effd29171665ea838816595)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-13 15:43:35 +00:00
Andreas Eliasson
8806b91afe Doc: Merge dangling text with \note paragraph
It's not possible to have empty lines inside a \note as this will cause
the text after the empty line to appear outside the note box. So, remove
the empty lines to make the note paragraph complete.
Also, revise the text.

Fixes: QTBUG-117111
Pick-to: 6.5
Change-Id: I50ad0cd559f684c5264898ef8bbac16910f96dea
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit e4bde15e149cf449911c9b871acfe8fafd4ac712)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-13 15:43:35 +00:00
Kai Köhne
462351a107 Highlight some examples for 'Data Processing & IO' category
Pick-to: 6.5
Task-number: QTBUG-117220
Change-Id: I1bf8d36ae93b96da55d18c9545c942707834c114
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit e45937c22d45ffc2ad5be6b11f11ba49900e7cdb)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-13 16:43:35 +01:00
Mårten Nordheim
24ca6bd117 Fix compilation with MSVC 17.8
stdext is deprecated, slated for removal.

The macros were used to work around a compiler warning generated
when using the 3-arg overload of certain STL algorithms even when
the 4-arg version (added in C++14) was not available.

These deprecation warnings seem to have been discontinued as of
  MSVC++ 14.15 _MSC_VER == 1915 (Visual Studio 2017 version 15.8)
so making the macros no-ops from VS 2022 17.8 onward is not expected
to trigger these warnings again.

Pick-to: 6.5 6.2 5.15
Fixes: QTBUG-118993
Change-Id: I2c3b69d46d13f6fcccf0ffce186b984b7758f287
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 52b6258ec846cc53ebdb1c8167edd30db39c7891)
2023-11-13 15:43:35 +00:00
Christian Ehrlicher
ef2a6ba74f QDial: don't crash when min==max and setting a value != min & max
QDial::bound() is crashing when min == max due to a division by zero.
Therefore check for this condition beforehand and return min.

Pick-to: 6.5 6.2 5.15
Fixes: QTBUG-104641
Change-Id: I612625af1ad18333d59a7771abfdec602301b58e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit e4315204b1412d74842b3167c3eb9a49dc233355)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-13 03:47:45 +00:00
Tor Arne Vestbø
83f7843403 macOS: Work around key view loop crossing NSWindow boundaries
AppKit will in some cases set up the key view loop for child views, even
if we don't set autorecalculatesKeyViewLoop, nor call recalculateKeyViewLoop
ourselves.

When a child window is promoted to a top level, AppKit will maintain the key
view loop between the views, even if these views now cross NSWindows, even
after we explicitly call recalculateKeyViewLoop. When the top level is then
hidden, AppKit will complain when -[NSView _setHidden:setNeedsDisplay:] tries
to transfer first responder by reading the nextValidKeyView, and it turns out
to live in a different window.

  ERROR: Setting <View: 0x145e0cfd0> as the first responder for window
  <Window: 0x10f904de0>, but it is in a different window (<Window: 0x147104f00>)!
  This would eventually crash when the view is freed. The first responder will
  be set to nil.

We mitigate this by a last second reset of the first responder, which is
what AppKit also falls back to.

It's unclear if the original situation of views having their nextKeyView
pointing to views in other windows is kosher or not, but that's left for
further investigations.

Pick-to: 6.5
Change-Id: I63636afbba85abf73a38db9701f32656c42c59cc
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit cb94e360ecc2809e462c6a01f45363db3d602684)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-12 23:00:02 +00:00
Tor Arne Vestbø
bc415a432a macOS: Respect QPlatformDialogHelper::ButtonLayout in native alerts
The buttons in QMessageDialogOptions do not have any order that we
can rely on. The standard buttons is just a bit mask, so any ordering
done on the QMessageBox side is lost. The custom buttons are ordered
in the same order the user added them, but this is not really the
order we want them to appear in the dialog either, as we have a
well defined order between roles provided by QPlatformDialogHelper.

We now follow the QPlatformDialogHelper::ButtonLayout order for
macOS, using the same heuristics for multiple Accept role buttons
as QDialogButtonBox.

For buttons with the same role, QMessageBox will respect the order
they were added in, but this is not something we can do for the
standard buttons, as long as they are flattened to a bit mask.

Pick-to: 6.5
Change-Id: I401f202a7c2d83dc253e988531ad145624c97580
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 0366b554c936e3257797f9c281c1cbd76e426dd3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-12 23:00:02 +00:00
Tor Arne Vestbø
c53356cfd6 macOS: Clarify relation between occlusion state, hidden state, and expose
Pick-to: 6.5
Change-Id: I0e05332087fb3f876a9d2fadd9d7dcfd556d5734
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 7a7aecae2ac7ae411e5e3a719f82cd1a0e7fe5ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-12 23:00:02 +00:00
Tor Arne Vestbø
cb9f861b2e macOS: Activate all windows on launch, not just key/main windows
The default macOS behavior when an application is activated is to
bring key and main windows to the front. Any window shown after
that is order to the front as normal.

For Qt apps we show windows in main() instead of waiting for the
application to become active first, and the request to show
the window may reach the window server before or after Finder
has made the application active. If it arrives first, the window
may end up behind the currently frontmost application.

This is particularly noticeable when the application is not
activated by Finder, and we do our own activation workaround.
In this case all our windows are hidden, except for the key
window.

To ensure a consistent behavior here, we explicitly activate
all windows of the application on launch.

Pick-to: 6.5
Change-Id: Ice55f7d03e077c5a5ca843f75f1a7296ebb47aa7
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit b49211c12543c3369b286b507c4277c66ef9fdef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-12 23:00:02 +00:00
Tor Arne Vestbø
eb937aa84f macOS: Only bring application forward on launch if needed
We override the macOS default behavior of not activating applications
unless they are launched from Finder. To play a bit nicer, we now
try to detect if we're already the frontmost application, and skip
the explicit activateIgnoringOtherApps if so.

Pick-to: 6.5
Change-Id: Iff4ddc3dc50aeb9700c88882dd7a270cfea5b737
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 6343caae25179b5895b4169d7b97d61293e49b0f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-12 23:00:01 +00:00
Tor Arne Vestbø
0e10c0bde2 macOS: Remove dead code for activating application on startup
We handle this in applicationDidFinishLaunching nowadays.

Pick-to: 6.5
Change-Id: I447e8923fba3eac4cb0a2727f369fff21054f9a1
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit b8879b4d2dea67d7b21e604e807095baa23c30e0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-12 23:00:01 +00:00
Vladimir Belyavsky
038a209985 QCocoaSystemTrayIcon: fix updateMenu() logic
Amends da754d5b6589c9877f0325edb3da5cbc64d966c7
We should avoid registering an observer multiple times for the same
NSMenu object, because it results in multiple consecutive
emitActivated() calls.

So,
- bail out early if menu is the same, i.e. we have nothing to do
- unregister an observer we added previously for the old menu

Fixes: QTBUG-119053
Pick-to: 6.5
Change-Id: I14fce693dba351b1d12f2140fa8e672227cc7a9e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5b451efe817a0bef8ed1463fdc5ca483f34a53fd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-12 23:00:01 +00:00
Vladimir Belyavsky
8fcd3b1b1b QSystemTrayIcon: Allow resetting context menu
Fix logic in QSystemTrayIconPrivate::updateMenu_sys() to allow resetting
the tray icon menu. Now we correctly handle `nullptr` menu, and update
the underlying QPlatformSystemTrayIcon instance accordingly.

Also we bail out from QSystemTrayIcon::setContextMenu() early if the
menu is the same.

Fixes: QTBUG-119068
Pick-to: 6.5
Change-Id: I704b40dfb1a3046331aef65417655411bf3a41a0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c1d389a132d291fb404bef11de3c1b45dbfa2afc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-12 23:00:01 +00:00
Christian Ehrlicher
b44828959e tst_qstandarditemmodel: fix memleaks
QStandardItemModel::takeItem/Row/Column() return items not owned by the
model anymore and therefore need to be cleaned up manually

Fixes: QTBUG-116532
Change-Id: Ic8797f58184f56b9c4ef415ce8f2363c1b352388
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ab4bb5077cc82bed1f5c297f1753a68ed5fb49f1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-12 19:42:39 +00:00
Christian Ehrlicher
7da3dda667 QStandardItem: Fix reset parent in takeItem()
After the change for QTBUG-89145 the parent was not set to 0 when the
item was not attached to a model.

Pick-to: 6.5 6.2
Fixes: QTBUG-117900
Task-number: QTBUG-89145
Change-Id: I421e775130b03ce3eb2dd1dd05370e7391af087b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0416e080cffe33de435631b5d47d3acbbcb7b880)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-12 19:42:38 +00:00
Christian Ehrlicher
ef144f2e30 QStandardItemModel: don't leak in mimeData()
When an invalid index is given to QStandardItemModel::mimeData() the
function bails out with a warning and returns a nullptr. But the
allocated data from QAIM::modelData() was not freed.

Pick-to: 6.5 6.2 5.15
Task-number: QTBUG-116532
Change-Id: Ibce9d51ea09d45f1b0eb3ca980aaff141af5bf68
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 37048d04172430ee88c9cd8f7589c51a5bbcd5f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-12 19:42:36 +00:00
Sergio Martins
74d460959b Make all QPainter operations warn if there's no engine
Otherwise, for example fillRect() will fail silently.

Most operations already had the warning, but some were missing it.

Change-Id: I1ef6bf880d5b0722baadcf0ced68a968f0b1a070
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit acfd2a4bb0b63a02f6c17eb72d59dd2ec02cfa59)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-11 23:45:00 +00:00
Lucie Gérard
874e5be7ff Modify copyright format in qt_attribution.json
Multiline copyright entries are entered via string array.

Task-number: QTBUG-111873
Pick-to: 6.5
Change-Id: Ib8203163db8d5d579117f402b7a89b59ae1a5169
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit c0f13eeb99e58c71c685d4c2d2932f300d69fb26)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-11 19:20:35 +00:00
Topi Reinio
a4043c8f6a 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.5
Change-Id: Ief1c9dc2ca38ba3da1fe3039500292147ec4cc7d
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit ebc371de0d626d60a2a3aa5b82e3530e3e1d9f27)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-11 18:15:24 +01:00
Richard Moe Gustavsen
ff8da2cf30 tst_qcombobox: skip popupPositionAfterStyleChange on QEMU
The test turns out to be flaky on QEMU.

Fixes: QTBUG-114760
Pick-to: 6.5
Change-Id: I264f79e9a056e82d4e6735e6ead0710ddabd8eba
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d74235db5db736e196989cb8271980bcd37ce1d7)
2023-11-11 18:15:16 +01:00
Ahmad Samir
e1fe8963a7 QStringList: improve benchmark code
Make the strings in the stringlist-to-be-joined unique, which matches
actual use-cases better than joining a list of identical strings,
especially with QString's implicit sharing, if it's copies of the same
QString, it's sharing the underlying data.

Pick-to: 6.5 6.2 5.15
Task-number: QTBUG-116859
Change-Id: I1da93885e938045322ba8337df5e4e96985f892f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e1dcc858b2a0ac2b359cdbf7e07e70c1237daef0)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-11-11 10:45:45 +00:00
Kai Köhne
9eaaab7df0 Doc: Add HTTP Client example also to Web Technologies category
HTTP belongs to Networking, but also fits well with the scope
of Web Technologies - qtnetworkserver is there after all, too.

So just add the example to both.

Pick-to: 6.6.0
Change-Id: I588e4e0eefc92ba396fbb21d6f55b33f68332a74
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit b23a06e039f9c98a2fb524a08a75b3d39bf67aaf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-11 10:45:42 +00:00
Topi Reinio
698e633d8c Doc: Fix QRgbaFloat function signatures
Commit baac34de modified the set[Red|Green|Blue|Alpha] function
signatures. Amend the \fn commands to reflect those changes.

Change-Id: I947995fc5c80baac111a04272cd848961c22eb73
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 7fdef80a6b4ee715914110687c61338042632348)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-11 10:45:40 +00:00
Morten Sørvig
45cab397e8 wasm: Improve screen cleanup
Fix the use case where the application recreates the
QApplication object while reusing the html container
element. This would cause an error:

  Uncaught DOMException: Failed to execute 'attachShadow' on
  'Element': Shadow root cannot be created on a host which
  already hosts a shadow tree

It looks like there is no way to remove a previously
attached shadow root, which means we can't return the
container element to its initial state if we attach
to the user-provided container element.

Fix this by introducing an intermediate element which
we can remove() in the QWasmScreen destructor.

Pick-to: 6.5
Change-Id: I929393a498b0440390a3e2c1774a3cac3a5a7e79
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 0e23865c9ed0cf6560df8c7c5fcea6e0eef1160e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-11 10:45:38 +00:00
Topi Reinio
1d261f3a54 Doc: Document QtTypeTraits header
There were multiple documented functions with \relates <QtTypeTraits>,
but the header file itself was not documented. QDoc still created a
proxy page for the header, but the information on it was incomplete;
for example, deprecated functions were omitted.

Pick-to: 6.5
Fixes: QTBUG-116349
Change-Id: Ic4334a43f72bb8a358cee7537a282495e4a046c6
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit fedb1f5b76ea2c5961f21e7ab1e2cf07c71f2a9d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-11 10:45:36 +00:00
Timothée Keller
ce6a81a6f0 Windeployqt: add options to deploy/block plugins
Some plugin types are pulled in by default by certain modules.
Give users the option to add/skip plugins and/or their types.

[ChangeLog][Tools][Windeployqt] Windeployqt now has options that allow for custom plugin deployment. Users can include or exclude them, either individually, or by type.

Fixes: QTBUG-117910
Change-Id: I85235783dcd814396f184912269cd5976717b2dd
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit d53c0d721f111d53ea95eb8914ad88560a00feaa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-11 10:45:34 +00:00
Cajus Pollmeier
c2869caa7e Avoid ${...} to be replaced by configure_file
When running configure_file without @ONLY, the exit code details get
stripped out by CMake. This leads to an empty application exit status
shown on the boiler plate HTML.

Fixes: QTBUG-117997
Change-Id: I4ab25960412da17c9509a66c1019c3b2b71ed108
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit ac039776a63ebc27386865ab6d2628dea44f21c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-11 10:45:31 +00:00
Axel Spoerl
5363ac342d Beautify QGuiApplication::event()
Replace if/elseif with a switch.

Task-number: QTBUG-112479
Task-number: QTBUG-119032
Pick-to: 6.5
Change-Id: Iff29fde6a9b9a16357b26cf90009fec7c9826349
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit b3958d26caffaa90193e649024ff2c0bf953fc2d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-10 22:24:42 +00:00
Liang Qi
99cda97844 xcb: fix deprecated QBitmap::operator=(const QPixmap&) warnings
Pick-to: 6.5 6.2
Change-Id: I2caa64d92ece20d5c8d650a3898926e8f0fa7b24
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit f84e654a620a4f04817b70bd1e7eab8a09a25526)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-10 19:54:51 +00:00
Matthias Rauter
9be581537f Draw ItemViewItem icon after the background in QStyleSheetStyle
Fixes: QTBUG-118870
Pick-to: 6.5
Change-Id: I8aad9aa3b4e7e92e96039313bda3e80281523594
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 304eca394aff0248b0d2a07b9a2c05dbd5234d2a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-10 19:54:51 +00:00
Marc Mutz
6295c40d92 QStringConverter: harden encodingForName() against nullptr
The nameMatch() function has an implicit precondition that neither
argument is nullptr: it immediately dereferences both arguments.

Prevent the crash by checking for name == nullptr early, before
passing to nameMatch().

Add tests for null and empty.

As a drive-by, make variables in the test const (needed for the
QByteArray to avoid detaching, peer pressure for the others).

Amends a639bcda1e42f48fa32885ede77f9fd320ce731c.

Pick-to: 6.5 6.2
Change-Id: I4a30f6c130310eb701ba7c7251168294489c34db
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit b113b01a711752d3add6c9df12d84438607de5b9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-10 19:54:51 +00:00
Volker Hilsheimer
89dd5ab630 Cocoa MessageBox: don't use native message box if detailed text is set
As per the documentation: A message box displays a primary
text to alert the user to a situation, an informative text to
further explain the situation, and an optional detailed text to provide
even more data if the user requests it.

The AppKit NSAlert doesn't provide such a "detailed" section, and our
code just added this "even more data" detailed text to the primary text.

This breaks the UI when the detailed text is very long, perhaps a
complete log output with dozens or even hundreds of lines of text.

Since NSAlert doesn't provide a "details" space, fall-back to the non-
native message box if detailed text is provided.

[ChangeLog][QtWidgets][QMessageBox] On Apple platforms, the native
message box is no longer used when detailed text is set.

Pick-to: 6.5
Fixes: QTBUG-118992
Change-Id: I6f4764ceb8f8e57d641c0b0660223a9c26f5bd26
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 8753bb3045d020bcae33eed67a2770a4709ac7b8)
2023-11-10 20:54:51 +01:00
Timur Pocheptsov
1d80626400 macOS: Use non-native fallback for message boxes with rich text
The NSAlert messageText and informativeText properties only allow
plain NSString, so we need to opt out of the native dialog if the
user has requested rich text for any of these properties.

Fixes: QTBUG-116757
Pick-to: 6.5
Change-Id: I3fd44ec94adad1dda1ed4dede46450a8a525d35f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 28ab45182a3fea76193146083838cca4212395d2)
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-11-10 20:54:51 +01:00
Alexandru Croitor
a1e143faab CMake: Document Android per-abi limitation of QT_ANDROID_EXTRA_LIBS
When the per-abi external projects are built, specifying a dynamic
path in QT_ANDROID_EXTRA_LIBS based on CMAKE_ANDROID_ARCH_ABI would
not propagate that value back to the main project's deployment json
file.
While the actual library files would be copied into the apk, they
would not be loaded because the generated libs.xml file would be
missing per-abi entries in the 'bundled_libs' array (except for the
main abi).

Document that project developers should explicitly specify all the
libraries in the property.
androiddeployqt then takes care to filter out unsupported architecture
libraries in each abi build dir, but it will still copy all of them
into the final apk, as well as list all the architectures in libs.xml.

A proper fix would be to generate additional files with information
from each per-abi external project, that would then be read by
androiddeployqt (basically merge specific target property info from
each sub-project).
Hopefully this can be done without introducing new API.

Pick-to: 6.5
Fixes: QTBUG-117206
Task-number: QTBUG-118838
Change-Id: I181a170cffdb49b0b0d455d997cfae90ada312f0
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit f639c04f84322b9c81b11261cf14625497d78f00)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-10 17:01:54 +00:00
Christian Ehrlicher
b4384dab06 QTabWidget/Bar: ignore hidden tabs for key events
Even a tab was hidden it could be accessed with the key navigation or
a scroll event which lead to painting artifacts.

Pick-to: 6.5 5.15
Fixes: QTBUG-101219
Task-number: QTBUG-63038
Change-Id: I58be694eef5f86cccecbe528891a39a4acdda15f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 83e92e25573f98e7530a3dfcaf02910f3932107f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-10 08:21:37 +00:00
Shawn Rutledge
35da0bb56e iOS: Make nextTouchId static, unsigned and let it overflow
If an application has two windows, and the user tries to do multi-touch
gestures with different fingers in each window at the same time, we want
the touchpoint IDs to be unique. m_nextTouchId was a per-window variable
before; the result was that the QEventPoint delivered to the second
window was replacing values (including QEventPointPrivate::window)
in the persistent QEventPoint that was still being held in the first
window; then when the release of the first point occurred,
QGuiApplicationPrivate::processTouchEvent() saw its destination window
pointer as null because the second touchpoint had already been released.

QEventPoint::id is of type int, with negative values being invalid.
nextTouchId is of type quint16 so that it will always be positive, and
we can let it eventually overflow (wrap back to 0) rather than resetting
it to 0 after each touch gesture. The only requirement is that the IDs
need to be unique and positive (and typically they are sequential: that
makes debug output easier to understand).

Task-number: QTBUG-118909
Change-Id: Ia0f1edc9a5e2b362028bed4418fed228814cddb6
Pick-to: 6.5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 68369237bfefc81410a0d8d7389ed5e0fba0b421)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-10 02:54:20 +00:00
Friedemann Kleint
6ac543c843 Windows QPA: Fix wheel events when using -platform windows:reverse
Wheel events in WM_POINTER messages use global coordinates.
Move the code doing the RTL correction into the local coordinates branch.

Fixes: QTBUG-117499
Task-number: QTBUG-28463
Pick-to: 6.5
Change-Id: I10e965da9e9660985eaa2681fcf780b5388299a2
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
(cherry picked from commit 78512135c83b92944a0d897d4f387c8e358160bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-09 19:49:04 +00:00
Axel Spoerl
b65e1141da QDockWidget: Remove "group" bool trap
The unplug() and startDrag() functions of QMainWindowLayout and
QDockWidget used a boolean argument specifying whether a single dock
widget or a group of dock widgets should be unplugged. The argument
defaulted to true.

That has lead to inconsistent unplug operations, broken item_lists and
crashes, especially when the methods were called without an argument.

To improve code readability, replace bool trap with a meaningful
enum. Remove default arguments, in order to force explicit calls.

This patch does not change behavior, it is just carved out to
facilitate reviews.

Task-number: QTBUG-118578
Task-number: QTBUG-118579
Pick-to: 6.5
Change-Id: I50341b055f0bb76c2797b2fb1126a10de1fee7dd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c93ab8c2a015b40b9a487ed9f23a72aebea8d52a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-09 19:49:00 +00:00
Allan Sandfeld Jensen
8702853313 Fix findNearestColor for semitransparent colors
The two destcolors and the buffer are all already premultiplied. This
would double premultiply them.

Pick-to: 6.5 6.2
Change-Id: I235bee616d8e0033b87c6f96464f0926af7bd29a
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit b637607789a9e92a0dd0ff7fb31b9a92a10ef0bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-09 19:49:00 +00:00
Eirik Aavitsland
4d691cfc8a QPrinter: allow any margins when setting a fullpage QPageLayout
By default, QPrinter::setPageLayout correctly rejects a layout that
specifies margins outside the printable area. However, when the layout
specifies fullpage mode, that check should be skipped, since then one
should be allowed to target the unprintable area, by definition.

Fixes: QTBUG-118580
Pick-to: 6.5
Change-Id: I8bd93d11aefee0344725ac51c2490d029657f483
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 2ac50bb0f539b1ee62503ff136063c693d4662e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-09 19:49:00 +00:00
Allan Sandfeld Jensen
774d80a7d5 Fix multiple threads accessing same byte
We can not thread mono image formats as the bit access isn't atomic.

Pick-to: 6.5
Fixes: QTBUG-117494
Change-Id: Ica8e08fc3da73983f6b4da2a133f5e715fd0d787
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 6532dc5d37668947f59cc0dff1fd10a2e040f6cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-09 19:49:00 +00:00
Mårten Nordheim
f9cc1e4aae QLocal8Bit::convert*Unicode[win]: Converge logic
I ended up writing different logic for similar things.
And using points_into_range doesn't work if we, by coincidence,
point at end, though this shouldn't be possible yet, but it may happen
once we support input larger than 2Gi. So, let's instead check if the
destination buffer has been initialized.

Pick-to: 6.5
Task-number: QTBUG-105105
Change-Id: I28c367eb965339ae84355c0cac27c5d0352d9271
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6f4823348220780a2e926c7885f2249f89f7e16d)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-09 13:35:17 +00:00
Mårten Nordheim
8296051ae7 QLocal8Bit::convertToUnicode[win]: Support stateless flag
By just setting state to nullptr.

Pick-to: 6.5
Task-number: QTBUG-105105
Change-Id: I6b4f8fe39f1ba51dcfaf98ce7e42c2acd4c4cf98
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 10f5e4f8099136bce59f5f859df89c5b2e695fc9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-09 13:35:14 +00:00
Axel Spoerl
6e367fbb30 Fully export QDockWidget debug operator
Amends bbeff2a3350dd3396400865525d509b784c2d93e.

Task-number: QTBUG-118578
Task-number: QTBUG-118579
Found-by: Friedemann Kleint <friedemann.kleint@qt.io>
Change-Id: I60d8d11a82ff5de8b9641c86b824969fc9a34b91
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit c02f8b9d4d9a6578bb2017bafbb963d09641383f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-09 12:10:08 +00:00
Christian Ehrlicher
9224284f7a SQLite: Update SQLite to v3.44.0
[ChangeLog][Third-Party Code] Updated SQLite to v3.44.0

Pick-to: 6.5 6.2 5.15
Change-Id: Ibdf8a6e0baf3d2b1bf0f9ffb48e908e2691b6a8d
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit c63a21ae5c3bf7d105ee79caa0d7a1f3fa14e1c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-09 12:10:08 +00:00
Mårten Nordheim
ed5bc72f76 tst_QDockWidget: use local context for timer
If we use 'this' as context it might still try to invoke
the timer after we have left the function, leading to
stack-use-after-return.

To avoid doing an in-depth dive if it's okay to use mainWindow as the
context or not, I just added a new local QObject.

Amends 9ff40b59da58160dc26c54204a615a2456e07405

Pick-to: 6.5
Change-Id: I2c3bdc1eb06731d9c38979610303876c2748fb73
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 26ded9dedf3f35e93b81bd0281fdd0bd30acb9d4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-09 12:10:05 +00:00
Lu YaNing
f514fba45b QXkbCommon: Use isKeypad() to replace duplicate logic
This amends 298c9509129cf039a1da75d5682cbe273a341590 .

Pick-to: 6.5
Change-Id: I44696464817d6d3f6b1b3a7d005334805fb1cc38
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit c524ca342b0a00208eb2cdbe929276bc9785eb6b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-09 11:43:05 +00:00
Mitch Curtis
71a0adc0c9 selftests: document how to run subtests from Windows' cmd.exe
It deoesn't like single quotes, which must be replaced with doubled-up
double quotes.

Pick-to: 6.5 6.2
Change-Id: I8e5f8047e72e4433926a9f4f2044407a4d823682
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ec5383efc37e993f5dfa8e729ad9b6e38c3cfe5f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-09 03:26:00 +00:00
Sérgio Martins
b3147d7d81 Add .cache/ to .gitignore
It's generated by clangd, when used for example from vscode.

Change-Id: Iac65face9634c869eaf94881edff82471a33742a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e6a0b6b3c9460cb6c08ece000b8514947c0f0683)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-09 02:42:49 +00:00
Thiago Macieira
f003d43eb0 QBitArray: fix GCC 13 warnings by improving code
GCC 13 has been complaining that QBitArray could be accessing past the
end of an array (specifically, the 1-element array QByteArray::_empty).
That's caused by the 'QByteArray::data() const' being:

 #if QT5_NULL_STRINGS == 1
     return d.data() ? d.data() : &_empty;
 #else
     return d.data();
 #endif

A way to avoid this is to use operator[], which doesn't attempt to hide
null pointers (it has an assertion).

This is accomplished by writing nicer, more readable code, which is a
nice benefit.

Fixes: QTBUG-118631
Change-Id: I85b3fc2dd45c4693be13fffd179579615a6ac98d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 8739963c8147269bc64b74c2c513cc8da4ce738b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-09 00:48:39 +00:00
Assam Boudjelthia
7f7fd8ce96 Android: add missing extras native methods impls and registration
This should have been done when the extras where moved to qtbase,
it went under the rug and was forgotten.

Pick-to: 6.5 6.2
Fixes: QTBUG-114971
Change-Id: Id7831a8bab8bedc1f869b9fc8bfc72acc3cca7a2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 510cc564c07d41c2eb1689f1928c0b77f652ceb5)
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-11-08 21:30:53 +00:00
Christian Ehrlicher
9a08abf41f Add QPixmapIconEngine::isNull()
Reimplement the virtual function QIconEngine::isNull() for
QPixmapIconEngine. This lets QIcon::isNull() return true when no pixmaps
are loaded during QIcon::addFile() e.g. due to a wrong filename.

Pick-to: 6.5
Fixes: QTBUG-118667
Change-Id: I29f2c492e55b60638507fa398ef7af76f4e9ff48
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 5a5c96c65d9c4c4e0eac1888d5f396f352e60444)
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-11-08 18:38:49 +00:00
Christian Ehrlicher
3b3b6f1adf QCheckBox: Don't emit checkStateChanged when nothing changed
QCheckBox::checkStateChanged() was emitted with msvc even though the
check state was not changed due to a faulty comparison.
Amends: 37b47ebf946ef1a37573107375fbe5fc0eb1e6d2

Fixes: QTBUG-118716
Task-number: QTBUG-104688
Change-Id: Iafeabeb9214f6c7510ea4ed87fabb7dc0ba175a6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 90822833f373d9aa9e2ee9b60f93b869e718cfe0)
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2023-11-08 18:38:48 +00:00
Dimitrios Apostolou
d15a32251c CTest should write a JUnit XML test summary
This feature is to be used when testing Qt in Coin (our continuous
integration platform). The command line option --output-junit is
supported in CMake 3.21 or greater. However we have one particular
configuration that tests with CMake 3.16, so we exclude that one.

We have already configured the individual tests to print detailed
results in their own XML files, using QTest's functionality. But then,
when a qt test process crashes, it leaves behind a half-baked XML
file, or no file at all.

CTest on the contrary knows nothing about the internals of a Qt test,
and only cares about the process exit code. Even if a test crashes, it
catches that and reports it as a failure.

We enable this functionality here to use in addition to what QTest's
XML files provide, in order to collect more complete information on
test results.

Pick-to: 6.5
Task-number: QTQAINFRA-5146
Change-Id: I226203f93413689f5767a4d01ea1852b453ebf31
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit 19aa21b595c7e523b6cc941580e55d8c6fc50a6d)
2023-11-08 19:38:48 +01:00
Jan Grulich
503ed57f93 QCryptographicHash: fallback to non-OpenSSL implementation for Keccak
Current versions of OpenSSL 3 don't support Keccak hashes as these are
going to be introduced with OpenSSL 3.2 so we should rather fallback to
the non-OpenSSL implementation instead of using SHA3.

Fixes: QTBUG-118814
Pick-to: 6.5
Change-Id: Iedeb81cd76d43d920fc10e1efdac261bc12a394c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 63fa92f2efb47dad817fce5f3dd3bdb48739c2a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-08 18:38:48 +00:00
Thiago Macieira
c5a2fa1af5 QOperatingSystemVersion: Move the new OSes into a non-exported class
The solution from commit 3446313c7a5cd6005089866a7b20c9f28e132a0a didn't
work completely as expected. That commit the QOperatingSystemVersionBase
base class so we could add new static constexpr inline variables to
QOperatingSystemVersion in patch releases. We need a different base
class because you can't have constexpr variables of incomplete types and
the the type isn't complete inside its definition.

However, QOperatingSystemVersion is an exported class and there's an
unexpected interaction between __declspec(dllexport) / dllimport and
inline variables: they're imported from the DLL that exported them. For
Qt 7 we can remove this class's export, but not until then.

This commit adds to the fix by introducing a middle base class, so we
can add the static constexpr inline variables.

Pick-to: 6.6.0
Change-Id: Ifa1111900d6945ea8e05fffd177e0b696209c7af
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 215677818470e48e9090d7ae4411e1fea62207b8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-08 18:38:48 +00:00
Wladimir Leuschner
32f640ec69 Use Desktop Handle in case of no valid app HWND for QPrintDialog
The call Win32 API PrintDlgEx needs in the PRINTDLGEX struct a valid
window handle for hwndOwner to show up. In case there is no window
created, as seen in the example, the call to PrintDlgEx fails with
COM error code E_HANDLE. Using the Desktop HWND, in case of no valid
app HWND creates a valid call to PrintDlgEx with showing up the dialog.

Fixes: QTBUG-118899
Change-Id: Ie7009c8e6e8285a0b6312e310b3d065c532f9e17
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 7e8ae9cf12611439462e8b26946473fd6492afcc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-08 18:38:48 +00:00
Timur Pocheptsov
1b4301c979 Openssl V3: try to work around the lack of SHLIB_VERSION_NUMBER
It's no more defined in opensslv.h, try to use OPENSSL_SHLIB_VERSION
instead.

Pick-to: 6.5
Fixes: QTBUG-116295
Change-Id: Ie465f4147e0ec95897bd8d35f71241884bf64b4e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 3159b337f01767412f51c649d30a72ac8417989b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-08 18:38:48 +00:00
Jonas Karlsson
4253b2b6e7 QHeaderView: relayout on resetDefaultSectionSize
We now call setDefaultSectionSize with the new default section size.
This clamps the value to min/max section size and it will resize
affected sections.

Pick-to: 6.5
Fixes: QTBUG-116013
Change-Id: I39849aca8d0672629ce0b3ca244038c27e045d4b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a8df174369cecd90f14dac85bf162353b7cb25d1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-08 18:38:48 +00:00
Jøger Hansegård
55a5cc4c93 Prevent oversized QToolButton menu from moving to primary screen
The QMenu pop-up used with a QToolButton could unexpectedly move to the
primary screen if it was too big to fit on the owning widget's screen.

The cause of the issue is that QMenu is a top-level window, and can not
infer its screen from any parents. Its positioning is therefore done
using heuristics in QToolButton. These heuristics attempt to calculate a
best guess point relative to the screen that contains the QToolButton.
If these heuristics result in a point that is outside all screens, the
QMenu's own screen takes precedence, and this is always the primary
screen. This way, the QMenu ends up at the calculated position, but
relative to the wrong screen.

This patch works around this issue by ensuring that the first estimate
for the pop-up position is always within the same screen as the
QToolButton. The danger with this workaround is that the menu may end up
in an inconvenient location. This does, however, seem to be handled by
subsequent adjustments in QMenuPrivate::popup.

Fixes: QTBUG-118695
Pick-to: 6.5
Change-Id: Ibb4a1c82e827c57bbb0798a6c6f5eecb6d639c62
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 70404a2773293e4f3a763aa2f057f1d6569e8661)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-08 18:38:47 +00:00
Friedemann Kleint
1248d78dbe Windows QPA: Emit QGuiApplication::primaryScreenChanged()
Patch as contributed.

Pick-to: 6.5
Fixes: QTBUG-93368
Change-Id: I8cc884e64e84128b125415e78e3a34245ae4e626
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit 01d55f0203e70e1345b068d940bc31026f181bf3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-08 18:38:47 +00:00
Christian Ehrlicher
045f5baf90 QWidgetWindow: pass QPointF to QMouseEvent
QWidgetWindow::handleMouseEvent() passed a QPoint to QMouseEvent which
might result in a wrong result on high-dpi displays. Since the incoming
event has a correct QPointF coordinate, use this for the QMouseEvent

Fixes: QTBUG-106262
Change-Id: Idbfdab19220cb06aa0a28eef4e6ab4cab1035d97
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a5a925bf2ede609714be931bd20cba29f9c3823f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-08 18:38:47 +00:00
Ivan Solovev
9f6765897c QSharedMemory: fix attach() -> create() for non-legacy SystemV mode
The problem with non-legacy mode is that the backend uses the same
filename for the system semaphore file and for the shared memory file.

What happens is that when we try to call attach(), a semaphore is
created. Later in attach() we set unix_key, because ftok() returns
a valid handle (it uses the file which was created for semaphore).
After that, an attempt to actually attach to a shared memory fails, but
no clean-up is done.
So, a later call to create() sees that unix_key is already valid, but
it cannot properly clean it, because it does not actually refer to
any shared memory.

Fix it by cleaning up unix_key and nativeKeyFile if shmget() call in
attach() fails.

Change-Id: Ibccc3ac307d8b2e07e1b9b24b55f97a859a03131
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e85a3cde2f8aa15eb33f12dc8c52ef660aeb7cc0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-08 15:44:44 +00:00
Axel Spoerl
fd242e8cec Extend qDebug functionality for QDockWidget
Add features and floating flag to QDockWidget debugging.
Debug dockwidget parents of a group window.

Task-number: QTBUG-118578
Task-number: QTBUG-118579
Change-Id: If2a6caacf5d02f9018c2a3073fdbc1de39bce1ee
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Keith Kyzivat <keith.kyzivat@qt.io>
(cherry picked from commit bbeff2a3350dd3396400865525d509b784c2d93e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-08 15:44:44 +00:00
Alexey Edelev
8e437b7bcb Remove forward declared QHash
Fixes the complication issue since the typedef was used as class member.
Replace the typedef with using statement.

Fixes: QTBUG-118627
Pick-to: 6.5
Change-Id: Ie3d341fb8f18a7341d018f51947127ace941a620
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit a8118caad6bec23699fbfd007fa1c0ba45d79277)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-08 15:44:44 +00:00
Thiago Macieira
457e6f8b19 Work around GCC 13's bogus "out of bounds" check to QByteArray::_empty
Nothing here is empty and even if anything were, QStringBuilder properly
handles empty strings.

In static member function ‘static void QConcatenable<QByteArrayView>::appendTo(QByteArrayView, char*&)’,
    inlined from ‘static void QConcatenable<QStringBuilder< <template-parameter-1-1>, <template-parameter-1-2> > >::appendTo(const type&, T*&) [with T = char; A = QByteArrayView; B = const char (&)[20]]’ at qstringbuilder.h:398:37,
    inlined from ‘T QStringBuilder< <template-parameter-1-1>, <template-parameter-1-2> >::convertTo() const [with T = QByteArray; A = QByteArrayView; B = const char (&)[20]]’ at qstringbuilder.h:117:54,
    ...
qstringbuilder.h:178:19: error: ‘void* memcpy(void*, const void*, size_t)’ forming offset [1, 5] is out of the bounds [0, 1] of object ‘QByteArray::_empty’ with type ‘const char’ [-Werror=array-bounds=]

QStringBuilder::convertTo() creates the target as
        const qsizetype len = QConcatenable< QStringBuilder<A, B> >::size(*this);
        T s(len, Qt::Uninitialized);

We know len can't be zero because GCC is complaining about a memcpy()
when the offset has been changed from 0, meaning QByteArray was given a
non-zero size and therefore its data pointer is not &QByteArray::_empty.

Fixes: QTBUG-116763
Pick-to: 6.5
Change-Id: I85599ea5ca7a4b79a8bbfffd178af437984080fb
Reviewed-by: Shawn Rutledge (away) <shawn.rutledge@qt.io>
(cherry picked from commit 9aaf12ebaadf25db67932d6985d9aed424873d50)
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-11-08 08:44:44 -07:00
Mårten Nordheim
85304da9e9 QNonContiguousByteDeviceThreadForwardImpl: reset m_atEnd during reset()
Because otherwise the atEnd() function will return true if we finished
an upload, and then we reset due to an error and try to upload again.
In a future patch we rely on atEnd() returning true only if the data
has actually been consumed, so re-uploads will not work correctly.

Pick-to: 6.5
Change-Id: Id914648f2509dd112b6bfc71231caa59cbe8ae68
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 127e6cc9077bb7ba328f5b71c0748bd0ef71508d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-08 15:44:44 +00:00
Mårten Nordheim
1b62cee8d5 Schannel: Return if socket is invalid
In a couple places we already check if the socket is connected,
however we can be connected _and_ have the socket be closed.
The logic behind that I don't really understand, but there are
similar checks for validity in the OpenSSL backend.

This happens when calling close() on a still-connecting
socket. The QIODevice is marked as closed, but the connection
cannot yet be aborted. And when it finishes connecting we
handle the signal, start encryption, and then disconnect.

Pick-to: 6.5
Fixes: QTBUG-116550
Change-Id: I06c0a2db32bea0b573a99a971b8fb0b66a7a73d5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 3ea46fa978eeb1e8fbcbd20f1dc88690a25dbe63)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-08 15:44:44 +00:00
Mårten Nordheim
80b9714d7e QNetworkInfo[win]: Advertise Metered feature
I forgot to add this to the features list when adding support for it.

Amends d2c5494c3d5412bfc1dc3e819e88a636407025fc

Pick-to: 6.5
Fixes: QTBUG-118741
Change-Id: Ieabf086ef66777e6178476934b88448ad88bc738
Reviewed-by: Erik Verbruggen <erik.verbruggen@me.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit c31227a548a2fc784370629a67823f35f2ae9b59)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-08 15:44:44 +00:00
Edward Welbourne
f5760cd7c9 QTZ/Darwin: Make available-ID checks cheaper
Previously we've checked whether an ID is available by computing the
full list of all known available IDs (converting each from NSString to
QBA in the process) in order to compare the offered ID to each of
those in turn. This is a significant performance bottle-neck

Simply trying to construct the NSTimeZone instance should suffice to
determine whether there is such a zone; if the ID is not available, we
apparently get back a null pointer, which is easy enough to test for.

Pick-to: 6.5
Fixes: QTBUG-118759
Change-Id: Ib272c96e25db9640490299c638e2e9196a58712f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit be55fbede9ed7a283d769fd5cf15a3a56bdcfcf7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-08 11:57:06 +00:00
Samuli Piippo
44df580c8e tslib: generate event with correct buttons and event type
Tslib doesn't give button and movements events separately, so send
the first event with pressure as MouseButtonPress, subsequent events
as MouseMove and event without pressure as MouseButtonRelease.

Pick-to: 6.5 6.2
Fixes: QTBUG-111952
Fixes: QTBUG-113307
Change-Id: I7ed6e37936887e11affb254d2fca74c79b6a43b9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit f0b2c5f21c8dcd66a7e43321ea2620aea71706e8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-08 11:40:53 +00:00
Joni Poikelin
a2a7da3a02 Fix smooth scaling of Format_Mono and Format_MonoLSB
Fixes: QTBUG-117713
Pick-to: 6.5 6.2
Change-Id: I2fb071a4d2229da50dfacb0a92c51c3e4ea57a74
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 799bfe94e8c17c0ff890c45b22d670d3bc8778c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-08 08:15:35 +00:00
Wladimir Leuschner
d2b109801e Restore WindowState when changing SurfaceType
Restore the WindowState, when a Window has to be recreated due to
changed SurfaceType.

Fixes: QTBUG-118194
Pick-to: 6.5
Change-Id: I40ba552cda9dfc8ab543611595c068f80b8fa1d6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit c88211d1e4ac12eb2ae4990703a4f73c7085d624)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-07 19:38:44 +00:00
Ivan Solovev
2c8d75ff60 QSharedMemory: fix attach() -> create() for legacy SystemV mode
The attach() -> create() sequence was not covered by unit-tests in
qtbase, but this approach is used inside QSharedImageLoader.

It turns out that 02c42b26e1ff94047657c4838128cb5b22d24d2b broke this
usecase for legacy mode, and the create() triggered an assertion
in QSharedMemorySystemV::updateNativeKeyFile(). Fix it by clearing
the nativeKeyFile if ftok() call in QSharedMemorySystemV::handle()
fails().

Add unit-tests for the attach() -> create() scenario.
These tests revealed that this scenario fails also in non-legacy mode
for SystemV, so add QEXPECT_FAIL for these cases for now. This will
be addressed in a separate patch.

Change-Id: If133fa56c82eba902374dc48d2757046b3d40baf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit fb1dcbfcba35fe436b7be1c851a129da9f98cb55)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-07 19:19:06 +00:00
Alexandru Croitor
96e9d5cd76 CMake: Remove qt_internal_qt_configure_end workaround
Now that the top-level build calls qt_internal_qt_configure_end
itself, we don't need to call it in qt_print_build_instructions.

Change-Id: I906ee7bc1aed3b597049b5996a41dd298175343c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 28516ed1fdf52665886f6005766257776453e584)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-07 19:19:04 +00:00
Jan Grulich
1084d008d3 QCryptographicHash: Do not rely on auto-loading of the default provider
When using OpenSSL implementation, we were assuming the default provider
will be automatically loaded, but this is not going to happen after it
gets unloaded. Even the documentation says that automatic loading of the
default provider occurs max once and if it's explicitly unloaded, it
will not be automatically loaded again. In our case we are explicitly
loading and unloading the provider after MD4 hash is used so using it
afterwards we will always fail.

Fixes: QTBUG-118227
Pick-to: 6.5
Change-Id: I8107b9ab02321b57978c3d25a061672fd2a7aee8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ddb1c75afe474e399fe9f5f839a9ac3873dee247)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-07 10:40:48 +00:00
Alexandru Croitor
70ee85eff9 CMake: Don't strip debug builds with qt-cmake-private-install in CI
This provides better stack traces and easier debugging in CI VMs.

Put the MSVC check for disabling stripping into the same place so
there's one location to decide whether stripping should happen.

Amends 60d804c56769de82e658205bec687b83833a61e9

Fixes: QTBUG-118070
Change-Id: I4684036c8a5a137d14eea58954b34fe1ceb7f804
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 09fdddeb326d0c79d080bdb50a92a839038baea7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-06 13:05:46 +00:00
Tim Jenssen
ebb80cbb08 Schannel: Avoid crashing for unparsed certificate
Crash reports imply the `certBackend` we extract in
QSslCertificate_from_CERT_CONTEXT is null, which means that
something went wrong when parsing the certificate data we get from
the certificate chain.
We assume the rest is okay since it must be inside the bounds of the
length of the chain.

It's not clear why the certificate would be invalid, but it's better
to avoid the crash for now.

Pick-to: 6.5
Task-number: QTBUG-118569
Change-Id: I76ce07fc38bf82ef5c93097d839724ddee1edeef
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 91fe6fb2e14f295c0020eb5e7f33444dfddbd7dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-06 13:05:46 +00:00
Edward Welbourne
6b08ad7ed9 QLocale/MS: return null variant, not empty string, on failures
Likewise for the string list in uiLanguages(). Document the exception
(for grouping separator) and the other corner case (currency symbol).

In commit 089bbfc30758265d3fce804b950f56a15225e32c we changed the
system locale look-ups to rely on backends to return null QVariant on
failed look-up, but the MS backend has several places where it would
return an empty string for lookups that really shouldn't.

Pick-to: 6.5
Fixes: QTBUG-118703
Change-Id: I1a5622beebc4e5639d643250829937a829e23363
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 385626d64256c1a7fe59fbbe9156508d757e2ccc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-06 09:20:20 +00:00
Tor Arne Vestbø
b391fce4e0 Fix tst_QWidget::hoverPosition blacklisting for x86_64
The blacklist just uses 'x86'

Pick-to: 6.5 6.2
Change-Id: I9279e4c497e566f59be54b5cc71a7671d3a3370f
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit db17487c9350d321905ce61a88bedb1b9f7abf3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-06 08:59:29 +00:00
Tor Arne Vestbø
1781d77092 Align QKeySequence behavior between macOS and iOS
External keyboards for iOS/iPad devices have the same Macintosh based
keyboard as Macs have, with Command (or Cmd) ⌘; Option (or Alt) ⌥;
and Control (or Ctrl) ⌃ keys.

We were already declaring the QPlatformTheme::KeyboardScheme as
MacKeyboardScheme on iOS.

[ChangeLog][iOS] Keyboard shortcuts now follow the same scheme as on
macOS, with their native representation expressed via the ⌘, ⌥, and ⌃
modifiers. Use Qt::AA_MacDontSwapCtrlAndMeta to override this.

Fixes: QTBUG-113165
Change-Id: Ia1856ee1718dab9f2f2512ffffc8b4d3cc5adecc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f341f75c8c23c8e97752941d1f20948e71c6c284)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-11-06 08:59:20 +00:00
Kai Köhne
292c23bbe2 Doc: Replace wrongly spelled word
It's actually 'lexicographically'. But 'alphabetically' is a more common word.

This was brought up in https://forum.qt.io/topic/151834/what-s-lexographically/5

Pick-to: 6.5
Change-Id: Ibeb0e4463e12b54c1c10ac7df268e4d62b6ce49f
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Inkamari Harjula <inkamari.harjula@qt.io>
(cherry picked from commit ed7912dbe08d622374d11b0dbb1fd2250b99103b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-06 08:28:46 +00:00
Dimitrios Apostolou
282280d2e8 Always print output of a failing test
For now this affects only the ASAN-enabled testruns that are run
without "-V" in ctest's command line.

Pick-to: 6.5
Change-Id: Iaa889f950e5de0657523dc9bcb457968c1cbf29e
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit 737ed178033e6dd3358fbcc87db300ab21d65b32)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-05 13:43:01 +00:00
Edward Welbourne
28ba848dfa Rework documentation of the serialization converter example
The documentation was previously code-heavy and short on exposition,
while focusing almost entirely on the CBOR converters. Prune most of
the CBOR code quotes, shuffle some snippet markers, add and remove
others and rewrite the main text.

Shift focus to the base-class for converters and how it's used by
main(). Retain relative focus on the CBOR converters, as they are
relatively full-featured hence illustrate more than the others do, and
replace the sequence of single-line sections about the others with a
section collecting all into a table and saying some general things
about them.

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: I8d41f25c165eb1a7ba20cb68aee6ab6b2fd050f8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1940f0c7be7c78b8773e9576e3740707bae37889)
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-11-03 16:53:33 +01:00
Edward Welbourne
a38955c704 Eliminate duplicate overrides of Converter methods in example
The Out-only converters shouldn't need to implement loadFile(), as it
shouldn't be called - a converter is not used for input unless it says
it supports input. At the same time, provide the "ground state"
implementations for optionsHelp(), outputOptions() and probeFile() to
save the trivial implementations the need to duplicate one another.

In the process, make the handling of loadFile()'s outputConverter more
consistent among those that do implement it.  Always set
outputConverter if it's initially null (the caller does assert this).

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: I856d12c791d1f8e0accdb7dd1412d493117b2302
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1022b0d111ea401a9aee719f89c75ff0ddb4fe9b)
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-11-03 16:53:32 +01:00
Edward Welbourne
73a2f1edbc Move Converter class, in eponymous example, to a file of its own
There's more details coming and it's good hygiene anyway.

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: Ief3acf6e508bc93eaa8490f6c49300b25c1d3556
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8b8fc42f2c6b08097bcd04038ed7f12667a90875)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-03 16:53:32 +01:00
Edward Welbourne
d46d1db4c6 Break out the list of available converters to a static method
Mostly to pave the way for moving the class code to a file of its own,
but this incidentally saves the need to std::as_const() every use.
Moving the underlying object to a local static of a private method
also saves the need for heap allocation (which was leaked).

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: I30f4bf3c46d39e04d0ac4e3e9ba431945ebb9193
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit d57a78657e09e38dc4137e3c6c80c1a42817cc8c)
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-11-03 16:53:32 +01:00
Edward Welbourne
e62633333a Split VariantOrderedMap out of Converter's header in example
Although used mostly in the same files, they're separate types, so
define them in separate places.

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: I9e64b382ad48f9a74e432ccd49b6f5fcc9316da3
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit c78d9bf54900df71768ab4653320deeeddde2748)
2023-11-03 15:53:32 +00:00
Edward Welbourne
c6011e07c1 Remove unused Map alias for VariantOrderedMap in convert example
Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: Ic82f7961df5f7a5bb0cd6cc113e4019508e58f47
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 08ac3ddde73ce4ad2c069a74d46e4c627b0a6756)
2023-11-03 16:53:32 +01:00
Pavel Dubsky
72f08b81ae Introduce QComObject base class
This base class implementation for COM objects provides IUnknown
interface implementation with reference counting which will allow to
keep all this functionality and implementation in the same place.

Pick-to: 6.5
Change-Id: I8ec597b1040ac33295317e06338ffdcb61b78f85
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 33732478733dd7c5db4abd2daaab8e72661ae4c5)
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
2023-11-03 15:53:32 +00:00
Harald Sitter
197e591558 a11y: fix race condition on atspi startup on Wayland
This amends db346e711c9af50566c234cfc21199680e6cb499 .

Previously we could race between dbus connecting and our "manual"
enabled call since we didn't take into account whether dbus is
connected or not.

This lead to scenarios where opening an application (in particular under
Wayland) would result in the application not being able to register on
the a11y bus because registration was attempted too early.
By simply taking connectedness into account we'll make sure to not
run registration too early anymore.

Pick-to: 6.5
Change-Id: I46a3c0b57f8a0c83d3e5fae9e355c2061954031f
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 918fed39156c90540a12557c7a6630ae3d7d841e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-03 15:53:31 +00:00
Tor Arne Vestbø
77dff1f5ed QMessageBox: Detect modifications to standard button text
The addButton(StandardButton) and button(StandardButton) APIs return
a QAbstractButton, that the user can in theory modify to their heart's
content. This causes problems when the native dialog backend is not
aware of these modifications.

We documented this limitation in e9a1c5321, but it turns out to be
more common than we first though. In particular, a typical case is
modifying the text of the button.

We now try to detect if the button has a non-standard text, and if
so turn it into a custom button when passing it on to the native
backend. From the point of view of QMessageBox it's still a standard
button, and will be reported as such in the result of exec().

To make this work the QMessageDialogOptions::CustomButton needs to
learn about custom button identifiers, so we can pass the original
standard button though.

This moves us closer to a world where the QMessageDialogOptions
represent both standard buttons and custom buttons using the same
structure, which is what we want anyways, so that we e.g. respect
the added order of standard buttons with the same role.

Fixes: QTBUG-118241
Pick-to: 6.5
Change-Id: Ifb7f7bd537fe71293f14ef6a006999e350bd0b52
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit bafeffff9d1b9b2c8108e74cb6857899f7dd5b5e)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-11-03 15:53:31 +00:00
Ivan Solovev
c62c335be4 QSharedMemory: fix semaphore creation in legacy mode
The legacy mode was using the new nativeKey to create a semaphore.
As a result, on macOS the name of the semaphore key file was the same
as the name of the shared memory key file.
This lead to a situation when the file was mistakenly deleted when
destroying any instance of the shared memory, not only the one that
created it.
Fix it by using QSystemSemaphore::legacyNativeKey() in legacy mode.

Add a test to verify that we cannot re-create a shared memory with the
same key. The test was failing on macOS without the fix.

Fixes: QTBUG-111855
Change-Id: Ib0bc41791e889b1888bbb8aa9044c6b053b63a5a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 02c42b26e1ff94047657c4838128cb5b22d24d2b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-03 15:53:31 +00:00
Alexey Edelev
3b562917b3 Mention QT_FORCE_FIND_TOOLS in QT_HOST_PATH
Document requirement of setting the QT_FORCE_FIND_TOOLS option to
ON to reuse the pre-installed Qt version when not cross-compiling.

Task-number: QTBUG-118211
Pick-to: 6.5
Change-Id: Ia02abeaede583ca01f10187158da0f4bc86f9d1a
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit c861f9acef70af5bdd317847fb6cfca79da3eb49)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-03 09:00:47 +00:00
Samuli Piippo
a911438755 tests: skip setPermissions test if running as root
Running this test as root doesn't make sense, and it is the reason
why QNX is failing.

Pick-to: 6.5
Change-Id: Ibbdce9090882cb9dd87d7fcd0802a481f9e7883c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 99cec50f56309c28712a444c40475ce69badfbf9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-03 09:00:22 +00:00
Thiago Macieira
8ef3ff1c62 QProcess/Unix: also ban vfork() under TSan
Complements 94ec17436cbdab52ed85e15ea197b538541b14ca for the ASan logic
(52ed6af5277100ed5b9a4f4231b94013ce539a2c for the code change).

Fixes: QTBUG-117533
Change-Id: I09c3950e719e4b259bc7fffd1793d59dbdbfe82a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a0a29695ab018118f194b3d332ae9b0065c7b1a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-03 06:36:58 +00:00
Friedemann Kleint
69487198ef uic: Port enumeration lookups to QLatin1StringView
This makes string operations on them easier.

Pick-to: 6.5
Task-number: PYSIDE-2492
Task-number: PYSIDE-1735
Task-number: QTBUG-118473
Change-Id: I92922b701fd72f5521eee7f6d3ef63492e03be9b
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit d7ebe91781b80c8f748ea56d7915f03e69916516)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-02 18:18:49 +00:00
Yuhang Zhao
962291ab17 windeployqt: improve MSVC runtime detection
MSVC runtime dlls also include vccorelibXXX.dll, concrtXXX.dll,
beside these traditional dlls, it's also possible to link against
the new UCRT runtime, the ucrtbase.dll (and possibly including
the API Set dlls), so we need to add some more checks to make
windeployqt more robust. I've tested a custom Qt build locally,
which I managed to make it link to ucrtbase.dll only, and this
code works fine.

Change-Id: I00bc8666d8850aac279b8747465879e39348ba02
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
(cherry picked from commit 8842391e5c1c1e751d5d8fca53556d9e8c80196b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-02 16:49:49 +00:00
Eskil Abrahamsen Blomfeldt
d40f19af75 Skip mixedScript test on platforms with no Hangul font
This test depends on the system actually supporting Korean
text, otherwise it will just return a single glyph run with
the digit and the missing glyph symbol.

Pick-to: 6.5
Fixes: QTBUG-118649
Change-Id: I54e55414ae4ba0a6328c7c3a57ae8840d3b123b1
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit c5b3fd134b9e88322379fb34616662690c7acbb8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-02 16:41:24 +00:00
Liang Qi
199540dd57 xcb: implement QXcbCursor::size()
A follow up of baed8534bc1dac36a9d0ef4240fc14398076a192 .

Fixes: QTBUG-118612
Pick-to: 6.5 6.2
Change-Id: I7b4a2276c6e6a14d5413f6cd64d801de11cc8c3e
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 78272c667f008f6afcf5f84e0add525b56c3a558)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-02 09:59:33 +00:00
Bartlomiej Moskal
bad32e1f06 Android: Hide text handle when it is out or covered
The text handle should not be visible in case when it is out of
the text-object, or when it is hidden by other object. That is why we
should call updateSelectionHandles() method after touch only in case
when cursor position fits to clipped input item rectangle.

Fixes: QTBUG-115005
Pick-to: 6.5
Change-Id: I35c083acd8fd4d5240e3bb15afa1afbec4ea0b26
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit d10d76f9f20d48d69117d9f7dab089cb2a696b2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-02 09:16:42 +00:00
Mike Chen
68ac8bdea3 xcb: unset states and set new ones as need
Should not unset all the old state and set the new ones.
Only unset the state that needs to be unset.

If states changes from maximized to minimized, there is no need to
unset the maximized state and set the maximized states again.
(minimized and maximized can exist simultaneously :)

This amends f61b140482d9578c07410a5979379e44e05352e5 .

Pick-to: 6.5 6.2
Change-Id: Ic93122b92fafcdba973b885e299b282408da7a1c
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 9161f66a496c7e6043e0670286f64d6fd95472c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-02 08:28:06 +00:00
Edward Welbourne
2eb1a72f73 Replace confusing member variable with a predicate
The Converter class, in the eponymous example, had a null member
variable that wasn't a nullptr - it pointed to an instance of
NullConverter - so that other converters could test whether a
Converter * they'd been passed was null (in the sense of pointing to a
NullConverter). This, however, was susceptible to misreading - I
misread one such comparison as a nullptr check and thus thought it
redundant with an earlier actual nullptr check. To spare future
readers similar confusion, replace the public static member variable
with a protected (since only other derived classes need it) static
predicate, to at least give the reader a clue that this is using the
word null in a class-specific sense.

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: I1e4f494b303d1bf90107f8c6fa3a4a22f6d81b90
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0b1670134b43ba390f35b52d2458e4269a804de3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-01 20:46:51 +00:00
Edward Welbourne
371dd6c6bd Amend #if-ery to exclude MS QTZP backend declaration when not in use
Since 2017 we've been using the ICU backend in preference to the MS
one, so there's no point declaring the MS one when it's not being
compiled.

Pick-to: 6.5
Change-Id: Ia7b770ec27bb627caace814b972967c4f7d63330
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0de55973d37a951fb5d5f596d7967f1978865845)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-01 20:46:51 +00:00
Friedemann Kleint
0dc1dac296 QtDBus: Fix unity build on Windows
Exclude qdbusconnectionmanager.cpp which includes qt_windows.h,
clashing with the "interface" parameter name in qdbusinterface.h.

Task-number: QTBUG-115352
Pick-to: 6.5
Change-Id: Id41910857cb203ec5a1b784fa171eeb189ca4eca
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit fcab2b88af61e7987ea962f520862cf470cd8c30)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-01 20:46:50 +00:00
Ivan Solovev
b799a2107c Extend QTestPrivate property tests - actual implementation [2/2]
This patch provides the actual implementation to detect binding loops
in property setters.

These test will help to catch all the existing binding loops that were
introduced when migrating to new bindable properties.

The logic of the new tests is taken from
tst_QObject::objectNameBinding(), but generalized to be applicable to
all bindable properties.

The original code from tst_QObject can now be removed.

The patch effectively reverts f791570b86ce4a0da45bb6e617701a48ee8189b7
because a lambda returning a nullptr now means that the binding loop
test should be skipped, which is not a good default behavior.
Now when all the existing bindable properties are fixed, it's fine to
give a compilation error when adding new tests, if the class is not
default-constructible.

Task-number: QTBUG-116345
Pick-to: 6.5
Change-Id: I059d444d4bb023c050a22e5b1974565e4f581b5c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit f5a5c59918021b0bf9a43e6130df2a3f02ea5b97)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-01 20:46:50 +00:00
Michal Klocek
9c1fb39c9c Doc: Fix QTest::createTouchDevice docs
After the introduction of QInputDevice class the returned
QPointingDevice object from QTest::createTouchDevice()
call is no longer automatically deleted when the
QCoreApplication is deleted. Moreover, this function does
not really go thorough qpa but simply registers the device with
QWindowSystemInterface::registerInputDevice() (which is
actually also used from qpa plugins when new device is plugged)

Pick-to: 6.5
Change-Id: I3a0400288d76b7c95659d6b6ea260eff3233ebf1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 567e9b2026c42f823d0f71c691746fe583dc8e4c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-01 20:46:50 +00:00
Laszlo Agocs
aecd210c75 Fix alpha channel logic in QRhiBackingStore
Mirror what other platforms such as Windows or xcb do.

Those all unconditionally upgrade a non-alpha format such as RGB32 to
something like ARGB32_Premultiplied (or whatever
qt_maybeAlphaVersionWithSameDepth returns).

Without this, there is a discrepancy between macOS and the other
platforms when using QOpenGLWidget or QQuickWidget (which trigger
the usage of QRhiBackingStore).

For example, attempting to have semi-transparent raster widget content
over the RHI-based widgets will render incorrectly. This is visible in
6.7 (dev) with the cuberhiwidget example as well: the red
semi-transparent overlay is rendered incorrectly on macOS since
QRhiBackingStore sticking with a QImage of RGB32 has far-reaching
consequences.

Upgrading to an alpha format is also required by the "hole punching"
mechanism the texture-based widget system relies on, although there is
a suspicion that that just happens to look correct with RGB32 as well
since there is an alpha channel technically with that format, and alpha
writes may not be masked out, depending on painting internals, ending
up with RGBA content in practice.
But in other cases, like in the report and the one mentioned above
this clearly breaks down.

Fixes: QTBUG-118553
Pick-to: 6.5
Change-Id: I4b5b7a4f720377d64903e948b866f8d1c443a2d2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit aa4fe3286d50e05bf7d521ad8d579062f250bd0a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-01 20:46:50 +00:00
Laszlo Agocs
b808b7004c QRasterBackingStore: check format alpha presence in a more generic way
...instead of hardcoding a format such as ARGB32_Pre. A subclass may
override format() after all.

A few lines below there is the same check in fact, but this time
with hasAlphaChannel(). To be consistent, switch over to
hasAlphaChannel() in the first case as well.

Pick-to: 6.5
Change-Id: I7a5653863a72f8a0df98da66290f6d17e548b0a8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 522d9fcfe40a107779f6e21d83195fafa67fb064)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-01 20:46:50 +00:00
Eskil Abrahamsen Blomfeldt
6f22ed4b55 Update Harfbuzz to version 8.2.2
Pick-to: 6.5 6.2 5.15
Task-number: QTBUG-118615
Change-Id: Ifdf6023781c7202bc07f7cfb821c8cfefd2720a8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 38ce08aa8e98035ad7414130d82458ab8b228514)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-01 20:46:50 +00:00
Mårten Nordheim
f542134498 QLocal8Bit::convertFromUnicode[win]: handle trailing high surrogate
The win32 API doesn't give us much choice. _Some_ code pages have
support for returning some error if we pass a specific flag, but not
all of them.

Anyway, since the code pages might not support all that UTF-16 provides,
we can't reasonably make it error out on characters that cannot be
converted.

So, the most reasonable thing we can handle is a unpaired high surrogate
at the end of a string, assume that the rest of the string was fine, and
that the low surrogate will be provided in the next call.

Pick-to: 6.5
Fixes: QTBUG-118185
Task-number: QTBUG-105105
Change-Id: I1f193c9d8e04bec769d885d32440c759d9dff0c2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit d8d5922f16f1710b66caf718c302b633d2f78b0b)
2023-11-01 21:46:50 +01:00
Mårten Nordheim
90a23d8d19 QLocal8Bit::convertFromUnicode[win] use local array for buffer
To match convertToUnicode, we use a local array as a temporary
buffer, then if any growth is needed we work directly with a QBA.

As a drive-by: explicitly cast to int where we pass int

Pick-to: 6.5
Task-number: QTBUG-105105
Task-number: QTBUG-118185
Change-Id: I1efff318eea41d87d558599d737b64107af4ae17
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit e34ee8e88a825fe305f582be7d78cca0f3af33cd)
2023-11-01 21:46:49 +01:00
Mårten Nordheim
0e1aef15f0 QLocal8Bit::convertFromUnicode[win]: Drop UsedDefaultChar argument
We don't use the value, and the docs[0] say that we get the best
performance if we don't pass the argument.

[0] https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-widechartomultibyte#remarks
See table

Pick-to: 6.5
Task-number: QTBUG-118185
Task-number: QTBUG-105105
Change-Id: I3eb5e023a936fe3def5169e3fb492a62708bbf44
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 36a6522b48dd74305e1a57a520651f34f2d91ee4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-01 21:46:49 +01:00
Mårten Nordheim
ac103de62b QLocal8Bit::convertFromUnicode[win] move cast earlier
So we don't have to do this multiple times when calling the function.

Pick-to: 6.5
Task-number: QTBUG-118185
Task-number: QTBUG-105105
Change-Id: Ifa72eedd5f71365618ec6b67fa3047f90f4eb541
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ab009f2f03a5d288fb4ee25722337ca5618d8137)
2023-11-01 21:46:49 +01:00
Safiyyah Moosa
524ce5bc3f Doc: Improve the QCombobox Documentation
The purpose of this commit is to improve the QCombobox documentation.

The following updates were made:
- The Combobox image was udated with a better quality image.
- The brief was updated to make it more understandable.
- The detailed description was updated with subsection titles.
- Full stops were added to the sentences that were missing them.

Fixes: QTBUG-117748
Pick-to: 6.5
Change-Id: I417a720299ac0eb2be3f080f2fc0f76a27242423
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 48c6f7250a439092cb7ede31e0169e790c9b5cd8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-01 20:46:49 +00:00
Andreas Eliasson
a6a9ac8539 Doc: Revise QWidget docs
Reviewing and improving the docs for QWidget is part of the objectives
for the 2023 Q4 OKRs.

Most of the work in this patch is fixing grammatical errors and typos.
It is tempting to move much, if not all, of the Detailed Description content from the QWidget class reference page (qwidget.cpp) into its own overview/explanation page, which would be more in line with the diátaxis framework. But I think that should be a different patch.

Fixes: QTBUG-117758
Pick-to: 6.5 6.2 5.15
Change-Id: Ibb3f367c4677f7e6615bc0cd39d0ffe921862cb9
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 45c6ef02e7e730f7a0c7b5bccd96c4f9ca74e1a6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-01 20:46:49 +00:00
Anton Kudryavtsev
87a3eeb26f qvulkanwindow: use qimage rvalue overalods more
Change-Id: I71bb0df5dbf1993284ec907f637a8696898dddb1
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 5e158ee17736cea5c745edbb5885a0fbfa6302b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-11-01 20:46:49 +00:00
Topi Reinio
05390e0d23 Doc: Fix warnings and linking issues
Remove or replace links to examples that were removed or moved under
manual tests.

Replace code snippets that were quoting the now-missing examples.

Fix documentation of QSet::removeIf().

Add qtopengl, qtshadertools dependencies to Qt Widgets documentation
project to enable correct linking to those topics.

Pick-to: 6.5
Change-Id: I058cd5f2063aa933ea310bceff906f05422a7cb2
(cherry picked from commit dc33b0ca7a680713552063d7f74befea53f34814)
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-11-01 10:19:17 +00:00
Kai Köhne
bee9f8be26 Doc: Highlight some Widgets examples for Desktop category
Pick-to: 6.5
Task-number: QTBUG-117208
Change-Id: I499b5141cc930c1f61a608bd734ef4982bd2ee0f
(cherry picked from commit b7b2375751ca098eaa564202b00a46ad58c87399)
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2023-11-01 10:05:40 +00:00
Mårten Nordheim
5e0c6b5fa0 QLocal8Bit::convertToUnicode[win]: handle more than one octet state
Both to store and to restore.

Without this a 3 or more octet sequence would cause errors or wrong
output. This can be seen with GB 18030.

Pick-to: 6.5
Fixes: QTBUG-118318
Task-number: QTBUG-105105
Change-Id: Id1f7f5f2fba4633b9f888add2186f4d8d21b7293
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 94214fe100334fd2983e76617191e4153c383a7f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-31 09:38:50 +00:00
Mårten Nordheim
e542a2f9e5 QLocal8Bit::convertToUnicode[win]: Drop MB_PRECOMPOSED flag
A few code pages do not support this flag[0]. It's also deprecated[1]
and is what Windows prefers to generate by default. So let's drop it.

[0] https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-multibytetowidechar
See note at the end for the dwFlags parameter.

[1] It's mentioned in the header files, but not online...

Pick-to: 6.5
Task-number: QTBUG-118185
Task-number: QTBUG-105105
Change-Id: I798c387170c73a953be874de139868543b2d775e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ef24784f886ee12363cce38b05167efe7e7f8d89)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-31 09:38:44 +00:00
Mårten Nordheim
8d1dfdd912 QLocal8Bit::convertToUnicode[win]: Simplify state-handling
Instead of having separate variables for the state, that we then
store back at the end, let's just make state-handing explicit, making
the logic around it easier to follow.

We now output Replacement Characters, if we try to decode stateless and
have an invalid sequence at the end. Otherwise we fall back to
convertToUnicodeCharByChar as before.

Pick-to: 6.5
Task-number: QTBUG-118318
Task-number: QTBUG-105105
Change-Id: Ifea64bc241113f468b69cad16fc3cc97a6ebe646
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2e9bb2ee5d3a3e025036e2dd6722eac15c922505)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-31 09:38:38 +00:00
Mårten Nordheim
e1180150e4 QLocal8Bit::convertToUnicode[win]: Drop QVLA in favor of array
We now, instead, resize and copy the data directly into a QString if
we run out of space in the pre-allocated array.

Pick-to: 6.5
Task-number: QTBUG-118318
Task-number: QTBUG-105105
Change-Id: I1eed5e75f0bd067b4e7d6bff97c4186f3f6ee0ad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d44aae13589074752ab74d796a7ade87261bceb4)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-10-31 10:38:31 +01:00
Santhosh Kumar
d490f3d9fd Fix margin issue in wizard for windows
The patch set 8dbc4824895ea9f87d1f6406fe2d22336b6253ed extends support in calculating margins when ExtendsContentIntoTitleBar() is used. But this affects existing QWizard that sets custom margins through Aero style. This is because, the custom margins set by Aero style excludes top margin (titleBarSizeDp()) and excluding it once again cause slicing in the client window area.

This patch set fixes it by considering top margin only when system margins is used in windows.

Fixes: QTBUG-117428
Pick-to: 6.5
Change-Id: I6d6eefc691f26474257b58304dac169fba20b5e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 58a6a92f688fccf9e841dea6976409d97a6dd3b0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-31 09:22:02 +00:00
Tor Arne Vestbø
7d79ae0d84 Blacklist tst_QWidget::hoverPosition() on macOS 14 x86_64
It relies on moving the mouse, which is likely related to this
failing in CI.

Pick-to: 6.5 6.2
Change-Id: Ib4a3ba7a9e874c9c2ef2d6d16143adf072e47588
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
(cherry picked from commit adf39eff44825ce19bd16c94089a6363c13bdd8e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-31 00:16:37 +00:00
Tor Arne Vestbø
ae12733471 Blacklist tst_QWidget::showMinimizedKeepsFocus on macOS 14 in CI
It was already blacklisted for macOS 13, and has also been blacklisted
on macOS many times in the past.

See also a9005a70d543db8c458f670a43c586d077b12417.

Pick-to: 6.5 6.2
Change-Id: I9dc87ef409dd1fcc0f47d5e776927e8912ab40e0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit ddf7e5decaac3eb4d459ca9993ba620d6e7c2057)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-30 19:45:04 +00:00
Tor Arne Vestbø
9954cb69e7 Blacklist tst_QTemporaryDir::QTBUG43352_failedSetPermissions on macOS 14 ARM
Not reproducible locally. Possible permissions issue in CI.

Pick-to: 6.5 6.2
Change-Id: Ibf2255da71aaa882a2d154db6523e1af27264d4c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 435dc5a6df8621ff40d1e1c1e48bb0549c6ecb4e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-30 19:45:04 +00:00
Tor Arne Vestbø
12be9f1e11 macOS: Check NSWindow as well when determining if setVisible can bail out
In be268ae19731ab854931e43eea83e0e140ec2538 we made QCocoaWindow::setVisible
idempotent by checking if NSView.hidden needed update.

This failed to take into account the case when a window is moved from
being a child window to a top level, where the window is still visible
and the NSView's hidden state doesn't change, but we need to order in
the NSWindow that we're now managing.

We now check NSWindow.visible as well, if we're a top level window.

Pick-to: 6.5
Change-Id: I94434d6ebfe2c9ece6eac7f83f17ead250ccc07a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit be7e5f94a1c0e63d6e4dbea5649d12cdc879d8f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-30 19:45:04 +00:00
Kai Uwe Broulik
e5e8b785cc QtDBus: Use explicitly meta type name instead of method type
In Qt 6, QMetaType sees the underlying type the compiler knows,
so a "using VariantMapMap = QMap<QString, QVariantMap>" typedef
will fail to match a signature of VariantMapMap to QMap<...>
because qDBusParametersForMethod looks for the method type name
whose QMetaType::fromName lookup will fail later.

Pick-to: 6.5
Change-Id: I142dc42ca86aa8a96f73424ec5da5780f2c1e6a3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a668ed44dc98a377a5253410d65fe4b3667e87e6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-30 16:43:23 +00:00
Edward Welbourne
ff1c503dd6 Rename Convert Example to Serialization Converter
The old name didn't say what sort of thing it was converting; and our
guidelines for examples discourage using the word Example in the
title. Also reword the description of the tool in the command-line
parser and an assertion.

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: I6f52f5227362b4b807c8aabfd2103287af42bca0
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit a9c47dde501d0e178a254920bd487dca956895be)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-30 16:20:07 +00:00
Paul Wicking
933cc5dd3c Doc: Specify correct include for QWaylandApplication
QDoc automatically generates include statements for types, by a set of
rules used to determine Qt's convenience header. For the
`QWaylandApplication` struct, no such convenience header is generated.

Use QDoc's `\inheaderfile` command to specify the correct header for
access to `QWaylandApplication`.

Fixes: QTBUG-118315
Pick-to: 6.5
Change-Id: Ib3b120e3ce6b5d4df74078a21bb137adaaffa2ce
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit cc921ad10408b03329caf6dcc62a432bf0feae31)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-30 14:40:58 +00:00
Edward Welbourne
575b9117f9 Report as available every QTimeZone(qint32).id() result
The QTimeZone(id) constructor accepts these IDs, but
isTimeZoneIdAvailable() did not admit to this. Although we cannot
sensibly list all 183,047 of them in availableTimeZoneIds(), we should
not claim they are unavailable. The custom QTZ constructor needs to
know when the ID it's been given is an IANA one (to refuse to use it),
so it has to be able ask the backends for "is this IANA", so the UTC
backend still has to report these IDs as invalid, leaving the QDT
frontend to include the check for these offset zones.

Extend isTimeZoneIdAvailable() test to include every offset-zone's ID
within QTZ's recognized range of offsets. Although the actual range
accepted by offsetFromUtcString() is wider, bounded by ±24:59:59, the
constructor from offset seconds (rather than offset string) is bounded
by ±16 hours.

Pick-to: 6.5
Fixes: QTBUG-118586
Change-Id: Id9b378aee122ec841635584367022fcb47041fdd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4389b0c42934b3a0abf9fcbef4f7c06b86ff1faa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-30 14:29:54 +00:00
Edward Welbourne
41675da88e Make Converter::saveFile() consistently error on unexpected options
Have the text dumper do the same as all the others, instead of
ignoring unknown options.

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: I3c1dcbeda19e679be562110e44c5f566dfcc79ce
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit b80be2a68446d52ef5d255c002d0c5a60fb5c03a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-30 14:29:51 +00:00
Laszlo Agocs
8a4fd01bf3 Do automatic r-b swap in QVulkanWindow's grab for BGRA8
While it would also be acceptable to leave this conversion to the user,
the returned image's format (that it's QImage::Format_RGBA8888) is not
documented. That needs to be corrected in any case. Then, we may just as
well add and document that for the most commonly used swapchain color
buffer format the r-b swap is performed automatically.

Pick-to: 6.5 6.2
Fixes: QTBUG-118244
Change-Id: I7ec8324ec3a0f5c1f2a7a592501d5ff59e3e8cc5
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit 7a3261c196e5e7d5b13ff2746faeedb979944d22)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-30 14:29:49 +00:00
Viktor Arvidsson
2e0b58607e Add missing timestamp to tablet events
When copying the event for notify, timestamp was not set as it is for
other input events.

Pick-to: 6.5
Change-Id: I81bb89993027c902db2d1113605d6e6a0faf98f1
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit efb06499a7cb766062ef05f4af6bef250e3fefba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-30 14:29:48 +00:00
Edward Welbourne
2196d3eff7 Align doc of custom QTimeZone constructor with declaration
The ID of the custom zone *must not* be an IANA ID, so naming the
variable ianaId was misleading. The declaration in qtimezone.h uses
zoneId, which is more appropriate, so change the docs and definition
to use that name instead. Also add emphasis where the doc says it must
not be an IANA ID.

Pick-to: 6.5
Change-Id: I55fbb748173b540741453db3f1e2492272635f9a
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4e3518bf633119dd83aaed05ec9e31e6fcf13dff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-30 14:29:47 +00:00
Edward Welbourne
ab34aa760c Convert fprintf(stderr, ...); exit(EXIT_FAILURE); to qFatal(...)
The serialization conversion example used raw C's way to abort on
error; change to using Qt's way of doing the same. Likewise, convert
the various other uses of fprintf(stderr, ...) to qWarning() and of
printf(...) to qInfo().

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: Ia8821d3c20f58f71c106028ec422ad473c11e164
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 4e20b852bb7726f5f0d53565b18b1cd325297622)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-30 14:29:44 +00:00
Tor Arne Vestbø
5c614efcab QMessageBox: Opt out of native dialog if standard buttons have menu
Amends 2d59f2e8caed71d4eceb1abe3ce17b7befb40559, which only checked
this for custom buttons, but standard buttons can also be customized.

Pick-to: 6.5
Change-Id: Ie8bafcf5007a0b4789b2d0ee1ddbc660a952fee4
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 7fb0c2bbf9af7956e6b8a0b1906792437aa40517)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-28 00:20:19 +00:00
Tor Arne Vestbø
7dc27689c7 Teach QMessageDialogOptions about default and escape buttons
There's logic in QMessageBox to resolve the default and escape button
if not set by the user. And the user may of course override these.

We now propagate the resulting buttons via the dialog helper, and
pick them up in the macOS native dialog backend. The only common
information we have between the standard buttons and custom buttons
is the button identifier, which for standard buttons is the enum
value, and for custom buttons is an auto generated identifier.
The same identifier is used when reporting the clicked button
from the native dialog helper.

Fixes: QTBUG-118308
Pick-to: 6.5
Change-Id: I5ca45604b51f0bbf74e56134d7b55bb8911f3563
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c5d9e4a7a78b82ed31e5225c169de4718dfe4f05)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-28 00:20:19 +00:00
Volker Hilsheimer
134d3592b7 Convert tooltips example to snippets
The important bits from the example are ~10 lines of code, no need
for building a poor-man's version of a graphics or item view.

Change-Id: I7874c66765c5b46230c92846ee3de1ee83f47e45
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit ae39b1634556f82fe5d7505ed9b6ebb883d6f813)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-27 21:05:01 +00:00
Volker Hilsheimer
e91de81017 QueuedCustomType example: use QThread::requestInterruption
Drop the home-made solution with mutex and bool (which could have been
an atomic, but we have had a ready-made solution in QThread for a long
time).

Pick-to: 6.5
Change-Id: Id213a021f0ae94215afb28ff874fcb597dd1e6f9
Reviewed-by: MohammadHossein Qanbari <mohammad.qanbari@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io>
Reviewed-by: Ed Cooke
(cherry picked from commit bd5c6fab403fd8d79b84aaf05424a24e2c88709d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-27 21:04:57 +00:00
Dimitrios Apostolou
09f48964e0 Increase Coin timeout for ctest command under sanitized testruns
Reason is that after changing the sanitized testruns to quiet, we
have been hitting the 15min output-inactivity timeout.

Set it to the same value as the total workitem timeout, effectively
disabling it.

Pick-to: 6.5
Change-Id: I13c2d97b25cf338873bb89ef1ed45d58e3cdd170
Reviewed-by: Toni Saario <toni.saario@qt.io>
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
(cherry picked from commit 333650c596890fb5117c3ab5c4295838600248f2)
2023-10-27 23:04:52 +02:00
Timur Pocheptsov
a69980e557 QMessageBox: Fall back to non-native dialog if button has menu
There's no plumbing in QMessageDialogOptions for supporting
native dialog buttons with menus, and even if there was such
plumbing, we don't know if our native dialogs could support
them.

As a workaround, detect the situation and automatically fall
back to the non-native dialog, so the user doesn't need to
set Qt::AA_DontUseNativeDialogs explicitly.

Pick-to: 6.5
Fixes: QTBUG-118419
Change-Id: Iece7012909261b8869ce0ca23e45e8daaf4babc7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2d59f2e8caed71d4eceb1abe3ce17b7befb40559)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-10-27 15:45:41 +00:00
Mårten Nordheim
ba8b0fdcf7 QLocal8Bit::convertToUnicode[win]: Fix indentation
To make future changes easier to read

Pick-to: 6.5
Task-number: QTBUG-118318
Task-number: QTBUG-105105
Change-Id: I431c83b956c179b1d04c2bf51b744227f8b136be
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 3a5339b4187c63acd0ea924937042f61150d2e06)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-27 15:44:48 +00:00
Mårten Nordheim
cfd9639095 QStringConverter[win]: expose+test control of code-page
Then we can easily test how fromLocal8Bit() and toLocal8Bit() behave
with different code-pages.

Pick-to: 6.5
Task-number: QTBUG-118318
Task-number: QTBUG-118185
Task-number: QTBUG-105105
Change-Id: Ib1cd3bccd27d598f4c80915557e332befcd96354
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 13fbedd162d167bb3cdbf95181b0870f61cf2ce0)
2023-10-27 10:26:56 +02:00
Christian Ehrlicher
d24179588b SQL: fix doc
Fix the link to QIBase.
This amends 3cb5408e9e2a05f9bd0f230d9bcc31076cb8ec81

Pick-to: 6.5 6.2
Change-Id: I99820971e4136b2cbbc6ee37d80394e0e016f444
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit a553d00179fea6d5ee54444c7dc533e4722c76dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-26 21:29:10 +00:00
Jarkko Koivikko
3e3bb98eb6 print: Use transient parent for native print dialog if provided
Change-Id: I6703784d57dab732e5d501cec0d1231b564a065e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit beeb531c3200b64cc46234e9fa4dcdac6eadae2c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-26 19:01:51 +00:00
Axel Spoerl
9254bc610c qsystemdetection.h: Update WASM in comments
WASM has been added as a definition.
Add it in the comment section as well.

Pick-to: 6.5
Change-Id: Id86520cad4c12d83234cc71a00cd3e484e2895dc
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit e3d34d2fdbd6e732eaa64a871931935b906d96ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-26 19:01:51 +00:00
Edward Welbourne
b5fa71c18f Rename the JSON Save Game Example to Saving a Game to File
Partly because it also saves to CBOR, but also because our guidelines
say to avoid using "Example" in the title.

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: Id858475a6b0474228cfe8044e188cc763f56e3a8
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 32500a76a0682744103eca8498ee6d358b7a3cdd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-26 19:01:51 +00:00
Tor Arne Vestbø
15317f352e Explicitly focus automatic default button in QDialogButtonBox inside dialog
QDialogButtonBox has logic to automatically resolve a default button,
in case one is not already set via QPushButton directly, or via e.g.
QMessageBox::setDefaultButton().

Unfortunately, this default button can in some cases be overridden by
the first button in the dialog button box. The reason this happens
is that the first button is the focus proxy of the button box, so
when the button box gains focus, it will transfer it to the first
button. And since QPushButtons inside a QDialog have their autoDefault
property set to true by default, this focus transfer will also reset
the default button to the focused button.

This arbitrarily happens for any role that happens to be earlier in
the QDialogButtonBox::ButtonLayout than the AcceptRole, and can be
very confusing for the user, so we try to avoid the situation by
explicitly setting the automatic default button as the focus
widget of the button box, unless one is set already.

This is also what QMessageBox::setDefaultButton() does internally.

The only case we're not covering is when the user sets a push button
as default via QPushButton::setDefault(), but we conservatively
assume that the user then also calls setFocus() on the button.

Pick-to: 6.5
Change-Id: Ibdac0a51ba9439321d4fd7a1dac1ed695e11d693
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d44413d526ec12ed83acd7343c2005782178c7ad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-26 16:22:35 +00:00
Tor Arne Vestbø
8bb6941738 macOS: Include StandardButton::RestoreDefaults when adding native alert buttons
The loop was breaking one button too early.

Pick-to: 6.5
Change-Id: Ic5027a2e4e35fbd54bf25b310768fd3278d4874b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit cd3a409589f139c693f4125bb9f276aa16842609)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-26 16:22:33 +00:00
Tor Arne Vestbø
44902f09cf macOS: Avoid adding modal session for window that's already added
Investigating QCocoaWindow::setVisible idempotence revealed that our
QCocoaEventDispatcherPrivate::beginModalSession() implementation would
happily add the same window multiple times, resulting in trying to
re-start a modal session for the same window when the window was
closed, confusing AppKit's logic for choosing the next key window
when a modal window is closed.

We now bail out if we detect this scenario, even if setVisible has
been fixed. Additional logging has also been added.

Pick-to: 6.5
Change-Id: I07418c12b421fb0b4ebf875050e32f56fdad6197
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 78cb91c5caa47d49a4105c1113edaf3a87827b98)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-26 08:39:39 +00:00
Tor Arne Vestbø
fa74a99c8e QMessageBox: Do last minute setup in setVisible instead of showEvent
The native message dialogs are shown in QMessageBox::setVisible,
instead of plumbed via e.g. QWidgetPrivate::show_sys (which is not
virtual). And we try to show the native dialog before we call the
base class QDialog::setVisible(), where we end up sending the show
event.

As the native dialogs might rely on the last minute setup of adding
an OK button or detecting the escape button, we need to do it in
setVisible instead.

We can not switch the order of showing the native dialogs after
calling the base class setVisible (and getting showEvent), as
we need to know whether the native dialog could be shown or not
to decide whether to show the fallback widget dialog.

The part from showEvent that added the detailsButton has been
removed, as we're already doing that in setDetailsText().

Pick-to: 6.5
Change-Id: I23f1d87d542d9dadfd71924f8119c22720f4b276
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit b0ddca18d73430771f52c034e3d5a1bb92363f64)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-26 08:39:32 +00:00
Tor Arne Vestbø
ed1def47a2 macOS: Don't refuse key window for direct transient parent of modal window
As explain in detail in 1bde2036051b3aaf5896ef1ff50c08c11ea1eba9, AppKit
doesn't treat non-direct transient parents of a window modal window as
being blocked by that modal window, but Qt does. To align with Qt, we
worked around it by returning NO from canBecomeKeyWindow for windows
that were blocked by a modal window.

This however had an unintended side effect for native dialogs, due
to the way we hide these dialogs. When a native dialog is closed,
AppKit will look for another window to make key, and as part of that
it checks canBecomeKeyWindow. The problem is that the modal blocked
status has not been updated in QGuiApplicationPrivate at that point,
so we tell AppKit it can't make the transient parent key.

The modal blocked status is only updated once we hit QWidget::setVisible,
at which point dialogs like QMessageBox and QColorDialog has already
called setNativeDialogVisible(false) in its setVisible() override,
triggering the close logic described above.

To fix this properly we need to have the dialogs call the base class
first when hiding, and then setNativeDialogVisible(), and also have
the macOS native dialog helpers react to hide() by ordering out the
window in case it didn't work at an earlier point. This kind of
change is risky for Qt 6.5/6.6 however, so we opt for a simpler
solution for now.

By limiting the original workaround for non-direct transient parents
not being blocked to just those transient parents, and only for window
modal dialogs, we avoid the issue with failing to transfer key status.

Task-number: QTBUG-104905
Fixes: QTBUG-118320
Pick-to: 6.5
Change-Id: Iabbca0b74a7db4e9821a9b60730d01fbad1425db
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 4a16e51bc3e248c6f82b70e176d605d54b9b2cad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-26 08:39:30 +00:00
Michael Weghorn
f89a2f41e7 a11y atspi: Don't restrict top-level window to 2 a11y roles
So far, only accessible interfaces of roles QAccessible::Dialog
and QAccessible::Window were taken into account when trying to
find the top-level window in order to calculate the window-relative
coordinates relative to that one.

However, an app doesn't necessarily need to have any such widget/
window as it's top-level object, but can have any widget there.
Therefore, consider any a11y object that is a direct child of the
application's a11y object a top-level window as well.

For example, in the spinboxes example
(qtbase/examples/widgets/widgets/spinboxes/spinboxes), the top-level
widget is a QGroupBox, which has an accessible role of QAccessible::Client,
which maps to ATSPI_ROLE_FILLER for AT-SPI on Linux.

Since that's the top-level widget, window-relative coordinates
should be calculated relative to it.
(Without this change in place, screen coordinates would be
used for the window-relative coordinates as well, as found by
the script attached to QTBUG-106527.)

Also deduplicate a bit and just have a single loop instead
of the extra check on the interface itself at the beginning.

Fixes: QTBUG-106527
Pick-to: 6.5
Change-Id: I8d2a00bcc22c71d696e4f48233afddc80e93bc1b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1b0e76f514e9a460e1d78a813813c0909838a03e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-26 05:10:17 +00:00
Fredrik Ålund
a0b14115f1 Fix datatype mappings for the Mimer SQL QtSql plugin
Some of the datatype mappings for Mimer SQL are wrong and some are
missing. Also, fix the datatype documentation for Mimer SQL.

Fixes: QTBUG-111219
Change-Id: Ic7edaaca9af9b3b480079b04b05c58ab22f34fa3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 00ed8d7822f6bb0434ad769dbda89858f97a4d2c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-25 21:02:07 +00:00
Marc Mutz
2007209a6f qmainindowlayout_p.h: make header guard match file name
Pick-to: 6.5
Change-Id: I922e54f93897ffd82931419afcbba4d148ca5e8d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit fbb1cc234b5615d28667174e84748df36b405c7e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-25 21:02:05 +00:00
Tor Arne Vestbø
0ed4dc554c macOS: Make QCocoaWindow::setVisible idempotent
The implementation of QCocoaWindow::setVisible is not idempotent,
as for modal windows it calls beginSheet/endSheet or starts/ends modal
sessions, which will confuse the AppKit modal session stack.

Once a window has been shown QWindowPrivate::setVisible hides/masks this
issue, by returning early if the visibility has not changed, but during
first show QWindowPrivate::setVisible will update the QWindow state,
before creating the platform window. If the platform window then picks
up the QWindow's visible state during creation, it will result in one
QPlatformWindow::setVisible() call during creation, and another one
via QWindowPrivate::setVisible after the platform window has been
created.

To fix this we can check the existing NSView.hidden state and skip
the setVisible call if it's already up to date. But one complication
is that our QCocoaWindow::setVisible has different behaviors depending
on whether the window has been initialized yet or not, due to how
handleGeometryChange skips sending geometry changes for uninitialized
windows. So we need to also bail out if we're still initializing the
window. This is fine, as we know we'll get a follow up setVisible
call via QWindow, both when QWindow itself creates the platform window
as part of setVisible, as well as when the user does a two step create
and then show.

For good measure we throw in a recursion check as well, in case some
of the logic in QCocoaWindow::setVisible before we update NSView.hidden
recurses back into QCocoaWindow::setVisible.

Pick-to: 6.5
Change-Id: Ibdcf4859e58d6684aac4490126d35eb12fdd5943
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit be268ae19731ab854931e43eea83e0e140ec2538)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-25 17:32:51 +00:00
Tor Arne Vestbø
6914ed3309 macOS: Fix tst_MacGui::nonModalOrder()
The test is testing whether the order of creating a child window
of a modal dialog and showing the parent dialog matters. But to
allow child windows of a modal dialog to become active that child
also needs to be a dialog. That's a limitation on macOS, where
only NSPanel subclasses can override worksWhenModal.

Fix the test, and rewrite it using more modern idioms, avoiding
the need for long waits in the test.

Pick-to: 6.5
Change-Id: Ifb640d0288a3c7ed37f2c61294e34cd96fba49ca
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 1af821825a4173532cf14024ea9bebc75bf3c62c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-25 17:32:50 +00:00
Huang Rui
6008eb98d5 forkfd_linux: change childStack size from 4096 to SIGSTKSZ
Starting from qt-6.6.0, the childStack size has been too small to run
qmake or qsb in the sandbox, which will cause segfault.
This problem can be fixed by changing the childStack size to SIGSTKSZ.
For security reasons, some Linux distributions, such as gentoo, will
use the sandbox when building applications. Previously, qt-6.5.0 could
be successfully built in the sandbox. The problem started with qt-6.6.0.
See also: https://bugs.gentoo.org/915695

Change-Id: I229c25397f557dd2fec3e0ec53ac68fda28bab13
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 993db5a12227b1e4067714ddc626d64a14474a54)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-25 09:10:08 +00:00
Eirik Aavitsland
6173f053a0 Update bundled libjpeg-turbo to version 3.0.1
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 3.0.1

Fixes: QTBUG-117804
Pick-to: 6.5 6.2 5.15
Change-Id: Ia6cdb02eb9c590fe024bdf75566976756c6e13c6
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 071291a0d465e3a2241af017a84fa4911acb486a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-25 06:36:14 +00:00
Zhao Yuhang
9f971deb06 Win: minor improvement of the console debug trick
If the application has already attached to the console, the
AttachConsole() API will fail but we can still redirect our
output to the console. The previous code doesn't take this
case into consideration, now it's covered by this patch.

Please refer to the "Remarks" section:
https://learn.microsoft.com/en-us/windows/console/attachconsole

Change-Id: I1c5033cc962dcd5a757ff15cc677a51e21330e0b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fd300f143fd30947bba60a03d614acd2711b635f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-25 06:36:14 +00:00
Tor Arne Vestbø
b80262055c macOS: Explicitly mark NSView as needing display when unhiding it
AppKit doesn't do this automatically for us, and since we may have
decided to not draw anything when the view was not exposed, we need
to inform clients that its time to draw something now.

Pick-to: 6.5
Change-Id: Ib2dd969632898ba5640d6848356acd1b97da652d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit ea0b99c0064806397081a6f19a2af56abea726de)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-25 00:24:30 +00:00
Thiago Macieira
74b93a3410 tst_QHashFunctions: suppress warning about casting from float to _Float16
Amends c86cf385d6d66d8fd3de1666205aaf4b8fcec747.

tst_qhashfunctions.cpp:109:59: warning: converting to ‘qfloat16::NativeType’ {aka ‘_Float16’} from ‘float’ with greater conversion rank

Pick-to: 6.5
Change-Id: I79e700614d034281bf55fffd178f91775966658f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit a61d7529511c890aa595110b9320ea0bf53dd623)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-24 20:32:20 +00:00
Tor Arne Vestbø
a431a60023 standarddialogs: Don't assume QMessageBox::exec() returns clicked role
When adding custom buttons to a QMessageBox the return value of exec()
as well as result() is not a StandardButton value, but instead an opaque
value, and the documentation says to use clickedButton() to determine
which button was clicked.

Pick-to: 6.5
Change-Id: Ib47a218989b4dcb5d51f648bc55bc02399bae602
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 1fd1ffd03d6889273f574c698e07c611bd311fd9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-24 20:30:12 +00:00
Bartlomiej Moskal
0eff6dfe9c Android: Fix for hiding cursor handles
After c80f262258b7846bf199887bcfdbb6dcfda6ad6f commit (which fixed
selection for read-only texts), checking if m_handleMode is Hidden was
removed. Because of that hidding cursor handle stopped work correctly.

This commit brings back check if m_handleMode is Hidden.

Also when only one handle is visible, it should be hidden within the
next 5 seconds regardless for keyboard visibility. That is how it is
handled in pure Android apps.

Pick-to: 6.5
Fixes: QTBUG-117367
Change-Id: I0400f9604234bfad7fe17d74673ae9a93088bab4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
(cherry picked from commit 9c8651478b482cb162a6fd92bb79f0d7f6a2573c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-24 17:52:16 +00:00
Alexey Edelev
23c1b520bd Fix the dependency list naming when collecting repo dependencies
The 'dependencies.yaml' file contains entries that aligned with the
repository naming but not the Qt projects naming. When parsing
it to collect the dependencies for the standalone repo we should
cut the 'tqtc-' repo prefix to avoid malformed names in
QT_REPO_DEPENDENCIES variable.

Pick-to: 6.5
Change-Id: If80e61394f245f09b620a9210246053d4e475f86
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit e5c7bb62eef98df40b3d2534b47a1d1ab26e7c38)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-24 17:18:21 +00:00
Kai Köhne
c172f26c9f Doc: Highlight 5 network examples
Pick-to: 6.5
Task-number: QTBUG-117222
Change-Id: I5d18a1c86201404609cbc58fd127f001cdc32478
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit bef5d486d5813d11a037d7cf2b34d008ac967563)
2023-10-23 14:59:51 +02:00
Assam Boudjelthia
1cf9392add Android: remove unneeded allowNativeHeapPointerTagging manifest flag
Amends b0907db9eae4b85fcab4fa997428c438d9443ee0.

Pick-to: 6.5
Task-number: QTBUG-91150
Change-Id: Ic7886a9fc69781e4f21417075516106ccb6c7bf5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 028a31b50574f8e850d4c67c2892f7ed22a073bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-23 12:59:51 +00:00
Mårten Nordheim
d1726e495a Remove Qt_6_PRIVATE_API ELF from a symbol used by ~QNetworkDatagram
As in 0f0371c8304bd7354a3c43f9fac6b85bd3e9a3f1.

Fixes: QTBUG-118229
Change-Id: Ie05c213ceb694413194826e4e119f3fb9ff1f1e8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ef76bd02a63953f5d9158265ca520d8b2c5dc8c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-23 09:52:04 +00:00
Mårten Nordheim
cc350b13c1 Schannel: Enable ALPN for some mingw configurations
... by checking if SECBUFFER_APPLICATION_PROTOCOLS is defined.
In this case, we assume that the current environment supports ALPN.
Then we no longer do a blanket block for all mingw configurations.

Change-Id: I2eedb813a5bdc3b1a5097053b04aa45d25d175aa
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit fa8943640c02adbe100cdbca2b44a102b45de53f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-23 09:51:38 +00:00
Thiago Macieira
c7bc337341 qt_safe_poll: round up when converting to milliseconds for poll(2)
When running on operating systems that don't offer modern APIs, we need
to round up to ensure we don't under-sleep and wake up before the timers
actually expire. In most cases, this is not a big deal because we'd go
right back to sleep and then wake up again.

The problem is that this new sleep would be for a duration of 0
milliseconds, so we'd end up busy-waiting until the timers do expire.
It's for less than 1 ms, but it's still power-consuming.

It's also perceptible when someone uses processEvents(), because we
could end up saying we didn't process anything, despite waiting for more
events. Since that violates the guiding rule for processEvents() (don't
ever use it), I don't consider this a big deal.

Fixes: QTBUG-118199
Pick-to: 6.5
Change-Id: I79e700614d034281bf55fffd178f0611be96bfa7
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 0cd2158533e566170d22dc71df85918f82551124)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-21 22:38:17 +00:00
Tor Arne Vestbø
0bc6150289 Avoid creating child windows twice when already visible
When a child window is made visible without its parent having been
created yet, we defer creating and making the child visible until
the parent is created.

But if a child window is explicitly created, we create the parent
first. And creating the parent will in turn apply visibility to
all children that had their visibility deferred. Which includes
creating the child.

This results in child -> parent -> child creation recursion,
which means that when we return from creating the parent window
we already have a platform window for our child, and should
bail out.

Pick-to: 6.5
Change-Id: I11dc4864b57f031de2cca70b79cdfc057d4fbd0d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 70d7c6a937fec04401a3c0bc6380731d9f4478e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-21 17:23:22 +00:00
Oliver Eftevaag
79da2a10c6 Move palette helper functions to QPalettePrivate
We want to use the bitPosition function in Qt Quick, in order to be able
to unset a bit in the resolve mask for a specific color group and role.

This patch, solves this by adding a new qpalette_p.h header, which
declares QPalettePrivate, allowing those helper functions to be accessed
anywhere internally in the qt framework.

Change-Id: Iecb28b48289d6bcabf0936274964a05d3c44efc0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 417878904b39b444632df18f7dd37bcb073c0467)
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-10-20 08:11:35 +00:00
Thiago Macieira
4caf69d65a Remove Qt_6_PRIVATE_API ELF version from a symbol used by ~QReadWriteLock()
Same problem, and same solution, as in
0f0371c8304bd7354a3c43f9fac6b85bd3e9a3f1.

Change-Id: I79e700614d034281bf55fffd178f56772b09cf25
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 79ef045ffdb3894957bcf69e4506522c344bcefe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-19 23:51:39 +00:00
Thiago Macieira
afc6c02ba9 tst_QProcess::startStopStartStopBuffers: depend less on OS configuration
The comment in this function made it clear that it really depended on
the size of the pipe buffer in the OS. I don't see a way to make a pipe
default to a different size on Linux -- it always defaults to
PIPE_DEF_BUFFERS (16) and that value is only increased as a result of
fcntl(F_SETPIPE_SZ), which we don't do. But we can be defensive and
simply write until the OS can't take any more data.

Drive-by update the comment on Windows to be clear that bytesToWrite()
does work, but only while the child process is still running.

Task-number: QTBUG-80953
Change-Id: I9d43e5b91eb142d6945cfffd17866d22a4127e5e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit a3f2ddc230b874b2e83d62eb702b3611a13761f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-19 21:09:05 +00:00
Marc Mutz
a1be56a6df QCborStreamWriter: use (new) QUtf8::convertFromLatin1() to speed up append(QL1SV)
Use the new function to convert into a QVLA instead of first
converting to a QString and then to a QByteArray. One conversion and
one buffer instead of two each.

Change-Id: Ieaa24c8ef325797b5a89e8da0ca4310667c00fa7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4cc31901ea36dcb37efbaa316dde653ad49a5dbb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-19 20:52:32 +00:00
Axel Spoerl
516cae81df QGtk3Theme: define light, midlight, mid, dark and shadow colors
Define color groups used for shading and in order to render specific
inactive texts, e.g. menu item text.

Found-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Pick-to: 6.5
Change-Id: I736f5aff1ff5379ce3f78b53e547b0b5f552779f
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
(cherry picked from commit fd09519bbd4e7ea89b898c7496e7e06980ee9672)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-19 20:10:41 +00:00
Dimitrios Apostolou
23ec6b1051 Keep the testrun quiet for ASAN testruns
This is purely cosmetic, to avoid confusion when reading the logs and
find many "FAIL!" strings all over the place. The ASAN testrun only
cares for "ERROR: AddressSanitizer" type errors, and tests pass even
if they print "FAIL!" (that is taken care by sanitizer-testrunner.py).

Fixes: QTQAINFRA-5896
Pick-to: 6.5
Change-Id: Ib7a5fb2c3ee56581db20efb4dd7cf24a053d5c13
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit ba1eec62a864428e4486b1e15f41ff06fc8f60d4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-19 17:43:24 +00:00
Thiago Macieira
28064908e0 moveToTrash/Unix: avoid TOCTOU in creating the unique file name
This is not a security issue because we still use QIODevice::NewOnly
(O_EXCL) and loop again. But because we do so, we don't need to check
for existence with QFile::exists() in the first place.

Change-Id: I9d43e5b91eb142d6945cfffd1786c98a39781517
(cherry picked from commit de24134aa7795a05ba271a751bf76792f9a3ff98)
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-10-19 17:43:24 +00:00
Thiago Macieira
4aba04d2ca moveToTrash/Unix: avoid QFileInfo to get an absolute file name
We know what engine we're using, so don't go the long way around via
QFileInfo and QFSFileEngine to get back to QFileSystemEngine in order to
calculate an absolute and clean path.

Since we're doing that, we may as well use QFileSystemEntry's ability to
give us the file name portion of this absolute path without having to go
via QFileInfo and QDir again. We just need to make sure that a dir name
isn't ending in a slash: absoluteName() would remove that for us, but
only if the entry isn't already absolute and clean.

Change-Id: I9d43e5b91eb142d6945cfffd17871389d359e750
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 61d99530c83acd7197bfc9574334f0964d13459a)
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2023-10-19 17:43:24 +00:00
Timur Pocheptsov
f0410ed5e8 Make static data-members constexpr
While a minor issue, it's possible to use them in a way requiring
a definition, triggering a linker error. We can either make them
inline or constexpr.

Pick-to: 6.5
Fixes: QTBUG-118170
Change-Id: Ia3dede91b989b295c3e792691d534648581a27c2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 113a6b89b8ddc841ef6717d79b8b119f8449703b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-19 17:43:24 +00:00
Marc Mutz
e789ea584f QIODevice: mark checkWarnMessage() as Q_DECL_COLD_FUNCTION
It's only called in exceptional circumstances, so the compiler should
optimize it for size, not speed, and paths leading up to calls to this
functions should be automatically marked as [[unlikely]].

Marking the function as cold accomplishes both.

GCC 11 seems to have had this figured out by itself, possibly
backtracking from the unconditional qWarning() in the first line of
the function, but it did have a (very small) effect on Clang 15, so
leave it in, if only as documentation.

Pick-to: 6.5 6.2
Change-Id: Ie8e9049300825a3aae2f9678a2907ceea0b21d1c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 546208f0ff23819d216cbb5bf0b5daded79b454e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-19 15:04:41 +00:00
Marc Mutz
bd242a7d2d tst_QMetaEnum: add round-trip testing to valueToKeys()
... adding a bit of test coverage of keysToValue().

This is not intended as a reproducer for QTBUG-118240, because that
is concerned with inputs valueToKeys() cannot produce.

Task-number: QTBUG-118240
Pick-to: 6.5 6.2 5.15
Change-Id: I5d772be4231717cdbb5d033b1f11ae31e4c57c0b
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 38994ab9accc9aecf1139eb02f7e5fc75fccceec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-19 15:04:21 +00:00
Kai Köhne
4dcab758b5 Move rsslisting documentation to common dir
Move the rsslisting example documentation to examples/network/doc,
as it is done for all the other examples.

Fixes: QTBUG-117215
Pick-to: 6.5
Change-Id: If83202825afe8c69cb7fda0f84ca4832cf3d60e7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 802db7b52380c8c9dae34ee5adab4b1bf974634b)
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-19 08:23:35 +02:00
Mitch Curtis
a63e0b853d Increase QTest failure message limit
QPalette specifically has quite a large amount of output (1363
characters) when toString
is called on it. We should make sure that we can fit that in our
failure messages. This patch does that by increasing the limit from
1024 characters to 4096.

Fixes: QTBUG-5903
Fixes: QTBUG-87039
Pick-to: 6.5
Change-Id: I1dc5078ad05858bb6542c3a06c6b84711af79e4f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 18152699e4c566002ecf958ad655b6f4c6a5c4ed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-19 05:14:48 +00:00
Thiago Macieira
90e551d0a5 tst_QStorageInfo::{tempFile,caching}: try a to find a non-btrfs storage
These tests skip when we're writing to a btrfs filesystem because, for
some reason, the amount of free space does not update synchronously with
file writing. But instead of giving up if $TMPDIR is a btrfs, let's try
and use the $XDG_RUNTIME_DIR, which is usually a tmpfs.

This will work in the CI for the openSUSE set ups, where / is btrfs,
/tmp is not a separate tmpfs, but /run/user/1000 is available.

FAIL!  : tst_QStorageInfo::tempFile() The computed value is expected to be different from the baseline, but is not
   Computed (free)                : 25510780928
   Baseline (storage2.bytesFree()): 25510780928
   Loc: [tst_qstorageinfo.cpp(234)]

Change-Id: I8f3ce163ccc5408cac39fffd178d7af1c67ec988
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ae03ffaffdcc8b2a0589b846e16ad016691dec29)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 17:17:16 +00:00
Dimitrios Apostolou
8101f7316c sanitizer-testrunner.py: be verbose about FAILs being ignored
Pick-to: 6.5
Change-Id: I8753b8793c744d4fe2cae8d7293abf6961c60601
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 474aa5263833f3e33d84c1f9f6b4ed207d2cdafe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 17:17:16 +00:00
Mårten Nordheim
5632626375 Http: don't try to send request on a closed socket
We have code in the protocolHandlers that tries to handle this case, but
if we have an error before we create protocolHandler (read: proxy
complains about something) we will assert in debug, or
deref nullptr in release.

Pick-to: 6.5 6.2
Change-Id: I4bde9c8af0fa96dc11f77ca4d4b5cb84c31b54fa
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 5c7c44cf8390cb08f3b46c9763c2d11da7179c93)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 17:17:16 +00:00
Santhosh Kumar
173038ae19 Fix tooltip palette issue in gtk3 theme
The tooltip text doesn't show with right palette when application runs
in dark mode using gtk3 theme.

This patchset removes explicitly setting ToolTipText palette in
gtk3theme.

Pick-to: 6.5
Change-Id: Id90626a377733814c3f32f0bf7e5539097b76dd6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 756857b5d05fe85ea93851111fafc430944dbe61)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 17:17:15 +00:00
Jøger Hansegård
a75ad8ddc5 Fix QNetworkAccessManager hang with low integrity level sandboxing
QNetworkAccessManager may fail to finish with Windows apps that are
running with low integrity level sandboxing.

The root cause is that such applications are not allowed to open ROOT
system certificate store with write privileges. This causes the
CertOpenSystemStore helper function to fail, because it attempts to open
certificate stores with the option of adding or deleting certificates.

We only use the CertOpenSystemStore with the intent of fetching
certificates from the certificate store, so we do not need write access.
The fix for this issue is threfor to open the system certificate store
as read-only by using the lower-level CertOpenStore function.

The CERT_SYSTEM_STORE_CURRENT_USER flag is provided to CertOpenStore to
keep the documented behavior of CertOpenSystemStore, which states "Only
current user certificates are accessible using this method, not the
local machine store."

Fixes: QTBUG-118192
Pick-to: 6.5
Change-Id: I529b760398f84137a0e95c8088a71b293d302b54
Reviewed-by: Fredrik Orderud <forderud@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 4d11ba66de81310ca79491035123392b923a39e2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 17:17:15 +00:00
Nicolas Fella
e8f931f2dc Add missing documentation for QWaylandApplication::seat()
Documentation for the other functions refer to seat(), but that itself
isn't documented

Change-Id: I9a628e87153b687b2fa444798de1af74e6251eee
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 255f6b67b879f56560100e655f9ba25493a0ffe9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 17:17:15 +00:00
Kai Köhne
58187aa14f CMake: Use stored compiler only for qt-cmake-private
Change the heuristic only to use the stored compiler if we
are  building qt itself, like with qt-cmake-private
/ qt-configure-module. qt-cmake is also used by end-users,
where the heuristic to change the compiler default base on
paths is surprising, and can go wrong.

Fixes: QTBUG-108323
Change-Id: I0274e470f214a84711013d77068551f9097f4685
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 3aa6f0b3961322a40f046cfb39a40d118f57216e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 12:41:44 +00:00
Christian Ehrlicher
b34a911b07 SQLite: Update SQLite to v3.43.2
[ChangeLog][Third-Party Code] Updated SQLite to v3.43.2

Pick-to: 6.5 6.2 5.15
Change-Id: I50ab6d53ada764e1d9390e4d768f4abf0de5652f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f2c2242c748e3954c647076d959c97a3025a0c92)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 08:08:34 +00:00
Thiago Macieira
19ad876963 QThread/Unix: don't hardcode OSes for PThread cancellation support
Instead, check the macro that we're about to use. This is also done in
qprocess_unix.cpp

Pick-to: 6.5
Change-Id: I8f3ce163ccc5408cac39fffd178d657b7594d07a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit dec72d165be9470ef8fa46901260fa1dc32d8568)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 00:03:12 +00:00
Tor Arne Vestbø
6e2f311873 Windows: Don't re-apply application badge if one has not been set
We need to re-apply the application badge when the color scheme changes;
when a task bar button is being created for the fist time; or after Explorer
has crashed and re-started.

But we should only do that if the user has set an application badge
via our APIs. Otherwise we might end up clearing an existing badge
that was set via the native APIs directly.

Fixes: QTBUG-118117
Pick-to: 6.5
Change-Id: I1f1fecba44c118d4e3f7ef4119139c3ebd23f047
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 8f2828683e2ac44a282e8f061de1c76925abcec1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 00:03:11 +00:00
Ivan Solovev
90c65ca197 QDateTime: improve docs about invalid vs valid datetime relation
Extract the information about the relation between invalid and valid
datetimes into a snippet, and include it in the documentation of
every relational operator.

Pick-to: 6.5 6.2 5.15
Change-Id: I61b239647efe928eb0758cfc5649b33ab4d06c7d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 9e26f1da0b0dedf7ee6d860b7c11a27b0b554866)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 00:03:11 +00:00
Wladimir Leuschner
abb26af834 Prevent state change of selected LineEdit in QWindowsVistaStyle when hovering
Hovering over a selected LineEdit gives the selected state precedence
over hover state.

Fixes: QTBUG-117606
Pick-to: 6.5
Change-Id: Ia52ce94443100bf3fb5d83b8dffa2752818ca33d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
(cherry picked from commit 4f51742ee12bea211b2fd0abd50a700e69a9a95c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 00:03:11 +00:00
Timothée Keller
5d292c4482 Windows QPA: remove SWP_NOCOPYBITS for plain moves
The SWP_NOCOPYBITS flag helps suppress some jittering during resizes.
At the moment this is called even for plain moves with no window
resizing. Make sure that the window geometry has changed before applying
the SWP_NOCOPYBITS flag

Fixes: QTBUG-115992
Pick-to: 6.5
Change-Id: Ic0cb32d9eb3b557bf2b2ef5b6ba80d34e27c5c19
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io>
(cherry picked from commit 9a64449cc353a35b37518ba4fcc62439877f6f10)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 00:03:10 +00:00
Milla Pohjanheimo
59e177b758 Add binary compatibility file for 6.6.0
Task-number: QTBUG-117583
Change-Id: I9b63b916a59ddaeb89d2b819b36ee9dc57851dac
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
(cherry picked from commit 5ceb78e8d92dab73cef10a37578a3de799d7880b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 00:03:10 +00:00
Jonas Kvinge
8863444053 macdeployqt: Fix codesigning with @loader_path
When the -executable parameter is specified, macdeployqt uses
@loader_path instead of @rpath. This case was not handled in
getBinaryDependencies() used for the code signing.

Fixes: QTBUG-118075
Change-Id: Ie1e0d0781305e1849df9ec0d5fb1c3ce6713a62b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 1eddd7add027d05cec2470a5209f46809e690478)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 00:03:10 +00:00
Ahmad Samir
1c359e6ea1 QCoreApplication: use the correct typedef of preRList
`QVFuncList` and `QStartUpFuncList` are identical typdefs
(`QtCleanUpFunction` and `QtStartUpFunction` are identical typedefs):
typedef QList<QtCleanUpFunction> QVFuncList;
typedef QList<QtStartUpFunction> QStartUpFuncList;

So from the compiler's POV QVFuncList and QStartUpFuncList can be used
interchangeably, but from a code reader's POV, this is confusing.

Use IILE to make the local variable const.

This amends commits 942922652481347659a0dae78758c334778a58d2 and
a887891271a52b2546265c13c6dc70fdd08507e3.

Pick-to: 6.5 6.2 5.15
Fixes: QTBUG-117242
Change-Id: I67f6af89027fe36a1915e815acd3c9446f7dcd5d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 408799de65aaa4adcc6660c444f98bfb1a326dfe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 00:03:10 +00:00
Mårten Nordheim
73cae2903b SignalDumper: fix UB (data race on ignoreLevel)
... by making it thread_local.

It is written and read by multiple threads at the same time, so it needs
to be protected. Since signal emission start and end happens in a single
thread, keep it thread_local rather than using an atomic.

Pick-to: 6.5
Change-Id: I98fc5438c512b45f936318be31a6fccbe5b66944
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 744e9a69ab4965561529f66d8872b6c2455f4fca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 00:03:10 +00:00
Samuli Piippo
a52ca1f24e eglfs: extend configure test for egldevice
Amend 1aba24a2ed4b75551a900772320d5a0dc1960043 and add check for the
EGL_DRM_MASTER_FD_EXT now used as older egl headers might not have it.

Pick-to: 6.5
Change-Id: I98b860d05396c24b8eb0e73172ac395c89da8628
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Alex Bu <alex.bu@qt.io>
(cherry picked from commit 38cc03c9af6ad5328c2dc0b1fda9ef59ae1d20aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 00:03:09 +00:00
Marc Mutz
401950a76f QAtomicScopedValueRollback: fix UB (passing rel/acq_rel to std::atomic::load())
It's explicitly undefined behavior to pass release/acq_rel
memory_order to load(), so don't.

This is private API, so no ChangeLog needed.

Reported-by: Fabian Kosmale <fabian.kosmale@qt.io>
Task-number: QTBUG-115107
Pick-to: 6.5
Change-Id: Iee119303d790c31937238ef92d900a25020e9713
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 5797f29e8c249e13da6285ae9b2d50fff4ffb505)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 00:03:09 +00:00
Alexey Edelev
f0286b60ba Allow Qt components be OPTIONAL when building standalone tests
We look for all Qt components when attempt configuring standalone
tests. If some 3rdparty dependencies are missing in user environtment
the configuring proccess will fail even if the dependency is not used
by the standalone tests. Avoid requiring the Qt components, so users
will see only warnings about the missing comonents or dependencies.

Fixes: QTBUG-117709
Pick-to: 6.5
Change-Id: Iecce40449cdf116f1a7c279ebb161f0f5c7f6a9f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 039257038533467d5b72ff2523c6d0db688f6f7d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 00:03:09 +00:00
Mårten Nordheim
41feba789e SignalDumper: fix UB (data race on indentation level)
... by making it thread_local.

As a natural (and welcome) side-effect, this makes output look sane in
multithreaded scenarios.

As for why it should be thread_local instead of an atomic:
Since signal emissions and slot invocations on one thread are not
necessarily correlated with another thread, they should not affect
one another's indentation level. As in, emitting QIODevice::readyRead
on a background thread should not make QEventLoop::aboutToBlock on the
main thread be indented. The only exception to this is BlockingQueued,
where one thread is directly tied to another (QTBUG-118145). But slot
invocations are anyway not currently printed for Queued connection
(see QTBUG-74099.)

Pick-to: 6.5
Change-Id: Iea1fc522d37626df14af419a3455a732729edf74
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit ae0d231c96ab93ec36c7202c268507314eb40116)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-18 00:03:09 +00:00
Timothée Keller
19471b215d Revert "Windows QPA: Move transient children with a window move"
This reverts commit 530d092eae0579bbb88e95f853715cac214da636.

Reason for revert: Moving transient children as a whole is too broad, and forces unrelated windows to have their position completely dependent on a transient parent.

Fixes: QTBUG-117779
Pick-to: 6.5
Change-Id: I01312e26e95c8144c392eca33aec41f54aaa40b0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 614e0f1daa9da2c285e2fd3868f7ebfa9837164c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-17 18:44:42 +00:00
Alexandru Croitor
deb49de7bc CMake: Fix Gui package to auto look up IntegrityPlatformGraphics v2
The previous attempt to record a dependency on the
IntegrityPlatformGraphics target for the Gui target was insufficient.

Aside from a qt_find_package(PROVIDED_TARGETS) call, we also need to
use qt_internal_extend_target(Gui PRIVATE IntegrityPlatformGraphics)
to ensure the dependency is written into the Qt6GuiDependencies.cmake
file.

Replace the target_link_libraries call with qt_internal_extend_target,
and remove the qt_find_package all together. A qt_find_package call
in src/gui/configure.cmake already exists, so the one in
CMakeLists.txt is redundant and can be removed.

Finally the
  qt_internal_extend_target(Gui PRIVATE IntegrityPlatformGraphics)
call will also result in a
  target_link_libraries(Gui INTERFACE
  $<LINK_ONLY:IntegrityPlatformGraphics::IntegrityPlatformGraphics>)
because Gui is a static library when building on Integrity, so the
transitive requirement will still be passed along to user projects.

Amends c03eb94c8a4c776a0315acc35538b3954e031222
Amends 8116fdde1c13fe00fb03414b56da2d66e215f279

Fixes: QTBUG-118051
Task-number: QTBUG-102883
Change-Id: Ic962df94a20071d3f2459e705dbafaca0319a638
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 8170e9e85a6e479ad3d2d1f2645f9bc148ab6fde)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-17 18:44:41 +00:00
Kai Köhne
740104872d Doc: Improve documentation for qInstallMessageHandler()
Mention that QtMessageHandler needs to be reentrant,
as well as other caveats. Mention QLoggingCategory,
so people do know that they don't have to necessarily
implement their own handler to filter messages (and that
not all messages reach the handler). Also mention
qFormatLogMessage().

Finally, give a more useful example for a custom
message handler that logs to a file. Note that the example
leaks a file handle at exit, but that is arguably not that
bad.

Pick-to: 6.5
Change-Id: I5be44167b266c9bbdbb0e94806bb024c9b352a32
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit cb841b449a22d6646e148cd7e9d58be5ef5de27c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-17 18:44:41 +00:00
Tasuku Suzuki
08e431956a CMake: Fix Qt toolchain file recursive inclusion
'.' in the regexp must be escaped.
e.g. "/qt/toolchain.cmake" matches "/qt.toolchain.cmake$"

Pick-to: 6.5
Change-Id: Ib6b66349e1619908a33b4a11d79f7ba19d0e8fdc
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 6544a23603b46c1e2e7c4bd7728ec4dbdb6aec16)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-17 18:44:41 +00:00
Laszlo Agocs
fed3097888 Sync also the profile env.var between Quick and RHI backingstores
Amends ffb857e9d0745fdd31bca091333f1120c5857d7b.

Pick-to: 6.5
Task-number: QTBUG-118116
Change-Id: Ifb55130fd66b8ea1446363ae22f11cfe4f4d48bb
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit 53f9768e6424f7b00946005f82f11d82facee35a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-17 18:44:37 +00:00
Laszlo Agocs
bd76a9a86f rhi: d3d11: Revive non-flip swapchain model support
Make the QT_D3D_NO_FLIP env.var. have an effect again.

This env.var. has the following effects:

- SwapEffect is set to DXGI_SWAP_EFFECT_DISCARD

- Scaling is set to DXGI_SCALING_STRETCH (no other option with the
  blitting legacy model)

- Alpha works without having to deal with DirectComposition, the dcomp
  code path is therefore skipped completely in legacy mode

- Requesting a HDR mode behaves incorrectly (there's an unwanted
  conversion to SDR or something like that)

- Different window resizing artifacts. Instead of the big black/white
  bars, that is typical with the modern, efficient flip swapchains in
  non-Qt applications as well, there is a bit of shimmering on the
  right side esp. when resizing on the left side. The option of using
  the legacy is model provided mainly for users where this is
  important.

- Reduced performance due the using the old blitting model, although
  that probably won't be visible for many typical Qt applications on
  desktop PCs.

Only for D3D11, because D3D12 does not support non-flip swapchains.

Note: this is incompatible with QT_QPA_DISABLE_REDIRECTION_SURFACE.

The reason to reintroduce this option is to provide a way, even if
just as a developer-focused environment variable, to get a behavior
that is identical to other frameworks and non-Qt applications that
still use D3D11 with the legacy swapchain modes in their rendering
engines. This applies first and foremost to window resizing, where
the visual artifacts common with flip model swapchains may be
misunderstood to be caused by Qt. Having a way to opt-in to the
legacy model allows avoiding/clarifying Apples-to-Oranges
comparisons.

Pick-to: 6.5
Change-Id: I04e46f71a96fa56cace38703e0e9b93b43bfebc7
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit 8a175f4ae231e54fafbd97f4da6b5db0fb66d47f)
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-10-17 18:44:37 +00:00
Alexey Edelev
192c343582 Add the missing QtGui/qtgui-config.h
QT_NO_OPENGL is defined in qtgui-config.h so we should include it before
checking the definition.

Fixes: QTBUG-115446
Pick-to: 6.5
Change-Id: I29b9d7d89fe4c079ca0cf767a1b1a63cc5621623
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 2b6270af24b236dc329b7deab8f0ea9916af2e1a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-17 18:44:36 +00:00
Mårten Nordheim
44e53b3ed9 http2: When a reply is removed from the queue, only remove one
We were using the .remove(Key) API on the map instead of
erase(iterator), so we were removing any reply of the same priority that
had not yet been popped from the queues.

Rewrote to drop loop and only work with iterators.
This issue was there since SPDY days, so not picking all the way back to
5.15, where HTTP2 anyway is not enabled by default.

As a drive-by, drop the #ifndef QT_NO_SSL, which was also there from
SPDY times, which was TLS-only.

Pick-to: 6.5 6.2
Fixes: QTBUG-116167
Change-Id: Id7e1eb311e009b86054c1fe3d049c760d711a18a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 13c4e11c49d16d6a83a142215d28e1ec660e1bba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-17 18:44:36 +00:00
David Faure
ee4e131097 Add missing | operator for QRegularExpression::WildcardConversionOptions
Change-Id: I76ed4ee5ef45a279c584e09fbd6d83f1b9127769
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d5c427c1458525ec1a42ab5212934fb6d6d9685b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-17 18:44:36 +00:00
Alexey Edelev
a36b083397 Consider changes of the CMake flags when re-building syncqt
Configure time executables don't adopt new cmake flags if they were
changed. Cache all flags that were used when building configure time
executables and consider changes when decide rebuilding them.

Pick-to: 6.5
Change-Id: Ifba77833f362c790120f0ab1f808a855327bc49f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
(cherry picked from commit 10e3075e6ce7e6cec3730b487e9b20871dca48e7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-16 15:42:37 +00:00
Mitch Curtis
8f87e3f67b selftests: respect ASAN_OPTIONS
Ensure that this environment variable is respected, as ASAN errors
(e.g. memory leaks) can cause the selftests to fail since they expect
no errors in their output.

Fix an incorrect function name in a comment, while we're at it.

Fixes: QTBUG-118041
Pick-to: 6.5
Change-Id: I07502101aabd8743df898ae8fe4a693c4733c4af
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 3f2b54f0a1749eb8a52e99dbba6af4839e36cb90)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-16 15:42:37 +00:00
Mårten Nordheim
9f49af182f QNetworkInfo[NetworkManager]: Mark invalid if unconnected
On some configs (e.g. using Snap) the NetworkManager service is not
available without some manifest or similar. In this case, the
_interface_ we have is still valid but we can't connect to the
service. So we need to mark the interface as invalid in this case, so
that we can avoid trying to use this plugin.

Pick-to: 6.5
Fixes: QTBUG-117490
Change-Id: I3c5ebb492f9ca4dfdf4353d77705ba993279eb69
Reviewed-by: Ilya Fedin <fedin-ilja2010@ya.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit fe653b70ae271da9a110d627da4ad2609a1fb8db)
2023-10-16 17:42:36 +02:00
Orkun Tokdemir
c04576cd7c Revert "CMake: Update timestamp file for Multi-Config and Cross-Config builds"
Since https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8878 is
reverted, the related change in `qtbase` also should be reverted.

This reverts commit 8041bfba47305352627d910930e52da496904c17 and 7a87149c25e04f5f1cbb786fd3b8f78e94574551

Change-Id: Iae42755ffc7b2c97e9cda4c211319df767a421b0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-10-16 12:17:52 +02:00
Thiago Macieira
8fa7b42ab1 tst_QFile::moveToTrash: use QDir::tempPath() for the rows w/ "temporary"
Both QTemporaryFile and QTemporaryDir are documented to use the current
directory if given a pattern. That can be anything & arbitrary, so it
doesn't give us consistency in checking. Moreover, it might be a read-
only directory.

Drive-by fix the number of 'X'.

Task-number: QTBUG-117449
Change-Id: Ifeb6206a9fa04424964bfffd178841c44e9636a0
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit a40341366f8e5b50dc62ef21fb47ba18deb38c2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-16 04:07:22 +00:00
Thiago Macieira
e1ad387733 tst_QFile::moveToTrash: avoid QSKIP+FAIL condition
QtTest can't handle a test that does both. This ends up recorded as a
skip in the summary.

Change-Id: Ifeb6206a9fa04424964bfffd1788412a438085b0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit ef22527bf5b9c067171be1f8b26165e381a85902)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-16 04:07:15 +00:00
Thiago Macieira
5306eac755 qTzName: suppress warning that tzname is deprecated with UCRT
Use the pre-existing MSVC code path, which uses UCRT.

warning: 'tzname' is deprecated: Only provided for source compatibility; this variable might not always be accurate when linking to UCRT. [-Wdeprecated-declarations]

Change-Id: I8f3ce163ccc5408cac39fffd178dc618f1a8f034
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
(cherry picked from commit eedb715ece5beabd1db731d0d003cf8112360f7c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-16 04:07:12 +00:00
Jonas Kvinge
55aecf2e2c macdeployqt: Also look for app libraries with .so extension
Fixes deploying glib-networking gio modules which uses .so file
extension.

Change-Id: I6b4c4e9c3bb5745ffa33d7e83c5853a9372f1ca6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c66dab56b20a47062c74fa6ecf8ea438bdc07b24)
2023-10-14 01:55:44 +00:00
Marc Mutz
b821985ad6 QSpan: add C++23 c{,r}{begin,end}()
It was weird that they were missing. Now that C++23 added them to
std::span, add them to QSpan, too.

Change-Id: I4a9b1fdeda66bc7b133c8f7b3b269656e5faffa3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 368ea559ebe842500fcad962d02308c7cb2f5632)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-13 10:58:55 +00:00
Marc Mutz
b539aa0192 Move qpointer.cpp → qpointer.qdoc
It contains no implementation. Proof: it includes no headers.

Pick-to: 6.5
Change-Id: I64b42ce799eec05a0faff2021e2b60460695e192
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 3321101d8f199f998c9f2b27d997000c38a30454)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-12 15:03:12 +00:00
Alexandru Croitor
efcf1cdeed CMake: Fix Gui package to auto look up IntegrityPlatformGraphics
When building non-qtbase tqtc repos in CI, we don't load a lot of
Plugin Config files in static builds due to project names having a
tqtc- prefix. This is similar to the issue and workaround that was
done in 4c6292686259e4e232f29cb6fd6c79065e9fa96d for qtserialport.

The specific issue here is the following error:

CMake Error at Qt6Gui/Qt6GuiTargets.cmake:61 (set_target_properties):
  The link interface of target "Qt6::Gui" contains:

    IntegrityPlatformGraphics::IntegrityPlatformGraphics

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  /home/qt/work/install/target/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake:52
   (include)
  /home/qt/work/install/target/lib/cmake/Qt6/Qt6Config.cmake:157
  (find_package)
  CMakeLists.txt:15 (find_package)

To work around the issue, explicitly record a dependency on the
IntegrityPlatformGraphics target for Gui when building on INTEGRITY.

The underlying issue is sadly still not fixed.

Change-Id: I9a9cff05d036f224aab8083ad6bc8b8e568abd8b
Task-number: QTBUG-102883
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
(cherry picked from commit c03eb94c8a4c776a0315acc35538b3954e031222)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-12 08:55:42 +00:00
Juha Vuolle
c17a1432cf Handle ACTION_POINTER_UP with tablet events
The ACTION_POINTER_UP is used when a non-primary pointer (touch, mouse
stylus, eraser) goes up. Without handling this action in these
cases, the table event remains in 'down' state (misses the
QEvent::TabletRelease) and as a consequence when it is next put on the
screen, eg. a line will be drawn to the new position (in case of a drawing
application).

In addition use getActionMasked() to get the action; non-masked
events would contain the index of the pointer too, and wouldn't
match with ACTION_POINTER_UP whose numeric value is 6. Rather the
actions would be in the lines of:
261, // ACTION_POINTER_DOWN(1), 6 with getActionMasked()
517, // ACTION_POINTER_DOWN(2), 6 with getActionMasked()
And so on.

Pick-to: 6.5
Fixes: QTBUG-86297
Change-Id: I1b50ca4d19b611aec8a5c280ed0521e2f11797b0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 3ee57b83870567d52acc00e534ef022a6d3b150e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-12 08:55:31 +00:00
Marc Mutz
f3280a8384 QSpan: remove a stale static constexpr extent from a base class
It's not needed, and might trigger -Wshadow on some compilers. Only
the public QSpan class has the `extent` static data member, everything
else uses the template argument, `E`, directly.

Amends f82cf6333e4e21c96d8b6bb272392f8142ead2b7.

Change-Id: If378119aff1e352d1e90854b570720444cd532a0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
(cherry picked from commit 9a0ae6c13bb8ad6c883285fea6fe494b532fc5e5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-11 22:20:45 +00:00
Michael Weghorn
e13917ec14 a11y atspi: Update text-attribute links
The previous ones no longer lead to the
corresponding documentation.

Pick-to: 6.5
Change-Id: I3f56ad71fa3f936898a25f20f718c7f65a0385a2
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 0699ef13017b93c3b5f85f461d284fb7815c1011)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-11 22:20:36 +00:00
Thiago Macieira
f2d4c19b2b Remove Qt_6_PRIVATE_API ELF version from a symbol used by QFuture::then()
QFuture::then() uses QtPrivate::Continuation::create(), which in turn
uses private API from an inline function:

    f->d.setContinuation(ContinuationWrapper(std::move(continuation)), fi.d);

f->d is QFutureInterfaceBase (a public class), but its setContinuation()
takes QFutureInterfaceBasePrivate by pointer. Our ELF versioning scripts
mark everything that uses that class as private, resulting in:

 4806: 0000000000287d70    365 FUNC    GLOBAL PROTECTED     16 _ZN20QFutureInterfaceBase15setContinuationESt8functionIFvRKS_EEP27QFutureInterfaceBasePrivate@@Qt_6_PRIVATE_API

This commit adds an exception for this symbol, causing it to go back to
the regular "Qt_6" ELF version:

 5629: 00000000003d6a16    366 FUNC    GLOBAL PROTECTED     16 _ZN20QFutureInterfaceBase15setContinuationESt8functionIFvRKS_EEP27QFutureInterfaceBasePrivate@@Qt_6

This solution can probably be cleaned up a bit by moving the marker into
the header files parsed by syncqt, so they follow code motion without
having to remember to update the CMakeLists.txt. That requires some
surgery with syncqt, so not suitable for cherry-picking.

As a drive-by, fix the target_type check
for the _qt_extra_linker_script_content genex property

Fixes: QTBUG-117514
Change-Id: I85599ea5ca7a4b79a8bbfffd178b92e73dbe11de
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 0f0371c8304bd7354a3c43f9fac6b85bd3e9a3f1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-11 21:25:24 +00:00
Santhosh Kumar
18a8b8f3c6 Fix inactive palette in gtk3 theme
In gtk3 theme, the inactive color group had been set with incorrect
palette or not been set for some cases, which leads to glitch when
moving application window. This is because inactive group palettes were
applied during window movement and its expected to be set with correct
palettes.

This patch fixes this issue by setting correct palette for inactive
color group.

Fixes: QTBUG-112879
Pick-to: 6.5
Change-Id: I6658843626f322fee0ef99dfafb550956e3e0aee
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit a608a7c29886fd95ea8569776036673e6c7639f2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-11 21:25:24 +00:00
Thiago Macieira
0088e32f8e qC{Debug,Info,Warning,Critical}: add parentheses around macro argument
Amends ef9fe7a99a9a6779e7133167fe84426bfe9cc371 and fixes some rare
cases where the macro argument wasn't a single token, such as what was
found in PySide code:

      qCDebug(*category, "%s", %2);

Fixes: QTBUG-117153
Pick-to: 6.5
Change-Id: I85599ea5ca7a4b79a8bbfffd178a51023648f244
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 964b9d7cd4c344b34d999b4d7f5e8185d02d3dac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-11 18:40:48 +00:00
Thiago Macieira
3b873fb7a9 Fix the static_assert for 128-bit integer types
Testing for Standard Library features with compiler version macros was
incorrect. This commit fixes that to check the correct macros. That
fixes the use of Clang-cl / ICX because Microsoft STL doesn't have
support for 128-bit integers (because Microsoft's compiler doesn't) but
Clang does.

Amends 104a0a9ecdb18d65e4d9075d87e8860c6c9d8335.

Fixes: QTBUG-117870
Change-Id: I85599ea5ca7a4b79a8bbfffd178b9688e7c1bf42
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 19f54b901ffbc9108875dc0d7d91138bc9d1c1ed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-11 18:40:48 +00:00
Rym Bouabid
cf631ab8d2 Remove Custom Type Example and Custom Type Sending Example
The whole Q_DECLARE_METATYPE part is superfluous in these two examples,
as QVariant works with any type as long as it is copy-constructible.
And QVariant will call the equivalent of qRegisterMetaType, so that
doesn't need to happen, either.
Showing how to integrate the type with qDebug is fine in theory, but
also a repetition of content that can be found in other places.

Given that there isn't much else being shown in these two examples, it's
better to remove them from examples and move them to manual tests.

Some parts of "Custom Type Example" were used as snippets in other
documentations under qtbase/src/corelib. So, they were added in
customtypeexample.cpp file in the snippets folder.

Fixes: QTBUG-117001
Pick-to: 6.5
Change-Id: I45b16338912e3f7394cbb5169642bd31af32d5e1
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit b956fec7eed57713faa5736917661280e5cec16c)
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
2023-10-11 16:12:24 +02:00
Arno Rehn
330d05eabc windeployqt: Don't copy files from unneeded QML modules
Previously, windeployqt would recurse into subdirectories when copying
QML modules, even if those subdirectories were a nested QML module that
was not needed for deployment.
Since most QML modules are nested in the QtQuick and QtQml modules, the
old code effectively always copied *all* QML modules.

This patch adds guards that prevent recursing into subdirectories if
those subdirectories represent QML modules.
These nested modules will still be deployed, but only if referenced from
the QML application (as determined by qmlimportscanner).

Fixes: QTBUG-117459
Change-Id: I4c0dfc15956ff40a0e8caec3fa334df10cc92ccd
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit a1e052a2918b6863dada64cba1a67c16762cde85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-11 10:50:55 +00:00
Kai Köhne
24fffd93a2 Doc: Highlight some examples for 'User Interface Components' category
Task-number: QTBUG-117243
Pick-to: 6.6.0 6.5
Change-Id: Ie8e7a07e7bbfd5037ccf6a6477f801ea9ed9e3c4
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit 6e33e3e89978ca6545d3012b0919d4a1c5401daa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-11 07:54:10 +00:00
Kai Köhne
0eb0f10a3e Doc: Highlight some examples for the "Graphics & Multimedia" category
Task-number: QTBUG-117211
Pick-to: 6.6.0 6.5
Change-Id: I9ebe20719ad96b0d9ced40745eb6ee09d3e6fb40
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit bb781bdb2dd386307446a1e8740402eab74bbc5f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-11 07:53:34 +00:00
Kai Köhne
ab2ebd86a2 Doc: Fix link to renamed setIncludesSubDomains() method
Fix capitalization of setIncludesSubDomains(). While a it,
make the links explicit, so that qdoc generates warnings if they fail.

Pick-to: 6.5
Change-Id: I74542c288083ec58f866a616da32bd40fcb3f40a
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 1b5402d2291f16403518ecb69b68ad73b9dd76df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-11 07:53:16 +00:00
Liang Qi
f3fbd07f7a xkb: fix build with libxkbcommon 1.6.0 and later
A few XKB_KEY_dead_* defines got removed from 1.6.0. See also
6073565903/NEWS (L9-L14)
https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/merge_requests/70/diffs?commit_id=cb44799b72f611eb4c9d7cc185bc3b09e070be08

Pick-to: 6.5 6.2 5.15
Fixes: QTBUG-117950
Change-Id: I55861868f2bb29c553d68365fa9b9b6ed01c9aea
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 8af35d27e8f02bbb99aef4ac495ed406e50e3cca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-10 17:29:37 +00:00
Shawn Rutledge
3369a7ab5f Fix hi-dpi mouse and tablet events on Android
Windows are not always fullscreen: e.g. the widget gallery example main
window isn't maximized, and a popup window may open anywhere on the
screen. So we always needed to offset by the window position. But it's
better to use QPlatformWindow::mapFromGlobal() since we are working with
native coordinates here.

Pick-to: 6.5 6.2
Fixes: QTBUG-109025
Change-Id: Id3d139fad610bbbc67a394599570a309196ae64c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 05de22e5f9edb107115029a126170034a78a5096)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-10 16:27:33 +00:00
Antti Määttä
1f7749ad31 Fix CTF with namespace build
Include moc must be outside the namespace.

Pick-to: 6.5
Change-Id: Ibdd539b5fdd8ab4aeb0019bcbb62d5702c310065
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
(cherry picked from commit 0bbb2f6981d3109b1e1e20639b88c6a05e6798e3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-10 07:30:21 +00:00
Eirik Aavitsland
696fbf9fc4 Avoid generating corrupt pdf output for out of range coordinates
The local qreal to string conversion would fail and produce
unsyntactic output if the integer part exceeded the range of an
unsigned int. Introduce check for that, and fall back to just output a
0 value instead in such cases.

Testing indicates that there is no point in supporting values beyond
4G, as pdf readers do not seem to accept higher values anyway.

As a driveby, also extend the check to catch all non-finite real
values, not only nan.

As a second driveby, simplify the splitting of a qreal into integer
and fraction parts by just using the std library function for that.

Fixes: QTBUG-117740
Pick-to: 6.5
Change-Id: I247b0612bd565fb2e6f47a182e74f19b8bb0d683
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 888be431da9bbdaca7dd32ba0975e206790c5c42)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-09 23:49:39 +00:00
Santhosh Kumar
3e971798e7 Fix disabled button color in Linux (X11/Wayland)
The palette mapping table (as read from gtk widget) maintained in
QGtk3Storage misses information of QPalette::Button and
QPalette::ButtonText role for QPalette::Disabled color group. This
cause disabled button widget to be rendered with incorrect palette
(such as in dark color scheme, light palette had been used).

This patch fixes this issue by extending palette mapping in
QGtk3Storage for disabled color group of button role.

Fixes: QTBUG-113486
Pick-to: 6.6.0 6.5
Change-Id: Ied4b2650c92cc1cda58be69257945991013b276f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 4cffb3b5fbbad24fed26690c3e10c0332cb0b33f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-09 21:27:31 +00:00
Friedemann Kleint
5097f3fa33 Fix documentation of QMetaClassInfo
Mention the modules using it instead of claiming it is not used
in Qt.

Pick-to: 6.5
Change-Id: I8c9490dfd89444509961c73eeff2f8584e0c5df4
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 1ffe7fbff0e0e5f40eedbd5dc9fb554c562a9338)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-09 21:27:31 +00:00
Tor Arne Vestbø
d599451e24 Guard QWindowsContext::instance() during screen change on shutdown
Destructing the QWindowsScreenManager might result in a
WM_DISPLAYCHANGE, at which point our QWindowsContext instance
is likely gone. We need to guard against that.

Fixes: QTBUG-117473
Pick-to: 6.5
Change-Id: If32941c5c11231f7c27e9dde54f4315f18da1100
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
(cherry picked from commit 7d663d2e08fb71801f0f1f084a124e706722bf0f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-09 17:18:21 +00:00
Rym Bouabid
a0f1e22993 Revamp Local Fortune Server Example: Allow specifying the server name
The server used to hardcode the name while the client allows the
user to specify it. The server's UI is adjusted to let the user first
specify the server name he wants to listen to and second stop listening
to the current server.

Task-number: QTBUG-117064
Pick-to: 6.5
Change-Id: I80fc976151ead7a181fbc32080597277bc515313
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit a8e8a77bc51fc87a5f3c4fec71070b5534659ad8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-09 09:18:37 +00:00
Liang Qi
51129d65b9 xcb: set _KDE_NET_WM_DESKTOP_FILE and _GTK_APPLICATION_ID for window
in top level, which are in used very common for KDE and GNOME.

Pick-to: 6.5 6.2
Fixes: QTBUG-117488
Change-Id: I88fe7b4afe44e4ac8f07e60e990cbe68498e98d9
Reviewed-by: Nicolas Fella <nicolas.fella@kdab.com>
Reviewed-by: Ilya Fedin <fedin-ilja2010@ya.ru>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 70d3c15e8e9ef5965a242022e6681dd87dff5bd4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-08 21:22:30 +00:00
Ahmad Samir
26c3a2fd79 QGraphicsAnchorLayout: compile with QT_NO_FOREACH
The m_edges container isn't changed after it's initialized in the
constructor (in a later commit I'll make this container const, so as to
keep this commit backport-able), and it isn't changed by the loop. Port
all loops over m_edges to ranged-for.

Remove "#undef QT_NO_FOREACH" from the source file, as that was the only
usage of foreach in it. And remove that source file from NO_PCH_SOURCES.

Pick-to: 6.5
Task-number: QTBUG-115803
Change-Id: I9cfc0c95865cbc7415dbecc82388c64c65ded4be
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 641bccce2a80b2a7268c3b8409bdc957b9a510b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-08 17:17:33 +00:00
Liang Qi
fcb2ba3d98 cmake: remove xcb dependency for accessibility-atspi-bridge feature
Qt a11y(ATSPI) support only depends on DBus and ATSPI, it should
also work fine on Wayland when xcb was disabled.

Task-number: QTBUG-117535
Pick-to: 6.5
Change-Id: Ibd7ebb32b94de1888920f0fe2b85ae3bd4d2c77a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 44894c579cb04b59057edd6f8bb5f77c62d701bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-07 21:34:41 +00:00
Liang Qi
efbcd59795 a11y: add runtime checking for xcb only calls
This amends d23562da1c4cb525d4012bee55bd665c6cafef04 .

Pick-to: 6.5
Task-number: QTBUG-117535
Change-Id: I33f97f3c26409a33c8a069f9dcdfe61bbd88e2ec
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 7e14e6c2d3bb5297eefa273d5a23836c931c7517)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-07 21:34:38 +00:00
Liang Qi
b3cd75fde7 a11y: fix the build without xcb headers
This amends 6802065da8706f1fc298a56b9f66ab8a815400d3 .

Pure Wayland runtime and build envs without X11/xcb are more common.

Need to find solution for ATSPI_MODIFIER_SHIFTLOCK on Wayland later.

Pick-to: 6.5
Task-number: QTBUG-117535
Change-Id: I65d41546e3dbb86c3a939a496ed43ac1737cf539
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 2ad3da8fce1bd31c3b4e970a505a051b7104765a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-07 21:34:36 +00:00
Timothée Keller
f4b91d595c Windeployqt: fix typo
Change "qpaths" to "qtpaths" since the former is not a valid option.

Fixes: QTBUG-117817
Pick-to: 6.5
Change-Id: Ib8c8c80f31c1c54747340442c6bf3185c7c69001
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 84d0ebabaab38a900b74bb0f384f46f3c9a400d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-07 12:16:08 +00:00
Volker Krause
628f875b7a Search extra library paths for Android dependency XML files as well
This fixes a regression compared to Qt5. In Qt5 absoluteFilePath()
unconditionally searched for all files in extra prefix dirs and the Qt
install prefix, in particular also the -android-dependencies.xml files.

After the changes in Qt6 up to now however those files are only searched
in the Qt install prefix. This broke external libraries also making
use of the -android-dependencies.xml mechanism, such as some KDE
frameworks.

Pick-to: 6.5
Change-Id: Ic53aab50c70f853f3b1d621d6de6edb3df223905
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit d25438ebbd62cd10a435f6d7dd6a7ce181e3ac5f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-07 12:16:08 +00:00
Fredrik Ålund
700c3ef931 Only build the Mimer SQL QtSql plugin for macOS on arm64 and x86_64
The Mimer SQL installation does not support universal binaries. Skip
building the Mimer SQL QtSql plugin when doing universal binary builds
of Qt for macOS

Change-Id: Ib0fad2d626fe65d886d5bf2f4848dda09bf65b14
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7c2167d3b886c8f2eb1ea6161f12440dfa8cf401)
2023-10-07 10:02:42 +00:00
Ahmad Samir
bab635fea5 QStringConverter: clarify decode()/encode() API docs
These methods return a struct which is implicitly convertible to
QString/QByteArray respectively. Don't hide the return type from QDoc,
this simplifies telling users what those methods return exactly.

Fixes: QTBUG-117705
Pick-to: 6.5
Change-Id: Ibb22a1e54fffce8f5f20aaabe47983870ccfba1e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9e5df4ae5344374eaae0cbdaa526d4dd49ed3a13)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-07 07:28:11 +00:00
Thiago Macieira
6cc68022fc tst_QFile: extend moveToTrash tests to exercise more corner cases
Added moveToTrashDuplicateName() to see what happens if you attempt to
trash two files with the same exact full path. Both files should get
independently moved to the trash bin and not clobber each other.

Added moveToTrashXdgSafety() to test that QFileSystemEngine will
properly skip over an unsafe $root/.Trash directory, as required by the
XDG specification. I think the specification should also make security
requirements on $root/.Trash-$uid too, but that's for another change.

Change-Id: I9d43e5b91eb142d6945cfffd1786cd60e4244c7c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1033780b3c8f24253f7889f3a2a290f27e38c2a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-07 01:43:40 +00:00
Mårten Nordheim
cb4cb61883 QHttpThreadDelegate: use new(std::nothrow) instead of try..catch
We usually compile without exceptions, so the try..catch is a noop.
So, if the `new` fails we would crash (or get UB) anyway. Instead
of that, use the nothrow version of `new` and check the result.

Pick-to: 6.5
Change-Id: I1902b717c70afcc44c1f3237370aae346262452a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 51c812af0747573ccf07fc232d860170c4ba2877)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-07 00:46:13 +00:00
Marc Mutz
3d3837287a QUuid: de-pessimize QDataStream operator
Use a stack buffer instead of a QByteArray to hold the 16 bytes for
the QUuid serialisation, replacing toRfc4122() with toBytes() and a
memcpy().

As drive-bys, drop the needless cast from char* to uchar*
(qToLittleEndian() has void* arguments, so char* is fine) and drop {}
around single-line if body.

Change-Id: I6ffabcf07fc9a730a782e20e113999a0dcf15067
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 72d51f1c42b83c26d15cb626f1b22905fbbea474)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-07 00:46:13 +00:00
Liang Qi
c9cb83d212 xcb: replace a warning with debug info in qxcbconnection_xi2.cpp
Fixes: QTBUG-117820
Pick-to: 6.5
Change-Id: I3b89305e1a8d92a02166efee7067108572f7a97a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 42d9c1913a504423783397adf6e6a77545f857ac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-06 22:01:37 +00:00
Thiago Macieira
a76492a5c0 qcompilerdetection: Add missing qtconfiginclude.h
The Q_DECL_{IMPORT,EXPORT} macros change with the configuration, so the
lack of our configuration this ended up producing inconsistent builds.

Amends 43ec3d8d011f1c067be2257ba657838f2c118415.

Change-Id: Ifeb6206a9fa04424964bfffd17892394d19e648f
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 22029a76c37d8d670479d523684a84f7966ed434)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-06 22:01:36 +00:00
Axel Spoerl
72e9795d41 QDockWidget: Do not propagate title from a closed dock widget
When a dock widget is closed while floating, it still reports being
floating even though the QWidget::windowHandle()->isVisible() returns
false. This is documented behavior and will not be changed.

c153066baaa88718ed45b68230d81285eb436d3d relied on the isFloating() to
return false, if the dock widget is closed. When the window title was
changed by setWindowTitle(), the change was overridden by reading the
old value from the window handle.

=> Amend the patch and add a windowHandle()->isVisible() as a condition.

In c153066baaa88718ed45b68230d81285eb436d3d, an autotest for the title
propagation (QTBUG-113591) was added to floatingTabs().

=> Harden the setWindowTitle() test function. Move the tests related to
QTBUG-113591 and QTBUG-117764 to this function.

Fixes: QTBUG-117764
Pick-to: 6.5
Change-Id: Id37a9a22d4d13abad4ea55c74ea4e834bdb2bfab
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 92d837e684e3ab619d28ad84d2ab3a1b82335173)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-06 22:01:33 +00:00
Mårten Nordheim
47c2aad025 http: fix leakage of network cache qiodevice
The QIODevice is owned by the caller of data(), so we should have
freed it.

Amends a6776de0c70d23ac197682c7bef603450cb8b03f

Fixes: QTBUG-117787
Pick-to: 6.5 6.2
Change-Id: Ic5575649038480f52cc13ee229980ee1c7cee728
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 23996976cfe79e5f9845a09e26c177d14470c897)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-06 21:12:14 +00:00
Mårten Nordheim
8e7dcd2256 tst_http2::redirect: reduce length of test
By fixing how many requests we are expecting to _finish_.

Since the nRequests variable is only decreased once a
request is finished, we only actually expect 1. No matter
how many times it gets redirected.

This was the slowest test-function in the test, clocking in at
10 seconds. Now it's sub 500ms.

Pick-to: 6.5
Change-Id: I544360f0928466c1bc0fbc6806952ccec588d131
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 0c4b2779ff1c41bbcae33960313d764a91757596)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-06 21:12:04 +00:00
Tor Arne Vestbø
e58b1efcae macOS: Activate Qt's platform a11y whenever the system queries us
Otherwise the cached information we store about e.g. table rows
and columns will not be updated, as QAccessible::isActive() is
false during QAbstractItemViewPrivate::rowsInserted(), and as a
result we'll be operating on stale information when the system
comes back later to query us about one of the cells.

This was observed when running a Qt Widgets table app with
the system's Keyboard Viewer open.

Change-Id: I88efd46dbc3d35c8b1888d3e29ef3d001bb9eac7
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit cf13e4c84c44b6f66f651035b3c3d012718b82dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-06 10:47:17 +00:00
Marc Mutz
6818d6915d tst_QStringApiSymmetry: add more invalid UTF-8 sequences
These represent US-ASCII characters incorrectly encoded as a two-octet
UTF-8 sequence.

Pick-to: 6.5
Change-Id: I5b1d58066d08cf61583dabcd71dd2f3ac7a3585a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit bc3ae300c5e6ab993549ce24ec681c4830741454)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-06 10:03:58 +00:00
Anton Kudryavtsev
f4cd637c8a qtextdocument: use qsizetype more
in Qt::mightBeRichText, Qt::convertFromPlainText
and emitFrameStyle to support large strings

Pick-to: 6.5 6.2
Change-Id: I7187bd81d3cbcc11ba898e015bd2a8ec64e3bf34
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 33d606412d8c2dc9ad3c0129af5bc8a74ce650be)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-06 07:14:16 +00:00
Anton Kudryavtsev
95c19a14b6 QString: use qsizetype more
It's last legacy int

Pick-to: 6.5 6.2
Change-Id: I691f7b15dead91166831cdf6c33a9f4d2d58b62e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e9e076df55ce1537b62f9b13cad0f9781935beb0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-06 07:14:10 +00:00
Edward Welbourne
f435aeb904 Make \brief of Saving a Game to File actually brief
Specifically, prune it to fit on a single line.
Much of what it was saying was implicit in its context already.
It also neglected to mention CBOR's part in the story.

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: I161a345cbbea8b706490fcbbadecd01b8946af31
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit e67f030600886a5630e22fa912e22087a7d63c56)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-06 06:50:00 +00:00
Christian Ehrlicher
84f0320209 Preparations to deprecate QItemDelegate
QItemDelegate was superseded since Qt4 by QStyledItemDelegate but it
took until Qt6.7 to remove the last occurrences in qtbase.
 - remove unused includes / replace with qabstractitemdelegate.h
 - replace references in the documentation with QStyledItemDelegate
 - adjust the examples and tests to use QStyledItemDelegate

Pick-to: 6.5
Change-Id: I246755004ce2d01192a726ca0972106c237df0cc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 4e8b54eb811f8c6064fd2e937711efe68543087c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-06 04:17:49 +00:00
Alexandru Croitor
1790cbd608 CMake: Fix incorrect UILaunchStoryboardName value in Info.plist
The value needs to be 'CustomLaunchScreen', not
'CustomLaunchScreen.storyboard', otherwise app store validation will
fail with the following error:

 Asset validation failed
 Invalid bundle. Because your app supports Multitasking on iPad, you
 need to include the CustomLaunchScreen.storyboard launch storyboard
 file in you bundle. Use UILaunchScreen instead if the app’s
 MinimumOSVersion is 14 or higher and you prefer to configure the
 launch screen without storyboards.

This brings the value in line with what we have for the qmake
Info.plist file.

Amends cf3535fdf2e7fe52b36aaa4b94a53525fd6640f4

Pick-to: 6.5
Task-number: QTBUG-104519
Task-number: QTBUG-110921
Task-number: QTBUG-116784
Change-Id: I4e9cc2ed685634544955e967f35fdc426dac0f0c
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 370962315ad184a772e1813edc3c948403c7b057)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-10-05 20:37:27 +02:00
Alexandru Croitor
619601bcb0 CMake: Add CFBundleIconName key to ios assets manual tests
It is required for publishing an app to the app store. Otherwise during
app store validation phase, you get an error:

 Asset validation failed
 Missing Info.plist value. A value for the Info.plist key
 'CFBundleIconName' is missing in the bundle 'foo'. Apps built with
 iOS 11 or later SDK must supply app icons in an asset catalog and must
 also provide a value for this Info.plist key.
 For more information see
 http://help.apple.com/xcode/mac/current/#/dev10510b1f7.

Note this is not needed when using Xcode 14.3+ and when one places the
icons into an asset catalog. When processing icons in the asset
catalog, Xcode generates a partial Info.plist file that will contain
the CFBundleIconName key and will merge into the final Info.plist
file.

Amends cf3535fdf2e7fe52b36aaa4b94a53525fd6640f4

Pick-to: 6.5
Task-number: QTBUG-104519
Task-number: QTBUG-110921
Task-number: QTBUG-116784
Change-Id: I53009097cf27b096c72ee9c4bad6aa4286272061
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
(cherry picked from commit 528e70b6d9333348044ecffb7bab8edfe9006538)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-10-05 20:37:25 +02:00
Marc Mutz
c5db4a8bd1 QtAndroidAccessibility: fix unneeded runtime initialization
Initializing QPointer with nullptr is currently still going through
the (T*) ctor, which is not constexpr, so is initialized at runtime.
This will change in Qt 6.7, but that doesn't help the older branches.

Use the default constructor, which is constexpr, and assert that no
runtime initialization happens by using Q_CONSTINIT.

Amends f9297565784e7eae87588417c8080cc1c9eede5f.

Not picking to 6.2, 5.15 because, while affected, they're in too
stable a mode for this, and they also lack Q_CONSTINIT.

Pick-to: 6.5
Change-Id: I41bb6f36d529effda008f166fd05a8896157edc9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit c0ba4ad49d9099e723518d9f4384e00bfb6ae1a7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-05 18:19:50 +00:00
Tor Arne Vestbø
546dae9285 macOS: Silence warning about supporting secure state restoration
We don't support or implement state restorations via the AppKit
state restoration APIs, but if we did, we would/should support
secure state restoration. This is the default for apps linked
against the macOS 14 SDK, but as we target versions below that
as well we need to return YES here explicitly to silence a runtime
warning.

Pick-to: 6.5 6.2
Fixes: QTBUG-117745
Change-Id: I0145504a79e53499852832d23dc7d4d6838dfa1b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit fc1549c01445bb9c99d3ba6de8fa9da230614e72)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-05 17:40:18 +00:00
Marc Mutz
7b1b40eb5e QPointer: fix missing converting move-assignment operator
When 6c504f2519e1180dbcfd77d5bb08b0db9742eeaa added the conversion
copy-constructor to fix an ambiguity, its commit message argued at
length why a move-assignment conversion operator was not possible. But
we actually have the existing converting move and copy ctors, so we
can just use copy-and-swap and move-and-swap, so do that.

As a drive-by, make the copy-assignment operator use copy-and-swap.

[ChangeLog][QtCore][QPointer] Added missing converting move-assignment
operator. This is forwards-compatible with Qt 6.6.0: compiling against
6.6.0 will just use the lvalue overload.

This is BC and SC, forwards and backwards (inline code, and going back
in time will just use the lvalue overload), so picking to 6.6.

Change-Id: Ibbefb0927c08d8c716a952c6c592a02df2a89008
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b6c73356355de752755dc54214818dac6d0a8694)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-05 17:40:16 +00:00
Rym Bouabid
a29dfae568 Revamp Semaphores example: Add \examplecategory {Data Processing & I/O}
Fixes: QTBUG-108859
Pick-to: 6.5
Change-Id: I0fecf50e95c351564e7e41142cd3d385c4d1d867
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 8c393e0024e8566881de8593acb21cd1a44b4644)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-05 17:39:54 +00:00
Rym Bouabid
904d432b0f Revamp Wait conditions exp: Add \examplecategory Data Processing & I/O
Fixes: QTBUG-108860
Pick-to: 6.5
Change-Id: I2ccf20f42d5abaa22e2daf4c8e7777ff903d947e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit dd98dac3bb234964ea0caa1f43f9672b0be965ef)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-05 17:39:54 +00:00
Rym Bouabid
f5d2ca1c54 Revamp Shared Memory example: Add \examplecategory Data Processing & I/O
Fixes: QTBUG-108858
Pick-to: 6.5
Change-Id: I66e1f92eb25ec1377c1f927e767cebaeb3ef5fec
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit e51bc067683ae623f0367830eb029d12c0cec444)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-05 17:39:54 +00:00
Rym Bouabid
00da474fca Revamp Bindable Properties exp: Revisit documentation
Remove "Example" from the title.
Add \examplecategory Data Processing & I/O

Fixes: QTBUG-114689
Pick-to: 6.5
Change-Id: I695df195819cc371d404c4c5f01a0c4830d9c438
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 9d32288a3806fb7d7ac938e71d7d49702b16be93)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-05 17:39:53 +00:00
Rym Bouabid
c49ccb12e6 Revamp Mandelbrot example: Add \examplecategory {Data Processing & I/O}
Fixes: QTBUG-108861
Pick-to: 6.5
Change-Id: Ie622a94072e243eb5d3f6c162e490884d4cdd0f2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit cc4ac31150e3a912405e6d43e17e5c26e02908f5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-05 17:39:53 +00:00
Assam Boudjelthia
b33b0b607a Android: bump Android target API level to 33
To follow latest Play Store requirement.

Pick-to: 6.6.0 6.5
Fixes: QTBUG-112637
Change-Id: I1ef4f8b639f4b0cc759a2363b7b9b9864b159509
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit b74f180ac065741783dc4e7f793bb97e35aed7f7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-05 12:51:03 +00:00
Leena Miettinen
e228211f41 Doc: Edit CMake Qt6 Core variable docs
Edit the docs for style and consistency.

Pick-to: 6.6.0 6.5
Change-Id: I24fb7f8b833ae7e5adaca31811bd171d892c5907
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 201c30986ba365be07e6be786bb59c5d0ed396b2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-05 07:28:39 +00:00
Laszlo Agocs
2d87d42040 rhi: Fix intro doc snippet with Vulkan
The QVulkanInstance must outlive the QRhi (if Vulkan is used).
Otherwise subtle problems may pop up upon application exit.

Change-Id: Ia7074c7f53633d51cf3bbdcc84e7f578214d9648
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 1d019de6b7090ea6c973f7e9fa780259a455ce98)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-04 22:23:57 +00:00
Joerg Bornemann
666a1db34c Doc: Fix link in QMake variable reference
In the description of the qt value of the CONFIG variable the link to
the QT variable was broken.

Pick-to: 6.5
Change-Id: I07dc1993ce0cefb7615d02aaefb9ad8391b1dd39
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 480b39288f8e65ab3c0ee19e8a38195a97d4046a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-04 21:41:52 +00:00
Mårten Nordheim
db90905601 Mark potentially unused variable as maybe_unused
Fixes compile error with MinGW clang.

Amends de6f4053139377b63cf92f6bca4d96d488682de4

Pick-to: 6.5
Change-Id: Idc1fac9d92369cfc79b5c770830bb43b3c5aae91
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b1531815465eeff249c1e8e27c3354e4a5da0eee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-04 19:16:40 +00:00
Rami Potinkara
061a057d5b Android: fix display cut mode being short edges always
Fixed _SHORT_EDGES and _DEFAULT conflict.

Mapping from Qt API's to Android's is following:
-QWindow::FullScreen -> _DEFAULT
-Qt::MaximizeUsingFullscreenGeometryHint -> _TRANSLUCENT
-Others  -> _NEVER
-Not supported -> _SHORT_EDGES (Use Java as workaround)

For example in QML:
-visibility: Window.FullScreen
-flags: Qt.MaximizeUsingFullscreenGeometryHint

Fixes: QTBUG-114437
Task-number: QTBUG-96877
Pick-to: 6.5 6.2
Change-Id: I730b3e3f76401b52548ece05dee60526d0be8207
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit adb7e2525e0d4db622833b6d05d6339e511c2480)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-04 19:04:57 +00:00
Kai Köhne
83fa3eed6c Remove 'SecurityCritical' attribute for psl-data
The list is used to prevent the setting of super-cookies for independent
domains, so in a way, the content is related to security.

Anyhow, having it always up to date is not super critical, as this is
used mostly as a band-aid. Also, the updates are fairly expensive in
file size, and as upstream doesn't do classic 'releases', we must define
how often we should update.

Let's remove the urgency to update it for every patch-level release by
removing the SecurityCritical attribute. Instead, we should aim for
updating it right before minor releases, so about twice a year. This is
btw what other projects are doing: Chromium updates the list
twice a year, Debian even less often.

Pick-to: 6.5 6.2 5.15
Change-Id: I05790f28002190ab0caa5a2a75e3b87cd44462d1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit ec7f06fa623a95e2f9c676d6ad475fe99a066111)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-04 18:37:05 +00:00
Vladimir Belyavsky
758e249f67 QRhiD3D11: do not crash on endFrame() when IDXGISwapChain is null
There are reports on crashes in QRhiD3D11::endFrame() due to nullptr
access to swapChain (IDXGISwapChain). It's still not clear under what
conditions this might happen, but we can make a speculative fix (as a
last chance) by simply adding a check that the swapChain is not null.

Instead of crashing in such cases, we will warn now and return
QRhi::FrameOpError, similar to the case when IDXGISwapChain::Present()
failed.

Task-number: QTBUG-109708
Pick-to: 6.5
Change-Id: I2b0430347a229a618176a38ce3dc9c6e5a33a60c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 2581bed66be114ae106696a0321f99fba1c4d6f9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-04 12:54:40 +00:00
Marc Mutz
6990f51553 tst_QPointer: ensure default-constructed objects are constinit'able
Construction from nullptr isn't, because it's using the QPointer(T*)
constructor, which cannot be constexpr.

Pick-to: 6.5
Change-Id: I19129a0fca5873e83d20351a909a7994399bfcce
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8b661846257670a1b8ef6b33593778c0f086c5e3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-04 08:20:10 +00:00
Marc Mutz
e4f5d86f88 tst_QPointer: add checks for CTAD
No pathological findings :)

Pick-to: 6.5 6.2
Change-Id: Ifbbca223a5e612e7abb67c0364d4354a9d8174e3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1cf0f8e7c3feb923ff08247d83d185c6aea986eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-04 08:20:02 +00:00
Marc Mutz
7844d919ce QAtomicScopedValueRollback: fix a typo
Pick-to: 6.5
Task-number: QTBUG-115107
Change-Id: I9ca5d143b5c89443fc40859c035be43cde3d73c4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 64b07fc811036af67ea4bbdb877765e597867f62)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-03 21:10:46 +00:00
Christian Ehrlicher
1a8769debc Qt container documenation: Misc fix for std comparison
std::map/multimap/unordered_map/unordered:multimap also need a 'Key'.

Fixes: QTBUG-89904
Pick-to: 6.5 6.2
Change-Id: Ib653c941b671905762270c82218e50dfed8fc8c6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit aeeb77650f05f90bb87ffe7e66cc2b6b3713ad2f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-03 19:08:54 +00:00
Christian Ehrlicher
ad27a2e579 QHeaderView: add test for rows/columns moved
Add a testcase to make sure the signals for moveing rows are properly
connected from the model to the corresponding QHeaderView slots.

Task-number: QTBUG-117698
Pick-to: 6.5
Change-Id: I354f8836d3de58a8bf51da7a8c0859a673ec9339
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit cb4e7f4176e6135d4af0604a6e5c32682b38d33d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-03 18:49:53 +00:00
Alex Bu
6f6f6c4c7a Egldevices: Use valid DRM handle to get platform display
Use a valid DRM handle as display attribute to get platform display.
This fix is used together with the default framebuffer fix for the
display issue of egldevices backend on Jetson AGX Orin devkit.

Pick-to: 6.5
Change-Id: Ia1975936653461c5a7e534c714a123837c62bc10
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
(cherry picked from commit 1aba24a2ed4b75551a900772320d5a0dc1960043)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-03 16:24:06 +00:00
Kurt Kiefer
cf44289e12 eglfs: add a default framebuffer to NVIDIA eglstreams
Newer versions of NVIDIA's DRM driver are rejecting the previously
accepted but non-standard use of framebuffer_id -1 in order to set
the output mode but not issue a page flip.

This change adds a default framebuffer to the egldevice driver for
use with the initial calls to set the CRTC mode and plane.

Pick-to: 6.5
Change-Id: I63dbb6b099250fcff7d995eec38fb75c675894cd
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
(cherry picked from commit 17a68dae5e9007d9a8b122b4ede1647d5900d6d4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-03 16:24:06 +00:00
Tero Heikkinen
1f0a31d6a6 Add QEXPECT_FAIL to tst_QApplication::sendEventsOnProcessEvents
Test sendEventsOnProcessEvents has been noticed to fail when
qgtk3 (Glib) is loaded - Should be fixed in QTBUG-87137

Moving test from blacklist to use QEXPECT_FAIL as it's more
recommended until test is fixed in the relevant configurations.

QEXPECT_FAIL is selected to use as original investigator
reported also some cases when glib is working. Therefore
this approach is giving us more insight for further
investigation is it always failing with glib or not.

It was also reported linkage to zeroTimer test QTBUG-84291,
but not sure why removing that has affected to this one.

Update to QEXPECT_FAIL documentation to tell in first place
that XPASS is not only marking it as XPASS but also failing
the test. Same is mentioned in different location but it
needs more searching or testing how it works in real test.

Task-number: QTBUG-115155
Change-Id: I7fb4ef28dba8adb7009be528f88fc758a12e9006
(cherry picked from commit de942651698d7dc6f2c2cabc1c0dc06b4e6b19fc)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-10-03 13:43:31 +03:00
David Faure
043ba52306 Fix copy/paste typo in qdom.cpp leading to wrong errorColumn
Detected by KDReports unittests ;-)

Pick-to: 6.5
Change-Id: I33ab4c16a0fa55d7feffccc807998213132676fb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 3d631da88bc08816b72493dbce785cabc56b70be)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-02 23:54:00 +00:00
Topi Reinio
d99e4ac02b Doc: Fix QIcon documentation
* Move \externalpage topics to external-resources.qdoc, as that command
  cannot be embedded in other topics.

* Fix references to non-existent function fallbackIconTheme().

Change-Id: I5d08206c53aea9c2d4c6fddf5d04df187b01ef53
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit b5169b5c909d06c61bdc45b09c97c05154043a24)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-02 21:11:20 +00:00
Topi Reinio
c2164340bf Doc: QtCore: Fix documentation issues
* Fix references to Wait Conditions Example, Semaphores Example, and
  MIME Type Browser Example as they were renamed.

* Rename 'Shared Memory' example as its title clashes with
  the title of another page (sharedmemory.html).

src/corelib/global/qfloat16.cpp:
    * warning: Invalid '\relates' (already a member of 'qfloat16')

Pick-to: 6.5
Change-Id: Ia28be8e3882a7ad1fadcdbd50a657705d58526bd
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit f0f0a5ccb63b367934cc29d6091a782ffc746161)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-02 21:11:18 +00:00
Tor Arne Vestbø
2cd1f9f03d Simplify tst_QShortcut
There's no need for the manual sendKeyEvent, as QTest already
has the ability to send synthetic clicks, and we don't need
a colored window to test shortcut activation.

Change-Id: I8409888664e2316bec4ea64f21dbb8b6915091f4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 8606f33641a0a2fb9926ebb604a7fc5894e5fc39)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-02 20:53:22 +00:00
Rym Bouabid
a1098f4462 Revamp Queued Custom Type Ex: Add const when applicable
Task-number: QTBUG-117147
Pick-to: 6.5
Change-Id: I2fe342fa585f8c1203fa64d2a9ceabc07070cc77
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 34ff72d0ba5284ff117ee4ae7f04072b51c85315)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-02 17:26:59 +00:00
Rym Bouabid
d02e9b3150 Revamp Queued Custom Type Ex: Declare stopProcess() as a method
Declare stopProcess() as a method because it's used in the connect()
overload taking a pointer-to-member-function, so it doesn't need help
from moc.

Task-number: QTBUG-117147
Pick-to: 6.5
Change-Id: Iaa1c02de82cffdea455af520c37dc0e6e6861443
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 74318643ced197f9380d21c3dfc662a85e73f5b8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-02 17:26:59 +00:00
Rym Bouabid
d199a00696 Revamp Queued Custom Type Ex: Revisit the documentation
Remove "Example" from the title.
Add \examplecategory {Data Processing & I/O}.

Task-number: QTBUG-117147
Pick-to: 6.5
Change-Id: Ieaab75dedb60329dcdcbbcfe6e2ad360df4d98df
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 4aab2ef0ac3b126b0af67b9f946bf49b79fe6968)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-02 17:26:58 +00:00
Rym Bouabid
a6dcdcde99 Revamp Queued Custom Type Ex: Fix includes
Fix includes order and add the needed ones to avoid transitive includes.

Remove QT_{BEGIN,END}_NAMESPACE because these are private Qt macros that
should not be used in the examples.

Task-number: QTBUG-117147
Pick-to: 6.5
Change-Id: I6caa0a59f2ab4dfec6fb558a0896c27b05b6a5db
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit aa9529408041ab16bb920840d78b3f41c759a2f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-02 17:26:58 +00:00
Alexey Edelev
880da41adb syncqt: Catch fs exceptions that happen when clearing staging directory
Pick-to: 6.5
Change-Id: I1617f0940e1b1d892d321fc6f5df11262ee1f288
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 9f3e7aaf17ba69a7cff81a584054978e6c283165)
2023-10-02 19:26:58 +02:00
Alexandru Croitor
606839a1f9 CMake: Update the ios assets manual test
- provide an asset catalog .json file for both Xcode 13 and 14
  formats. Apps built against the Xcode 13 SDK are not validated
  anymore by the App store, but it's still useful to see how things
  were before.

- Xcode 13 required the following icon sizes for a universal iOS app:
   60x60@2x, 76x76@2x\~ipad, 167x167, 1024x1024

- Xcode 14 only needs the 1024x1024 one

- icons need to be embedded into the asset catalog starting with iOS
  11 according to Apple docs (not sure which Xcode version, but it's
  needed for both Xcode 13 and Xcode 14), and they don't have to
  manually be copied into the bundle anymore, Xcode takes care of
  that when processing the asset catalog

- add an 167x167 icon image for the iPad pro for Xcode 13

- add an 1024x1024 icon image that is required for successful app store
  submission and embed it into the asset catalogs

- for Xcode 13, we need to manually specify all the required icon
  sizes

- for Xcode 14 we can rely on Xcode to generate the smaller icons from
  the big one

- because the icons need to live in the asset catalog folder, remove
  unnecessary icons in the appicons folder.

- for the cmake project, make sure the asset catalog compiler generates
  the icons by setting the
  XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME attribute
  qmake does automatically already.
  it would be nice if we can do that automatically in a future Qt
  version

- remove unused icon references in Info.plist file with Xcode 13

- remove all icon references in Info.plist with Xcode 14, rely on Xcode
  to add that info via its generated partial Info.plist file that gets
  merged into the main one.

- don't include CMakeLists.txt as a text resource

Amends cf3535fdf2e7fe52b36aaa4b94a53525fd6640f4

Pick-to: 6.5
Task-number: QTBUG-104519
Task-number: QTBUG-110921
Task-number: QTBUG-116784
Change-Id: I0bc556e66647a66bc21402ea62db3374d0970e97
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit bf2587d9e5a3b25ca6dc1224a635bd8565681d2b)
2023-10-02 19:26:58 +02:00
Jan Grulich
c3ccc8650c QCryptographicHash: don't forget to unload OpenSSL providers
Automatically unload loaded crypto providers on cleanup. In most cases
we don't load them, but when we do (e.g. when MD4 is used), we would be
leaking memory.

Fixes: QTBUG-115233
Pick-to: 6.5
Change-Id: I91318d391ab35d00647d1e9e2408fc987811a2d3
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit e25c773f2b7e5ee303eac27da09b11ecbcb8a05a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-02 17:26:58 +00:00
Rym Bouabid
1b78e645e1 Revamp Bindable Subscription ex: Create QString using a Literal operator
Create QString at compile time using the literal operator""s instead of
using pointer to characters. This way, no conversion or allocation will
occur at runtime.

Task-number: QTBUG-117422
Pick-to: 6.5
Change-Id: I92eed0a371bf6383ddb1e938646029f1c24242bf
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit ed72a5d9e11382f8c5a10924702beed809343809)
2023-10-02 19:26:58 +02:00
Rym Bouabid
e8f20fbb52 Revamp MIME Type Browser Ex: Replace QObject by Q_DECLARE_TR_FUNCTIONS
When declaring MimetypeModel class, use Q_DECLARE_TR_FUNCTIONS Macro
instead of Q_OBJECT as we only need to call tr() functions.

Task-number: QTBUG-117146
Pick-to: 6.5
Change-Id: Ic7afd4a806d57ba2a651ebe129f3a91f35764354
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit e6c8c16afb3e0481ac6322506ed0c801b2b3ec71)
2023-10-02 15:29:29 +02:00
Axel Spoerl
c224c98b81 QDockWidget: Don't use QWidgetResizeHandler on Windows
QWidgetResizeHandler sets its own mouse cursor, which can cause the
wrong icon being shown in corner cases (e.g. floating dock with custom
title bar and windows container).

Windows handles resizing of toplevel windows on platform level. A
QWidgetResizeHandler is not necessary.

=> Do not create one on Windows.

Resizing of floating dock widgets is tested in
tst_QDockWidget::dockPermissions(), floatingTabs(), hideAndShow().
=> No separate autotest needed.

Fixes: QTBUG-102196
Pick-to: 6.5 6.2
Change-Id: I20ab203e6b7ecc1dbda0524c7ff9bef271a7c04f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
(cherry picked from commit 975c0bdf732ea7c5f7632913a27a1b6ae5cd5b26)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-02 12:51:11 +00:00
Morten Sørvig
114c8eb7a5 Add catch-all DPR update to expose event handling
The platform plugin should already DPR (or DPI) change
events, however if that does not happen we update in
the expose event as well as a last resort to make sure
the window's DPR value is in sync.

Also print a warning and ask for a bug report.

Pick-to: 6.0
Change-Id: Ibb144f163281a28216c2fa3353ed50237e91ce25
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 5f1c29376c02f722450f6bf1aa5f0647601e0e59)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-02 12:51:09 +00:00
Øystein Heskestad
6ab5ec5b4a Fix not emitting proxyAuthenticationRequired signal for NTLM
During NTLM http proxy authentication QHttpSocketEngine did
not emit the proxyAuthenticationRequired signal during
handling of HTTP 407 responses. As a consequence, the proxy
server was spammed with connection requests that never
worked.

Fixes: QTBUG-109718
Pick-to: 6.5
Change-Id: Icf0ccf58e3f2690d210652713155a303026ed3b1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit c73ee7353a22005890839afebb920a3c242b1f57)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-02 12:50:20 +00:00
Mårten Nordheim
8ce6302d54 QWindow: Fix error for unused capture
Amends 89ce65c2d01e77c1cf49bb8579f63b60480e0186

Change-Id: Ifddf6b2e849929137d1db8f777a7cb9fa3cd2038
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e4d545b4c6d5f14fa538cbfc40f0134ea28e9419)
2023-10-02 07:45:51 +00:00
Mitch Curtis
71122209f4 Doc: state that models are not thread-safe
Fixes: QTBUG-107598
Pick-to: 6.5 6.2 5.15
Change-Id: I0e7ea8d4b2094d92b3cad5eec5b30e6e3ac64018
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ccda3362464bfaff999b739aa81925c7b51075a9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-02 04:22:54 +00:00
Thiago Macieira
922f60c140 QtTest: block almost all Unix signals in the WatchDog thread
Signals delivered via kill(2) are delivered to any thread that is
running, so let's make sure the WatchDog thread doesn't get them.

This may be hiding bugs in the user's handler code, but in simple unit
tests the user may not be expecting there to be multiple threads in the
first place.

Change-Id: I512648fd617741199e67fffd17822cdcdf30926c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit da0571d87890b587154a6d9124ac29dc30b151dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-02 02:03:37 +00:00
Christian Ehrlicher
aa606f9760 Tests/QAbstractiItemView: fix runtime warnings
Fix runtime warnings about testdata with the same name.

Pick-to: 6.5
Change-Id: I5d4927cc53be3e08a524498db42a8a08396ced8e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 2203dec57bfca11722ddac7df394490a35e90b79)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-01 13:44:12 +00:00
Marc Mutz
e1e2b00c99 Add a script for updating from publicsuffix/list.git
Upstream changes every few days, so make this as easy as possible.

Older branches have a different way to update the list. The idea of
this script is to paper over the these differences.

Pick-to: 6.5 6.2 5.15
Task-number: QTBUG-117138
Task-number: QTBUG-116236
Change-Id: Ib7c6187e4b9c09de715a014d22af9c20d4783086
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit fd89295562919358eeaa514114366fc9d9d27960)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-01 11:27:20 +00:00
Marc Mutz
05029ec45d QAtomicScopedValueRollback: make store_part() static
... because we can.

Pick-to: 6.5
Task-number: QTBUG-115107
Change-Id: I23b5edc6111615cbd0352847b2f1a1667948c40a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e054d9f558200f131bedffc59eab1ba160b16e6c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-01 10:50:03 +00:00
Albert Astals Cid
9c54a8bb9e FileChooser portal: Make sure filter.name is not empty
Xdg-desktop-portal will reject any OpenFile request if there is an empty
filter, so if we can't find the mimetype in the mimedatabase we just
use it's "raw name"

Pick-to: 6.5 5.15
Change-Id: I705ae7523445e5c2ec97a42ee334401bc90adb68
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 88c74240a8db5dfe9ebce387845a21c7b6244340)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-10-01 08:48:12 +00:00
Marc Mutz
04182ccf58 QPersistentModelIndex: fix UB (op< on unrelated pointers)
Pointers can only be legitimately compared with less-than (<) if they
point into the same array (or one past the end). This is decidedly not
the case for heap-allocated objects like
QPersistentModelIndexPrivates, so doing it is UB.

Fix by using std::less, which is guaranteed to be a total order, even
for unrelated pointer values.

Pick-to: 6.5 6.2 5.15
Change-Id: If04341b4b55784e7732782f3ae829f53b0ceab9c
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 49f9271360e0ef4e624212e442dfcd7765571d60)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-30 14:46:17 +00:00
Alexandru Croitor
24997bb32e CMake: Don't set QT_BUILDING_QT for single standalone tests
Standalone test projects have the following condition in the
beginning of their project:

 if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
     find_package(Qt6BuildInternals COMPONENT STANDALONE_TEST)
 endif()

When configuring the project the first time, QT_BUILDING_QT is not
set, find_package is called, configuration succeeds.
But because standalone projects implicitly include QtSetup.cmake,
that file sets the QT_BUILDING_QT cache var to true, and upon test
reconfiguration, cmake errors out with:
 Unknown CMake command "qt_internal_add_test"
or similar.

This happens because QT_BUILDING_QT is true on the second
reconfiguration and the find_package mentioned above is not executed
anymore, leading to unknown internal command errors.

Set a new QT_INTERNAL_IS_STANDALONE_TEST variable when we detect
a standalone test and check for its value in QtSetup so we don't
set QT_BUILDING_QT to TRUE anymore.

Adjust a few code locations where QT_BUILDING_QT being false might
trigger different behavior for standalone tests.

Task-number: QTBUG-93020
Change-Id: I5413b9f37653225175a1006f7626e023045b5979
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
(cherry picked from commit b9b5ed3aa607f644cf32b5798ac742442de9fe3e)
2023-09-30 12:20:43 +00:00
Tor Arne Vestbø
a8aa762424 revert "xkbcommon: make shortcuts persistent across layouts"
This reverts commit 5e76a9569e37e6620a7ddf3a9d9620fbb9b9d04f.

The change's stated goal was to make shortcuts "stable",
i.e. work the same, regardless of which keyboard layout
the user has selected.

In doing so, it changed the semantics of shortcut handling
to depend on the order of the keyboard layouts reflected
by XKB, picking the first Latin layout in the list, instead
of prioritizing the currently selected/active keyboard
layout.

This change in semantics is a major behavior change, and
breaks common and valid setups such as having [en,fr] or
[en,de] layouts.

For example, the French layout uses an AZERTY layout,
where the Q and A keys are switched compared to QWERTY.
With the change in place, pressing the physical A key
on a French keyboard, with Control pressed, no longer
selects all text, but instead quits the application,
as the shortcut is interpreted based on the English
layout, which just happens to be first in the list.

Similar issues exist for German layouts, which use
QWERTZ, or more complex layouts such as the Neo layout.

The semantics of prioritizing the order of declared
layouts instead of the active one is inconsistent with
both macOS and Windows, as well as other toolkits on
Linux, including GTK and earlier versions of Qt.

It's also not discoverable by the user that the order
now matters. For example, there is no UX in the Gnome
setting that tells the user to ensure the order matches
their expectations for shortcut handling. And if there
was, this would only apply to Qt apps built with 6.6.0,
creating inconsistent behavior for users.

Worse, the X server is limited to four concurrent keyboard
layouts (groups), so if the user adds more layouts than
that, Gnome will replace the X server's view of layouts
only when switching to a layout beyond the first four.
And in that case, the X server's view of the layouts is
actually starting with the fifth layout declared in the
Gnome preferences. The logic in the reverted patch does
not take this into account, making it confusing for the
user which layout actually takes precedence.

Note that reverting this change does not affect our
fallback logic for layouts that do not produce Latin
symbols for the given key press, such as Greek or Russian.
Those layouts will continue to fall back to a Latin
layout for their QKeyEvent::key().

[ChangeLog][QtGui][X11/Wayland] A change in 6.6.0 that
resulted in keyboard shortcuts not respecting the user's
active layout has been reverted.

Task-number: QTBUG-108761
Change-Id: Iec2897cd1541c0c125cc5b1078d0beec12b501c0
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 9800c63533c6b975d0a19fb4079ac15de07a7363)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-29 15:35:49 +00:00
Joerg Bornemann
ab971d249f QMake: Make 'entrypoint' and 'qt' CONFIG values order-independent
If users have
    CONFIG += qt
in their .pro file then the project won't link if the platform requires
the entrypoint module. This is because qt.prf is loaded before
entrypoint.prf in this situation.

Make the CONFIG values 'entrypoint' and 'qt' independent of their order
by embedding the content of entrypoint.prf into qt.prf.

Pick-to: 6.5
Fixes: QTBUG-117674
Change-Id: I72a3c9be023a73d70454533262544a4211cb6974
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit b289d669a5025c7969ee35f2ee0d4284d173dec5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-29 15:22:40 +00:00
Michael Weghorn
d2a71d0324 a11y: Keep current combobox entry in sync
When changing the selected index in a combo box,
also update the current index in the item view's
selection model right away, and don't delay this
until when the combobox popup gets shown in
QComboBox::showPopup.

This is needed to make sure that the selection
is properly exposed to the accessibility layer.

On the accessibility layer, QAccessibleComboBox,
the a11y implementation for the combobox, exposes
the entries in its list child
(s. QAccessibleComboBox::child) and Orca queries
the selected item when the combobox gets focus,
which didn't return the proper results earlier,
resulting in no or the wrong entry getting
announced.

Extend the existing combobox a11y tests
accordingly.

Pick-to: 6.5
Fixes: QTBUG-117644
Change-Id: Ia26de5eafd229f7686745a2fbe03fc1eb6a713f8
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 5093e517b924074ab6e63658c87237be315a17e6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-29 10:38:32 +00:00
Axel Spoerl
aa152c3e4d QComboBoxPrivateContainer: add missing keyEvent->accept()
Call QEvent::accept() when a key event has been acted on.
This prevents redundant event delivery and consumption.

Task-number: QTBUG-117644
Pick-to: 6.5
Change-Id: I069c61c14890577683894f165fd2585ba05c45ff
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 2b63d0ccf3f99b3a21d02fc4804df0be385e9526)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-29 10:38:32 +00:00
Axel Spoerl
e0038c43b3 QComboBox: Modernise connect statements
Replace string based syntax with PMF.
Use QObjectPrivate::connect.
Rename _q_ functions.
Fix dangling connections in QComboBox d'tor: Completely disconnect
model, instead of only disconnecting QObject::destroyed.

Task-number: QTBUG-117644
Pick-to: 6.5
Change-Id: Ie87ac4881029ed1ef2f5c627f631cc54ccb39706
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit d8e110054876b1cbf186e95bac5561a237ee1c13)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-29 10:38:32 +00:00
Simo Fält
b52ecb886a CI: Fix resolving dependencies with Debian packages
Change-Id: Ia057c34318daff2d63237d523803a4231a621da1
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit ce09de5809fc22ca7e0c8114fbde3577cac668de)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit e20328d84f4e6c0db5d0a93e3f136cc178bee05b)
2023-09-29 10:38:32 +00:00
Edward Welbourne
8f43b0ee5b Deduplicate code in setup of serialization converters
The setup of the input and output converters is fairly complex but was
made harder to read by nearly-duplicating its logic for input and for
output. Break out into a separate function to make clear what parts
differ between the two and what parts don't. In the process, allow the
search for a named converter to continue past a match that doesn't
support the needed direction, on the off chance of a name collision.
Make an error message more articulate in the process.

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: I2a9de8b406c538098076f388fc8a1980b91fe16b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6a7b7272cd6ce6b8264796c25b686bf5376b8aea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-29 10:38:31 +00:00
Edward Welbourne
b4e09800bb Check input and output converters do support the relevant directions
It was previously possible to select an input-only converter for
output or an output-only converter for input. Also add a comment to
explain why failure to probe for the auto output converter isn't an
error, where failure to probe for the auto input converter is.

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: I17dfbbee7d8b5a9629e66d0e1a6a4014b01a7262
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit ccd59b2d4f8f1c4fde3f1498d28c0dc91ba75efd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-29 10:38:31 +00:00
Edward Welbourne
7bd8ab4917 Replace the image to illustrate the Serialization Converter
The old image wasted a log of space, was poorly legible and showed
little more than the cbordump example's illustration shows. Make
explicit that we get an initial CBOR file from savegame, show how it
can be converted to and from XML (idempotently) and still find space
to show the same thing as before. All more legibly and in a smaller
file.

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: Ifc599d0dd646f136ccd2860ca927186d478b0fb9
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
(cherry picked from commit b9787a3985e503a51115da6a7282eb27f1958c64)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-29 10:38:31 +00:00
Edward Welbourne
6d3db093b7 Fix warning on invalid time-zone lookup
Amends commit 569dc0de50a46b64763921199a2706ab34d151a9 to still return
when no zone file is found with the given name, as the code did
before.  Attempting to continue past the error was provoking warnings
from QIODevice::read().

Pick-to: 6.6.0 6.5
Task-number: QTBUG-116017
Change-Id: I0e224a6b30a3f32cd925d87ffba4dcb24f9b8568
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 59bf9160cc285bac1732fd3ade2ac033b2348b28)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-29 10:38:31 +00:00
Rym Bouabid
12e88c1ce3 Revamp Local Fortune Client/Server Ex: Update the QDataStream's ver
... from Qt5.10 to Qt.6.0

Task-number: QTBUG-117036
Pick-to: 6.5
Change-Id: I47983b74d1001fa2e2cd278edda3d78430b97b45
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 294fd9af6d036841c61280156482277ecd8fffe4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-29 02:01:19 +00:00
Alexander Volkov
f63cb046eb Avoid crash when keysymToQtKey(keysym, Qt::ControlModifier) is called
For example when Ctrl+Home is sent by virtual keyboard on Wayland.

Pick-to: 6.5 6.2 5.15
Change-Id: I41f1d2a28c9091efa621d5826a3b9e3e0e481ceb
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit e68a0da0b907af7980481a3cf30f6b4b97c06b6e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-28 17:49:46 +00:00
Kai Köhne
ff180da7ea Doc: Don't mention setDefaultCiphers() (removed in Qt 6.0)
Pick-to: 6.5
Change-Id: I775da7679bf4ff398a22334103c3116befec7da9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 54b5ffb602ab9afda5281f1d6c5c77acc96cd8ed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-28 17:49:46 +00:00
Orkun Tokdemir
5c9e772985 CMake: Update timestamp file for Cross-Config builds
Since https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8564 is
merged, the timestamp file for {target}_json_file.txt should be updated
for `Cross-Config` builds.

The actual error message before this commit when CMake 3.28 is used:
```
ninja: error: 'src/corelib/Core_autogen/timestamp', needed by 'src/corelib/meta_types/Core_json_file_list.txt', missing and no known rule to make it
```

Pick-to: 6.6.0 6.5 6.5.3 6.2
Change-Id: Ib544b18b67d2d4722f3801b1f46a0e0e18e59d48
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 8041bfba47305352627d910930e52da496904c17)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-28 17:49:45 +00:00
Alexey Edelev
47fad9f1e4 Remove framework-related functionality from syncqt
The files generated by syncqt should land not only in module include
directory, but also in framework directory. Before syncqt made two
copies of the generated files one in staging directory and the second
one in module framework directory. This commit moves all logic related
to framework header files to cmake scripts. This is done for both
consistency and simlifying the logic. The whole module .syncqt_staging
directory is copying to the framework library in cmake.

[ChangeLog][Tools][syncqt] '-framework' and '-frameworkIncludeDir'
arguments were removed. The related logic is moved to cmake scripts.

Task-number: QTBUG-116483
Pick-to: 6.5
Change-Id: If79c5470d2ab51eb7fc083bce6fb01858bed76ba
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit bfe62b0224d38a5b214de97e51dd60c9393222f7)
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2023-09-28 16:28:10 +02:00
Volker Hilsheimer
24e57ce6ca QTestPrivate property tests: don't try to create abstract types
Amends 5743837a26fce1962c0480bc7536b4c2d0e69997, after which Qt
Positioning and Qt SCXML failed to build as some properties operate on
abstract classes.

Check whether we can instantiate the tested class before trying to do so,
otherwise return a default-constructed unique_ptr.

Pick-to: 6.5
Change-Id: Ida9d4375197a93438062b1e1473b4a2a22cc7054
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit f791570b86ce4a0da45bb6e617701a48ee8189b7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-28 11:51:44 +00:00
Alexey Edelev
64cfe7a5d0 Resolve symlinks when running headersclean check
In some corner-cases the header files are passed by symlink path
if the source directory is symlink. Make sure that we resolve symlinks
when running headersclean check.

Fixes: QTBUG-117518
Pick-to: 6.5
Change-Id: Ifaffc9186e78fba86037cb50438021466903d210
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6f36ee51678fae136aaa1a6ffa8e154b6e224ced)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-27 18:29:18 +00:00
Liang Qi
718bb11701 QAccessibleComboBox: Cleanup comboBox() calls
Handle comboBox() returning nullptr.
Avoid repeated qobject_cast by calling comboBox() once per function.

Fixes: QTBUG-115161
Pick-to: 6.5 6.2
Change-Id: I3d102cebe807da379fa4d9ee2aee1e72b8fdf004
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit fc556e3571b7e2d7fe307778b17e6cf0ff9e1bfc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-27 17:45:12 +00:00
Alexey Edelev
416081ef4f Use the actual target name as base name for android deployment settings
QtC is unable to find the deployment settigns if target uses custom
OUTPUT_NAME. There is no particular reason for using the target
OUTPUT_NAME property as the base name for android deployment settings.

[ChangeLog][General][Android] The target name is used as a base name of
android deployment settings, but not the OUTPUT_NAME property.

Pick-to: 6.5 6.2
Fixes: QTBUG-117509
Change-Id: I1ac3b0ad305dc55289bef39c6e946bcf684e772f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 9349e463d4d6c58d3fb3e3512e104b07a5082188)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-27 17:45:11 +00:00
Ivan Solovev
e87daa3f32 Extend QTestPrivate property tests - update signatures [1/2]
Testing for the binding loops requires a second instance of the
TestedClass. In general case, we cannot guarantee that the TestedClass
is default-constructible, so we introduce a new parameter - a function
that returns an std::unique_ptr holding the properly-constructed
instance of TestedClass. The default implementation simply creates
a unique_ptr using a default constructor, which is good enough for
most cases. The user needs to provide a custom function when
TestedClass has no default constructor (for now such usecase exists
at least in QtScxml and QtPositioning).

This patch introduces new signatures for the helper functions, but does
not actually provide new implementation.

This is an attempt to simplify the CI integration process.
The new arguments have default values, so the existing code will not
be affected.
The idea is that the merge process goes as follows:
* this patch gets merged into qtbase. It should not break leaf modules,
  because the new parameters have default values -> existing tests are
  unaffected.
* it unblocks all patches to the leaf modules that require the new
  parameter for the test helper functions. These patches are also
  supposed to fix all the problems with the binding loops.
* once these patches are merged, a follow-up patch to qtbase that
  actually extends the test coverage can be merged. As it is supposed
  that all problems in the leaf modules are already fixed, merging
  this patch should not lead to new problems.

The actual implementation of the new tests is provided in a follow-up
patch.

Task-number: QTBUG-116345
Pick-to: 6.5
Change-Id: I0dd5c8c60de01aa960d63673b5d7de97950d9490
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 5743837a26fce1962c0480bc7536b4c2d0e69997)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-27 14:49:31 +00:00
Marc Mutz
cec3d03d11 Un-deprecate qSwap()
It seems to have fallen prey to the mass-deprecation of <QtAlgorithms>
in Qt 5.2. Since it didn't actually duplicate STL functionality, that
was uncalled-for: Unlike std::swap(), it's ADL-enabled, so the docs
were wrong to suggest replacing it with std::swap instead.

In fact, the tony-table that 5957f245c6c77c98d7e90d614c9fe2cdbfe7e8e6
added to qalgorithms.qdoc didn't include qSwap(), yet, qSwap() was
marked as deprecated.

Un-deprecate and expand the discussion to more faithfully represent
its value, without going into the depths of teaching how to swap
correctly in C++ (link to boost.org and cppreference.com for that
instead).

Remove the example that used qSwap() on doubles, which is precisely
_not_ how you should use it.

Amends 5957f245c6c77c98d7e90d614c9fe2cdbfe7e8e6(!).

[ChangeLog][QtCore] Un-deprecated qSwap().

Pick-to: 6.5 6.2 5.15
Change-Id: I4981005ba71b0d1824f2a46897145255fa66a7ea
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit aa19704bbc35d5310b33a9fbe2added77470a836)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-27 11:06:09 +00:00
Ulf Hermann
37fe0b86d2 QProperty: Steal currentCompatProperty while evaluating a different one
currentCompatProperty should point to the compat property that's
currently being evaluated. As soon as we start evaluating a new compat
property, it's invalid by definition. Temporarily disable it then.

Pick-to: 6.5 6.2
Fixes: QTBUG-109465
Change-Id: I7baba9350ebf488370a63a71f0f8dbd7516bf578
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit c4bfd32cca547504ebccfad3da4e73a2b712baea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-27 09:31:52 +00:00
Kai Köhne
c66b3afc5a Move Calendar Widget Example to UI Components category
Pick-to: 6.6.0 6.5
Change-Id: Iafa05fbfde41dbbf7ddffd667983db9cc1c6e184
Reviewed-by: Mats Honkamaa <mats.honkamaa@qt.io>
(cherry picked from commit 9de4133da29460b0f1fd13bc3ecd2483dc5ea04a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-27 09:22:12 +00:00
Rym Bouabid
b09b349dfa Revamp Local Fortune Server Example: Declare sendFortune() as a method
Declare sendFortune() as a method because it's used in the connect()
overload taking a pointer-to-member-function, so it doesn't need help
from moc.

Q_OBJECT is not needed anymore as the "Server" class doesn't contain
signals and slots anymore.
Use Q_DECLARE_TR_FUNCTIONS Macro to allow tr() calls.

Task-number: QTBUG-117064
Pick-to: 6.5
Change-Id: Id197cb4c9f9df2102b769d028d8a0cae91e5c492
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit deec34c2fb496c8f96b76d456d27a2824622f401)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-27 01:07:18 +00:00
Rym Bouabid
2d81291a45 Revamp Local Fortune Server Example: Revisit the documentation
Remove "Example" from the title.
Add \examplecategory {Connectivity}.

Task-number: QTBUG-117064
Pick-to: 6.5
Change-Id: I53c106f3429d5fe31ca7a8e8b821e4c1cafdda64
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 6ca8b61b6b758366d08fab621c0ba0b82929c680)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 23:07:39 +00:00
Andreas Eliasson
de7b2bfa4c Doc: Fix typo in examplecategory command
This resolves
(qdoc) warning: Unknown command '\examplecateogry'

Pick-to: 6.5
Change-Id: I52c417bde49ce52089da485d6144f64d636f5a3b
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit c3171938c3e2426ca3391a7e7f531836e7a08383)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 23:07:35 +00:00
Thiago Macieira
2780fefb27 QNativeSocketEngine: fix build with FreeBSD: sockaddr_dl wasn't declared
This partially reverts fcb548878bfae3db34d482f3ad97074aca76b410.

qnativesocketengine_unix.cpp:872:40: error: unknown type name
'sockaddr_dl'; did you mean 'sockaddr_in'?

Change-Id: Ifeb6206a9fa04424964bfffd178844096ee7741b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit e95467bc6b685deccc0c3c8dfa337317a6b44eb0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 23:07:34 +00:00
Thiago Macieira
01bc132083 QFuture: fix headercheck warning with Clang 17: member shadowing
Pretty sure this is a Clang bug because the promise member that it says
is getting shadowed shouldn't be in scope (`this` isn't being captured).

  qfuture_impl.h:538:60: error: declaration shadows a field of 'Continuation<Function, ResultType, ParentResultType>' [-Werror,-Wshadow]
  qfuture_impl.h:327:26: note: previous declaration is here

Pick-to: 6.5
Change-Id: Ifeb6206a9fa04424964bfffd17883e21cfec6d8e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit bf7732baca43537b11ba8989d7e68fa9a9a6696d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 20:27:42 +00:00
Rym Bouabid
500b747bb9 Revamp Local Fortune Server Example: Fix includes
Fix include order to respect the Coding Conventions.

Add needed includes to avoid Transitive includes.

Remove uneeded classes.

Remove QT_{BEGIN,END}_NAMESPACE because these are private Qt macros that
should not be used in the examples.

Task-number: QTBUG-117064
Pick-to: 6.5
Change-Id: Ie98d4fbddb18d5578e2651bdb4850527ff984582
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit f77c7e1bf54288bd6720e8a41b7ac9a0486c93d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 20:27:42 +00:00
Rym Bouabid
abdab47635 Revamp Local Fortune Client Example: Revisit the documentation
Remove "Example" from the title.
Add \examplecategory {Connectivity}.

Task-number: QTBUG-117036
Pick-to: 6.5
Change-Id: I3103669d1613e9832190b00cbe13f34ca5683ae1
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 7b63372c2f667015a04421b3f9bf6345681429b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 20:27:42 +00:00
Rym Bouabid
bd1d39c8c6 Revamp Subscription example: Cretae QString using a Literal operator
Create QString at compile time using the literal operator""s instead of
using pointer to characters. This way, no conversion or allocation will
occur at runtime.

Task-number: QTBUG-117425
Pick-to: 6.5
Change-Id: I2a19d4fe1150aad7908d0c2a7215099bc0814e8d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit ba98644180bcaf40341a9005abe93575cf45cc5a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 20:27:42 +00:00
Rym Bouabid
cb8392742e Revamp Subscription example: Fix includes
Add needed includes and remove uneeded includes.

Task-number: QTBUG-117425
Pick-to: 6.5
Change-Id: Iec4cc7a862aa164742e502f33447fa939dfb53ae
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 9ed067e719346f91a2f4a0e50efefe333e00d5af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 20:27:41 +00:00
Rym Bouabid
2b5c7b2e25 Revamp MIME Type Browser Ex: Fix includes
Fix include order to respect the Coding Conventions.

Remove QT_{BEGIN,END}_NAMESPACE because these are private Qt macros that
should not be used in the examples.

Task-number: QTBUG-117146
Pick-to: 6.5
Change-Id: Iba7a4726180ec97d9654ed3b934baca8c1df0b5c
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 00d8d566c65209130cce2c2cb710bebc4beaf438)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 20:27:41 +00:00
Rym Bouabid
77f336ab7f Revamp MIME Type Browser Ex: Revisit documentation
Remove "Example" from the title.
Add \examplecategory {Data Processing & I/O}.

Task-number: QTBUG-117146
Pick-to: 6.5
Change-Id: I6004f6708299886d6423325a551a9fd03a4a57df
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit a0bd124a5698e65324dbf05ae291f2b4f70d66e5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 20:27:41 +00:00
Wladimir Leuschner
b77a6e6884 Ensure stable sort in QListWidget
QlistWidgets with sorting enabled do not sort stable. A re-sort is
triggered when any Qt::ItemDataRole is changed and not only when
Qt::DisplayRole is changed. Due to an unstable optimization, the changed
element gets inserted at the beginning of their respective "equivalence
group".

This patch disables the optimization and ensures stable sorting
with std::stable_sort. Sorting is only performed, if the subset of
changed items in the range [begin, end] is not already sorted in the
whole list. For this purpose, it is assumed that the list has already been sorted before begin and after end. This assumption minimizes the subset to check.

Limits / side effect:
The patch focuses on the most common use case, which is a single item being changed. Replacing the optimization by std:stable_sort can potentially slow down the sorting performance of large data sets.

Task-number: QTBUG-113123
Pick-to: 6.5
Change-Id: Ib2bd08f21422eb7d6aeff7cdd6a91be7114ebcba
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit cf6bccbcf50340c75dfcc13117137b173a5c00be)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 20:27:41 +00:00
Mårten Nordheim
78ee38f10f QNetworkInfo[glib]: Fix implicit QString creation
Change-Id: I906f80be9a6b902af2cb417ef2162f0c76ddbe5f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit af195c4463d0cb46733189a2a9124dc2a80ec54a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 16:37:36 +00:00
Øystein Heskestad
a92db9d5fa Fix renamed and duplicated namespaces in QXmlStreamWriter
The XML stream writer previously added namespace declarations with the
same URL as existing ones, but new names, and renamed the XML elements
to use the new namespaces instead of the existing ones.

[ChangeLog] Fix renamed and duplicated namespaces in QXmlStreamWriter.

Pick-to: 6.5
Fixes: QTBUG-75456
Change-Id: I90706e067ac9991e9e6cd79ccb2373e4c6210b7b
Done-With: Philip Allgaier <philip.allgaier@bpcompass.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 13f673939d9dadbcc398aefa4c1449a8a21d2308)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 16:37:36 +00:00
Rym Bouabid
c1f74f051b Revamp MIME Type Browser Ex: Fix too long lines
Fix code lines that do not respect the 100 characters limit rule.

Task-number: QTBUG-117146
Pick-to: 6.5
Change-Id: I9833e9a25a09833b3e0384c95af8a422d5aa4582
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 81857ad5c3587de8ca3a622f8286fff2504ea333)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 16:37:35 +00:00
Laszlo Agocs
5508073cba rhi: vulkan: Print vma statistics on out of device memory
Following a vmaCreate* it makes sense to test for
VK_ERROR_OUT_OF_DEVICE_MEMORY and print the allocator statistics
in order to give an idea of the application's (video) memory
usage.

For instance when running on a Raspberry Pi 4, this helps to indicate
that the application is just too big for the device, and is more
informative then just a Failed to create image: -2 message.

Pick-to: 6.5
Change-Id: I666e2358303894efab9d12d2b3a3d98f0bd3a5b6
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
(cherry picked from commit 9f6a2e357b55998e7022fe9640a9acff26d7c64e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 16:37:35 +00:00
Wladimir Leuschner
443a9fa2bd Use correct parameters to query highcontrastmode on Windows
Task-number: QTBUG-113645
Change-Id: Ib400253a5589345648025c22c1487598cbefbd23
Pick-to: 6.5
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit e5c136c1797ca9a5f4763bfe30c570f6c4faf64f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 16:37:35 +00:00
Laszlo Agocs
78d7004755 vulkan: Do not set the portability bit with old SDKs
Because it's a validation error with old ones, but required
in some cases from 1.3.216 on (MoltenVK). Ridiculous.

Amends 7fbc741d107ab679f6abd680ec909ce9b2bf333a and
b018bc6e2d27b95024ee8f1b8c719199df47c264.

Fixes: QTBUG-117412
Pick-to: 6.5
Change-Id: I9b4cacbe611d4e557ee1c156527142eb919d6b77
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit 8a5a5f6c9773dc41b4c8685bc1c6bd34ce49a320)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 16:37:35 +00:00
Laszlo Agocs
730959d6ce kms: Print the screen virtual position in the logs
It is impossible to see otherwise what is going on.
What's worse, it prints the screen geometry (that does not
include the virtual desktop adjustment), which is incredibly
confusing.

Change-Id: Ie67a4d8110a0b5c9cb75e6290f06c857a980d2c8
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit 9cad3fcc971f50ad7e53a7be3746d751639976b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 16:37:35 +00:00
Laszlo Agocs
0d7f2dfa1c vkkhrdisplay: Fix output selection
While this platform plugin does not have full multi-screen support,
it at least has the ability to choose the one to use via env.vars.

This currently does not work. What's more, it looks like it chooses
the last display by default, instead of the first.

Fix the display/display-mode logic. This now allows QT_VK_DISPLAY_INDEX
to work correctly, for example on a RPi4 with two screens connected.

Fixes: QTBUG-117416
Change-Id: Ia5ac8fde5827b3a2e1945e8e4f04fb8dd90704e2
Pick-to: 6.5
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
(cherry picked from commit 66be69139ce15be5df800e93a4702891fa8d6fb3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 16:37:35 +00:00
Joerg Bornemann
a2098df701 CMake: Store info about the debug build in QtDeploySupport.cmake
Application deployment must know whether the Qt installation is a
debug_and_release build - or more generally, a multi-config build with a
debug configuration. Store the following information in
QtDeploySupport.cmake that's read at installation time:
- whether Qt was built multi-config with a debug configuration
- the postfix for debug libraries

Task-number: QTBUG-109444
Pick-to: 6.5
Change-Id: I96a2120ba1a2b03125661cc829498653e37dfb0f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 266c2d23ae01ab452b7396df5a1d06dacb3149d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 11:45:55 +00:00
Doris Verria
1d3c5fad6a QAbstractItemDelegate: Update spinbox editor value before committing
QAbstractItemView installs the delegate as an event filter on the
editor, so the delegate will get the focusOut event (and other
events) before the editor does. QAbstractItemDelegate will then
emit commitData, signaling that the "updated" data should be
written back to the model.
In the case where the editor of a delegate (QAbstractItemDelegate)
is a QSpinBox with keyboardTracking set to false, the value of
the spinbox won't be updated while typing, but only when the
spinbox's text edit focus is lost. In this case, the delegate's
commitData will be emitted before the spinbox has had a chance
to update the value in its handling of the focusOut event.
To fix, make sure to update the value before the data is
committed to the model in the delegate's tryFixup method.

Fixes: QTBUG-116926
Pick-to: 6.5
Change-Id: I68540964342407d23387e4404a0fe3f00d80eb5f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit faae3dc6b15e3d8754b15a7cfb22b6a797fd2e36)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 11:45:55 +00:00
Tasuku Suzuki
895e6dc4de QSignalMapper: Fix compile error in snippets
Change-Id: I676cf8e120aedddc2565d2b08dae3f5ec612c1ec
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 4abd6172f5e2660deab8bfda2fa77a78741e0b1c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 11:45:55 +00:00
Rym Bouabid
d70e7cf27a Revamp Bindable Subscription ex: Fix includes
Reorder the includes following the coding conventions.

Remove unneeded includes.

Add needed includes to avoid Transitive includes.

Task-number: QTBUG-117422
Pick-to: 6.5
Change-Id: Iaf2b939bc160312de8aa4035da03b648cf76f17d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit a69be76a303ad99d16355f5edd5fbbec1b10106c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-26 11:45:55 +00:00
Simo Fält
9018d187ae CI: Enable changing chroot in platform config for Debian packaging
Allows us to change the target distro through platform configuration
yaml file.

Task-number: QTBUG-117120
Change-Id: Ie6e99e4b25198e27491e6191f57d77dbbe3c4eed
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit 798175930e517e28230e3db3213510a22a041620)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit f07efb48194925fcf598a2f8ff46cafa8eec1284)
2023-09-26 07:43:05 +00:00
Paul Wicking
7d3c51f154 Doc: Fix typo
Pick-to: 6.5
Fixes: QTBUG-117482
Change-Id: I033b5bda78482a7b43fac365d5a781bc3fa27fad
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit e2bdf3a535f92324ed79ba2ef9fb8883b036f95d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-25 22:05:21 +00:00
Liang Qi
42b199f122 xcb: replace a warning with debug info
Pick-to: 6.5 6.2 5.15
Change-Id: I850297ad34edaf5dd66f56f549325745f2f5a07f
Reviewed-by: Keith Kyzivat <keith.kyzivat@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 58215288f40f08aa49cf9c157588498a39b5afdb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-25 22:05:21 +00:00
Giuseppe D'Angelo
6bce1ddecd QWeakPointer: fix the converting constructor from rvalues
When constructing a QWeakPointer<T> from a rvalue QWeakPointer<X>,
even if X* is convertible to T*, actually doing the conversion
requires access to the pointee's vtable in case of virtual inheritance.

For instance:

  class Base { virtual ~Base(); };
  class Derived : public virtual Base {};

Now given a `Derived *ptr`, then a conversion of `ptr` to `Base *` is
implicit (it's a public base), but the compiler needs to dereference
`ptr` to find out where the Base sub-object is.

This access to the pointee requires protection, because by the time we
attempt the cast the pointee may have already been destroyed, or it's
being destroyed by another thread. Do that by going through a shared
pointer. (This matches the existing code for the converting assignment.)

This requires changing the private assign() method, used by QPointer, to
avoid going through a converting move assignment/construction, because
one can't upgrade a QWeakPointer tracking a QObject to a QSharedPointer.
Given it's the caller's responsibility to guard the lifetime of the
pointee passed into assign(), I can simply build a QWeakPointer<T> and
use ordinary (i.e. non-converting) move assignment instead.

Change-Id: I7743b334d479de7cefa6999395a33df06814c8f1
Pick-to: 6.5
Fixes: QTBUG-117483
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 89b6ad3ab5f40a6538105d2fbe52faf9d49c48bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-25 19:50:18 +00:00
Ilya Fedin
baec3249f1 QNI: glib support for the isMetered API
Task-number: QTBUG-91024
Change-Id: Ieb46b87dde58a65a108f215c9c30695c02a51982
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 7a8b403bd3568b04779cb1495a40dffe4fba945d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-25 19:49:53 +00:00
Christian Ehrlicher
0af27bf836 ItemViews/css: Honor size for sort indicator only when there is one
When using css the size for the sort indicator is not honored correctly
and therefore the header view text overlaps the sort inidcator.
This patch reduces the available with for the text when (and only when)
there is a sort indicator shown), also for the size hint.

Fixes: QTBUG-115486
Pick-to: 6.5
Change-Id: Ic865bceaf98cd303490d821ecfb033abb8d6ba2a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 230ff021a14816519b175d02d3400541ddd2abad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-25 18:34:57 +00:00
Nicolas Fella
770d4ad14f QDBusConnection: Print error from prepareHook
When the operation fails we print a warning, but that warning does not
include the error message that prepareHook internally collects but
ignores.

Printing the error is useful for debugging.

Change-Id: I946c4781942115a17ffd43a79bff7676b6674be1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b2e5f7049047f6311b96506621ac75ec2fcb0c2e)
2023-09-25 17:21:55 +02:00
Thiago Macieira
f4bcf9f5af tst_QFile::moveToTrash: include the test name in the tempfile templates
Makes it easier to locate later which test may be leaking stuff.

Change-Id: I9d43e5b91eb142d6945cfffd178713f869752761
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 610b26b819c7963dfeebf3e073562a51554acc9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-25 15:14:50 +00:00
Thiago Macieira
f7bead1dd6 Q{Temporary,}File: make QStandardPaths use test mode
The moveToTrash tests, on XDG platforms, would be trashing to
~/.local/share/Trash. Unlike Windows and Apple systems, the XDG trash
spec creates two files and these tests weren't deleting both of them, so
we had a slow increase of left-over files in ~/.local/share/Trash/info.

Cleaning up ~/.qttest is left as an exercise for the users. For example,

 $ cat ~/.config/user-tmpfiles.d/qttest.conf
 #Type Path                            Mode User Group Age         Argument
 e     %h/.qttest                      0700 -    -     1w

Pick-to: 6.5 6.2
Change-Id: I9d43e5b91eb142d6945cfffd1786aeff91d34fde
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 772ad60425866d895cbd76cfb478893ec8496505)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-25 15:14:45 +00:00
Thiago Macieira
0c6e7378ac moveToTrash/Unix: use lstat() to confirm $root/.Trash is suitable
We can't use QFileSystemEngine::fillMetaData() because there's no bit in
QFileSystemMetaData to indicate the sticky flag, so we must make a at
least one stat() or lstat() call ourselves. Given that we need to know
if $root/.Trash is a symlink, that system call must be lstat(). And it
turns out that system call provides everything we need to confirm its
suitability.

This avoids QDir overhead just to manipulate strings.

Change-Id: I9d43e5b91eb142d6945cfffd1786c5e54199ecb2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 36a169e31e86fadde41c61804ce437164977f60a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-25 15:14:34 +00:00
Thiago Macieira
2fb2b238de moveToTrash/Unix: remove unnecessary targetPath variable
It was used twice, in both cases to create a QFileSystemEntry, so the
two results were equal. Therefore, just use the first result to create
the second.

Change-Id: I9d43e5b91eb142d6945cfffd1786d45d20485f40
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3d027f8d959879d0c0525fedd03907a607ea32ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-25 15:14:27 +00:00
Laszlo Agocs
81b6eb264d Sync rhi backingstore d3d12 behavior with Quick
When adding the D3D12 code path in widgets it seems it was ignored that
the retry-with-WARP logic was present both for D3D11 and 12 in Qt Quick.

For consistency, the same logic must be used. Right now widgets only has
the retry logic for D3D11.

Change-Id: I08d5728acfb9a68db7e0a4b0477050f08546ffac
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit 54816a8f9af706d9a14cd2501fcaf74962bbdbd8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-25 11:24:38 +00:00
Volker Hilsheimer
a20cf52e09 QFile::moveToTrash: fix error reporting on Windows
If a move-to-trash operation failed, e.g. because the file was opened by
another process (or QFile), then the moveToTrash function would still
return true.

MSDN documents the IFileOperation::PerformOperations to return whether
the operation succeeded, but evidently this is only a statement about
the execution of queued up operations, not a statement about any of the
operations' success.

If the operation succeeded is reported by an HRESULT parameter
of the IFileOperationProgressSink::PostDeleteItem implementation,
and we ignored that parameter so far.

Check it via the SUCCEEDED macro, and set a boolean sink variable based
on that, which we can inspect to return the correct value.

Augment the test case by opening those files we create ourselves, and
if that fails (which it will on Windows, but not necessarily on other
platforms), then try again after closing the file. If the first attempt
succeeded, then the source file must also be gone.

Pick-to: 6.5 6.2 5.15
Fixes: QTBUG-117383
Done-With: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: Icb82a0c9d3b337585dded622d6656e07dee33d84
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 6ca2008d6e1e02e85f39faab28d5c8a0c0dad082)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-24 23:40:30 +00:00
Thiago Macieira
290a9ec13c moveToTrash/Unix: rename 'infoPath' variable to 'pathForInfo'
We have other variables whose name start with 'info' in this function,
so infoPath is misleading: it's not the path to infoFile and it isn't
related to the infoFileName. Instead, it's the path to the file being
trashed which will be saved in the info file.

Change-Id: I9d43e5b91eb142d6945cfffd1786d358a0e02dfd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6434b6ea486bbb959a15d83322b6869d8f29b9bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-24 21:13:34 +00:00
Thiago Macieira
f3e34e9466 moveToTrash/Unix: avoid mkdir/chmod race condition for the trash dir
QDir::mkdir() followed by QFile::setPermissions() is a race condition
because an attacker could enter the directory before we set the
permissions. QDir::mkdir() got an overload with the permissions in 6.3,
but I decided to go a level lower and use QFileSystemEngine directly
here.

Pick-to: 6.5
Change-Id: I9d43e5b91eb142d6945cfffd1786c338e21c129e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a71f5568304fa2c9d596d52374c7e69ac98f8ad7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-24 06:44:31 +00:00
Thiago Macieira
8273557bd3 moveToTrash/Unix: use Qt::ISODate to format the current date
Instead of forcing QDateTime to parse our pattern.

Change-Id: I9d43e5b91eb142d6945cfffd1786d094a123826a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6e4d9ff74d518d81842936be1c905b71b67e1352)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-24 06:44:29 +00:00
Tor Arne Vestbø
43fd66f144 Remove remnants of Qt for Native Client (NACL)
The project has been superseded by Qt for WebAssembly and was
never supported in Qt 6.

Pick-to: 6.5
Change-Id: I36682cfe3ce6adac76a307b0faba97dcb7c655cc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 201045a1fd0bee3a05b6ced34a912d07fe09eb59)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-23 22:26:19 +00:00
Giuseppe D'Angelo
11aa3b13b3 QPointer: also provide a converting assignment operator
d026fad3d962eed0119351cd37f34490e09153fd added converting constructors
for QPointer. This however made converting _assignments_ ambiguous,
introducing a regression for users coming from Qt < 6.6.

This code:

  QPointer<Base> base;
  QPointer<Derived> derived;
  base = derived;

used to convert `derived` to `Derived *` (using the implicit conversion
operator from `QPointer<Derived>` to `Derived *`), and then the
assignment operator for `QPointer<Base>` that took a `Base *`.

The introduction of the conversion constructor in 6.6 makes it possible
to convert `QPointer<Derived>` to `QPointer<Base>`, and then fall back
to the compiler-generated assignment operator for `QPointer<Base>`.

The result is that the code above is now ambiguous and stops compiling.

Fix this by adding a converting assignment operator for QPointer.
I'm only adding the const-lvalue overload because the implementation
requires going through the private QWeakPointer::assign helper. We
cannot copy-assign or move-assign the inner QWeakPointer, as those
assignments require lock()ing the QWeakPointer and that's not possible
on a QObject-tracking QWeakPointer (but cf. QTBUG-117483).

Assigning from a rvalue QPointer would mean calling assign() on
the internal QWeakPointer _and_ clear the incoming QPointer,
and that's strictly worse than the lvalue overload (where we just call
assign()).

Change-Id: I33fb2a22b3d5110284d78e3d7c6cc79a5b73b67b
Pick-to: 6.6.0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6c504f2519e1180dbcfd77d5bb08b0db9742eeaa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-23 22:10:20 +00:00
Ahmad Samir
411a213f65 QItemSelectionModel: remove some redundant code
QObject::disconnect(connection) already sets connection.d_ptr to
nullptr, and the default constructor only does that:
QMetaObject::Connection::Connection() : d_ptr(nullptr) {}

So calling disconnect() suffices in this case.

Pick-to: 6.5 6.2
Change-Id: Icd5f9a15c83939eeecd9efb474ac3b38c0f2dfe4
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 3bac47336483d720c1d7376ea053c03a4e80173c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-23 20:52:39 +00:00
Andreas Holzammer
8da777fa6a eglfs: Extend GBM surface creation probing
Some graphics drivers do only create a surface with the help of
gbm_surface_create_with_modifiers and others do require to use
gbm_surface_create. So it is needed to probe these.

Change-Id: I9ea657f12f2ea23ec426a378cfd67e297cb2d310
Pick-to: 6.5
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 86eb1f4413e96e1731e8feeba7f51b5842759784)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-23 05:22:30 +00:00
Tor Arne Vestbø
d48f08edb6 Avoid extending dirty region in beginPaint
When the raster window is resized, we need to resize the backingstore,
and make sure we repaint the entire window. We defer the backingstore
resize to beginPaint, in case multiple resize events come in before
we have a chance to paint, but we can't defer the invalidation of the
paint device window, because QPaintDeviceWindowPrivate::paint() has
already subtracted the paint region from its dirty region at this
point. Invalidating yet again will result in the dirty region of
window not clearing fully until after the final resize, and when
that happens we will also repaint the window with the wrong dirty
region, based on the window's original size.

My moving the window invalidation to the resize event, while keeping
the deferred backingstore resize we avoid this problem.

Pick-to: 6.5
Change-Id: I44662778f5b1bcd259b20ca86124e6487561ef4f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit e0eb2818face4ffb7dafd87464f355d4654b7be0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-23 00:43:58 +00:00
Volker Hilsheimer
99720e3b2b Silence compiler warning
Don't get a QModelIndex out of a temporary QPersistentModelIndex.

Change-Id: Ida9e25f1a17130e19b75221e1189e6f2fccd3f27
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit c4a8c2b0d039f34b26ddd70c7e66022a037a10c4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-22 21:49:04 +00:00
Tor Arne Vestbø
c31a907028 macOS: Reset NSApp main menu temporarily when re-using top level menu
AppKit's built in logic for customizing menu entries, such as adding
text input (emoji, dictation) entries to the Edit menu, happens via
[NSApplication _customizeMainMenu], which is triggered either from
[NSApplication finishedLaunching], or [NSApplication setMainMenu:],
but in the latter case, only if the menu is different.

In our case, we might be re-using the same menu as before, but the
menu now has additional sub menus such as an Edit menu. In that case
we still want AppKit to do its magic, so we need to reset the main
menu temporarily to nil so that AppKit sees the menu as a "new" menu.

Pick-to: 6.6.0 6.5
Fixes: QTBUG-116903
Change-Id: Ibd9da72fb81b7cd1d707bd350a62d0c93356dbd4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5994e94fd1325d1741b2f987172b6b42a790a9fb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-22 19:42:59 +00:00
Tor Arne Vestbø
269903a5db qmake: Don't error out if QMAKE_DEFAULT_LIBDIRS is empty on macOS
The new linker in Xcode 15 doesn't provide any default linker or
framework paths when requested via -v, but still seems to use the
default paths documented in the ld man page.

We trust that linker will do the right thing, even if we don't
know of its default linker paths.

We also need to opt out of the default fallback logic to
set the libdirs to /lib and /usr/lib.

This may result in UnixMakefileGenerator::findLibraries finding
different libraries than expected, if additional paths are
passed with -L, which will then take precedence for qmake,
even if the linker itself will use the library from the
SDK's default paths. This should hopefully not be an issue
in practice, as we don't turn -lFoo into absolute paths in
qmake, so the only risk is that we're picking up the wrong
prl files and adding additional dependencies that the lib
in the SDK doesn't have.

Pick-to: 6.6.0
Change-Id: I2347b26e2df0828471373b0e15b8c9089274c65d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit cdf64b0e47115cc473e1afd1472b4b09e130b2a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-22 19:42:55 +00:00
Tor Arne Vestbø
1c1cbc3b22 xcb: Work around GCC ABI issue causing warning on ARM
In member function ‘virtual QDpi QXcbScreen::logicalBaseDpi() const’:
 qxcbscreen.h:139:42: note: parameter passing for argument of type
 ‘std::pair<double, double>’ when C++17 is enabled changed to match C++14 in GCC 10.1
     QDpi logicalBaseDpi() const override { return QDpi(96, 96); }

It's not possible to silence this warning/note using pragmas.

Pick-to: 6.5 6.2
Change-Id: I913a1753ce0c82ac17951faa58b0a88bf1daa4db
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit a0792da1266fc6070fa3fb54171884c2fb6d4122)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-22 19:42:52 +00:00
Kai Köhne
3e797f074e Doc: Fix location of QT_REQUIRE_VERSION documentation
<QMessageBox> is not a (separately documented) header. QDoc
therefore puts the documentation on a separate proxy page:

https://doc.qt.io/qt-6/qmessagebox-proxy.html

Fix this by actually linking to the type.

This amends  95a3f85a2f, which moved the macro from
QtGlobal to QMessageBox.

Pick-to: 6.5
Change-Id: Ia2ed3d9fd786732c85d731634ff79afefe42333b
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit ec32748b1e98b05d8dda23f8de2c6735f6a1140b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-22 10:32:04 +00:00
Kai Köhne
f5056133a3 Make examples/bindableproperties a proper project
Both executables (subscription, bindablesubscription) are documented
as one project. Make sure that e.g. Qt Creator can also load this
project.

Fixes: QTBUG-117109
Pick-to: 6.6.0 6.5
Change-Id: I3912f2f76379940b02f3a57a7a55440a30366755
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f2ec221bd62b8722915db9fc7dc3eb78991f6e6d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-22 10:32:04 +00:00
Volker Hilsheimer
eb1a6263ce QDockWidget: ignore close event if DockWidgetClosable is not set
[ChangeLog][QtWidgets][QDockWidget] A floating dockwidget that doesn't
have the DockWidgetClosable feature flag set can no longer be closed by
a call to QWidget::close or a corresponding keyboard shortcut (such as
Alt+F4).

Fixes: QTBUG-116752
Pick-to: 6.5
Change-Id: I7859a2eed11f0e4ee013f7f56611e282e9bcae9a
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 6c90aa029bb65dc5357ac7a26738e711c97732a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-22 10:32:03 +00:00
Rym Bouabid
0098309003 Revamp Local Fortune Client Example: Create QString instead of char *
Create QString at compile time using the literal operator""s instead of
using pointer to characters. This way, no conversion or allocation will
occur at runtime.

Task-number: QTBUG-117036
Pick-to: 6.5
Change-Id: I9942ef8efa38de9ac5975799249a65fcb4c966c9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit badb0818f5116e19de9bdb6f6b2e0c3e0fa7da99)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-22 10:32:03 +00:00
Volker Hilsheimer
0f9b8e1641 Doc: fix name of return argument in prototype
The documentation refers to it as \a ret, so call it ret rather than
just r.

Pick-to: 6.5
Fixes: QTBUG-116890
Change-Id: I12d8c3cfd33d5718d88794ca87bff996a27423ee
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit fca11e0112682d6049f0699e7d2a036bbec93411)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-22 12:32:03 +02:00
Rami Potinkara
42df73235f Update mobile example categories for Qt 6.6
Add mobile example category tags for the chosen examples.
Add for the ones that work best for both, Android and iOS.
Remove from the ones that do not work for both (at least yet).

Added
- hellogles3
Removed
- qtandroidnotifier (not iOS)

Fixes: QTBUG-116780
Change-Id: Icb4c7ba1f22d4e67089a565071d83cdf8ec95896
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit bbf0022d99b223239c7ce7769af9f58c01fc5c68)
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2023-09-22 06:10:46 +00:00
Volker Hilsheimer
ae8e356c51 QItemSelectionModel: don't warn when destroying the model
Amends 4f4a8e75ab34003a4a49b89392ae7712415ac788, after which
QItemSelectionModel printed a warning when destroying the model.
We reset the selection model in response to the model getting destroyed,
and since the model is already set to be nullptr at this point the
select() function complains about changing the selection with no model
set being a no-op.

Fix this by not calling reset() when the model gets destroyed - the
stored selection and currentIndex are already reset at this point -
and instead only call reset() when a new model is set in initModel.

Fixes: QTBUG-117200
Pick-to: 6.6.0 6.5 6.2
Change-Id: I12fc6b3fb2f2ff2a34b46988d5f58151123f9976
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit dc126de22ea4d38736ae57c08c0b271f3c53fad9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-22 06:10:46 +00:00
Thiago Macieira
271d38b0ef IPC: Move the legacy key to the QNativeIpcKey
This is needed to support passing it to other processes so they can
enable legacy, compatibility mode. Right now, there's no such code, but
I am 90% certain we'll need it soon in 6.6.x, if not for compatibility
changes in the future.

There's a bug in passing a QNativeIpcKey to another process that causes
QSharedMemory to use the wrong QSystemSemaphore for control (a feature
that should never have existed in the first place, but we're 15 years
too late on that). I have not yet investigated a fix for this, but it
will likely involve knowing the original legacy key.

Pick-to: 6.6.0
Change-Id: Idd5e1bb52be047d7b4fffffd1750b547013cb336
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9edb835904a7fa856e482464a7258019d5766333)
2023-09-22 08:10:42 +02:00
Marc Mutz
cc86ff5b3d qswap.h: use a more robust include guard
Just "QSWAP_H" is a bit meager to be unique. We don't really have a
monopoly on q-prefixed function and header names, there's the C std
function qsort(), e.g...

So use a somewhat more unique name as header guard.

Pick-to: 6.5
Change-Id: I554fa224afcb6858b752e8044ef3c03dfc69c084
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 0bd3e28b17d076da4816fbbfd65d7c8df0a9e37b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-21 20:05:27 +00:00
Marc Mutz
c1851914c4 qswap.h: include what you need
The qSwap() function needs std::swap, so include <utility> manually
instead of relying on transitive includes.

Pick-to: 6.5
Change-Id: If1331e1eabb55542eac7477522a8e906efb5379f
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 9d70118c661cb370c9e8b68ad24b804fc7d69a8f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-21 20:05:24 +00:00
Marc Mutz
7e32fc0725 qswap.h: remove stale comment
It's now documented in qswap.qdoc.

Amends 9c706e25673ccbe9d154720ea3e659b27edea80d.

Pick-to: 6.5
Change-Id: If6138df419dee165e9f1de4c0a0d68af1dcfaa42
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 88a109bede58bf8fd6da406824bdcc4153413e85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-21 20:05:18 +00:00
Kai Köhne
fe2ceb6078 Doc: Improve documentation for QMetaEnum::metaType()
Rephrase hard-to-read sentence.

Replace 'integral type;  with 'numeric type', as this seems
to be the terminology in the standard:

  The type-specifier-seq of an enum-base shall name an integral type

Finally, no need to use \sa for a method that is mentioned right before.

Change-Id: I543041e78cc09ccd58182db454880941592c74ae
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit 5bfac5358a9bde151491443fbc75c913b7ada9fd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-21 19:29:34 +00:00
Alexandru Croitor
b4ec9f1730 Fix reported QtCore copyright year
Pick-to: 6.5 6.2
Fixes: QTBUG-101162
Change-Id: I09df1e19d353ab93fb0042b2fa9a68c89d8a5399
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit db17465d37b09c4240b454267591bcdae4b0cd02)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-21 17:28:56 +00:00
Nicholas Bennett
67a4f257b8 Docs: Update Links to Android Notifier Example
Added to the list of important links on the Android Platform home page.

Task-number: QTBUG-116780
Pick-to: 6.6.0 6.5 6.2
Change-Id: Id65a73d56bff0b288ebb1da098f6dbd8cbbe606e
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit e7847a3258aa4eb6fc51c97a2ac05f57a1eadb53)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-21 17:28:53 +00:00
Alexandru Croitor
f3ce3ca241 CMake: Add a config.redo script similar to qt5's config.status
The config.redo script can be executed to reconfigure a pre-existing
qt build dir with the configure options that were last passed to the
build.

It just calls the original configure script with the -redo option.

It's nicer than calling configure + -redo manually because you don't
need to write out the full source path for configure.

In qt 5 times this script was called config.status.

On windows the script is called config.redo.bat.

Rename the config.redo file that QtWriteArgsFile.cmake writes to
to config.redo.last, so it doesn't conflict with the name of new
config.redo script.

Amends 5c40cb0f1a8fad03edb3ef0f97df15e9dd643bdf

Pick-to: 6.5
Change-Id: Id47c56a24561410aec6fbaa79b13fc8a78d12ed0
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 8ffb6ce64cb0183bf6805497b398463549c1ed8d)
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-09-21 14:43:23 +02:00
Marc Mutz
be0679e70a tst_QStringBuilder: update the warning re:includes in stringbuilder.cpp
Not only are we subject to Q and P defines, we're also included in the
unnamed namespace now.

Amends df030e06a81cf636aa766053af979ae79c2ab69d.

Change-Id: Ie2f4c9f45d9845d8a26140e0e1214e87b615ff02
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 10d915277ee2cbf8d5c5fbc5ea6d92f5d9d92791)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-21 07:36:09 +00:00
Marc Mutz
99aa3d5ad1 Update public suffix list
Version 1a4824549b093abc3077205ae5386ed57f73806d, fetched on
2023-09-20.

Pick-to: 6.6.0 6.5 6.5.3 6.2 5.15
Fixes: QTBUG-117138
Change-Id: If288d7fce714384a0132261303de31ad2299c239
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit dee68587d5fd3feb99a04ad700f2cd065cf72797)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-20 22:33:38 +00:00
Volker Hilsheimer
345d3efe3f JNI: fix isObjectType trait function
Java arrays are always objects, also if they don't contain objects.

Change-Id: I376c9cc39445d7d9aaac093e4cd6995c8322ed0d
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Zoltan Gera <zoltan.gera@qt.io>
(cherry picked from commit d2f950e88f6f3966e5593e06f307959d12c19ec8)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-21 00:33:38 +02:00
Allan Sandfeld Jensen
224d4ad279 Switch QRgbaFloat api to hardcoded float parameter and return values
This makes it source compatible with Qt 6.5 by allowing us to change
FastType to something other than float, which we have done for Qt 6.6 on
systems with AVX float16 instructions.

Pick-to: 6.6.0
Change-Id: I7ebf0c178ba0ff7f04f6788d182a1a000fe31c0c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit baac34de6fcbdcc6ee5eb06c3db16c7eda32f121)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-20 19:20:24 +00:00
Rym Bouabid
49eb2d1d8e Revamp Local Fortune Client Example: Fix include order
Fix include order to respect the Coding Conventions.

Include individual headers instead of "generic" headers.

Remove QT_{BEGIN,END}_NAMESPACE because these are private Qt macros that
should not be used in the examples.

Task-number: QTBUG-117036
Pick-to: 6.5
Change-Id: I33f9c54098824bfcfacac7c2f624554e105a291a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit b83736be05e8ba4bcc586ff276ce81f992e0ef76)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-20 18:36:44 +00:00
Marc Mutz
183f179fd0 moc: make qHash(SubArray) accept a seed
This prevents the use of the one-arg-to-two-arg adapter template which
we'd remove rather sooner than later, because it's causing all sorts of
problems, but probably can't, until Qt 7.

Task-number: QTBUG-116074
Change-Id: I5907da0dc8c01b636d16dcc01e9c808ab9a85081
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 5c8910adfd613382e97c5517e85e9088a2abbe3e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-20 18:36:42 +00:00
Eskil Abrahamsen Blomfeldt
5a6d960018 Upgrade Harfbuzz to version 8.2.0
Task-number: QTBUG-117136
Pick-to: 6.6.0 6.5 6.5.3 6.2 5.15
Change-Id: I910c8bff2fe521aa02929b9000fa7f38192d1a51
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 08134e458d7fdd0b9565976046821b3903166dd6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-20 18:00:24 +00:00
Bartlomiej Moskal
e2752e4274 Android: Handle ImhNoTextHandles flag from InputMethodHints
[0]Qt::InputMethodHints has a flag ImhNoTextHandles that was not
handled. This flag should be considered when QAndroidInputContext is
updating Text handles position.
What is more, this flag can be used to fix the problem with visible
text cursor out of the text object.

[0]https://doc.qt.io/qt-6/qt.html#InputMethodHint-enum

Task-number: QTBUG-115005
Pick-to: 6.5
Change-Id: Ie50b77d7afbadfebe73f10137f09da9560aea1ba
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
(cherry picked from commit 0f0ab90cf60a7169c365c8c9f46b7ccd379a10d1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-20 08:07:02 +00:00
Antti Määttä
652e2c571f CTF: Fix channel naming
This was erroniously removed in a previous change.

Pick-to: 6.5
Change-Id: Ia62327bea7e3d190503a0eb05217c0f780f4fe9a
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
(cherry picked from commit 720bb62f5c24ddb06f2cb4252c513c9d5b0e9639)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-20 05:39:30 +00:00
Marc Mutz
8e14e13c16 [docs] Fix \since for qHash(qfloat16)
The patch adding the function unexpectedly made it into 6.5 before
6.5.3 was forked off. That's nice, as it reduces the number of
releases with a broken implementation, but the documentation and
ChangeLog were written assuming a merge for 6.5.4.

Fix the documentation.

Amends 6da6a17de9ccfcd5458ea72507b131660e0ab948.

[ChangeLog][Editorial][QtCore] Delete the old entry for
qHash(qfloat16), keep the one from this commit.

[ChangeLog][QtCore] Fixed qHash(qfloat16) which was broken from 6.5.0
to 6.5.2, inclusive. If you compiled against one of the affected Qt
versions, you need to recompile against either Qt 6.4 or earlier or
6.5.3 or later, because the problematic code is inline.

Pick-to: 6.6.0 6.5 6.5.3
Task-number: QTBUG-116064
Task-number: QTBUG-116076
Change-Id: If8fa35fb8532cf0bbf2ba0438694d95fd9bd6991
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0f19cafc3cbb85dfd67c5c6f7421943e9c063ea1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-19 18:54:35 +00:00
Santhosh Kumar
5e2caca64e Show command link button in respective color for windowsvista style
The command link button was shown in active color even when its disabled
while using windows vista style and the patch
e9cf618a9d0ead8711a5fbe563b1c7118c0143c8 further cause regression when
hovered over it.

This patch fixes it by setting color for corresponding color group in
windows vista style.

Pick-to: 6.5
Change-Id: I9a8f62f8c5895592571978ec7c9abccfc69e64a2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 25c9f595465b5333f558b35a165e6940d834037d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-19 08:36:43 +00:00
Andy Shaw
406ad89a3b SQLite: Update SQLite to v3.43.1
[ChangeLog][Third-Party Code] Updated SQLite to v3.43.1

Pick-to: 6.6.0 6.5 6.2 5.15
Fixes: QTBUG-117139
Change-Id: Id4f7d55adb317f009613245510c4eb26678ddc7a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4583d808ea50beb8da9302f34eacfc1e9a2ed907)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-19 05:27:47 +00:00
Vladimir Belyavsky
a7e0d6ebdc QNetworkConnectionEvents: fix potential nullptr access
Fix potential nullptr access in
QNetworkConnectionEvents::getNetworkConnectionFromAdapterGuid().
This can happen if for some reason the NetworkListManager instance
failed to be instantiated in QNetworkConnectionEvents constructor.

Fixes: QTBUG-117097
Pick-to: 6.5
Change-Id: If51ea383e22461a6c3124576c4e1be3f30dde1f6
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 6b4cc9bf7358176890630879dbdd08f6d4535bd9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-19 01:25:53 +00:00
Friedemann Kleint
6c9ecf98e1 hellogl2 example: Decouple mainwindow from window
The circular dependency cannot be ported to the corresponding Python
example.

Task-number: PYSIDE-2206
Pick-to: 6.5
Change-Id: I031b3fffdd7bd677d2fc55e132975a65f66ad128
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 62eaaeb4f58388dc56cb1b23beae892e2fd6df89)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-18 22:28:42 +00:00
Friedemann Kleint
734db610c3 hellogl2 example: Streamline code
- Shorten menu code, add keyboard shortcuts and a quit action.
- Avoid calls to setLayout().
- Pass a parent to message boxes.
- Use the current screen for size calculation and consider
  availableGeometry().
- Prevent closing by the Escape key in docked mode.
- Split the dockUndock() function into dock()/undock() for clarity

Pick-to: 6.5
Change-Id: I007da3bff86ee3f2dc8f87379e5d2ba2f0f6f3d7
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 6f8398c8eb5476a6e98126d5b63421896b874271)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-18 22:28:42 +00:00
Eskil Abrahamsen Blomfeldt
b2e888dc81 Upgrade to Freetype 2.13.2
Task-number: QTBUG-117135
Pick-to: 6.6.0 6.5 6.5.3 6.2 5.15
Change-Id: I2485cf286f590eccee9c4be4bb19559631288fd5
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit 5641a5e1e54c9694a1ba1d462165db9c7c0e529c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-18 22:28:42 +00:00
Laszlo Agocs
69c0ca3174 Sync rhi backingstore prefer-software env.var with Quick
Behaving differently in QQuickWindow vs. a QRhi-based widget
window is not great for WebEngine. The env.var naming is not
the best (QSG prefix) but we already have some precedent for
this (recognizing QSG_INFO in QRhi), and there is no other
choice anyway.

Pick-to: 6.6.0 6.5 6.5.3
Task-number: QTBUG-116445
Change-Id: Ibfd495cbd1d42502441d6629325bdeb033e813f3
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit ffb857e9d0745fdd31bca091333f1120c5857d7b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-18 22:28:42 +00:00
Allan Sandfeld Jensen
13f83f8e0c Compress UpdateLater events
Handle UpdateLater events in QApplication::compressEvents

Change-Id: I0c63f88d8ed90fc56c093c534394461797d1336b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit cb42c940787cf8c44e11f2b650d81c3d1eff1580)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-18 20:02:08 +00:00
Axel Spoerl
29d20a781c QMessageBox::about / aboutQt - use native modal dialog on iOS
The about / aboutQt statics in QMessageBox used a non-native, non-modal
dialog box on all operating systems. This creates a grid layout with
labels for heading, text and icon.

This has two unwanted side-effects on iOS:
- When the screen size is not sufficient to display all text, the text
is not rendered. On an iPhone SE for example, only the Qt icon is visible.
- When the screen height exceeds the minimum requirement, the informative
text is bottom-aligned.

=> Show about(Qt) message boxes in a modal, native dialog.
=> Update documentation.

This partly reverts aafed07dee5fd2d22518e49c4fa7798735e9e681.

[ChangeLog][iOS] QMessageBox::about(Qt) now shows native, modal dialog.

Fixes: QTBUG-115832
Pick-to: 6.5 6.2
Change-Id: I4cfbce416e7d2717058bef9a050a85d424b8a03d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 6f5136ef6661150046b64992fb78b23f02da0ef2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-18 16:24:49 +00:00
Ivan Solovev
7ac5927e50 QAbstractAnimation: avoid spurious dependencies on the state property
The state property is read-only, meaning that it can only be modified
from the class internals. At the same time, the public start(), stop(),
pause(), and resume() methods, as well as a private setState() method
can be called from other property setters, thus creating an unwanted
dependency on state.

Fix it by using valueBypassingBindings() when reading the state.

Task-number: QTBUG-116346
Pick-to: 6.5
Change-Id: I404cd2141ea52b8ffed5edbb4261a535cd329ec2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit ab9f5a9a0b13c33e103d159a40869a69a9583899)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-18 16:24:47 +00:00
Friedemann Kleint
08dd6dce63 Add Python-specific note to QOpenGLContext::aboutToBeDestroyed() documentation
The signal is not received when emitted from the destructor.

Pick-to: 6.5
Fixes: PYSIDE-2460
Change-Id: Ic2273c5b9ef1f53bd58615b6982016e646aee326
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 98e0600c5a317bec17740aa010a36589adc7eab4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-18 06:21:54 +00:00
Thiago Macieira
a5a1231d52 IPC: disallow unknown queries in QNativeIpcKey string form
So we can add them in the future but cause older versions of Qt to
reject them if they don't know what they are.

Pick-to: 6.6.0
Change-Id: I512648fd617741199e67fffd1782b85935bb832a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 18867845eb77537c4125e1da4dfcd049e303ee27)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-18 03:11:27 +00:00
Thiago Macieira
ef5f2322a7 IPC: Remove the "small" object optimization in QNativeIpcKey
The original design was supposed to be small, at a single pointer, but
that never made it through, with the "QString key" member. So the
anonymous union for typeAndFlags overlapping with the extension pointer
was just unnecessary headache.

So separate the two. This means QNativeIpcKey's size increases from 4
pointers to 40 bytes on 64-bit systems and to 24 bytes on 32-bit systems
(so we have 6 unused bytes on both architectures).

Fixes: QTBUG-116821
Pick-to: 6.6.0
Change-Id: I512648fd617741199e67fffd1782b7d5ba5ddd12
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit eb5c5a76cf369dd5e40289c1013f043c7e82ff2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-18 03:11:24 +00:00
Thiago Macieira
608b08f4d5 IPC: make the two platformSafeKey functions return QNativeIpcKey
There's no need to return QString, only to create the QNativeIpcKey
elsewhere, when nothing uses this intermediary QString (those two
functions aren't used in unit tests any more, since the two "IPC: add
native key support" commits (2c286561bbc9e4e408d34e5bf43db8ad9acc0e84
and 3ae052d3bb5d7af0badf32575a5aa042cffd8243). Since they aren't used in
the tests, we can remove the Q_AUTOTEST_EXPORT macro too and the
unnecessary default argument.

I'll need the ability to return QNativeIpcKey to store the original,
legacy key inside of it.

Pick-to: 6.6.0
Change-Id: Idd5e1bb52be047d7b4fffffd17506c05e4f61f79
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b5584ed2240abe3892fa5b0a23b3ad093ed9fec2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-18 03:11:20 +00:00
Joerg Bornemann
5c9fa4ca4a CMake: Fix condition of the ipc_posix feature
The ipc_posix feature was OFF despite the following test values:
    TEST_posix_shm ON
    TEST_posix_sem ON
    TEST_sysv_shm OFF
    TEST_sysv_sem OFF

The 'NOT (TEST_sysv_shm AND TEST_sysv_sem)' part of the condition is not
correctly evaluated. Resolve the parentheses to work around this issue.

Pick-to: 6.6.0
Fixes: QTBUG-117052
Change-Id: Idac23d207f8dd644d059977ca41b6e32b17b3a49
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 828770c60c1c0342a015fc7fe2d6e714f645fb64)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-18 03:11:17 +00:00
Tor Arne Vestbø
ea4f2e8546 qmake: Bump supported macOS SDK version to 14 (Sonoma)
Pick-to: 6.6.0 6.5 6.5.3
Change-Id: I49f97e844729f2b99af6efad00d024db13050ea1
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 34a0dbc3a944127e48d14b6e032a8c05e8c580b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-18 01:10:29 +00:00
Arno Rehn
a2792bac1a QtFuture: Prevent whenAll()/whenAny() from creating reference cycles
whenAll() and whenAny() create a shared context object which is
referenced by the continuation lambda. The refcount of context is only
correctly managed when it is copied non-const to the lambda's
capture list.

Fixes: QTBUG-116731
Pick-to: 6.6.0
Change-Id: I8e79e1a0dc867f69bbacf1ed873f353a18f6ad38
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ba2ebc24a1b29020699dc2282b05a60506b56c6d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-17 16:58:16 +00:00
Alexey Edelev
38f03c8719 Iterate over all extraPrefixDirs when collecting "directories"
When collecting plugins required for the android application according
to linked targets we should take into account all prefix directories.
But not only the first one. Otherwise the order we use when adding
paths to extraPrefixDirs will affect collecting of the plugins. This
specifically leads to the issue if the user project builds custom Qt
plugins. The plugin directory from user project build tree will be
found first and all plugins from Qt installation directory are
discarded.

Pick-to: 6.5
Fixes: QTBUG-116920
Change-Id: Id94ebaf5ccd1a279a74b38b59ff535f45230e1b4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 630d3328ddc35a02c42fa6501636eaee6eb76a37)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-15 11:03:39 +00:00
Rym Bouabid
cfa2ff60a3 Revamp Shared Memory Example: Change the used QSharedMemory constructor
Use QSharedMemory(const QNativeIpcKey &key) constructor to port away
from the deprecated QSharedMemory(const QString &) constructor.

Task-number: QTBUG-108858
Change-Id: I05615100f77f571fe32a3cf627c3df46baaa7f7a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 976f30dc5939d887606cc4df33b80f6e9d3563ab)
2023-09-15 13:03:39 +02:00
Edward Welbourne
f39f1bfd9e Support the TZDIR environment variable
On Linux / glibc, this overrides the default system location for the
zone info. So check for files there first. Break out a function to
manage the trying of (now three) zoneinfo directories when opening a
file by name relative to there.

Pick-to: 6.5
Task-number: QTBUG-116017
Change-Id: I1f97107aabd9015c0a5543639870f1d70654ca67
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 569dc0de50a46b64763921199a2706ab34d151a9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-15 11:03:38 +00:00
Edward Welbourne
2b253e4ef3 Use the modern name for zone Asia/Kolkatta
The old name Asia/Calcutta is being phased out. We can't assign
QTzTZP, so select between new name and old using a reference variable.
In the process, fix a QCOMPARE() against bool to a QVERIFY().

Pick-to: 6.5
Change-Id: I7cd8a813f8a88c8ae4ba07213f04f4ad0860cec0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c0cb616c1d62a90e612bd64d427f37ac11a5a473)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-15 11:03:38 +00:00
Rym Bouabid
aa21d402d3 Revamp Shared Memory Example: Revisit the documentation
Remove "Example" from the title.
Extend the \brief.

Task-number: QTBUG-108858
Pick-to: 6.5
Change-Id: Ie8bd0c808503861027f80493c430e8ac1baada5f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 0132ad0fde1dc5046aa86e89d1550d0ce6c8e02a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-15 08:36:00 +00:00
Eskil Abrahamsen Blomfeldt
d0ed5db781 Fix crash when reading corrupt font data
When loading the font data, we had some unprotected reads. To harden
this, we check everything against the length of the font data
before reading.

[ChangeLog][QtGui][Windows] Fixed a possible crash that could happen
when loading corrupted font data.

Fixes: QTBUG-116773
Pick-to: 6.6.0 6.5 6.2 5.15
Change-Id: I156df3b8833c9ed785fcc690821a7a74d9a51126
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 9fe47cf2e11d7c9ad4f72e6fc5e53f10a9743b03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-15 08:18:15 +00:00
Marc Mutz
321dcd1d1d Long live Q_(U)INT128_C()!
Compilers that support 128-bit integer types usually don't have
support for 128-bit literals, so provide Q_(U)INT128_C macros and back
them with UDLs. This, of course, only works in C++, so until compilers
provide built-in literals that support C, too, that's all we get.

[ChangeLog][QtCore] Added Q_INT128_C() and Q_UINT128_C() macros to
create qint128 and quint128 literals in a platform-independent way.

Pick-to: 6.6.0
Fixes: QTBUG-116822
Change-Id: I4be645baf2e007ee1aa1a27f9b5166671806dc49
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 16433a4a6ed22750adfdb9633149c3bd485c4656)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-15 04:38:25 +00:00
Marc Mutz
09bf722590 Long live Q_(U)INT128_MIN/MAX!
Since compilers don't provide such macros, do it ourselves.

In order to test these macros, add ad-hoc specializations of
QTest::toString() for qint128 and quint128 locally to the test. Turns
out it's not too hard to write them, so we might move them to a public
header, yet.

Pick-to: 6.6.0
Change-Id: I1483f3af2ccec6038e1c780649f9ffe413bb59ef
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 104a0a9ecdb18d65e4d9075d87e8860c6c9d8335)
2023-09-15 06:38:25 +02:00
Giuseppe D'Angelo
018d273557 QWindowsFontDatabase: fix a data race
QRawFont::loadFromData can be called from any thread. It calls into
QPlatformFontDatabase::fontEngine. The code path may end up creating a
UniqueFontData and storing it a QWindowsFontDatabase member (a QMap).

Two threads calling loadFromData (on different QRawFont objects)
will therefore race on the mutation of the map.

Add the missing mutex protection.

Change-Id: Ib38c2b3539679c820d997a6548e4b397cbc2bb73
Pick-to: 6.5 6.2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit a1b55b1360acff00f9932d99ab48f4614754e3b8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-14 21:57:52 +00:00
Giuseppe D'Angelo
7a705e9c60 QWindowsFontDatabase: avoid multiple map lookups
Use the iterator-based API, and avoid a quadruple (!) lookup into a
QMap.

I'm aggressively cherry-picking to avoid merge clashes with an upcoming
fix.

Pick-to: 6.5 6.2
Change-Id: I05968f4aec9e42f84f909a1103e43ba323a9544f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2bc475f94ec037890490d8c2592497ba67c87c0b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-14 21:57:44 +00:00
Liang Qi
3516539945 GUI: give more warning when can't load xcb since 6.5.0
normally because new depedency of xcb-cursor0 or libxcb-cursor0 is
missing.

Pick-to: 6.5
Task-number: QTBUG-108796
Change-Id: I040e9c0932bbf1f9026b365ded462c7373b219b5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit f7519a89d27de7e473bb864cb377aa679c619c0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-14 20:14:39 +00:00
Rym Bouabid
1f4460cb1f Revamp Shared Memory Example: Fix formatting of the dialog.h header
"dialog.h" has inconsitent indentation.

Task-number: QTBUG-108858
Pick-to: 6.5
Change-Id: Id029d5ec63f3831e5ffcfe2b61d7e86896d4afb5
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 0a62d4e4c07ddcc650c67faf977663f7fb8aef62)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-14 16:24:19 +00:00
Rym Bouabid
3b99767b43 Revamp Shared Memory Example: Fix include order
Fix include order to respect the Coding Conventions.

Task-number: QTBUG-108858
Pick-to: 6.5
Change-Id: Ifecf7c60ca7135104631587b25e907cb1d39e25b
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 8643b52467f4034498c7fb08ede4b1f429ed5aa5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-14 16:24:19 +00:00
Rym Bouabid
c7d06095cb Revamp Wait Conditions Example: Revisit the documentation
Change the title.

Remove the first \brief as there are two briefs in the document
so that the new title makes sense with the second brief in
"All Qt Examples" doc page.

Task-number: QTBUG-108860
Change-Id: I1dec2ad107e3f9ff9b4203960ba54ae6d0d8c7b6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
(cherry picked from commit dcc08440567c1e5d36ba68a68a617182151f8bdc)
2023-09-14 18:24:19 +02:00
Rym Bouabid
f2b570c206 Revamp Semaphores example: Revisit the documentation
Change the title.

Remove the first \brief as there are two briefs in the document
so that the new title makes sense with the second brief in
"All Qt Examples" doc page.

Task-number: QTBUG-108859
Pick-to: 6.5
Change-Id: I8b0370c9a85179e172918231ae48a3c52845bf21
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 70815d31fe6075d15a85be90c940d3f9d3b8d05c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-14 16:24:18 +00:00
Rym Bouabid
e9d400b4aa Revamp Mandelbrot example: Revisit the documentaton
Remove "Example" from the title.

Edit the link (title) to the documentation of Mandelbrot in QThread
documentation.

Delete the foreach related sentence as we are trying to port away from
this Qt pseudo-keyword.

Task-number: QTBUG-108861
Pick-to: 6.6.0 6.5
Change-Id: I6d04f24ac9c1fa1efe30a947c2da2ec7475edc80
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 73a1ae6ea91cbcc7ddfd80defd78ac924dea4c6e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-14 16:24:18 +00:00
Rym Bouabid
f67e649e9b Revamp Mandelbrot example: Add const/constexpr when applicable
Add const in front of local variables when applicable.

Replace const by constexpr when the value of the variable can be
calculated at compile-time.

Task-number: QTBUG-108861
Pick-to: 6.6.0 6.5
Change-Id: I2cd1bc97aaa07d6d564731d9ccddba9a74e96fef
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 7903a52d46401e224f1d85067d51bf443066cbec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-14 16:24:18 +00:00
Alexey Edelev
3a8583628c Add variable linked to configure-time executables to detect CMakeCache wiping
Wiping of CMakeCache should lead to removing of CMakeCache that is
generated for configure-time executable. Otherwise configure-time
executables might still use wrong compiler or compiler flags.

Pick-to: 6.5
Task-number: QTBUG-116789
Change-Id: I702d5d29e0c5f35a8a36311cf9a84ea7a0f4d781
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 9d11e5019016ce62c57f6f6567b01d5916a359a8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-14 16:24:18 +00:00
Alexandru Croitor
c75eadf08e CMake: Fix reconfiguration when -no-opengl is specified
In a previous change, we ensured that all INPUT_foo cache variables are
unset at the end of configuration, so they don't influence feature
re-evaluation in case if a command line flag like -no-gui is not
specified upon second reconfiguration and a FEATURE_foo is manually
toggled in the CMakeCache.txt, effectively getting rid of
stale INPUT_foo values.

Unfortunately that causes an issue when configuring with -no-opengl
and then trying to reconfigure with 'cmake .'

Specifically various feature options like ENABLE / DISABLE use
INPUT_foo variables in their expressions.
qt_configure_add_report_entry CONDITIONs also use them.

These expect the INPUT_foo variables to be persisted, and if they are
removed, the expressions might be re-evaluated to a different value,
and cause re-configuration to fail or unexpectedly toggle features.

To support both cases described above, instead of removing all INPUT
variables when configuration ends, only unset those INPUT variables
whose corresponding FEATURE_foo variable has been manually toggled in
CMakeCache.txt or via an IDE.

Toggling a FEATURE_foo manually is intentional, which means the
INPUT_foo value should be discarded. Whereas pre-existing INPUT_bar
variables will persist, thus not breaking cases like the -no-opengl
report CONDITION.

Amends 2799391703e44a34b6557e234462e425a61785f2

Fixes: QTBUG-116973
Task-number: QTBUG-112957
Change-Id: I5851255bfa41a9a1d116630a5d9f7b9a74aa93ed
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit d1a17d96550362b28f77a6bbff9dd15b15d40559)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-14 16:24:17 +00:00
Rym Bouabid
66e35b71da Revamp Mandelbrot example: Declare slots as methods instead
Declare zoom as a method because it's never used as a slot.

Declare updatePixmap as a method because it's used as a slot
as pointer-to-member-function, so it doesn't need help from moc.

Q_OBJECT is not needed anymore as the MandelbrotWidget class
doesn't contain signals ans slots anymore. It's replaced by
Q_DECLARE_TR_FUNCTIONS because we are using tr() function.

Fixes: QTBUG-108861
Change-Id: I9a1d66711cdc9f0ca5a1bc6645f7e0ed3395645c
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 2a2275756b31ae870b5735aecb21a6e8f4c6bd55)
2023-09-14 14:31:50 +02:00
Rym Bouabid
87728a2330 Revamp Semaphores example: Replace const by constexpr when applicable
Replace const by constexpr when the value of the variable can be
calculated at compile-time.

Fixes: QTBUG-108859
Pick-to: 6.5
Change-Id: I4abf5162d521fc5dca0286a6254f86c57a473367
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit c4a1c171a3b2ade21a344de99962b3848e4ad85a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-14 12:03:52 +00:00
Timothée Keller
3a54d31093 Windows QPA: Adjust margins for Windows App SDK compatibility
If using the ExtendsContentIntoTitleBar() method from the Windows App
SDK, the top margin becomes zero. The current approach does not account
for this, since it relies on the AdjustWindowRectExForDpi function.
Do a manual check after and correct if necessary, by comparing the
window and client sizes.

Fixes: QTBUG-113736
Pick-to: 6.5
Change-Id: I62e0338b3ff7af47f5525dcccd0f9acfe9691819
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 8dbc4824895ea9f87d1f6406fe2d22336b6253ed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-14 11:50:34 +00:00
Albert Astals Cid
9be520e445 ios: Fix crash when closing app while showing a native screen
Fixes: QTBUG-117021
Pick-to: 6.5
Change-Id: Icebae0e815b42c6e0bf39e727fd1a16db5752d78
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit ae83f327cd812c199304159fc9bbd93f4a728fdb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-14 07:27:24 +00:00
Morten Sørvig
f69a721aed wasm: fix "'QString' is deprecated" warnings
Use the _L1 operator from Qt::Literals::StringLiterals

Change-Id: I3d8dc0b7219879a1907e67b539e047ae7f7aae87
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 37dde96e5f1cdf8208b5ab9b4d1edacda416adc3)
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2023-09-14 07:27:24 +00:00
Alexey Edelev
7a90c43a41 Show the allowed values for configure arguments
Just some help to users, so they can spot the allowed values without
looking into docs.

Change-Id: I22ad9533104949286de447a05a6e875e8d933bf6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 47a42b9c6a523478dc30732a17bc0ac1e02d301d)
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2023-09-14 07:27:24 +00:00
Kaj Grönholm
f4cd58a9b7 Round the image scaling when not antialiased
When painting an image with antialiasing not turned on, round the
target area to closest integers (pixels).

Task-number: QTBUG-116297
Change-Id: I64e78a9087ee042aef0ea297c48b5ead36697d10
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
(cherry picked from commit 743c1cf96bae2722ac70a551c7d66b7d2f6a65d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-14 07:27:24 +00:00
Santhosh Kumar
bf2bc292a8 Update version for QPalette::accent API in documentation
Follow up patch to 3c391c159ce0e29a9a654edee45bd64bcde6ccd2.

Change-Id: I23235ae8516a53cf09c00b0daedc054df2f0cfa8
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 42e164f5ad7f279d3b7862d5882ba6705db596d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-14 07:27:24 +00:00
Jani Heikkinen
cd58207188 Bump version to 6.6.1
Change-Id: I19f1b88b9403401ebccd41a7309a7f00b789bd51
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2023-09-14 10:27:23 +03:00
Marc Mutz
66d10dc253 Document q(u)int128 and QT_SUPPORTS_INT128
[ChangeLog][QtCore] Added qint128 and quint128 typedefs on platforms
that support them.

Fixes: QTBUG-116925
Pick-to: 6.6.0
Change-Id: Ibd55cb0b1931b48a91598d3165e5911e3a4079f2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 454636afec1be8d4483b65ae564487eca9734ffd)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-14 04:52:48 +00:00
Marc Mutz
297aa6d751 Add some tests for q(u)int128
Check that QIntegerForSize<16> and std::numeric_limits<quint128> work
and that q(u)int128 are available in C mode, too.

Pick-to; 6.6.0
Change-Id: I44af8282399c78f6e74a8268af53bad64407ca34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 32f66f7008ce8fff1a8cdc5219978d1a61d4684c)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-14 04:52:48 +00:00
Thiago Macieira
cd8667cb17 qsimd_p.h: rework the check for x86-64-v3 features
Instead of checking that all the features be present if any of them are
-- which is not an acceptable proposition, because each of them were
productized in at least one processor before -- let's simply insist that
they all be present if AVX2 is. That's what we can guarantee: all AVX2-
capable processors are capable of:

- AVX and earlier SSE (architecturally implied, so not checked)
- BMI1
- BMI2
- F16C
- FMA
- LZCNT
- POPCNT

This restores the original set of features that were checked in commit
ad65bbe4c061c4c1521b928a18ef9d68b7c69cbb when this was introduced, but
only if AVX2 is set. It also POPCNT, which was introduced with the
Nehalem architecture (which matches x86-64-v2) but aren't implied by
AVX.

GCC's -march=x86-64-v3 implies CRC32, but -march=haswell does not
because there were SKUs lacking CRC32, AES and PCLMULQDQ. This is
probably a bug in GCC.

Fixes: QTBUG-116357
Task-number: QTBUG-111698
Task-number: QTBUG-107072
Pick-to: 6.5
Change-Id: Ifa1111900d6945ea8e05fffd177e113eaa506dde
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 39d3af0c29147ff319e89c0be602d99af0af0996)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-14 02:23:30 +00:00
Eskil Abrahamsen Blomfeldt
8055247fc0 Mark feature API in QFont as preliminary
Using ints for the tags is not ideal. There is no type safe
way to do conversions from strings, and how the int corresponds
to the four-byte tag is not clear from the API, so user code
can end up being less readable due to this.

Especially since this type of tag is a data type used several
places in fonts, and we will need them again for implementing
support for variable axes, it's worth giving this an extra
round of polish.

Since it was not addressed in a timely manner and we don't want
this to delay the upcoming release, we mark the API as
preliminary for now, to give ourselves the option of changing it
to something.

Fixes: QTBUG-116929
Pick-to: 6.6.0
Change-Id: I498478785dcd5ece954151f01f1a017828d6b8b8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 6ab362a7eaddd6b2e867c9de6dbb04b7f760d005)
2023-09-13 20:56:38 +00:00
Axel Spoerl
4bc76c2647 QOpenGLCompositorBackingStore: ensure backing store on flushed windows
When the first QEglFSWindow got created for a QWindow, a backing store
was created with it and associated to the new QEglFSWindow. When the
window was hidden on the platform screen, the QEglFSWindow got deleted
and re-created when it was supposed to be shown.
The re-created QEglFSWindow was no longer associated to the backing
store. It was therefore not rendered on the screen.

=> ensure that the backing store is re-associated to the QEglFSWindow,
corrsponding to the QWindow argument passed to flush().

No autotest is added, because the fix is purely visual.
The widgets/menus example can be used to test the functionality
manually (see bug reports).

Fixes: QTBUG-115196
Fixes: QTBUG-116769
Pick-to: 6.5 6.2
Change-Id: I92ce2e8f7e76bd2d26e713a4d20612d079fb4717
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 4bc8f548222a0dd2967063a23e76c37d302253cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-13 14:06:44 +00:00
Mårten Nordheim
d4a6c81081 QString: fix append() wrt. raw data
When appending to an empty string, we optimize and
copy the internal pointer. But if the other string was
created with fromRawData this might be temporary data on the stack/heap
and might be de-allocated or overwritten before the string
is used or is forced to make a deep-copy. This would lead to incorrect
data being used.

This is easy to overlook if you plan to append multiple strings
together, potentially supplied through an argument. Upon appending a
second string it would make a full copy, but there might not be a
guarantee for that. So, it's hard for users to avoid this pitfall!

Fixes: QTBUG-115752
Pick-to: 6.6.0
Change-Id: Ia9aa5f463121c2ce2e0e8eee8a6c8612b7297f2b
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4660a230d527a9cffda41999103aba6ff5c2ecd5)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-13 14:05:30 +00:00
Nicholas Bennett
590c94b1ae Docs: Add macros for common Qt products
Added macros for Qt for Android Automotive, Qt Online Installer, and
Qt Maintenance Tool.

Task-number: QTBUG-116562
Pick-to: 6.5 6.2
Change-Id: I0ef3bc0fd6b1ddf94c8be2feed7cf5e691c4776f
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Esa Törmänen <esa.tormanen@qt.io>
Reviewed-by: Mats Honkamaa <mats.honkamaa@qt.io>
(cherry picked from commit a9c63e826caebe0ad7621c63fb6e7637a86f59b6)
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2023-09-13 10:49:50 +03:00
Marc Mutz
e8fb761f75 Fix qHash(qfloat16) to match Qt 6.4 behavior
There were two problems:

- On platforms where QFLOAT16_IS_NATIVE == true, a qHash(qfloat16{})
  call has become ambiguous between the three FP qHash() overloads
  (float, double, long double), where it was unambiguously calling the
  float one in Qt 6.4. This SiC was caused by the replacement of
  operator float() by operator __fp16() in
  99c7f0419e66692260be56c0385badeacb3f6760, which is in Qt 6.5.

- On platforms where QFLOAT16_IS_NATIVE == false, qHash(qfloat16{})
  would produce a different value from qHash(float{}), and therefore
  Qt 6.4, when the seed was != 0, because the former would go via the
  one-arg-to-two-arg qHash adapter while the latter one would
  not. Since participating functions are inline, this causes old and
  new code to produce different hash values for the same qfloat16,
  leading to a BiC possibly corrupting QHash etc.

Fix both by adding an explicit qHash(qfloat16). This function is
inline, so it doesn't add a new symbol to 6.5.x.

[ChangeLog][QtCore] Fixed qHash(qfloat16) which was broken from 6.5.0
to 6.5.3, inclusive. If you compiled against one of the affected Qt
versions, you need to recompile against either Qt 6.4 or earlier or
6.5.4 or later, because the problematic code is inline.

Pick-to: 6.5
Fixes: QTBUG-116064
Fixes: QTBUG-116076
Change-Id: Id02bc29a6c3ec463352f4bef314c040369081e9b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6da6a17de9ccfcd5458ea72507b131660e0ab948)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 23:26:14 +00:00
Marc Mutz
4f450ddf19 Qt UDLs: avoid the deprecated form of UDL definitions
cppreference.com says¹ that the space after the "" is deprecated now,
so remove the space. Let's just hope all our compilers support this,
otherwise it will get ugly².

¹ https://en.cppreference.com/w/cpp/language/user_literal#Literal_operators
² https://github.com/yhirose/cpp-httplib/issues/953

Pick-to: 6.5 6.2
Change-Id: Ic8e4939e3ba713023c5a5c020305c96b521dbda9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5503b478935aee563d31c5df035803818f4cead3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 23:26:12 +00:00
Tor Arne Vestbø
281ee04a82 embeddedwindows: Mask the painting manually by applying a clip
QWindow::setMask() is not guaranteed to turn the masked out areas
transparent, and it's up to the client to ensure this during
painting.

Change-Id: I1155b3ad095152a993532f2290cacb670e20daa7
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5ce4aecd495667a50dd121930f9ca39dc07cfc36)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 21:40:12 +00:00
Alexey Edelev
7e1321080c syncqt: Add the missing is_open check to writeIfDifferent
Pick-to: 6.5
Change-Id: I2a969483d20f250083c1a262bd3bfc696a7f0df4
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
(cherry picked from commit a86fb92d4bc1a64703cabf351035efc861ea54dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 21:40:12 +00:00
Alexey Edelev
28ad12261c syncqt: Mark updateOrCopy as exception free
Pick-to: 6.5
Change-Id: I4ac468ef503775bca7d3848d26b42990bb4fdd1a
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit cab5ede6a3890b9cc07e54a0558a577c932ec21a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 21:40:12 +00:00
Tor Arne Vestbø
da2e47edb0 embeddedwindows: Fill bounds, instead of event rect
The event might come from a partial expose, but we want to
fill the entire bounds of the window, as we're filling with
a gradient.

Change-Id: I66cedb160fb0ed06935c06ba2fe5dec9ed468833
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 61c043333b255afcd83260b78027242fc27a2e83)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 21:40:11 +00:00
Alexey Edelev
afbc0c7267 syncqt: Handle possible exceptions thrown by std::filesystem::create_directories
Wrap the directory creation logic with try/catch to handle possible
file system exceptions.

Pick-to: 6.5
Change-Id: I11ad4552dccfdc8cc8a4ec4912d0a15d0f9557c6
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
(cherry picked from commit 7164cce881c3d65eb18749471ba5e358c7d5998a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 21:40:11 +00:00
Alexey Edelev
35b3deeb58 syncqt: Add the missing file stream close calls
Call close explicitly to avoid any issues related to non-closed file
descriptors.

Pick-to: 6.5
Change-Id: I02df30032dc04afd5d135d707eff4a6efe6a3ea5
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
(cherry picked from commit e9ca247479206b3d6f3815c599a244d9bfbae394)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 21:40:11 +00:00
Alexey Edelev
89b36f4943 syncqt: Generate the deprecated header in the framework directory too
Generate the missing deprecated header in the framework directory for
the cross-module deprecation case.

Amends 7e84a04563142d217317928865a8f6475d189d95

Pick-to: 6.5
Change-Id: Ibb2d262e41c6de7dfb34c39cabd6b19c43aa9636
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 09c46d63af3ea68d7b49c395b9375d2b5d3ed666)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 21:40:11 +00:00
Tor Arne Vestbø
18678e3fc7 xcb: Reflect geometry of foreign window on creation
Change-Id: I305b256696a32454f64c12c5a8901b65506fc520
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 4e2e3a6b4fe0ff5e1930707808f02e3be9343312)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 21:40:11 +00:00
Ahmad Samir
f6720887e6 tst_QDnsLookup: skip a unittest on Windows
See code review 496440 on Gerrit for the details.

Change-Id: Ibd32a44cf7e2e07f36687cc2f0eeaf3008f64e73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 9b40272562cb8f83efcd8a062c76edc41a9cf952)
2023-09-12 18:12:38 +00:00
Ahmad Samir
f96365db99 tst_QDnsLookup: fix typo in CMakeListst.txt
There was an extra `q` before dnslookup.

Found while trying to build tst_qdnslookup, the target wasn't seen by
CMake/Ninja.

Change-Id: Id594aab30dc9081fc269541561e0f2db5e615657
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 0ce51dee0e3c0d0e49c2ad211bdbbed03003d3a4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:38 +00:00
Thiago Macieira
3c5841ace3 tst_qdnslookup: fix the location of the opcode in the header
We were reading the wrong byte with the wrong shift count.

 4.1.1. Header section format

 The header contains the following fields:

                                    1  1  1  1  1  1
      0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                      ID                       |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |QR|   Opcode  |AA|TC|RD|RA|   Z    |   RCODE   |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                    QDCOUNT                    |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                    ANCOUNT                    |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                    NSCOUNT                    |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                    ARCOUNT                    |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

This diagram is big-endian, so bit 0 is the MSB.

Change-Id: I964c2b1e6b834feb9710fffd177bb72110bb77e7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 19673b6cf949dce5d0cd8efa4ad6f91c9f26f06f)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-12 18:12:38 +00:00
Axel Spoerl
a93a41fcd1 Remove dead code in QMessageBox
Remove code guarded by #ifdef 0

Task-number: QTBUG-115832
Change-Id: I7d1dfd3dca2d8cda455d73f90dc2ae142ea41118
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit b2f4e1e395bba4b72d5e1d5cc6e4469b97731a65)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:38 +00:00
MohammadHossein Qanbari
f4d0320f45 doc: Remove QSettings' paths for embedded linux
Embedded Linux is just Linux nowadays.

Fixes: QTBUG-116715
Change-Id: I1f64d27550db6f711c7f1f578e85cad12d0973aa
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
(cherry picked from commit d8b7c03cc5b82276c74b6f210dc18a324ede3105)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:37 +00:00
Edward Welbourne
f8466e5b2c Turn Directions enum into an enum class in serialization converter
Task-number: QTBUG-111228
Change-Id: Ie1f8ea5e2575427528c19875db7a8e4e27200aec
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit e53d0220da4906f88494933ff3b0076335ad065f)
2023-09-12 20:12:37 +02:00
Edward Welbourne
9fcee2287a Turn Converter::Direction into a QFlags enum
This lets us testFlag() instead of using raw bit-field operations.

Task-number: QTBUG-111228
Change-Id: I2c26e9a24728e81baa42cf14c75271a015460913
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit ad63118071e3068ef3f45e75fad82a04952ba0fb)
2023-09-12 20:12:37 +02:00
Edward Welbourne
50b51d2b50 Serialization converter example: const-ify the Converter type
Its methods act on their parameters without changing the converter, so
can all be const. Its instances thus have no non-const members to
exercise, so can always be const.

Task-number: QTBUG-111228
Change-Id: Ifcdb2f2159c2cfcd7998dd118aa327a32d299ccf
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 77fdd21cbf1a053efe6eec51356c665ed982d47c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 20:12:37 +02:00
Edward Welbourne
2d9935cc6d Separate streaming dumper and converter in the convert example
The two were in the same files but mostly unrelated to one another -
aside from the converter defaulting to the dumper for output.
Furthermore, the dumper actually uses QDebug and QTextStream, not
QDataStream; rename it to reflect this reality.

Task-number: QTBUG-111228
Change-Id: Id65c120c319b555039f7fd186ed262f35ff5260a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit eaebb5c4d2e2a87b23d63c5406bf54458b4c4a24)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:36 +00:00
Edward Welbourne
ca9a3ba6c8 corelib/serialization examples: clang-tidy and coding style clean-up
I overrode clang-tidy where it uglified or obfuscated and did some
clean-up provoked or made possible by its changes. Konrad pointed out,
in review, a constructor that could be = default; it could, in fact,
vanish entirely as a result.

Task-number: QTBUG-111228
Change-Id: I9b7744a3abaa29e6f9e0689d0f6985bfd88cd0fd
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
(cherry picked from commit d8517fb1ab83e7051b1d2c2152014e7ff1760426)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:36 +00:00
Edward Welbourne
d066497527 corelib/serialization examples: use string literals more
A couple more compilation units could use Qt::StringLiterals. Prefer
QL1SV for the code constants, to keep code small. Convert fpToString()
to take QL1SV instead of const char *, with suffix empty by default.
Also rearranged some spacing, some if it suggested by clang-tidy.

Task-number: QTBUG-111228
Change-Id: I03d810d52afcd4a760d18f2553914b75af716b74
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 319b2e0e86f0afa6aa48625702010b5a6db4fe38)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:36 +00:00
Fabian Kosmale
e4101bf6ca QBindable: Add doc example for ctor taking property name
Change-Id: I36de517291ef940d6fa284e062d44a5b619c0018
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit b7184e110434cdae127d03a1467ba6fb02607768)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:36 +00:00
Axel Spoerl
88ec95d25f qobjectdefs.h - fix comment typo
Change-Id: I314c01156daaaf993ff0b80e049327d52e520382
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7c55651ff2537fdc9b7c8667aff38d98c0cd9b65)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:35 +00:00
Richard Moe Gustavsen
1b86653088 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.

Fixes: QTBUG-113765
Change-Id: I61b5b832904de471c2303fc67325feec322b1449
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 8393922e7071221a9c6c0811eb714f20bf4ed02b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:35 +00:00
Axel Spoerl
9954eb9c50 tst_QSplitter: fix compiler warning
QLabel *l is declared uninitialized, assigned in a for loop. The last
object is deleted for testing purposes.
This leads to a false compiler warning about deleting a potentially
unintialized pointer.

=> initialize with nullptr to silence the warning.

Change-Id: I1422b04fc1fdbfc7248de577884aabfb539f3f4b
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 41c8d215f273c048d76c51de4c56cb55c4325c85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:35 +00:00
Paul Olav Tvete
0ef069956f Doc fix: Use correct initials for Porter and Duff
It's Thomas Porter and Tom Duff, not Xavier and Yoann.

Change-Id: I2e9345c06c299e9c0475831e21c3b9b85c58a32f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 631cb589bf53223648376c72d588a7914e463924)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:34 +00:00
Kai Köhne
c02d99a7f9 Doc: Mention reset methods for QCalendarWidget::maximumDate, minimumDate
Change-Id: Ic3bfbcec1ac7d31ab704b52e6560d44f4a2054e7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit bd9a32adca32c6ad36e6c42c08eed3e62e9f3490)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:34 +00:00
Axel Spoerl
16c1d52a66 tst_qstatictext: Fix CMake condition
Private libraries were linked conditional to QT_FEATURE_private_tests in
the CMake file. qstatictext_p.h was included conditional to developer
build. A developer build fails, with test enabled and private tests
disabled.

=> Change the CMake condition to QT_FEATURE_developer_build, to resolve
mismatch between CMake and cpp file.

Change-Id: I79213e7d3c38851b8b80cb8ab248d7bff750c227
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 38380de63c53b27dc85a1ba49e1ffade1c183fdd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:34 +00:00
Axel Spoerl
bcdcceca6c QDialogButtonBox: Manage hide and show of standard buttons
0b421fa58b9a73d657bf17834788fd1175c4767e ensured a correct focus chain,
when buttons in a QDialogButtonBox were hidden.

The implementation did not check, if a hidden button was added via
setStandardButtons(). In consequence, it was removed from the
standardButtonHash and never added again.
QDialogButtonBox::button() returned nullptr for a standard button,
once it had been hidden. That introduced a regression.

This follow-up patch makes sure, a standard button is not removed
from standardButtonHash, when hidden. By no longer removing it from
standardButtonHash, it makes showQDialogButtonBox::button() always
return the pointer to the standard button, even if it is hidden.

The function handleButtonDestroyed() used the argument
QDialogButtonBoxPrivate::RemoveRule::KeepConnections, in order to leave
signal/slot connections untouched. It expected the the destroyed button
to be removed from standardButtonHash. In order to retain that
functionality, the enum class RemoveRule is renamed to RemoveReason,
and one value was added. QDialogButtonBoxPrivate now handles all
necessary cases of removing a button:

ManualRemove (previously Disconnect):
- remove button from roles
- remove button from standardButtonHash
- disconnect all signals

LeaveEvent (previously KeepConnections):
- remove button from roles
- do not remove button form standardButtonHash
- do not disconnect signals

Destroyed (new):
- remove button from roles
- remove button from standardButtonHash
- do not disconnect signals (QObject will do that)

An autotest is added to tst_QDialogButtonBox.

Task-number: QTBUG-114377
Pick-to: 6.5
Change-Id: Ib28625d44fa89c3d06f181f64875c2e456cebbfa
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit edc984db384311e25a0afe4902585bd97e4ebcd1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:34 +00:00
Lorn Potter
4fb8aebf8f wasm: send key release for touchscreen input
Fixes: QTBUG-114203
Change-Id: I117ce857484520167d0c0166280dd604c139ff03
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit eda0ccb36baae10784f71552408148f095d25953)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:33 +00:00
Morten Sørvig
4b21b332ee Always run screen change side effects
processWindowScreenChangedEvent() returns early if the
screen for the (top-level) window has already been updated,
for instance by a call to handleScreenRemoved(). This was
preventing us from updating the DPR and window geometry.

Move the code a slot connected to QWindow::screenChange,
which gets emitted for all windows (also child windows),
whenever the screen changes.

Fixes: QTBUG-116232
Change-Id: I44701fd001ab1fd54efe9c8451c6a58cfc0b285f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 89ce65c2d01e77c1cf49bb8579f63b60480e0186)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:33 +00:00
Dennis Oberst
d5b36aa609 tst_QString: assign(it,it) add test-cases for empty range
Change-Id: Iaf2ddb247aa279166110ad8793b1e37e66e8b11b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit c8be7c6a6c8bdefea523428163fe03186fd42ce5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:33 +00:00
Joerg Bornemann
9dbb4a8f81 CMake: Fix build with CMake 3.28 on macOS
FindWrapOpenGL.cmake assumed that IMPORTED_LOCATION is the absolute path
of the library within the framework. That's not the case with CMake 3.28
anymore. There, IMPORTED_LOCATION is the absolute path of the framework
directory.

The relevant upstream CMake change is
6b01a27f901b5eb392955fea322cde44a1b782a3.

Pick-to: 6.5 6.2
Change-Id: I6b702a28318e0978c56dec83c398965aa77ef020
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 0efea8020c1d221635aaa0a71529edb392cfe3cc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:33 +00:00
Thiago Macieira
1bb4c33708 QProcess/Unix: update the close-file-descriptors feature with a minimum
So that one can pass a few extra file descriptors to the child while
still closing all the rest.

strace -f of this test showed on Linux:

[pid 117952] dup3(4, 0, 0)              = 0
[pid 117952] dup3(9, 1, 0)              = 1
[pid 117952] dup3(11, 2, 0)             = 2
[pid 117952] close(12)                  = 0
[pid 117952] dup2(100, 3)               = 3
[pid 117952] close_range(4, 2147483647, 0) = 0
[pid 117952] execve("testUnixProcessParameters/testUnixProcessParameters", ["testUnixProcessParameters/testUn"..., "file-descriptors2", "3", "100"], 0x561793dc87d0 /* 120 vars */ <unfinished ...>

Change-Id: I3e3bfef633af4130a03afffd175e984bf50b558d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit abd2ffc1497e6d13a607362f7f4362e2a6d00448)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-12 11:12:32 -07:00
Jaishree Vyas
4b26cb5866 Doc: All overviews list categorization
The \generate list names are added for each categorized section with
some explanation. Here, calling the overviews as
explanations-(name of the section). The idea is to give general terms
instead of specific phrases like 'core' etc, for better understanding.

Task-number: QTBUG-115347
Pick-to: 6.5
Change-Id: I673e38c0e9193b7f7d54008bfcf82c2d3a10be3f
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 29eb5d8ace744cd4a946aca3f5f1ffe0f4bd0a1f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:32 +00:00
Fabian Kosmale
37e3596808 QAccessibleWidget: Remove pointless ZWSP in warning message
There doesn't seem to be reason for it to exist, and apparently it
causes compilation failures with icc.

Fixes: QTBUG-116517
Initial-patch-by: Yorick Bosman
Change-Id: Ic2ed1d4318d522851278afa7f9791441af4fa709
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ca4633f243a23de1848ebf32aef45f23d6d18154)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:32 +00:00
Laszlo Agocs
faee1c1640 Fix backing store compositor transform with Vulkan
The problem does not become apparent until a QQuickWidget or QRhiWidget
using Vulkan is put into a QScrollArea and then attempted to be scrolled
vertically.

Fixes: QTBUG-116338
Change-Id: I55367b51aaf2bb8d039bf5e313a0d8c3d7908327
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 750d00aba7e49b6093bc273924ba688cb433b505)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:32 +00:00
Alexey Edelev
b984680021 Require the C++17 standard for configure-time syncqt
Require the C++17 standard, but not what is set by Qt for syncqt,
to avoid unwanted standard check in some corner cases.

Pick-to: 6.5
Task-number: QTBUG-116789
Change-Id: I34e07e172e31d5ffc69b84dd3ef30f02f6e75a9d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 7a70c6fcfd5d3e000b80ab9b833f4e2b14a3563d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:32 +00:00
Tor Arne Vestbø
b46607000e Rework QIcon theme documentation
Generalized the documentation, and clarified behaviors,
in preparation for adding additional platform icon engines.

Change-Id: I4a694dc2cedd08cb195c738048c7dae72cbfe867
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 17dc1e2152c424343526962ce710cf4b2bbd920d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 18:12:31 +00:00
Vladimir Belyavsky
8f07015af8 QWindow: avoid extra window resize on changing min/max sizes
Amends e7477e8934ab38722f5589914d08b3f15e870109.
Do not call QWindow::resize() on changing min/max sizes if
bounded window size has not changed. Otherwise it may unexpectedly
reset window's state on some platforms, like Windows and Linux.

Fixes: QTBUG-115699
Pick-to: 6.5
Change-Id: I217ca3fd854a1f41d6df312e3258734d1d3bce45
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7efc0f6f1994a06359deb859fd73126d576df226)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 14:17:05 +00:00
Rym Bouabid
a88f26f7e4 Revamp Mandelbrot example: Fix Includes
Reorder the includes following the coding conventions.

Remove unneeded includes.

Add needed includes to avoid Transitive includes.

QGestureEvent is passed by a pointer in the gestureEvent method in
mandelbrotwidget.h. So, we do not really need to include the header.
Instead, forward-declare QGestureEvent class in a namespace.

Task-number: QTBUG-108861
Pick-to: 6.5
Change-Id: I48cfd663bf98350281ef7f31e6c0ef3e301a08ca
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit a4d7a4ccb39daa86ee2ef23b1408344822ae7c16)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 14:16:31 +00:00
Rym Bouabid
364c409e9f Revamp Mandelbrot example: Use a Literal operator to create QString
Create QString at compile time using the literal operator""s instead of
using pointers to characters. This way, no conversion or allocation will
occur at runtime.

Task-number: QTBUG-108861
Pick-to: 6.5
Change-Id: I4fb51d74abbbfa08fb9fddfa90d8afcebd82a7e2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit ae0d545d31b480ca65e93e5af5f4649caabaa683)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 14:16:25 +00:00
Rym Bouabid
f1adbc7bfe Revamp Mandelbrot example: Fix too long lines
Fix code lines that do not respect the 100 characters limit rule.

Task-number: QTBUG-108861
Pick-to: 6.5
Change-Id: Idbc148b77b52a359d972233c977bbf2ccf9fcd24
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 36c2a9c51435739b51df7f95d1589bed7db7bcd7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 14:16:15 +00:00
Santhosh Kumar
41a21e8ac3 Update documentation for QPalette::accent API
The documentation for QPalette::accent had been missed and its updated
as part of this patchset.

Amends patchset 17c589df94a2245ee92d45839c2cba73566d7310.

Fixes: QTBUG-116930
Change-Id: Iaa53e15dbecaa3c741e2db013c96b4424be39e91
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit e418980b2fbd60a778f469b0d6852aab28df9001)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 14:15:50 +00:00
Giuseppe D'Angelo
df1f97a5b2 QProcess: zero-fill a struct sigaction
Otherwise valgrind (rightfully) complains:

==75693== Syscall param rt_sigaction(act->sa_flags) points to uninitialised byte(s)
==75693==    at 0x597E5F3: __libc_sigaction (libc_sigaction.c:58)
==75693==    by 0x5105CE4: QtVforkSafe::change_sigpipe(void (*)(int)) (qprocess_unix.cpp:145)
==75693==    by 0x51083AA: (anonymous namespace)::QChildProcess::startProcess() const (qprocess_unix.cpp:911)
==75693==    by 0x5106442: (anonymous namespace)::QChildProcess::startProcess(void*) (qprocess_unix.cpp:330)
==75693==    by 0x5A61BB3: clone (clone.S:100)
==75693==    by 0x1FFEFFE3DF: ???
==75693==    by 0x857E86F: ???
==75693==    by 0x1FFEFFE3EF: ???
==75693==    by 0x5102C09: std::tuple_element<0ul, std::tuple<QProcessPrivate::UnixExtras*, std::default_delete<QProcessPrivate::UnixExtras> > >::type const& std::get<0ul, QProcessPrivate::UnixExtras*, std::default_delete<QProcessPrivate::UnixExtras> >(std::tuple<QProcessPrivate::UnixExtras*, std::default_delete<QProcessPrivate::UnixExtras> > const&) (tuple:1796)
==75693==  Address 0x1ffeffe148 is on thread 1's stack
==75693==  in frame #0, created by __libc_sigaction (libc_sigaction.c:43)
==75693==

Change-Id: Ib5a18fb76f2b7c2c1604e73ff64a251a0418c63c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 91dcc76fc13d2ebbac9aa326f8c6d453a93a05bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 07:59:08 +00:00
Pranta Dastider
50cee3d508 QtDoc Global: Add macros for Qt Design Studio in qtdoc
Adding some Qt Design Studio macros for global
qtdoc use. This would ensure flexibility for
the documentation writing.

Task-number: QDS-10142
Change-Id: Id61a68d124aad1b8c8f9e17358fb5990efbab5de
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit c33fd574c970eb920a899a9caccb2e6b1838ee19)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 07:59:08 +00:00
Giuseppe D'Angelo
3b67d5a5d1 QProcess: remove a XFAIL for QNX
91dcc76fc1 might have fixed the underlying issue, so we no longer
need the XFAIL codepath at all.

Fixes: QTBUG-114720
Change-Id: I67ccbed67a0536b679c50c26eb0b3e51c93dceeb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2f945aaa263d4688724d11e6ba7f768c4dc6bdd0)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-09-12 07:59:08 +00:00
Anu Aliyas
9dd2dd4ab4 [windeployqt] Copy v8 context snapshot
- Copy v8 context snapshot while creating package with windeployqt

Fixes: QTBUG-116777
Change-Id: I707e1d147ebf0ba5ee63dd25218e23ac850efe45
Reviewed-by: Michael Brüning <michael.bruning@qt.io>
(cherry picked from commit 8c468fc2ab3bdfb4f49eb9db10db0fb805d64180)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 01:12:25 +00:00
Tor Arne Vestbø
9f3c74bfab cmake: Don't pass -undefined,error to Apple linker
Error is the default for this option in ld64, and with the new linker
in Xcode 15 the option was deprecated, causing a warning, so let's just
skip adding it and assume undefined symbols results in errors.

Fixes: QTBUG-116732
Pick-to: 6.5
Change-Id: I736a891ae102fe1dfb2cdf869f42c665e231adba
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit c00b17de6620c9339be39ca35fea98e19951e72f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 01:12:25 +00:00
Tor Arne Vestbø
8efaa9f830 xcb: Implement native window helper for embeddedwindows/foreign window test
Change-Id: I73720f8f49a5d7e5df7c95bf4b17ef910180e01c
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 3cb3c1d9a8e5cfe262be8d6e9800f604d4d48c97)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 01:12:25 +00:00
Ivan Solovev
d28a9f512e Add QSqlField::swap() documentation
Fixes: QTBUG-116937
Change-Id: Ic5f08c3a7d0f2c0c926ced0d194fd5a2aea191fd
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5a1a80861f2abff08cc811cd01512199a1722c3f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 01:12:25 +00:00
Giuseppe D'Angelo
170a2594f4 QPolygon(F): streamline the QDebug streaming operator
Just re-use the private functionality present elsewhere. As a drive-by
fix this will also properly separate the individual points with commas,
making the output readable again.

Before:

> QPolygonF(QPointF(0,0)QPointF(93.75,0)QPointF(93.75,62.5)QPointF(0,62.5))

After:

> QPolygonF(QPointF(0,0), QPointF(93.75,0), QPointF(93.75,62.5), QPointF(0,62.5))

Change-Id: I0cf0408bfb2fe72974e4dbd5d2958c5a2aa56b5f
Pick-to: 6.5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit c7486cd665e201dd48f49312681de4a776fbe558)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 01:12:25 +00:00
Paul Wicking
75779446e6 Doc: Add missing since to enum value
Task-number: QTBUG-116848
Change-Id: Ia137a21de5bab406a133ee032b6ccf3089de8d22
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Fredrik Ålund <fredrik.alund@mimer.com>
(cherry picked from commit 8f448d7ac77438c79314e140101bc2ddc14afcdd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-12 01:12:25 +00:00
Morten Sørvig
7549f7fdb0 wasm: don't crash if app is deleteLater()ed
We check for a valid event dispatcher when waking up,
but there was no check after processing queued events,
and processEvents() would continue with a stale this
pointer if one of the queued events happened to delete
the application object.

Fix this by checking if this is still a valid pointer
after processing events.

Fixes: QTBUG-116330
Change-Id: Ic4d91298986847e6095ce9daea51a4b974106c06
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit fefb1e18b1b6834ea344bed273735f096c61eb90)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-11 18:51:24 +00:00
Giuseppe D'Angelo
43cfa11b31 QCOMPARE: restore compatibility with braced-init-lists
a611a9f537f1187825339c2a2214c8ec4a23680f (in Qt 5) added support for
mixed-type comparisons through QCOMPARE. That commit added a new
overload for qCompare taking two types, T1 and T2; but it also left the
same-type qCompare(T, T) overload around, guarded by a Qt 6 version
check.

The mixed-type version is however not a generalization of the same-type
one, because it won't work if one of the arguments doesn't participate
in FTAD. Case in point: braced-init-lists. In Qt 5 this worked:

 QCOMPARE(some_container, {42});

but in Qt 6 it does not work any more. The mixed-type overload fails
deduction (can't deduce T2); in Qt 5 the same-type overload deduced
T=SomeContainer, and {42} was used to select a constructor for
SomeContainer.

--

There's a partial, straightforward workaround for this: default T2 to
T1 in the mized-type overload. In that case T2 has a "fallback" if it
cannot be deduced. This is partial because of course doesn't address
the case in which T1 cannot be deduced, but I don't think that is
common at all.

QList is special here, because it has qCompare overloads that makes it
comparable with arrays, initializer lists and more. I don't like that
very much -- we should probably have a qCompare(input_range,
input_range) overload, but that's an exercise for C++20.

Change-Id: I344ba33167829984978cd8d649a1904349a9edab
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5560723e9dd8f32a2fb2530b975ba0bb0f9f5ef7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-11 16:12:03 +00:00
Ivan Solovev
f5c68d0e89 QCborValue: add benchmark for operator[]
In order to test the impact of migration to QASV.

Task-number: QTBUG-101707
Change-Id: I17f84ca98fc87d89bb4cd6ad98c8a12aecd315ee
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 516d828f240c3166a057372dde6cbec4ea6d380a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-11 07:27:30 +00:00
Giuseppe D'Angelo
1255def0f2 QAbstractProxyModel: delay headerDataChanged emissions when inserting/removing rows/columns
33c88f86b5b8714977719a8ccff0f7c15c9cbd44 added some logic to QAPM in
order to have it automatically emit headerDataChanged when rows/columns
were added or removed in the model. This was done as a stopgap measure
to prevent QAPM from asking for illegal indices in order to implement
automatic remapping of the section headings (since there's no
mapSectionToSource).

The commit seems to have introduced a regression in QHeaderView, which
isn't prepared to receive headerDataChanged while a row/column count
change is in progress. When receiving headerDataChanged, QHeaderView
will try to read the row/column count and will store it internally.
When it will then receive the signals for insertion/removal of
rows/columns, it will interpret it as a modification of the previously
stored value -- even if the value it stored was already correct.

Fix this by avoiding to have two signals in flight at the same time;
emit headerDataChanged as a queued invocation.

Task-number: QTBUG-114225
Change-Id: I521465a852b8c7135f22f730ead41dca760ba428
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit a0bcad39033bddd9b9d14a524b829513105913d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-10 22:42:57 +00:00
Kai Köhne
c3c5323e6c Doc: Add documentation for added QNativeIpcKey overload
Document new implicit constructor introduced in the commit 08605f0d78485

Fixes: QTBUG-116870
Change-Id: I518f0a043d7738698ae568ce0b51db3f2c28574f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
(cherry picked from commit ef748095fe587446838428fdc44a9389be81f833)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-10 22:42:57 +00:00
Kai Köhne
515a0faf85 Doc: Mark QEvent::DevicePixelRatioChange as new in 6.6
Fixes: QTBUG-116872
Change-Id: I5094a0c0f3deed1e4f6b59e577367c220be8774e
Reviewed-by: David Edmundson <davidedmundson@kde.org>
(cherry picked from commit 7c5e64eb0a0e425229782244789ebdc1749311ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-10 22:42:57 +00:00
Kai Köhne
dce0b8ea69 Doc: Remove see also self-reference in QFileInfo
Change-Id: I83f42f85e838c953b19dbcbb8d656408ed148934
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9aaeb1bb3dc2b24b3dce0cf9943c0bfa2ab191cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-10 22:42:57 +00:00
Ahmad Samir
030793accd QDataStream: clarify QDataStream::operator>>(char *&s) API docs
The wording was slightly ambiguous giving readers the idea that it will
scan for a \0 terminator in the data; however what actually happens is
that readBytes() gets the length of the string from a quint32 in the
stream right before the data, and readBytes() always adds a
null-terminator.

Fixes: QTBUG-3287
Change-Id: Ie22500a9c191ffd590a6b57babeb67577c24dddb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 74098981bd42e6bc135c22506e5a910e37544406)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-10 17:26:39 +00:00
Ahmad Samir
046ea6b707 QElapsedTimer: document Duration and TimePoint typedefs
Fixes: QTBUG-116876
Change-Id: I71215d9f9e3caf0c50635a86c65c94a6f097cbe0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3fbcf53828c039d1210e203c8c631d10e26deee1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-10 14:31:56 +00:00
Thiago Macieira
23c87ff341 QLogging: attempt to free memory in qt_message() before abort()
Just so memory leak checkers won't complain.

Change-Id: I2b24e1d3cad44897906efffd177fb9ddf0eb0a2a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit b24630ce028847e52dfcf23769f5d19fb1c33c03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-10 03:37:29 +00:00
Thiago Macieira
02fd6ca5e7 QLogging: deduplicate calling of isFatal()/qt_message_fatal()
Just roll everything up into qt_message().

Change-Id: I2b24e1d3cad44897906efffd177fb9867131b795
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 88e9ce201b9599db7470c7879e0bf29262501a42)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-10 03:37:25 +00:00
Heikki Halmet
92ae4071dd Add feature to disable building tests
IFW requires static build of Qt which does not build tests on all
configurations. This allows building modules without them building tests. Previously IFW used 5.15 repos, those build tests in test workitem, not running into the issue.

This is only relevant if the tested repo i.e IFW implements it's own
test instructions.

Change-Id: I1e03f3b577d7be314f92ed3989e5f6daf2a46da1
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit 409aa8d097a424c6281653d8c4dc3bc1c46054ed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-09 17:21:22 +00:00
Kai Köhne
e6157e356a Doc: Fix documented default for QCalendarWidget maximumDate, minimumDate
The default minimum date and maximum date for QCalendarWidget are not
the 'earliest and last dates' that QDate class can handle. Instead,
minimumDate is initialized to November 25, 4714 BCE (first Julian day),
and maximumDate to December 31, 9999 CE.

Change-Id: Ice9289853a7e825ff2b31567efb81cdfb7d678a1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 99371811594e813f26e014a3adc629746231765b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-09 14:52:56 +00:00
Kai Köhne
8145c7d2dd Mark linux_perf_event with GPL-2.0-only
"GPL-2.0" as a SPDX identifier is deprecated in SPDX 3. Use
the more explicit GPL-2.0-only instead.

Change-Id: Ie543135ad1d73205f7a94db140189f5132098ea2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 8550d60acaead1f5a148f8e8e8384798dc6cd071)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-09 14:51:44 +00:00
Kai Köhne
5700a3355c Mark freetype as GPL-2.0-only
GPL-2.0 SPDX identifier is deprecated. Use the more explicit
GPL-2.0-only instead. Also, in SPDX expressions AND and OR
need to be all uppercase.

Change-Id: I0875cf3b9b2020f69e3318d5ff314988a3992409
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 0b3b1ab26c126701c8ac317d94d80858f0bb2ec7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-09 14:51:32 +00:00
Assam Boudjelthia
0ef9d8a49a CMake:Android: Add jar files to a ${target}JarSources
For better integrations with Qt Creator, add a custom target with
the Jar files so they are shown under the project files. Since
source_group() is not supported, add_custom_target() is used.

Change-Id: Ie527fdce918d526ee6e8953e27d4e0f4131a9828
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit c76918eca2a964906f1c2a59886b3b6892ffe264)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-09 10:09:16 +00:00
Tor Arne Vestbø
eb5f183754 Add note to QMessageBox::button() about modifying returned button
We don't have a good way to detect whether the button is modified or
not, to bail out of using the native dialog helpers.

Document that this API shouldn't be used to modify the standard
buttons (they are standard after all), and recommend the explicit
APIs for adding custom buttons instead.

Fixes: QTBUG-112525
Change-Id: I38c8ef5e1717a85f0db59c9e705d0775982ffb57
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e9a1c53214d3936721e00bebbdc1e949e10658dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-09 10:09:15 +00:00
Tor Arne Vestbø
259b3148ab doc: Fix links to QMesssageBox::Option::DontUseNativeDialog
Change-Id: Icb6f28bb17ade242f6ef5dcc4ea65611a6abe9f0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a7bfe58989270af694c5ce137b054da8e888adb9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-09 10:09:15 +00:00
Volker Hilsheimer
61cd31a67d macOS file dialog refactor: don't heap allocate string and string list
We always allocated them in the constructor function, and never tested
them for nullptr, so just manage them as regular members.

As a drive-by, apply const to read-only variables in relevant code.

Change-Id: If0a3ac8982582f2adf5187a3c0357f4da93467fb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit a7b50c40a0af8e617b73f581c019d0f16f7d04d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-09 03:10:57 +00:00
Fredrik Ålund
df55581a79 Add macOS support for the Mimer SQL QtSql plugin
Make sure the Mimer SQL include files and libraries are found
to enable the Mimer SQL QtSql plugin.

Fixes: QTBUG-111219
Change-Id: Ieee0e26f3689dd373fda81c98180066927d25b40
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d21003fc48f26712eedb2798db57e04120f9101f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-08 21:01:22 +00:00
Ivan Solovev
974e5986ba QItemSelectionModel: fix binding loops
... by using valueBypassingBindings() when accessing the properties
from the setters.

Also adjust initModel() to use the raw pointers instead of accessing
the property when comparing the value and doing all connections.
This change is safe, because initModel() is a private method that is
only called from the constructors of the class and the setter.

Task-number: QTBUG-116346
Change-Id: I6ecde571aeed74077099c6bf8f66736ba14d29f8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 9578485f35d7942e190c5ea8f5c187644a4e4c6b)
2023-09-08 18:35:05 +02:00
Marc Mutz
806a24a57d tst_QHashFunctions: fix std::pair test to use QFETCH_GLOBAL seeds
Because the local `seed` variable shadowed the member one, this test
was run for each QFETCH_GLOBAL with the same data and seed. That
doesn't make sense, so make the test use the member variable `seed`,
as all other tests already do.

Since zero is one of the seeds coming from QFETCH_GLOBAL, drop the
seedless calls to qHash(), too.

Amends 64bfc927b09b46bb7fc0dc6caf1bf1a4d4133ab4.

Change-Id: I1e22ec0b38341264bcf2d5c26146cbbcab6e0749
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 9c63667d01eb13f43d3b51a8a3502bfc233d6b0b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-08 16:35:05 +00:00
Marc Mutz
b0d6fe9ad1 tst_QFont: fix -Wsign-compare
Amends 17f8e2c441f2302f1df19053208f77f7fb60e1f1.

Change-Id: I896027866c11b5e135c39848cefcf45942f1cf99
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit defabd265e69fb2cfb07ac2bf265578373604809)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-08 16:35:05 +00:00
Marc Mutz
d1f2b9dcc8 tst_QHashFunctions: test with actual 64-bit seeds
The old code only tested with seed = 0 and seed = 1045982819, the
latter being a "random number", which, however, fits into
32-bits. Since Qt 6.0 increased the seed from uint to size_t, amend
the test to actually test a seed value with some of the upper half of
bits set, too, also in 64-bit mode.

While we're at it, also test with each seed's bits flipped for extra
coverage.

Remove a static assertion that prevented testing seeds with the MSB
set.

Change-Id: I5ed6ffb5cabaaead0eb9c01f994d15dcbc622509
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 8ca319a172b84207be404ed3bb619c3548a802da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-08 16:35:04 +00:00
Marc Mutz
2265a1efd7 QLibraryInfo: fix GCC ubsan build
Same bug that plagues tst_qbytearrayview.cpp, similar fix: drop the
static checks for GCC. Except that here, following code uses the
variable, so it needs to exist. Fortunately, the GCC ubsan bug does
not affect construction from a string literal, so we can use
that. This is losing the position checking for "." in qtConfEntries,
but the the original author (Thiago) informs me that was just a way to
save two bytes, we don't actually need the assertions, so remove them.

As a drive-by, remove the unneeded, and potentially pessimizing
(forces the compiler to allocate storage for it in the binary), static
keyword from the constexpr variable, which should more than make up
for the extra two octets.

Change-Id: I88397ac61c5cd8f53d39e957212c895239aace04
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit de6f4053139377b63cf92f6bca4d96d488682de4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-08 16:35:04 +00:00
Safiyyah Moosa
92e3f5250a Doc: Add \examplecategory for qtconcurrent
Task-number: QTBUG-116071
Change-Id: I7413a0d8085eec38e6480f6aa21c85620ca68f54
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit a1d308a316cb91b303f6d1bdfdb604f709a5df59)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-08 16:35:04 +00:00
Tor Arne Vestbø
d514557091 CoreText: Resolve color scheme (dark mode) via the platform theme
We might be drawing glyphs outside the main thread, which triggers
the main thread checker for our access to NSApplication from
qt_mac_applicationIsInDarkMode().

Change the CoreText font engine to pull out this information from
the theme instead, and teach the theme to only updates its color
scheme on the main thread.

Change-Id: I02be713d9705c6e0c21107db7f7de039182f601d
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 6cf4c5b98fb0e3f30379d79003ab587aadebbce7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-08 08:46:33 +00:00
Volker Hilsheimer
c462d33d3d QComboBox on macOS: guard against destruction while native popup is open
Since showing the native popup on macOS is blocking and processes events
the QComboBox might get destroyed while the popup is open. Guard against
this by using QPointer and returning early (dismissing the scope guard
that would otherwise reset the menu's parent, writing to freed memory).

The problem is then that the native popup remains visible, as the
destructor of QComboBox calls cleanupNativeCombobox which destroys the
platform menu (i.e. the QCocoaMenu instance), but that doesn't dismiss()
the popup. Add a call to dismiss() to the QCocoaMenu destructor to make
sure that destroying the menu closes it first.

Fixes: QTBUG-116155
Change-Id: If0ac19796603667f4c8e80c302710dc4c9aded50
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 03d62322b239772e0440cee9ce7576147239f339)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-08 08:46:33 +00:00
Dennis Oberst
45bf63676d QArrayDataPointer: remove Q_CHECK_PTR in assign(it, it) again
This commit reverts 2d77051f9dfd11ae292ad4bac2f28c5f7a0e7f83.

When requesting an allocation of size 0, we will actually get
a nullptr.

 qarraydata.cpp:
    ~~~
    if (capacity == 0) {
        *dptr = nullptr;
        return nullptr;
    }

This will let the Q_CHECK_PTR trigger falsely. Such an occurrence was
initially detected during the cmake_automoc_parser build-step.

Found-by: Marc Mutz <marc.mutz@qt.io>
Task-number: QTBUG-106196
Change-Id: Icb68c5dd518c9623119a61d5c4fdcff43dc4ac5d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3db9ef358da817480d6f4c055d85a6aa7be17991)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-08 08:46:32 +00:00
Alexandru Croitor
a169728d7f CMake: Add a helpers file for commands to run in the top-level dir
It makes sense (in my opinion) to have the top-level CMakeLists.txt
to include and call certain commands that should be controlled by
qtbase, to avoid submodule update difficulties when we want to do
changes in qtbase that shouldn't concern the top-level file.

Create cmake/QtBaseTopLevelHelpers.cmake and move some pre-existing
code from the top-level CMakeLists.txt into separate functions that
are defined in qtbase.

This file will be included in the top-level one and said commands will
be called there.

This also prepares for qt_print_build_instructions not call
qt_internal_qt_configure_end anymore, because it will be called
by the top-level project.

Change-Id: I1fe3490001cf441d742c64b2ef1f267cd4362f6a
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 6add599079f3b653256957eeca2042095711d04e)
2023-09-08 10:46:32 +02:00
Alexandru Croitor
086a22c4fc CMake: Handle INPUT_foo values when detecting dirty builds
Before this change, the dirty feature code only checked for
differences between FEATURE_foo and QT_FEATURE_foo, without taking
into account modified INPUT_foo values that might passed via the
configure script.
This led to issues in certain scenarios when reconfiguring with the
configure script.

For example configuring with -gui / -DINPUT_gui=ON and then with
-no-gui / -DINPUT_gui=OFF would fail saying
  'Feature "widgets": Forcing to "ON" breaks its condition'

This happens because the widgets feature depends on gui being
available, but because INPUT_gui modifications don't trigger the dirty
feature re-eval code, we don't recompute the value of widgets.

Extract the code that takes into account the INPUT_foo variables into
a separate function, and use it both when computing feature values and
also when detecting dirty features.

This means any non-matching INPUT_foo variables will now also trigger
dirty feature checking.

Use the same function to replace the duplicate code we have to early
initialize the developer-build, no-prefix and pkg-config features.

Task-number: QTBUG-112957
Change-Id: I775cf70b48291a659b0fecf7cb9570ec12735bca
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 4d86ca8c4ef1797dd697f3f35fc023d5b50e4664)
2023-09-08 10:46:32 +02:00
Alexandru Croitor
bb66e67b6c CMake: Rework INPUT_foo vars handling when reconfiguring
To be able to reconfigure Qt with modified feature values using the
configure script, and take into account INPUT_foo values, we need to
ignore FEATURE_foo values. But we can't always ignore FEATURE_foo
values, because users might want to toggle them by editing
CMakeCache.txt or using an IDE.

What we can do is tell CMake we are configuring via the configure
script, in which case we can mostly be sure that any passed
INPUT_foo values should have higher priority than pre-cached
FEATURE_foo values.

We also need to remove all the cached INPUT_foo variables after they
have been used for feature computation, so that subsequent
reconfigurations where an INPUT_foo is not passed anymore, doesn't
cause a feature to accidentally reuse the previous (stale) value.

Pass -DQT_INTERNAL_CALLED_FROM_CONFIGURE=TRUE to CMake when configuring
via the configure script, and use that as a marker to make INPUT_foo
values have a higher priority.
This needs to be done centrally in qt_evaluate_feature and also in a
few more locations where we check INPUT_ values, like the developer
build and pkgconfig features.

Because QT_INTERNAL_CALLED_FROM_CONFIGURE would become a cached
variable, we want to remove it at the end of the configuration phase,
so that future 'cmake .' reconfigurations are not considered to be done
via configure.
To do that, we unset it right at the end of
qt_build_repo_end in a per-repo build, and in the final
qt_print_build_instructions call in a top-level build.
The latter needs a cleaner fix in follow up commits in qt5.git and
qtbase.

Task-number: QTBUG-112957
Change-Id: I3fd338092041ef09e3f5a4dfbaf61da5deea0514
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 2799391703e44a34b6557e234462e425a61785f2)
2023-09-08 10:46:32 +02:00
Alexandru Croitor
238e18e385 CMake: Fix toggling of FEATURE_developer_build and some other options
Previously if Qt was configured with -developer-build, configure
would pass to CMake -DINPUT_developer_build=ON, which will ensure that
both FEATURE_developer_build and QT_FEATURE_developer_build are set to
ON.
Then if somebody tries to toggle FEATURE_developer_build to OFF in
the CMakeCache.txt and rerun cmake, the feature will bounce back to ON,
due to the code in QtSetup.cmake that doesn't take into account if
FEATURE_developer_build is already defined, and thus reset it based
on the value that is cached in INPUT_developer_build.

Change the checks for INPUT_developer_build and INPUT_no_prefix,
to take into account the defined-ness of their
FEATURE_ counterparts.
If they are defined, ignore the INPUT_ values.

This allows toggling the FEATURE_ variables and also aligns with
the INPUT_ handling behavior that we have in qt_evaluate_feature which
ignores INPUT_ values once the FEATURE_ is defined.

While this aligns the behavior with other features, there is still a
problem.

If you first configure without -developer-build,
and FEATURE_developer_build is set OFF, and then reconfigure with
-developer-build, because FEATURE_developer_build is already defined,
the INPUT_developer_build=ON is ignored.
This is a problem for other features as well and will be handled in a
follow up change.

Task-number: QTBUG-112957
Change-Id: I4f31157b0e7963e4d43e28062a585e939ceea0c1
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 17efffe1ad6b85f45f418d5d08b5e85a456b12e3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-08 10:46:32 +02:00
Alexandru Croitor
43326b3802 CMake: Recompute features when dependent features are marked dirty
Before this change, if a user toggled a FEATURE_foo variable, we only
recomputed the value for dependent features who's CONDITION would break
with the new value. If the CONDITION was not broken, the dependent
feature value would remain unchanged.

For example if FEATURE_developer_build was OFF, and the user
toggled it to ON, the FEATURE_private_tests value would remain OFF,
because OFF is a valid value for private_tests' CONDITION.

But we would like FEATURE_private_tests to become ON if we toggled
FEATURE_developer_build to ON.

To address this case, we need to recompute features who's dependent
feature values have changed.

The algorithm introduced by this change is:
- keep track of initial dirty features, aka track when FEATURE_foo is
  different from QT_FEATURE_foo. We expect FEATURE_foo to be the
  variable that a user toggles in the cache file or an IDE.
- when evaluating feature values, collect feature dependencies from
  the various expressions given to options like CONDITION, AUTODETECT
- if any feature dependency is marked dirty, reset the feature value
  to its auto-computed value and mark the reset feature as dirty
- repeat for all feature evaluations

Because feature evaluation is eagerly recursive, we will successfully
reset all features that need resetting.

To ensure against unforeseen breakages, allow disabling this behavior
by configuring with -DQT_NO_FEATURE_AUTO_RESET=ON

Adjust some of the messages to contain more details.

Note that the pre-existing behavior of resetting feature values when
the condition can't be satisfied, stays. For example if
FEATURE_developer_build is OFF and FEATURE_private_tests is manually
toggled to ON, it will reset to OFF
because its condition can't be satisfied (developer_build is still
OFF).

Amends 61943aefd68b7d88c5eb395c4e44d08a94a70ad0

[ChangeLog][Build System] The build system will now try to recompute
configure features when dependent feature values are toggled by the
user.

Fixes: QTBUG-96936
Task-number: QTBUG-85962
Task-number: QTBUG-112957
Task-number: QTBUG-116209
Change-Id: Ib627f3675df8a3b08f4936cdc9c51f2d6e15f58c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 65e04162d17dfe2d18fa302c930f0a3d68131a2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-08 10:46:32 +02:00
Alexandru Croitor
010ab170cb CMake: Move dirty feature / dirty build detection into QtFeature.cmake
It makes more sense for it to live next to the other feature code.

Task-number: QTBUG-96936
Task-number: QTBUG-85962
Task-number: QTBUG-112957
Task-number: QTBUG-116209
Change-Id: I8438e6fce9deaa5e709e4b0e2e1ea4eb0600a89a
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit c1d2356856481b32099cfc8fd5e6fdc856ea7d31)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-08 10:46:32 +02:00
Alexey Edelev
b211c84505 Do not override the generator type in configure script
If '-G<generator type>' is passed to configure script we should respect
this argument but not override it by the autodetected generator type.
'-cmake-generator' option will still have higher priority, but if
generator is set using CMake argument it will not be auto-detected by
other build config specific options, like '-debug-and-release'.

Change-Id: I75b49e33fa717f90bbd74045948fccb9f5350e8d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 139f3f61bd9d68422aa05a8d82ee3aa7897918d2)
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-09-08 10:46:31 +02:00
Doris Verria
67739448fb iOS: Add version check when setting accent color
UIColor.tintColor is only available on iOS 15.0 or newer. Ammends
commit 69cc7f946a66527c3f2b7a28510dcb37459dc33a

Fixes: QTBUG-116840
Change-Id: Id82006629ee3c3d2548ea39afde265cdccf2cdab
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 00bdf56b83e5959e8a4e9924ba9edf533f4c58ab)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-07 23:11:31 +02:00
Jaishree Vyas
63b0b25ccf Doc: Add example categories for qtopengl
Task-number: QTBUG-116069
Change-Id: If675124e538c197d3b446f09da0620718b7b7118
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit ce47799de69812681b6be0b9d3d6d5c5e980bafb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-07 08:28:17 +00:00
Dennis Oberst
62e17eae88 Update bundled zlib to version 1.3
zlib 1.3 has been available since August 18, 2023.

Version 1.3 now defines the following:

 #  define crc32_combine_gen     z_crc32_combine_gen
 #  define crc32_combine_gen64   z_crc32_combine_gen64
 #  define crc32_combine_op      z_crc32_combine_op

We patched those in manually with qtpatches.diff, so we update it to
reflect these changes.

Updated the diff with 'git diff --relative > qtpatches.diff' from within
the 3rdparty/zlib directory.

Since updating zlib always requires some manual intervention add a
minimal guide that will be printed on using import_from_zlib_tarball.sh.

As a drive-by fix an error in import_from_zlib_tarball.sh where passing
in a path already containing a backslash as:

 import_from_zlib_tarball.sh zlib-1.x/ ./

would append another backshlash to that path (zlib-1.x//). Furthermore
add the '-v' flag to the copy command to make it more verbose.

[ChangeLog][Third-Party Code] zlib was updated to version 1.3.

Task-number: QTBUG-116236
Change-Id: Ib7c8698035e1e049b455308c5774fcaf88b7622a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 3652cdf6c78d22126c4f2ec363f338169330c849)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-07 05:49:21 +00:00
Volker Hilsheimer
9044a8e035 Dialogs: clean up native dialogs when object gets destroyed
QWidget::setVisible is virtual, and called via hide() by both the
QDialog and the QWidget destructor. A dialog that becomes invisible
when getting destroyed will at most execute the QDialog override.
Subclassing QDialog and overriding setVisible() to update the state
of the native platform dialog will not work, unless we explicitly
call hide() in the respective subclass's destructor.

Since e0bb9e81ab1a9d71f2893844ea82, QDialogPrivate::setVisible is
also virtual, and gets called by QDialog::setVisible. So the clean
solution is to move the implementation of the native dialog status
update into an override of QDialogPrivate::setVisible.

Add test that verifies that the transient parent of the dialog
becomes inactive when the (native) dialog shows (and skip if that
fails), and then becomes active again when the (native) dialog is
closed through the destructor of the Q*Dialog class. The test of
QFileDialog has to be skipped on Android for the same reason as the
widgetlessNativeDialog.

Fixes: QTBUG-116277
Change-Id: Ie3f93980d8653b8d933bf70aac3ef90de606f0ef
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 505ed52cd4dcef081d9868424057451bd1dce497)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-06 23:21:53 +00:00
Volker Hilsheimer
864544eb1a QFontComboBox: inform accessibility about model reset when filter changes
Signals are blocked explicitly, so the modelReset signal that would
normally make the view update the accessibility framework does not work.
Update accessibility explicitly.

Fixes: QTBUG-114423
Change-Id: Iba6f0b9dfb258e85111326184d7899bf0570a5c1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit a0b7eee6c6af8d233e3bb7bd5c39f9059ec994f0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-06 20:52:06 +00:00
Thiago Macieira
cd917e8999 Doc: remove erroneous statement that signals can't have return types
They can (it's just very, very unusual).

Fixes: QTBUG-116695
Change-Id: I2b24e1d3cad44897906efffd178178f1542e67f2
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 40e9e42bc6ea81bd22c187ba6d08954ab3e0a245)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-06 20:52:06 +00:00
Vladimir Belyavsky
f76ee96e58 QNetworkReply: fix potential nullptr access in loadFromCacheIfAllowed()
Fix a potential nullptr access in
QNetworkReplyHttpImplPrivate::loadFromCacheIfAllowed() on accessing to
QAbstractNetworkCache::data(). It is not yet clear in what cases
cached data can be null, especially if metaData is present,
but we have user reports of such crashes.

Amends a6776de0c70d23ac197682c7bef603450cb8b03f

Fixes: QTBUG-116788
Change-Id: I548065c6f809d9d45db6dd785c28acbdc77621e2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 74fb2519e32760dbe9f10a9ffd2b460d827062a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-06 20:52:05 +00:00
Ivan Solovev
355e2aa12c QItemSelectionModelPrivate: improve formatting of the connections
The formatting of the connections in the initModel() call was confusing
and made me overlook the fact that they all were directly used to
initialize the connections array.
Indent all the nested connections, and move the closing '}' to a
separate line to make the code more readable.

This commit amends 4f4a8e75ab34003a4a49b89392ae7712415ac788.

Change-Id: I607e09699a3b4865cb17639ffc75f754f4400c91
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 76617b07cf386f46a094b811373718725b14174e)
2023-09-06 22:52:05 +02:00
Axel Spoerl
f56b186f78 tst_qsslkey: Fix CMake condition
Private libraries and WrapOpenSSL were linked conditional to
QT_FEATURE_private_tests in the CMake file.
qsslkey_p.h and open ssl symbols were included conditional to developer
build. A developer build fails, with test enabled and private tests
disabled.

=> Change the CMake condition to QT_FEATURE_developer_build, to resolve
mismatch between CMake and cpp file.

Change-Id: I3ac93b02701e467a0b548c35d441d35a45c4568b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 70b57c943ad981ffe2e519fc0ab7176f83dafcd4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-06 20:52:05 +00:00
Axel Spoerl
9bd2b35bf3 QItemSelectionModelPrivate: use QObjectPrivate::connect
QItemSelectionModelPrivate::initModel() uses string based connections,
to connect/disconnet its QAbstractItemModel.
The QObject::destroyed signal is connected to modelDestroyed(), which
does not disconnect other signals.

QQuickTableView's selection model binds to its QAbstractItemModel.
The binding also reacts to QObject::destroyed
Eventually, QItemSelectionModel::setModel(nullptr) is called.
At this point, only a QOBject is left from the QAbstractItemModel.
That leads to warnings about disconnecting string based signals, which
belong to QAbstractItemModel.

This patch changes the connect syntax to the QObjectPrivate::connect
API. Instead of keeping a list of string based connections around, the
connections themselves are kept in a list member. Disconnecting happens
based on that list.
Connections are also disconnected in
QAbstractItemModelPrivate::modelDestroyed.

An auto test is added in tst_QItemSelectionModel.

Fixes: QTBUG-116056
Change-Id: I57e5c0f0a574f154eb312a282003774dd0613dd6
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 4f4a8e75ab34003a4a49b89392ae7712415ac788)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-06 20:52:05 +00:00
Ivan Solovev
e3cf47d7d7 QAbstractAnimation::setCurrentTime() - fix bindable property usage
The setter is complicated, because it reads the values of four
properties (loopCount, totalCurrentTime, currentLoop, and direction)
and modifies the values of two properties (totalCurrentTime and
currentLoop).

For the read-only properties, inroduce local variables, so that the
binding evaluation is done only once, and re-use the local variables
afterwards.

For the read-write properties, use {set}ValueBypassingBindings()
methods, because we are anyway explicitly calling notify() afterwards.
Intorduce a newCurrentLoop local variable to calculate the new value
of currentLoop, and update the actual property only once.
Use the newCurrentLoop and msecs variables instead of accessing the
actual properties when determining if we need to notify about
property changes.

The other complexity is that the setter calls a virtual
updateCurrentTime() method in the middle of the calculation.
Subclasses can override the default implementation and modify the
properties there (at least QSequentialAnimationGroup updates
totalCurrentTime property under certain conditions). Keep it in
mind and re-read the property values after the call to the virtual
method.

As a drive-by, make some pre-existing variables const.

Task-number: QTBUG-116346
Change-Id: I0a48bcabde15333e80ea2d54e308cb9438b310e7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit bfc2d69c613d9431f00ac303aed3076e0d1d4dae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-06 20:52:05 +00:00
Ivan Solovev
4c9e36ffcd QTimer: extend property tests and fix binding loop
The bindable property tests were not using the QTestPrivate helpers, so
add a new test which uses them.

The new tests revealed a binding loop for the interval property.
Fix it in a usual way by explicitly removing the binding and using
{set}ValueBypassingBindings() in the setter.

Task-number: QTBUG-116346
Change-Id: If94f57938da449a68e3527aead5ebd55ba410adb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 7d70edd31cb4c55471ad96e3a1d7114e2c081cf6)
2023-09-06 20:52:05 +00:00
Mårten Nordheim
4f55529d4a qnetworkproxy[libproxy]: Add missing include
Amends cda98280edd2ab7b8d6b3dee08281b045c470dc5

Fixes: QTBUG-116758
Change-Id: I337d946a054eb9c9e2f6ec9e8af40694b37afe12
Reviewed-by: André Klitzing <aklitzing@gmail.com>
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
(cherry picked from commit 177ffb473b7c7c7733a9b66c13f8bab71ddf2bcd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-06 17:27:58 +00:00
Marc Mutz
4daef13af8 Clean up inline keyword use in qstring.h
If an inline member function is defined outside of its class' body,
its declaration must have the inline keyword. Otherwise, in certain
situations, MinGW complains like this:

   qstring.h:1118:13: error: 'void QString::clear()' redeclared without dllimport attribute after being referenced with dll linkage [-Werror]

Fix all instances in qstring.h by

- adding the inline keyword where it was missing on the definition
  (except constexpr functions, which are implicitly inline)

- removing the inline keyword from all out-of-class-body definitions

While the latter isn't necessary for fixing the MinGW
warning-turned-error, the churn is warranted: It's enlisting all
platforms' help in checking for inline consistency (by causing
"multiple-definition errors" at link time or "inline function never
defined" at compile time when we get it wrong). If we kept the inline
keyword on the definitions, only MinGW would continue to warn, and only
in some, as of yet not fully understood, situations, so we'd have no
control over when these warnings pop up in user code.

Change-Id: I0ae78f1d8f1fa4eaec0b162ea16013669370eead
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 1c1d7ab486b87489163c56b05d10ff907e1d821d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-06 17:27:58 +00:00
Santhosh Kumar
35ee5b4eb7 Set color scheme after handling theme change in windows
Setting color scheme before handling theme change provides incorrect
palette color when user switches from light to dark or dark to light.
This is visible when using Fusion style (or other style that supports
dark mode) in Windows. The change has been made as part of patchset
787038bb1d282b4d6c5c040d8e902ccac9befb41.

It also has to be noted that handling palette changes to make further changes to the palette (or the style sheet), is less likely than
Handling the colorScheme change signal and in this sense, this patch set
can also be considered as an improvement.

This patchset reverts that change and updates color scheme after palette change in the application.

[ChangeLog][QtGui][ColorScheme] Update colorScheme property after
palette change.

Fixes: QTBUG-112653
Change-Id: I71bc413c56663fefdf9fe5871bbb19b7e6c3d9ff
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 39882a1354cb06d2b0b0a0d5b41a168041df0476)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-06 12:32:54 +00:00
Mats Honkamaa
a87bfe2c83 Doc: Add example categories to Qt Widget examples
Added example categories and fixed some minor typos as well.

Task-number: QTBUG-116359
Change-Id: I2e270a1919003f4cea233666b64437e4c2b77121
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7ef93cbf6883af053b1bdf042975b11a39f0312b)
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-09-06 09:31:43 +02:00
Laszlo Agocs
704d4597a5 d3d12: Avoid full-size staging for partial texture updates
Running the BenchmarkDemoQt6 application features a massive
startup time, followed by running out of memory (GPU-side,
assuming a discreet adapter), which is then remedied by the
system with heavy swapping. This is due to creating 8+ GB
of staging data.

While there are doubts about the application itself (seems there
is an upload for each Quick 3D Texture per material per model,
even though the texture itself is the same?), there is no reason
for the D3D12 backend to use so much more memory compared with
other backends.

That is now ensured by only creating a staging area for the data
(taking the 256-aligned row pitch requirement into account), not
simply using the subresource (i.e. the whole image) size. This is
equivalent to what e.g. the Vulkan backend does.

Fixes: QTBUG-116729
Change-Id: I1b5083c6b859ec0736cd9fd792cba8236aeba6e3
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit d5eed2c5f54da60be9bc5966a6be7c18dc77011f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-05 23:17:58 +00:00
Liang Qi
7864c01c77 widget: set WA_X11NetWmWindowType* after xcb window was created
This amends 17d68c4fc371c32bd58d0a94ac63f0170edaf29e.

Fixes: QTBUG-116696
Task-number: QTBUG-39887
Change-Id: Idf385bcbeb630ddfc51b39b2af35da3ab94b07c0
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 29b076d6143f8a4aede72c176efcc40e5b7d701e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-05 22:29:07 +00:00
Edward Welbourne
4b39596512 Minor tidies in example's XML converter
Make a local variable more local, set a variable only once its new
value is known to be valid.

Task-number: QTBUG-111228
Change-Id: Ib6aa16e8c834f89c6ccc0715f20b0e5f0a7f3b6d
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
(cherry picked from commit 40b07ee887d9717088e3189b15c86a5c87759b1d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-05 20:42:00 +00:00
Edward Welbourne
19242733aa Revise new-in-CLDR v43 enum entries to say new in 6.6, not 6.7
After the v43 update landed, a bug surfaced that was fixed by it, so
it has been picked back to 6.6, in which it has landed before 6.6.0
branched. Consequently the new enum members are in fact [since 6.6],
not [since 6.7], so update the documentation to reflect reality.

(They may also be in 6.5.3, subject to ongoing debate, but they were
not in 6.5.0 so are not [since 6.5], even if 6.5's branch does end up
describing them as [since 6.5.3].)

Change-Id: Ida938fc3e3575d6e45d61449123464ebb5b6638c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 648f6482582c1110f297b46508416e0166aaea24)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-05 20:41:55 +00:00
Edward Welbourne
9478aa74ee Exploit C++17 init-statements in if to simplify a loop
The serialization converter example's text converter's loadFile() can
be made tidier by making the conditions within its loop into a chain.

Task-number: QTBUG-111228
Change-Id: Ic82355eab7380a0c671b3805ca140958bb1c5af5
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
(cherry picked from commit d631f888042e3f3f5d4d0284c6bad8eb91e2c9a3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-05 20:41:53 +00:00
Volker Hilsheimer
a1045b2b0f QPrintDialog on macOS: Don't crash when parent is not a window
The test case is an incomplete version of the test that will be added to
verify the fix for the referenced bug report. The test crashes already
when showing the dialog without this fix.

Task-number: QTBUG-116277
Change-Id: I969a723157f6453b78bafae5cb24a6b37b1eea50
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e73f35d9c63378ed26e33f488a3ee5bb0745e9d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-05 20:41:52 +00:00
Edward Welbourne
7cd3b65980 Update datastream converter to use Qt_6_0 instead of Qt_5_0
It was added in 5.12 and we've had a few upates since then.

Task-number: QTBUG-111228
Change-Id: Iacb5368d4baa7d25f981bb0b8bd8d68b5461e17d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 833ed75b650bb870a158fa8f6e50f06e64fb90a6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-05 17:39:55 +00:00
Edward Welbourne
4091fe8516 Core serialization examples: spacing-only clang-format changes
Marc disagreed with clang-format on some, which are thus excluded.

Task-number: QTBUG-111228
Change-Id: I1402274635dba866a8160a68211874cb11dcfa61
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 670f66eed3fd81f4b7c3e6f43d06e5bb79176527)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-05 17:39:49 +00:00
Alexandru Croitor
253731e84e CMake: Don't add no-prefix define to qconfig_p.h
It's unlikely that C++ code needs to query that feature. It also
causes full rebuilds of Qt if the feature's value is toggled.

Remove the no-prefix define from qconfig_p.h.

Task-number: QTBUG-116689
Change-Id: I7d968b1c3d6bff3653e1233cea09a36579776347
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit afe158b93686a82e5f1586b1785a2fdd7e8bb765)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-05 17:39:46 +00:00
Santhosh Kumar
e9cf618a9d Reset palette resolve mask in windows vista style
The palette set by windows vista style during polish doesn't allow style-
sheet style to override it.

This patch reset resolve mask for the palette set by windows vista style
and thus it can be overridden.

Fixes: QTBUG-115511
Change-Id: Ifcaf441f806cfa0273599b3dce83fdfaec3f5a66
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 4cf92d83c3a8966fd1716939829fdbd4642810e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-05 12:28:33 +00:00
Mitch Curtis
68e2645da2 Note that QPalette::ColorRole must be kept in sync with QQuickColorGroup
Without adding the corresponding properties, they will not be available
in QML.

Task-number: QTBUG-116106
Change-Id: I233e456ced585b9274a1724cc550bc2959757104
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit bcae883274a11a6a80a901a6e2776332992ed08e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-05 05:49:51 +00:00
Ilya Fedin
91619f0e76 QGenericUnixServices: ensure xdg activation token callback is called
The callback doesn't get called if the signal is emitted immediately
or if hitting the early returns

Fixes: QTBUG-113995
Change-Id: Ib3e1d324a2becd8148cd76b4441fce5c4cc725e8
Reviewed-by: David Redondo <qt@david-redondo.de>
Reviewed-by: David Edmundson <davidedmundson@kde.org>
(cherry picked from commit d524f0a75632d8603e32b3ee7fe02138ff8343d1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-04 21:42:58 +00:00
David Faure
30d416c67d QMimeDatabase: fix detection of pattern conflict in different prefixes
Installing a second mimetype with *.txt as glob had a different
effect depending on whether it was installed into the same prefix
or a different prefix as the one where text/plain is installed.

Change-Id: I7f54b8efe22f620eb57257745c48fe5402c87626
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1b39e61a775d70ee96287e9f0e418cb5741e6638)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-04 21:42:58 +00:00
Laszlo Agocs
941b2de2ee Use linear filtering again when QT_WIDGETS_HIGHDPI_DOWNSCALE
In ec27b99c2a16994127f77d76eb1fb466c390aee9 the filtering mode is
changed from Linear to Nearest since users encountered obscure cases,
in particular when multisampling with large sample counts got enabled,
where the different filtering mode becomes noticeable. (Qt 5 and Qt 6
up until 6.4 uses Nearest, whereas the OpenGL -> QRhi migration
introduced using Linear in 6.4)

Meanwhile, the as of now undocumented high DPI downscaling feature
got introduced, and that prefers linear filtering. (since that's
definitely not a 1:1 mapping when it comes to texture size and the
on-screen quad) To reconcile the differences, add support for both
kind of samplers, and choose based on the sizes.

This should have no effect when not running with the env.var.
QT_WIDGETS_RHI=1 QT_WIDGETS_HIGHDPI_DOWNSCALE=1 set, but should
restore the pre-6.5.2 look when they are set.

Fixes: QTBUG-115461
Change-Id: I42eb8526cb7f74236b5550e26c4570771d2fbfb4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 9505305c403423f58e70471aaf55994bb734a0bd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-04 17:10:58 +00:00
Mårten Nordheim
a506e0835e tst_QString: deduplicate datatags
By saying what's special about some of them

Change-Id: I17bf2e12a27bf55f621020ddf3819ee9e606847d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6577242adff254724c739637a92372839c29da04)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-04 17:10:58 +00:00
Ahmad Samir
37cfc0e045 QSortFilterProxyModel: "fix" connection names in connect calls
d->model is the source model, so a QAbstractItemModel; techincally it
made no difference because it resolves to the same signal(s), but it's
less confusing as QAbstractItemModel.

Change-Id: I4388a50ac33a2bee628fccc1aef6a9d1898e2ca2
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 726899dc6569448598b3775a63eca7e14c4da3f0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-04 17:10:58 +00:00
Thiago Macieira
2578cc7d9e QArrayData: make calculateBlockSize() account for the extra null element
Instead of adding it after the block size was calculated. This makes no
difference for non-growing (exact) blocks. For growing blocks, this
means we take that extra element into account before rounding to the
next power of two, instead of after. That results in a change of the
thresholds of when a block grows and also what capacity it will
contain.

For example, for a QString growing to 22-25 elements:

      Request     |       Previously        |           Now           |
elements |  bytes | malloc()ed | capacity() | malloc()ed | capacity() |
    22   |    44  |        66  |        24  |        64  |        23  |
    23   |    46  |        66  |        24  |        64  |        23  |
    24   |    48  |        66  |        24  |       128  |        55  |
    25   |    50  |       130  |        56  |       128  |        55  |

To avoid wasting elementSize - 2 bytes in this footer, we only include
this footer if elementSize <= 2. Thus, for a QList<int> growing to 11-13
elements:

      Request     |       Previously        |           Now           |
elements |  bytes | malloc()ed | capacity() | malloc()ed | capacity() |
    11   |    44  |        66  |        12  |        64  |        12  |
    12   |    48  |        66  |        12  |       128  |        28  |
    13   |    52  |       130  |        28  |       128  |        28  |

In both cases, we now only allocate powers of two while growing, which
may be beneficial to some allocators.

Change-Id: Ifa1111900d6945ea8e05fffd177dcb96e251d0a1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 961620824ca0ae764b3c6ce98b16ecce951168c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-04 13:19:49 +00:00
Ivan Solovev
72024ef741 QAnyStringView: fix construction from QL1SV for bootstrapped builds
The SizeShift was not taken into account when constructing QASV from
QL1SV. This is not an issue in normal Qt builds, because SizeShift == 0
there.
But in bootstrapped case (and in future Qt 7) SizeShift changes to 2,
and the bug becomes visible.

The tests that were available on dev were never picked to earlier branches, so the cherry-pick skips the test improvement.

Change-Id: I337b37b5230323a5357f48fd1c9bf799ca507d52
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d752da1857358726b89027ac039c20c1cd696b36)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-09-04 13:19:43 +00:00
Ivan Solovev
8d47db7a78 QAbstractProxyModel: fix binding loops
... by using valueBypassingBindings() when accessing the properties
from the setters.

This commit is mostly trivial.
Had to change the template parameters in the unit-test, because the
updated QTestPrivate::testReadWritePropertyBasics() creates an instance
of the TestedClass, and QAbstractProxyModel cannot be instantiated,
since it has pure virtual methods.

Task-number: QTBUG-116346
Change-Id: I0cae29263ea9bb92c9de06891b0ba8633fb9fd72
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 6a873778b976b4752e874a2d87ea84e5d9e0d3c5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-03 18:53:55 +00:00
Ivan Solovev
5381df0240 QSortFilterProxyModel: fix binding loops
... by using valueBypassingBindings() when accessing the properties
from the setters.

Task-number: QTBUG-116346
Change-Id: Ibbad552fa1e611f4bb704b4e47667df5f328f152
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 2ef65f895be6cf7b448e739301a19a3c82458f7b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-03 18:53:54 +00:00
Ivan Solovev
94d9e05aa6 tst_QDnsLookup: extend test coverage for property bindings
The pre-existing tests were not using the QTestPrivate helpers, so
extend them with the call to QTestPrivate::testReadWritePropertyBasics.

The updated test didn't reveal any problems with binding loops, so no
other action is required for now.

Task-number: QTBUG-116346
Change-Id: I51a17974a7f5bec3c969fcb55b6f28e3e9218eb5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 96a62cd1f5e5c5a915d60ba6d86a5ea44fc32acc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-03 18:53:51 +00:00
Ivan Solovev
654b74aa05 tst_QMovie: extend the test coverage for property bindings
The old tests were not using the test methods from QTestPrivate, so
add another test case.

Task-number: QTBUG-116346
Change-Id: I291ede26461e79a615630f1decad2ad7549b4dd8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit cdb50edc9862679e8795a8404ce49fb26534f4bc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-03 18:53:47 +00:00
Ivan Solovev
b34073eab5 QLocal{Socket,Server}: extend the test coverage for property bindings
The pre-existing test for QLocalServer was testing only a minor subset
of cases, so replace it with the call to
QTestPrivate::testReadWritePropertyBasics.

The test for QLocalSocket's bindable properties was missing, so add
it.

The new tests didn't reveal any problems.

Task-number: QTBUG-116346
Change-Id: I695bb050d39eeae9ffb84c097c36601a4ca89af6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 1ad424aed502386c97359b65f37edf2966c0dfa6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-03 18:53:46 +00:00
Ivan Solovev
75dc131a28 QVariantAnimation: fix binding loops
Rewrite the logic of the setters to use removeBindingUnlessInWrapper()
and {set}ValueBypassingBindings() calls.

The logic of both setters didn't change, because previously the
pre-existing bindings were implicitly removed when calling the
assignment operator.
The new code just makes it explicit.

Task-number: QTBUG-116346
Change-Id: I475e6cd65fc73796176f257835cb67b9e70a1e34
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit df9651c3fcdd026255add31744b2f75dc2ecdd62)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-03 18:53:42 +00:00
Ivan Solovev
d2891e5d01 QTimeLine: fix binding loops
... by using valueBypassingBindings() when accessing the properties
from the setters.

The most complicated case here is the currentTime property, because
its setter was calling the public currentValue() and currentFrame()
methods. Both methods are reading the same currentTime property.

Fix it by replacing the calls to these methods with the calls to
valueForTime() and frameForTime(). Both take an int parameter, so
the updated code can use valueBypassingBindings() to pass the current
time to these calls.

Task-number: QTBUG-116346
Change-Id: I5c3a05f3e21e4c9e53ed98c9f8d1dce76e40a00d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 47d2788e0b99870cbd21044ac1e42d0c2cabb1f0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-03 18:53:39 +00:00
Ivan Solovev
d8f614648f QDBusServiceWatcher: fix binding loops
This class has two bindable properties - watchedServices and watchMode.
What makes this class non-trivial is the fact that these properties
depend on each other - setWatchedServices() need an up-to-date
watchMode to set up the services, and setWatchMode() needs an
up-to-date list of services in order to update the mode on them.

Update the setters in such way that they remove the bindings from
the updated property, and at the same time trigger the re-evaluation
of the property they depend on.
This includes refactoring of the helper setConnection() method in such
way that it does not cause property re-evaluation, and also update
of the {add,remove}Service() helper functions to take the watchMode as
an input parameter.

The public {add,remove}WatchedService() methods were updated similarly.
The logic of the removeWatchedService() method was additionally
updated to do some changes to the properties only if the
service-to-be-removed actually existed in the list.

Task-number: QTBUG-116346
Change-Id: If46cf926c7ace9dc4893d8daaef088f61e41c21a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit d85663ced8762b3096dbcbcfbc3894895a6e11c7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-03 18:53:37 +00:00
Ivan Solovev
1a779b15b2 QPauseAnimation: extend tests and fix binding loop
Extend the unit-tests for bindable properties and fix the discovered
binding loop by using {set}ValueBypassingBindings() in the setter of
the duration property.

The code refactoring does not modify the setter logic, because
previously the binding was anyway implicitly removed when calling the
assignment operator. The updated code just does it explicitly.

Task-number: QTBUG-116346
Change-Id: I0f339d182efb60500ee7f12e407f200d739da312
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit b64e36240b807e6dba783732593036439fec8a62)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-03 18:53:30 +00:00
Ivan Solovev
2bc116f832 QSequentialAnimationGroup: extend bindable property unit tests
The bindable property tests should use the helper functions from
QTestPrivate.

Task-number: QTBUG-116346
Change-Id: Ie1a61ab80e6f737eac02246214c2c93129a1cf94
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 22c2c15b27a65e988be2c7e21f3e97c4ced97375)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-03 18:53:29 +00:00
Ivan Solovev
bda8582f39 QStandardItemModel: extend the test coverage for property bindings
The pre-existing tests were not using the QTestPrivate helpers, so
extend them with the call to QTestPrivate::testReadWritePropertyBasics.

The updated test didn't reveal any problems with binding loops, so no
other action is required for now.

Task-number: QTBUG-116346
Change-Id: I360614a40fe2bacb796051607ed67e7e666b4f22
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit ac59fcdab8adb80648fee15956428630946dd01d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-03 18:53:21 +00:00
Ivan Solovev
fd7418cfb5 QPropertyAnimation: fix binding loops
... by using valueBypassingBindings() when accessing the properties
from the setters.

Task-number: QTBUG-116346
Change-Id: I04abc394f4406dc0fa75c55a9093e10c27a20c30
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit b6b94111c77df60c425617d0d76a6574906294c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-03 18:53:13 +00:00
Alexey Edelev
84dbb356ef syncqt: Close ifstream before attempt to remove file
ifstream may block the file descriptor in some operating systems.
Wrap the reading of files in staging directory with extra scope,
to make sure that ifstream closed the descriptor before the removal
attempt. Also make sure that we closed the ifstream explicitly.

Change-Id: I56ef5e9925501912d5cd61e8545f664e0a0d90b8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 3115610cfa37b1341392039537299aea4a0b5d93)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-02 10:53:12 +00:00
Thiago Macieira
9e1eb7ff69 tst_QFileInfo::stdfilesystem: add extra Unicode string tests
Change-Id: I2b24e1d3cad44897906efffd17803f70bd4d60f6
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 5b9e2f31bd4bc636cf596ef3375317f33041cad5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-01 22:40:56 +00:00
André Klitzing
6c6653719e Fix living QLibProxyWrapper after shutdown of QCoreApplication
Task-number: QTBUG-84234
Change-Id: I8f5e2947b6529a0a8871d040050205934ee60354
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit cda98280edd2ab7b8d6b3dee08281b045c470dc5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-01 22:40:55 +00:00
Thiago Macieira
7bee8bd163 QList/Doc: document the resize() overload taking a parameter_type
Added by commit b42a2b3c3338a320a438bc081cb885fd4547f01f for 6.0, but we
forgot to document it.

Change-Id: I2b24e1d3cad44897906efffd1780086b51c0e3fa
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit a15fef35ff9f78a2c16c31cc106175453d5ecfe0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-01 22:40:53 +00:00
Thiago Macieira
66dfbea290 tst_QFileInfo: replace a portion of a macro with a lambda
It's very hard to debug a macro.

Change-Id: I2b24e1d3cad44897906efffd17803b8eac9bd844
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 9e8c93fac10b802448b6b7938054220984734434)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-01 22:40:48 +00:00
Thiago Macieira
641459e986 tst_QFileInfo: don't trigger libstdc++ std::filesystem bug
libstdc++'s std::filesystem::path implementation incorrectly assumes
that any 8-bit char input is UTF-8, when it patently isn't on Windows.

Reported at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111244

Fixes: QTBUG-116609
Change-Id: I2b24e1d3cad44897906efffd17803f2862935c9b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 2b06d41b46cf97a92dee10c4432cdc5c719bcee0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-01 22:40:47 +00:00
Volker Hilsheimer
f326d50e72 QAccessible: consistently respect rootIndex of item views
Accessibility implementations rely on correct information about the
model dimensions when operating on item views. An item view that has a
root index set needs to report it's size based on the root index, rather
than for the view's model directly.

Pass the rootIndex to all calls to QAbstractItemModel::column/rowCount.
Refactor the code to avoid excessive dereferencing of a QPointer, apply
const and fix/improve coding style in touched lines.

Emit a ModelReset notification when the root index changes, or (in the
case of QListView) when the model column changes.

Split long Q_ASSERTs into multiple lines to be able to better trace the
exact reason for an assertion, and replace the assert with an early
return of nil when it's plausible that a cached cell is no longer part
of the view (i.e. because the root index changed).

Add a test case that verifies that changing the root index changes the
dimension of the view as reported through the accessibility interface.

Fixes: QTBUG-114423
Change-Id: I7897b79b2e1d10c789cc866b7f5c5dabdabe6770
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit c59b34b8cf1c2a087e361d4235990803d89d34ec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-01 19:08:23 +00:00
Ahmad Samir
2a70f6cccf QMdiArea: port Q_FOREACH to ranged-for, loop could call QCA::sendEvent()
Take a copy of the d->childWindows container because each loop body
may end up directly/indirectly calling QCoreApplication::sendEvent()
which means unbounded/unknown code could be invoked causing recursing
into the class, leading to modifying the childWindows container while
iterating over it.

Task-number: QTBUG-115803
Change-Id: Ib62ba38700e8862940ba98fdeb663dd730ff125f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 875f988af5d9df6c85269959414014d6ef1417ad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-01 12:36:51 +00:00
Assam Boudjelthia
5a171799cf Image Gestures Example: use QFileInfo for images file names
The example keeps around image file names only and append
them to the selected dir path, that works fine for file
scheme files, but for Android with content scheme files,
that doesn't work as good because usually the paths are
returned by a provider and managing them manually like
appending a file name to a directory (tree) path might not
work.

This patch retrieves QFileInfo objects and use the absolute
file paths to open any image.

Fixes: QTBUG-116181
Change-Id: I9911a181d92ba0452500398cbe052b9583bd79a0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 381612f7944b202c8b1428f0cc9d1af72f5f7647)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-01 06:31:46 +00:00
Volker Hilsheimer
fbafac20af Constrain QCoreApplication::requestPermission to compatible functors
The 6.5 versions of the overload not taking a context/receiver object
were constrained by requiring a functor to be free function or lambda.
207aae5560aa2865ec55ddb9ecbb50048060c0c0 removed that constraint, which
might be source incomaptible if wrapper functions in user code forward
the constraint using Expression SFINAE. Those wrappers would no longer
be removed from the overload set based on the same criteria as the
function they wrap.

We can't constrain the new functions based on the same predicate as
before, as after the simplification we have only one overload with, and
one without context object. But we can still remove overloads for
incompatible functors.

Add the respective scenario to the QPermission test as a compile-time
test.

Found during 6.6 header review.

Change-Id: Id21391b4a6b78a29de2f8fa04374f4262e5fafa7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d027b0c8162ac888de233cf3a41e3254ba2d7cc8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-01 04:33:39 +00:00
André Klitzing
50d9ed401b Fix -no-feature-sharedmemory
Fixes: QTBUG-114779
Change-Id: I7acf9bc2ba461fe1644c4ff6a157f88c9cce84c4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 514a6776e1055015ace1ef6378834a6c4d776864)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-31 14:39:34 +00:00
Elias Hautala
e76a01d690 Exclude some examples from Android build
Excludes  dnslookup, waitconditions, semaphores, cbordump, savegame,
convert, pingpong and complexpingpong examples from Android build
because of missing Qui and Quick dependenies.

Task-number: QTBUG-111933
Change-Id: Ied01f62ee61a9220dcb44c13fda46f6a5e158293
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 39a5ed4bdd348d3cd18a08d322b48d85e8d116e8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-31 14:39:34 +00:00
Morten Sørvig
fa4231bd11 wasm: rename JsString -> EcmaString
QString::fromJsString -> QString::fromEcmaString()
QString::toJsString() -> QString::toEcmaString()

For API naming compatibility with QByteArray::fromEcmaUin8Array()

Change-Id: If6e2121e31e630d6728ed24e41d14b763f395aaa
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit c802a9e987c9e38c01580f467eab92a651b3e033)
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-08-31 16:39:34 +02:00
Ahmad Samir
928885a5c0 QMdiArea: port Q_FOREACH to ranged-for: loop doesn't change container
The container is childWindows in all cases:
- place(): queries the windows' geometries
- setChildActivationEnabled(): sets a bool member in subwindow->d
- subWindowList(): {pre,ap}pends windows pointers to a separate QList

Task-number: QTBUG-115803
Change-Id: I0fdd5f22f29f085b71bf46f68bf9ec04c45c9317
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 79dc2980e69d1b568c3c80e30a3bd0af21548f22)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-31 11:52:30 +00:00
Ahmad Samir
c013c57c84 QMdiArea: port Q_FOREACH to ranged-for, d->pendingPlacements
Task-number: QTBUG-115803
Change-Id: Ibf2f049aacad925fea318c0ec490749e68e05b1d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 446af298b0c00a419ff8e373e6b2917fd2af44eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-31 11:52:01 +00:00
Ahmad Samir
e016960338 QMdiArea: port Q_FOREACH to ranged-for, d->pendingRearrangements
Take a copy of the member container as the loop may modify the container
(either by moving/reordering the Rearranger elements or by appending).

Task-number: QTBUG-115803
Change-Id: Iaf891b29e9c7cdfdb3dc82e03ed94defb8d0cf4c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit cfec14e1ff94b05bdfe15294199964247dbac518)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-31 11:51:55 +00:00
Casimir Saastamoinen
6782e1eb70 Enable binfmts incase it is disabled
Task-number: COIN-1075
Change-Id: I476833e87af213b4fd7eced4accdc19f093c6824
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit d4cccd0471cd5b57c900ef13e5dedd30f79f9de7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-31 10:34:27 +00:00
Thiago Macieira
514d24da02 tst_selftests: deduplicate the Unix/Linux conditions
Amends 118f2210c6279803b9a4103a796ce75e88f8beb2. That commit added

 #ifdef Q_OS_UNIX
     if (test == "assert"
         || test == "crashes"
         || test == "failfetchtype"
         || test == "faildatatype")
     return; // Outputs "Received signal 6 (SIGABRT)"
 #endif

Which duplicated 4 out of the 5 tests in the block:

 #ifdef Q_OS_LINUX
    // QEMU outputs to stderr about uncaught signals
    if (QTestPrivate::isRunningArmOnX86() &&
        (test == "assert"
         || test == "crashes"
         || test == "faildatatype"
         || test == "failfetchtype"
         || test == "silent"
        ))
        return;
 #endif

But as Linux is Unix, we never got to that second block for those 4
tests.

Change-Id: I2b24e1d3cad44897906efffd177fb4b5507d190a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit f1ba2b9f44964a0546da4815669cf728e50dd4a8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-31 08:06:51 +00:00
Thiago Macieira
63959e4560 QArrayData: change calculateBlockSize() to not have an in/out parameter
Won't make a difference in codegen, but it's the right thing to do.

Change-Id: Ifa1111900d6945ea8e05fffd177dc8d200c2368f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 167d28e77adbaeb482cfb3c27c5acd41777430cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-31 08:06:51 +00:00
Michael Weghorn
3fc198cf3c a11y uia: Don't return "S_OK" and null text range
When QWindowsUiaTextProvider::RangeFromPoint was
called with a point that is not over any
character, it was previously returning S_OK
and a nullptr for the text range.

This is contrary to what the
ITextProvider::RangeFromPoint documentation [1]
says:

> If this method succeeds, it returns S_OK.
> Otherwise, it returns an HRESULT error code.

and

> The property never returns NULL.

Therefore, setting pRetVal to NULL and returning
S_OK at the same time is problematic.
Return UIA_E_ELEMENTNOTAVAILABLE instead for that
case, and only return S_OK when actually
setting a valid text range provider as well.

Ideally, this should return an empty range for
the character that is closest to the given point.
That one could be identified by iterating over all
characters and calculating their distance to the
given point, but that would be too expensive.

[1] https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcore/nf-uiautomationcore-itextprovider-rangefrompoint

Fixes: QTBUG-115801
Change-Id: Ib08d02677935a45517c937613785f1e3f53ee032
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit 9900a12df649229c9ff9e2115ac90fb7f634da1d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-31 08:06:51 +00:00
Timur Pocheptsov
001ecc5d7b OpenSSL: move DH calls under OPENSSL_NO_DEPRECATED_3_0 guard
Initially, DH functions were deprecated, but when OpenSSL v3 was released,
they changed their mind (now they changed it again). OpenSSL must
be configured with 'no-deprecated'.

Fixes: QTBUG-83733
Change-Id: I69f14929e91f5fc147f9297f6fff20674e81b6f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 8051edfdb5efcafd76b178990b8ff760342aeee3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-31 08:06:51 +00:00
André Klitzing
01692d46c8 Bump androidx dependency to 1.10.1
This avoids linter warning:
  Obsolete Gradle Dependency

Change-Id: I9d2e3f7a4d082c7b90e5e533b9fe3d5046b79a48
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 5dc9692e48ea15ab3da4283997547a2849f1944e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-31 05:38:28 +00:00
Olivier De Cannière
6099a3e09b QLocale: Add Q_ENUM registration for some enums
Fixes: QTBUG-116527
Change-Id: If04bd5f504b3a8a39a35b9ba7024cdc9eb2d154a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit f9dccd05d3ff4bb403b8ad66f641695c9a00ee1d)
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-08-30 15:50:32 +02:00
Thiago Macieira
7efe78bb5e QTimer: fix regression on singleShot-invoking non-mormalized SLOT()s
The was introduced with the rewrite of QMetaObject::invokeMethod() in
commit 0f76e55bc440a70f5d9530a192c9ce6334a8f06, because we have an
optimization for zero timers to avoid creating a temporary
QSingleShotTimer object. The old implementation did attempt to normalize
the target slot name, but did so because it looked metamethods up using
QMetaObject::indexOfMethod:

    int idx = meta->indexOfMethod(sig.constData());
    if (idx < 0) {
        QByteArray norm =
QMetaObject::normalizedSignature(sig.constData());
        idx = meta->indexOfMethod(norm.constData());
    }

The new implementation does not use this method so it didn't need to
attempt to normalize.

I am fixing this only in QTimer and not in QMetaObject::invokeMethodImpl
(even though it is trivial to do so) because I don't believe spaces in a
pure string to invokeMethod were ever expected to work:

    QMetaObject::invokeMethod(obj, "slotName ", Qt::QueuedConnection);

The Q_ARG and Q_RETURN_ARG (for code not recompiled) still does
normalization inside QMetaType::fromName().

Fixes: QTBUG-116060
Change-Id: I964c2b1e6b834feb9710fffd177cac60c83ef413
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4368179c37cae05d16109e319fc1c77490754c7d)
2023-08-30 09:17:18 +00:00
Timur Pocheptsov
0cc4424414 tst_QSslSocket: don't use deprecated RSA api
OpenSSL 3.1.2 can be configured with no-deprecated option, in this
case test fails to build.

Change-Id: Icaf457f55fb001b632922856dbe4bbb5bdba220e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a323f05c5e3b4b2268b3a00eac79af1bdfaa03bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-29 18:15:18 +00:00
Thiago Macieira
d5e8ff75ce tst_QUdpSocket: move up the search for IPv6-capable interfaces
Let's do it in initTestCase(), where we're already searching for IPv6
addresses, instead of storing the information in a local static.

Change-Id: Ifa1111900d6945ea8e05fffd177efb6a055aaa58
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit fd924ab0b648f6a7516a6940272115a7db736a25)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-29 16:57:13 +00:00
Alexey Edelev
10cc2d614c Allow generating deprecated header files cross-module
If some header files were moved to another module within same repo it
makes sense to allow deprecating them. 'syncqt' now is able to detect
this kind of header files if the 'foreign' module is specified in
qt_deprecates pragma as part of the deprecated header name.

Task-number: QTBUG-116483
Change-Id: I479ea60e71de112b67c281722600cd818aac7762
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7e84a04563142d217317928865a8f6475d189d95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-29 16:57:11 +00:00
Thiago Macieira
25d7fa178b QString: use qustrlen() in the QChar* constructor
Instead of a manual loop, which was there since at least Qt 4.5.1
(beginning of the public history).

Change-Id: Ifa1111900d6945ea8e05fffd177dd3dfea450a67
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 9c70e117114b51d3c72283d976048e2768968039)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-29 16:57:06 +00:00
Thiago Macieira
d0968b6ddf Doc: update QTimer::start() to say that it sets the interval
I thought it went without saying...

Fixes: QTBUG-116218
Change-Id: I964c2b1e6b834feb9710fffd177c8338f8f1e618
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 2c86903704413d869131d5ea81951eb8de51639e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-29 16:57:04 +00:00
Thiago Macieira
3590e2cc52 tst_QNetworkInterface: enable IPv6 detection for Windows
This was disabled in d0d1d7403377363a101d4f1781d06a9b44787d0a, I guess
accidentally, by a too-wide conditional. The change the same commit
applied to QtNetworkSettings didn't make the same mistake.

I am also opportunistically updating the conditional to QT_CONFIG (I
missed this in 9d4579c1cd0aae5f75c8702826b5d874a6aae83e) and adding the
Linux-specific check, as the AF_NETLINK implementation does not rely on
getifaddrs() or if_nametoindex().

Drive-by fix indentation.

Change-Id: Ifa1111900d6945ea8e05fffd177ef8fcb11b4e1e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 2e51fbf89a748ad3550e786f1bdbf623169550d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-29 16:57:02 +00:00
Thiago Macieira
724f7fb6c8 QVariant: de-duplicate customConstructShared()
Commit 3ad9f94ff2de3a1f812bb0139ff31e31d5ffb529 (Feb 2023) moved it to
qvariant_p.h but commit 79ae79d05c65019233cf9ae9e77ef59d90e75ac2
(authored Sep 2022 but committed June 2023) brought it back, probably by
accident due to conflict resolution during rebasing.

For some reason, no compiler in our CI complains about it, but ICX 2023
(based on unrelased Clang versions) did:

variant_p.h(101,23): error: call to 'customConstructShared' is ambiguous

Fixes: QTBUG-116496
Change-Id: Ifa1111900d6945ea8e05fffd177eab656a2dc507
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit bed203a6fccb77e008dc384615b0ffaae6e14b54)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-29 16:56:59 +00:00
Timothée Keller
bd4ab9c23c Revert "Windows QPA: Change monitor index detection"
This reverts commit f4d6d04898bcc239f4b271330ba778de69bbd893.

Reason for revert: EDID serial numbers can be shared across monitors, so the move to EDID serial number for screen index detection does not work as intended,and breaks monitor detection.

Fixes: QTBUG-116499
Change-Id: I6995b21788eb632e38eeef3a93492dbe0740da4a
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 695948fad028f97521135ecb3478f2798ae6700f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-29 13:27:19 +00:00
Assam Boudjelthia
d05102e1da Android: fix handling of tree content uri with sub-document
Check for the index of last '/' from the non-encoded path.

Amends ea75e34d6968bb59624874411e793c95b26d0dbe.

Change-Id: I3ef5d454a46c711a85fe7ef01ea9d3d93a2d574f
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 4721721f6005c90cb1760b0c6e074468aa73512f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-29 13:22:09 +00:00
Simo Fält
208a587b01 COIN: Increase timeout for running sbuild for debian packages
Pick-to: dev
Change-Id: Id0b53dece8d4bbf1faa89c1ec409c5d241129779
Reviewed-by: Toni Saario <toni.saario@qt.io>
2023-08-29 11:15:07 +03:00
Ivan Solovev
1018624561 Update gradle to 8.3.0
The latest version of gradle was released on August 17, 2023

This update ignores most of the changes to gradle.properties file,
as we do not really use most of the variables which are set by the
upstream release.

Task-number: QTBUG-116236
Change-Id: If66e1a264328b772e742473b859ed9240f77b9c6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 39b39f0d5fd971515443f7517c850cc3ad698ef2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-29 04:53:11 +00:00
Christian Ehrlicher
3ba8179d6b QTextFormat: documentation fix
The QTextFormat description refers to setDirection() but this function
does not exist. The correct function name is setLayoutDirection() even
in Qt4.

Change-Id: I2d1f49fba558874b5875d8d93ef61d6208134609
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit fd96e11bb1200902ff7ec2bbe6f3903b2d96bdd8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-28 22:46:09 +00:00
Ahmad Samir
fc08f7c6b8 Gui: fix CMake warning about unconditionally installed headers
qaccessible.h and qplatformaccessibility.h are supposed to always be
installed as public headers, regardless of QT_FEATURE_accessibility.
Their contents are wrapped in "#if QT_CONFIG(accessibility)", so
installing them even if QT_FEATURE_accessibility is not enabled
shouldn't be an issue.

The warning was about uncoditionally installed header files,
"CONDITION_INDEPENDENT_SOURCES", being in a
"qt_internal_extend_target(Gui CONDITION QT_FEATURE_accessibility"
call. Thanks to Alexandru for confirming my vague suspicions about the
issue in the bug report.

This amends commit 9f36ab1f8df7f79ffb78259725110106aa5a8e37.

Task-number: QTBUG-111785
Change-Id: I5e5950f341d6729e15961d6fb3d3f8fe85007e38
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit be0e81d493db8a4117a00de21adc39ce02f0ee42)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-28 22:46:09 +00:00
Andreas Eliasson
d8a8cc1295 Doc: Remove links to removed examples
These examples have been removed as part of the examples revamp project.

Change-Id: I2a8237334a2acae2735c2dbd86004048d288896a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 41f032e358e704693834a98d37331d0d63b7aab9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-28 18:55:25 +00:00
Christian Ehrlicher
35dda81f7a SQLite: Update SQLite to v3.43.0
[ChangeLog][Third-Party Code] Updated SQLite to v3.43.0

Fixes: QTBUG-116248
Change-Id: I039f572d21a8506faa5e29a48cdc7e40f990d946
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 49e52e8dd68cc58b9c9ec9bd2c1f89184845d746)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-28 18:27:59 +00:00
Kai Köhne
b02a296710 Doc: Mention version of QApplication::setActiveWindow() deprecation
Change-Id: I7cd9be3b34a4cb7f396d175ff8137b590c2435c9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit be26eb14da255514270773f9b90e9154c7a4c1c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-28 11:55:13 +00:00
Kai Köhne
646912cac7 Fix definition of QOSV::MacOSSonoma
Make sure that MacOSSonoma symbol is defined in
qoperatingsystemversion.cpp, instead of duplicating the
MacOSVentura symbol. This seems strictly speaking not
needed (as this shouldn't have compiled otherwise), but is
avoiding confusion in the future.

Also document when it got added (Qt 6.5).

Amends 0237709e2.

Change-Id: Idff7cbe0b5862907d735fb60f91f85469cb1edf0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5d8e0ce0fbe179b9f4e4ec46c209c746b57cbdf2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-28 11:54:54 +00:00
Safiyyah Moosa
bbae65a75d Doc: Add \examplecategory to qtgui
Task-number: QTBUG-116068
Change-Id: Ia0bdc2122434adac51b37ba2207a2b0b993cf19b
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 3b187f14a1f80ac6893b5f7b5df9194691bc955c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-28 11:49:50 +00:00
Lorn Potter
883a12d28d wasm: remove 'shift' from being inputed on touchscreens
Fixes: QTBUG-116231
Change-Id: Icbbe80877c2c21c3e82ba2c27909b6679b72e498
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 91d3c48d3da5f75e126bbce79096a84c078e23e2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-26 05:04:55 +00:00
Piotr Wierciński
8240f9437e wasm: Fix QFileDialog file filter
File filter was not properly processed when using LocalFileAPI.
The QtFormat->AcceptList conversion was happening twice, resulting
in erronous types. This prevented dialog from appearing on Chrome.
Additionally remove unused debug code.

Fixes: QTBUG-115087
Change-Id: Ie6770e2f1d2aa7c3ad19f9ab105dbec8102d45fc
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 62caae95784a2e70d46194622e96e0e6bdf13c28)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-25 18:53:35 +00:00
Timur Pocheptsov
e32b3aeb64 Blacklist tst_QMainWindow::QTBUG52175_tabifiedDockWidgetActivated
We are BLACKLISTing on macos/arm - the test is flaky.

Task-number: QTBUG-115945
Change-Id: I3be28c895d46ce5ba86e00d597016334bdb16021
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit a3cbbe449a1946d1f50930859efe5f003cf6fda6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-25 18:53:35 +00:00
Alexey Edelev
65f2d65730 Disable android_deployment_settings test for non-standalone scenario
The test changes couple variables to emulate the user project
environment. These variables also affect the policy handling.
The test will build and work properly only if tests are built
standalone. So add this limitation.

Amends 2e340cea88b6721cf09f24a190aa6a81af81852e

Change-Id: I0cc49bf55bf7763e4c3ecdfa5333fb0453f06794
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d02c3151b224443b72a7c9d5791ed93325ef21f9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-25 18:53:35 +00:00
Assam Boudjelthia
6ec1766c5c Android: use all nameFilters at once for native file dialog
Since the native file dialog doesn't allow changing the name filters
after it's been opened, another way to ensure that we comply with
the provided nameFilters list is to provide them all at once.

[ChangeLog][Android][FileDialog] use all nameFilters at once since
Android file picker can't change nameFilters after being opened.

Change-Id: I389feecae190af41b87c7f2070494bd57eec4b69
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 0f4181919663e85ddc142456b357dcde3d0a4a7f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-25 18:53:34 +00:00
Pasi Petäjäjärvi
bcbbafca88 QGuiApplication: Report default platform name before initialization
Calling this function before we had a QGuiApplication instance, would
return an empty string, even if QT_QPA_DEFAULT_PLATFORM_NAME was defined
at compile time. We now return the default platform name

[ChangeLog][QtGui][QGuiApplication] QGuiApplication::platformName
now reports the default platform name if QGuiApplication hasn't been
instantiated yet. It used to return an empty string.

Change-Id: Iffe7cde8943ed2d186bc494d0920b9cf79389dd0
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit dd3840a1a201318c8f089dc7d34ec38f64e05b4e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-25 15:56:46 +00:00
Joerg Bornemann
eb1d0f5d05 Doc: Document TR_EXCLUDE
Change-Id: Ib2e06e46f44564a2c7581ff4d7f3d8a29d2756c9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit bfca8c6d2447558609b4cce71d112a8ab34b8bec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-25 15:56:43 +00:00
Tor Arne Vestbø
ac2c9b21c9 Stabilize tst_QGraphicsEffect::draw()
It's very flakey in CI: http://testresults.qt.io/grafana/goto/XZQAAPRSg

What we want to test is whether Qt issues paint events in response
to enabling an already enabled effect. Doing so via qWait will process
both window system events and posted Qt events, and the former might
include spontaneous paint events from the system that we can't control.

Task-number: QTBUG-115945
Change-Id: I65e5c6a4458e77b3bd2ad700c5caf6d441f4ca53
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit ea25b3962b90154f8c6eba0951ee1c58fe873139)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-25 10:04:59 +00:00
Ahmad Samir
9595678cad tst_QSpinBox: handle an old TODO
QTBUG-69492 has been fixed since Qt 5.12.

Change-Id: I8bc59bd37a9ee2f47f13fa8ff54aa91e2c9148fa
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2e37cff19efb6b87945c89029f70fc612b3a6806)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-24 20:35:15 +00:00
Ivan Solovev
afe0a6a4ab double-conversion: update to 3.3.0
Retrieved from/changelog here:
https://github.com/google/double-conversion/releases/tag/v3.3.0

Task-number: QTBUG-116236
Change-Id: Ifac887dfcb9151fe2bd8b7e3f5dfe763836a9adb
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 605412dd1996922ac1b05bfa43e47c8dc137d123)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-24 18:41:23 +00:00
Alexandru Croitor
a31d82ba66 CMake: Add missing labels to compile tests
The displayed failure messages were missing the label, making the
output confusing.

Change-Id: I4e20687f85b651dcac66ebd6e0881809dc0be709
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 6e853572c5ee614687987db6b8d8506c5971ee5c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-24 16:28:17 +00:00
Morten Sørvig
d0378c32d0 Reduce nesting in processWindowScreenChangedEvent()
Replace if-block with early return on null QWindow.

Task-number: QTBUG-116232
Change-Id: Iaf402edfd9b03734b64fdf707834fa92c827a1dc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 198eaaf523b8905d23c3b8f01a75647e42012327)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-24 16:28:11 +00:00
Timur Pocheptsov
8d1cdc1fe8 tst_gestures: clean-up the BLACKLIST
The recent change in QCocoaScreen (108d2e44867acfa98c3b0c211d9b48f39d10efa9)
fixed the problem with no widget found at 'hot spot' (while we know
it's there, since we create it and wait for it to get expose event).

Fixes: QTBUG-108402
Task-number: QTBUG-115945
Change-Id: Ibbf6867bb3381b8137d64cdbd15cc467d8fcf348
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 708b3285f395944062ef32f2c4f0190b470854db)
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-08-24 15:57:15 +02:00
Ievgenii Meshcheriakov
9559c09fbe Update public suffix list
Task-number: QTBUG-116236
Change-Id: I91d4619b69a16ef1ac2f954b738f181b1dd9d9a1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 43a2f19a07ab6ad2ec5c1ceb2a0f0af5eecf2de9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-24 12:32:01 +00:00
Thiago Macieira
eb8cda8ee8 Doc: add missing docs for QFileInfo::filesystemReadSymLink()
Fixes: QTBUG-116351
Change-Id: Ifa1111900d6945ea8e05fffd177dc57774db65cf
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 306d32fdd3633213c9c2bf8dc79b99deb7123646)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-24 03:56:19 +00:00
Thiago Macieira
16cce399d2 QString: use equalStrings in operator== and operator!=
QStringView already did since 6.0. I don't know how we missed this.

Change-Id: I5acc02341c5940499682fffd1774f7c3a807317a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 3c4c7860f08e45de2965ea544a8eb742549bb150)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-24 01:14:34 +00:00
Ivan Solovev
cbea2f5705 QSqlIndex: implement member swap() and use a macro for move-assignment
Also declare the type as shared using Q_DECLARE_SHARED

Found during Qt 6.6 API review.

This commit amends 46e909a37a38289a601333ae6f205e8946152287.

[ChangeLog][QtSql] QSqlIndex is now a relocatable type.

Change-Id: I78394cba082b4df2e4d8a6aab8e8e87f2340962c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit f081578ce097e5b437a0b1beee84f7056e9099f8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-23 15:16:07 +00:00
Ivan Solovev
6f00da8489 SQL: add missing Q_DECLARE_SHARED to the value types
QSqlField and QSqlRecord implemented all special member functions and
the member swap() function, but were missing the Q_DECLARE_SHARED
macro.

Found during Qt 6.6 API review

[ChangeLog][QtSql] QSqlField and QSqlRecord are now relocatable
types.

Change-Id: Ia10f1d3fd9f634864be5b36d1d3903301adfa9ab
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 2f8771191369b19d05971a135700ad9c17f11063)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-23 15:16:07 +00:00
Alexey Edelev
4f1e91a185 Add test for the qt6_android_generate_deployment_settings CMake command
qt6_android_generate_deployment_settings is implicitly used by
qt6_add_executable in user projects. This test makes sure that the
function behaves as expected for user projects specificly, since in Qt
tests it behaves differently because of Qt-specific conditions inside.

Task-number: QTBUG-116037
Change-Id: Iea10eca7a780ebaff0c05b91ebe47b821b9ec956
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 2e340cea88b6721cf09f24a190aa6a81af81852e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-23 15:16:07 +00:00
Marc Mutz
a1b79d137f QUuid: drop the noexcept of fromBytes()
The function has a precondition, namely that [bytes, 16) be a valid
range. Therefore it cannot be noexcept.

Found in API review.

Change-Id: Idcc61cdc3b1cbffc20a86b0dbc4eb17e51c1becd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c8d04c1a37c5f307a8e27f8897d5868286fb32cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-23 13:01:00 +00:00
Marc Mutz
f974ea6f86 QDeadlineTimer: make the (Qt::TimerType) ctor explicit
Qt::TimerType is not a faithful representation of a QDeadlineTimer.
It's missing the actual deadline, and so should not be allowed to
participate in implicit conversions.

Consider whether you'd like to see such code:

    foo.setTimeout(Qt::PreciseTimer); // HU???

So split the old (TimerType = CoarseTimer) ctor into an explicit
default ctor (applying NSDMI to make it =default'able) and a new
explicit (TimerType) ctor.

[ChangeLog][Potentially Source-Incompatible Changes][QtCore] The
QDeadlineTimer(Qt::TimerType) constructor is no longer implicit. To
keep old source working, wrap the Qt::TimerType argument in
QDeadlineTimer{}. This is backwards-compatible with older Qt versions.

[ChangeLog][QtCore][QDeadlineTimer] The (Qt::TimerType) constructor is
now explicit (was: implicit).

Found in API-review.

Change-Id: I72aaaad5201bd288a6fd6af398573aaa9d0eda5a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 17f2b6d2e9379d7edaf5acd17a6547ca46b12f2b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-23 13:00:51 +00:00
Tor Arne Vestbø
281b5154bf macOS: Re-apply QWindow visibility when moved between NSWindows
When a QWindow is moved between being a child window and a top level,
it gains a corresponding QNSWindow, which we create as part of
QCocoaWindow::createNSWindow(). NSWindows are not visible by default,
so we need to re-apply the QWindow state to the newly created window,
just like we do for other QWindow properties.

Change-Id: I809d12b09eeccea7a4ee4e8444f69db46dbd159e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit a143158eb12c398c756532aaec58340ec980b44d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-23 13:00:48 +00:00
Axel Spoerl
44a2dd16ed QDialogButtonBox: Use separate eventFilter class
bbb71e7e80f292c2e69faef81b1624832981147e added an eventFilter override
to QDialogButtonBox, in order to fix QTBUG-114377. The approach added
a symbol to QDialogButtonBox, which breaks binary compatibility between
patch releases.

=> Use a separate class to install an event filter
=> Remove the symbol (eventFilter override) in QDialogButtonBox

Fixes: QTBUG-116287
Change-Id: I920deca9f45f6246ed1fcbf5346f681dd5dd12f6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit aff0915352dda0cfaa11a249b665fbe47be21d69)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-23 12:56:29 +00:00
Alexandru Croitor
bc948965f1 CMake: Fix build when developer-build is on but private_tests is OFF
If qt is first configured without -developer-build, and then
reconfigured with -developer-build, QT_FEATURE_developer_build will be
ON but QT_FEATURE_private_tests remains OFF, and is not reset to ON.

This causes a link failure in Network, because the source files
defining the QNetworkAccessDebugPipeBackendFactory class are only
added if QT_FEATURE_private_tests is ON, which is not the case above,
but the C++ code checks for the QT_INTERNAL_BUILD define which is
defined when -developer-build is ON.

Align the C++ code to check for the private_tests feature.

Task-number: QTBUG-112957
Change-Id: Ib6ed891a84c6b118836497d6ead48019bb1b9052
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 409469ba14633545f8cf445baf9ffc286d491094)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-22 16:09:48 +00:00
Friedemann Kleint
d21f16ecb9 Mimer SQL driver plugin: Fix messages
Amends 0efd8854c4b32ec0b011efbf6b3a1990fe684e32.

Task-number: QTBUG-111219
Change-Id: I8425c13a324562beb4a687ecdd0339a129fe190e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Fredrik Ålund <fredrik.alund@mimer.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 462904d46bf2c44ed196a7794838655698ede6c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-22 14:59:46 +00:00
Edward Welbourne
6f303a6c24 Update CLDR version in qt_attribution.json
Amends commit 923790832777f3e4d9d9be5eba13a9ffdedcf9e7 - I neglected
to update the attribution. The license hasn't changed.

Change-Id: Ie1e281bf08ac31506e152fc0fa17c8fae6b7ac98
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit 196a1acffc0eb7179cfad5030c0a7fe80aae481e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-22 14:59:46 +00:00
Timur Pocheptsov
9e43e9fa3a tst_QSslSocket: skip tests requiring TLS v 1.0 downgrade
If OpenSSL version is 3.1.1 or above - this version moved the protocol
under security level 0, but the default one is 1.

Fixes: QTBUG-116166
Change-Id: Iaabb2cf33e2a9f280d6167233ee16080dee808b0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6d6d22b65d9a0cc8664cc9e051e66a80db132b6e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-22 14:59:46 +00:00
Axel Spoerl
e27d14bd55 tst_QDockWidget: Fix compiler warning in non-development build
Static variables for a message handler were used only in developer
build, while they were declared unconditionally.
That has lead to compiler warnings about unused variables in a
non developer build.

=> declare them only in developer build
=> move assignment and static method in front of the method,
that uses them.

Change-Id: Ie06f91f7857130f08fd484a6e7319ddfd16c546b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 366b4d3ae7783a055a6b1d6fe18470169cb6f8f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-22 14:59:46 +00:00
Oliver Wolff
14d8d5099e Remove elfreader and other unix leftovers from windeployqt
Back then elfreader and other unix functionality was added for the
purpose of having one generic deployment tool but it was never used.
Remove the code to be more clear on what to expect.

Change-Id: I2b7a759de04afe0c5fb210ad65f1c86e32934f18
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 68b16974a72a35e33e4e947f7edfabd6ccd5f6a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-22 14:59:45 +00:00
Tor Arne Vestbø
04efbda0df macOS: Use enumerateWindowsWithOptions to implement QCocoaScreen::topLevelAt()
The [NSWidow windowNumberAtPoint:belowWindowWithWindowNumber] API has issues
with sometimes being out of sync with the window server, resulting in failing
to hit test windows that we know are there.

This has manifested in flakeyness in our tests, for example in tst_QWindow's
testsInputEvents: http://testresults.qt.io/grafana/goto/YNGj7TgIg

A workaround is to call [NSWindow windowNumbersWithOptions:0] to force a sync,
but we might as well use the more modern block based API to iterate our own
windows in Z-order. This API seems to do the required sync on our behalf,
or at least doesn't operate on stale data.

The logic has been otherwise kept as is, including treating non-top-level
windows as candidates for hit testing, which seems strange for a function
named topLevelAt(). This is to be investigated further.

Task-number: QTBUG-108402
Task-number: QTBUG-115945
Change-Id: I5599881c381a0a673d262e4b9585e2c6798c9810
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 108d2e44867acfa98c3b0c211d9b48f39d10efa9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-22 14:59:45 +00:00
Topi Reinio
61c8e411b5 Doc: Qt OpenGL: Remove duplicate source dir from documentation config
As /examples/opengl is already listed in exampledirs, .qdoc source
files under that directory do not need to be listed in sourcedirs.
Doing so will cause the example to be listed twice in lists generated
by the \generatelist and \annotatedlist QDoc commands.

Same applies to imagedirs variable.

Change-Id: I168dbfe111a4cb9615626eb9869f97d3814a14b7
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
(cherry picked from commit 634f474300fe27b6decb61937f1c5a5401807fad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-22 09:13:21 +00:00
Eskil Abrahamsen Blomfeldt
2e8fa5b8f3 Update version of FreeType attribution
We updated FreeType to 2.13.1, but forgot the attribution file.

Task-number: QTBUG-115340
Change-Id: I1e7bc91b9fd4a7674d40d15b3f2759f38831cd8e
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit 11321384d9393c27ad218971d0fdf3c735a05dee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-22 07:35:17 +00:00
Li Xinwei
bc569d65b1 CMake: use correct link flag for MinGW(GCC) static-runtime build
When using MinGW compiler and Qt is configured with "-static-runtime",
we should pass "-static" to g++ while linking, like Qt 5, instead of
"-Wl,-Bstatic", to get rid of dependencies on libgcc_s_seh-1.dll,
libwinpthread-1.dll and libstdc++-6.dll.

Because syncqt doesn't link to any Qt library,
"target_link_options(${target} INTERFACE -static)" has no effect on it.
So we should use "PRIVATE" instead of "INTERFACE" for executables.

Change-Id: Icf551783f92ef3615b3840c9af16d163eee09fdb
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 9256d9e7b6ab4bfeaeb733c88719e1019d7bd92b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-22 05:44:59 +00:00
Timur Pocheptsov
06a0f9b419 tst_QDtls: use DTLS v 1.0 test data conditionally
Starting from OpenSSL v 3.1.1 DTLS 1.0 is only available, if the
security level is 0, which is not the case most of the time. So
we consider this version number to be a 'threshold' after which
we don't test v 1.0 anymore.

Task-number: QTBUG-116166
Change-Id: I9763703f36ae742e1d3c7cb17872cf8d0d82ab85
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit c1b287c531f444dfe57e6bb1353e1c517ad2d416)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-21 16:37:32 +00:00
David Redondo
a4b96df51d Add support for setting the initial directory in portal file dialog
Change-Id: I2bceddb470e7870f19fc616e3dbae73cc057cb66
Reviewed-by: David Edmundson <davidedmundson@kde.org>
(cherry picked from commit 42fd8a8e8a758e7e4ddaae9943402b2e3bae25fe)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-08-21 16:37:32 +00:00
Sze Howe Koh
53e351a1ad Doc: Clarify how to use QPainter with QTextEdit
The documentation suggests that it is possible to reimplement
QTextEdit::paintEvent(), but doing so might produce cryptic runtime
warnings:

    QWidget::paintEngine: Should no longer be called
    QPainter::begin: Paint device returned engine == 0, type: 1

The correct way to reimplement this function is noted under
QAbstractScrollArea::paintEvent(). This patch updates the note and
copies it to QTextEdit for clarity.

Change-Id: Ib7d8dadeb2358475bcdb0b2e624857700f9a004e
Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io>
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5a2474b2dd0472948c53b16c4bf566db489dcfb9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-21 14:16:21 +00:00
Ulf Hermann
3ce73dc0d6 QObject: Do not register an observer when writing objectName property
Observers should only be registered when _reading_ the property.
Otherwise we get binding loops.

Change-Id: I974f6ea444fa7a5d333ed79eea6f34e3d757d169
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 9306db6d465a165ebe2edcbe5b0180f04d0c46ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-21 12:16:04 +00:00
Ievgenii Meshcheriakov
2fd12c03cd QAbstractEventDispatcherPrivate: Create free timer ID list in constructor
Create the global static free timer ID list in the constructor
so that it is destroyed after any global static QDaemonThread instance
that may be using it.

Fixes: QTBUG-58732
Change-Id: Ic2d33ac3aa2ec3ca0261be9996920aae260e16fd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit cff1c12eca6e1e7d2645f7079895718193beb621)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-20 23:55:15 +00:00
Christian Ehrlicher
b29f12be3e WindowsVista style: fix subControlRect() in rtl mode
During refactoring of the vista style in
46f98147f4e3a09b32042c0655d5de7285a795e3 a regression slipped into
subControlRect()'s default branch which lead to a double call of
visualRect(). This breaks nearly all subControlRect() calculations in
rtl mode.

Fixes: QTBUG-116224
Change-Id: Ida722e1b6c6a311b27a9b48d1fe1378b47c21cf4
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit e26a87f1ecc40bc8c6aa5b889fce67410a57a702)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-19 21:09:44 +00:00
Marc Mutz
4df46fd72c QRecursiveMutex: make tryLock(QDeadlineTimer) the default (was: int)
The default argument staying on the old int overload meant that on
Windows a nullary tryLock() call would need to go through both DLL-
exported functions (int, then QDeadlineTimer) and on non-Windows
platforms, it would hit the out-of-line QDeadlineTimer(qint64)
ctor.

By moving the default argument from the old to the new function, we
reduce the nullary call on Windows from two to one exported functions.
On non-Windows, we make it to hit QDeadlineTimer's constexpr inline
default ctor instead.

Found in API-review.

Amends ff9da1db0b0963f967f45ab430ec40a3051b70b4.

Change-Id: Id3e9923cf97ee1673fe05c85c30b5a12531857b3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f780893c39d6090e804c8caeb08af4f919777109)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-19 08:30:52 +00:00
Marc Mutz
566aede35f QHostInfo: remove usused -Result and -Runnable ctors
Clean up after all users are ported to the SlotObjUniquePtr overloads.

Change-Id: I3e58249296ea9674c45fb412463ae3201518de72
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1a3f573bd9fd7463e1def4c1fe655bcf0e2e6baa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-18 23:24:44 +00:00
Ahmad Samir
f925278917 QByteArray: remove a unittest
It relied on an implementation detail of operator+=(), that the latter
wouldn't just use assignement (e.g. if `this` is empty/null).

It also had undefined behavior, when the char array used with
fromRawData() went out of, the nested, scope, the code was pointing to a
dangling stack pointer.

Thanks to Thiago for the explanation in code review.

This ties in with further changes in this series, where append() is
changed to preserve null-ness; there is no way to preserve null-ness in
append() while keeping this unittest passing.

Change-Id: I43b9f60db9ce2d471f359f32bcc48e7b4cfceeab
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d1da83002d18040f8ac21ebf6542ff71cb462509)
2023-08-18 16:54:12 +00:00
Ivan Solovev
82e189441e QNativeIpcKey: improve operator==()
There is no need to check if lhs.d == rhs.d in the end of the function,
because we already have the same condition earlier.
If none of the previous conditions was true, we can just return false.

This commit amends 7a370838177e581c8a9342808ba86e081951a41c.

Change-Id: I06dca9b3dedf5895820685a6ded5363963e6fa3f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit e6a36f21a3c44943afc8c60b9dc2e40976fcdb49)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-18 16:00:35 +00:00
Ivan Solovev
8ab0d1e9e8 Do not rely on transitive includes for QESDP
Explicitly include <QtCore/qshareddata.h> into the headers that use
QESDP.

This commit amends 6ff4c3d787ecc2e6d2740f22d0406b34346faede.

Found during Qt 6.6 API review.

Change-Id: Ia52d9e7551295f0c7380c7ed33b68f452cb689aa
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 314d86335ddd3ba8f67267c0e25b4df5fe0419c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-18 16:00:32 +00:00
Ivan Solovev
3e9c292dbc QUuid: convert bswap(Id128Bytes) to a hidden friend of Id128Bytes
... and rename it to qbswap(), thus enabling the endian conversions
for Id128bytes via q{To,From}{Little,Big}Endian() functions.

Found during Qt 6.6 API Review.

Change-Id: Ie320cee52ec2b9de0aaa112adec8febb7f5b68a2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 470b2b8ad9f28eaf24518dfa3f48cc13fcdc421f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-18 16:00:31 +00:00
Andreas Eliasson
f7dcf1a2d9 Doc: Delete links to removed examples
The examples have been removed as part of the examples revamp project.
This patch resolves a number of qdoc warnings.

Change-Id: Ie3d2f5637136c631d7e9f7a8ffd93baea52f77d8
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 132be307fff049e83ba8b93733fc571c0c45469b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-18 16:00:28 +00:00
Marc Mutz
6de7e0d646 QHostInfo: add -Result and -Runnable ctors taking SlotObjUniquePtr
... and use them around the code.

Avoids the impedance mismatch between users, which .release() their
SlotObjUniquePtr's into the ctors, and the ctor, which constructs its
member SlotObjUniquePtr from that.

The old constructors are left in on purpose and removed in a follow-up
commit to facilitate cherry-picking into branches that might have
additional callers.

Change-Id: I6f8bce317d5116296973a3a2e3f97db1451f579d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 14cf4f75848180503d3c83ff1d9aeb4536c307b7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-18 16:00:26 +00:00
Marc Mutz
954f13545c QPollingFileSystemWatcherEngine: change PollingInterval to chrono::seconds
More expressive and type-safe.

Move it to the .cpp file (the only user) and make it static to avoid
creating a non-namespaced symbol.

Change-Id: Ib9b393e660e51c1791ed3a9a4a12e5c75736bf2a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a19585eee174dd593aa979e5232e9cca677bef44)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-18 15:01:56 +00:00
Tor Arne Vestbø
5d341c848e iOS: Add support for foreign windows
Task-number: QTBUG-116183
Change-Id: Ia92ee2d15f2e91a326ad342237fb0a83305c019f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 17e7d98626b21e55d1ca8eb638859e025bf0ec9a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-18 15:01:55 +00:00
Marc Mutz
743aac16b3 QPollingFileSystemWatcherEngine: replace QTimer with QBasicTimer
We already have a QObject (*this), so we don't need another one in the
form of a QTimer; we can just let QTimerEvents be delivered to *this.

Changes surprisingly little code, because the code used start(int)
already.

Mark the timerEvent() final to avoid surprises from potential
further-derived classes.

Change-Id: Ib4ee8f8f6b9995d67d964afb231e913a00a76af3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 22858ffcedda16cd9f773df9ec74a5bff72a081a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-18 15:01:53 +00:00
Marc Mutz
3458cf984a QMessageBox: leave the Option's underlying_type as the default, int
QFlags<Option> will anyway store the value in an `int`, so we gain
nothing from choosing quint8 as the fixed type, except artificially
limiting the number of possible future options to eight.

Found in API-review.

As a drive-by, put options one per line and add a trailing comma where
possible.

Change-Id: I0ed588ea6c7912e50705af89c47e2cf7e2ee23a0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d8952690c75f83388e2b24f1b0f76266a58552e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-18 15:01:52 +00:00
Ulf Hermann
b33b0eeb45 Doc: Fix introduction version of QT_DISCARD_FILE_CONTENTS
It didn't actually land in 6.5.

Amends commit 5a0dcda171772e75eeb22f719cec36ef8efe355d.

Change-Id: I8d63f0e5019c37dbbc02294515444dd8e901dd6f
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 199570e3b1e7b3a6db64be29d9b5889e29cd8a01)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-18 15:01:51 +00:00
Marc Mutz
2969f119eb QCryptographicHash: fix incorrect GCC check
It's Q_CC_GNU, not Q_CC_GCC.

Amends 0411d98192ede84b115618ece876579fd79252f8.

Change-Id: I56c4393e5955ac1bbcc8a198b11487cff775b16d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 5c96b2a864d7cd522c2e1c9bb842c2d9d8b11692)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-18 15:01:49 +00:00
Eskil Abrahamsen Blomfeldt
ea50a2deb5 Update to Harfbuzz 8.1.1
Change-Id: I886bc7d385e62ff0c9546c18bb7bb9273ef1cbd1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9266b6d0914a31215d8505a363ecfd8f80b744eb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-18 15:01:43 +00:00
Bartlomiej Moskal
b32f16b169 Android: Fix wrong position of EditPopupMenu
When Edit Popup Menu was not shown, the size of EditContextView was
wrongly returned. That is why the popup appeared in the wrong position
and then "jumped" to the right one.

To get correct values even when Popup is invisible, size should be
calculated manually by getting height/width of all visible buttons (with
getMeasuredHeight/getMeasuredWidth[0]) and paddings of EditContextView.

[0]https://developer.android.com/reference/android/view/View#getMeasuredWidth()

Fixes: QTBUG-115632
Change-Id: I5f6abffab1a1e836c59a922ffa727d893ca9820f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 51d331b13bc1b922797eb81b2a73f78e1c07bf22)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-18 13:40:01 +00:00
Santhosh Kumar
4781de5859 Rename accent color in QPalette
Accent color role has been renamed according to name rule of other
color roles in QPalette.

Fixes: QTBUG-116107
Change-Id: I70ac98a1e97afbdc7ea5f8d79f808c307e170712
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 90980a54e87147ae59ed0628f8b1de67d98ecae4)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-08-18 13:45:56 +02:00
Allan Sandfeld Jensen
e4d4714aae Increase setup precision and reduce test precision
Reduce test precision to account for rounding errors, and at the same
time increase the setup precession by premultiplying in rgba64 instead
of argb32, which makes the test randomness trigger more regularly.

Task-number: QTBUG-115945
Change-Id: I3e95449ada26ff5bb0acc00412f345733603f4c0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit ae9594ea98e723a99b8ad8c056505f4c7deb77c9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-18 09:32:08 +00:00
Thiago Macieira
cd81b9016e QCollator: clarify the POSIX backend limitations
This clarifies what doesn't work, that we print a warning, and that it
applies to all Unix systems aside from macOS, not just Linux.

Fixes: QTBUG-115852
Change-Id: I80612a7d275c41f1baf0fffd1779701e98e7552d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 120fc8244a484a5fde5b19f2e603b05692b79f61)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-17 19:41:41 +00:00
Kai Köhne
d9b11a3343 Doc: Fix \since for QMessageBox::options
While at it, also make \brief a proper sentence, starting with
an uppercase letter and ending with a dot.

This amends code added in commit 29b2506e8c .

Change-Id: I5ca4c5e2a7dd2e826ba4392f4ea0e0dee00c92f4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
(cherry picked from commit ab1b22c49b4a815991c73e84818db7538f9a1a0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-17 17:45:25 +00:00
Ahmad Samir
f6ccf8bfbf QMdiArea: port Q_FOREACH to ranged-for, one trivial case
Straightforward, the code was already iterating over a local const
copy, i.e. Q_FOREACH wasn't needed here.

Task-number: QTBUG-115803
Change-Id: I3e806c54ce56b6eb06431eea6aea1758c8ecd154
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit a6274fa39ae865b20d395817f30a6f7c83bd5ea9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-17 17:45:25 +00:00
Marc Mutz
6c9cba45ca tst_macdeplyqt: unbreak runVerifyDeployment()
Amends f2f8820073488c89fb71e3eb2d2e87bb582c3995.

I have no idea how this went through the CI, but assigning to a const
variable cannot possibly compile.

Reported-by: Axel Spoerl <axel.spoerl@qt.io>
Task-nubmber: QTBUG-115839
Change-Id: I0f22dcd5ab691f92880ea3c6446aedca53df0721
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit c0a38066095b3ed28281391e75c251709f875f53)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-08-17 19:45:24 +02:00
Marc Mutz
0603c8be97 tests: port assorted trivial uses of Q_FOREACH to ranged for loops
All of these fall into the trivial category: loops over (readily made)
const local containers. As such, they cannot possibly depend on the
safety copy that Q_FOREACH performs, so are safe to port as-is to
ranged for loops.

There may be more where these came from, but these were the ones that
stood out as immediately obvious when scanning the 100s of uses in
qtbase, so I preferred to directly fix them over white-listing their
files with QT_NO_FOREACH (which still may be necessary for some files,
as this patch may not port all uses in that file).

Task-nubmber: QTBUG-115839
Change-Id: I7b7893bec8254f902660dac24167113aca855029
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit f2f8820073488c89fb71e3eb2d2e87bb582c3995)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-17 17:45:24 +00:00
Marc Mutz
55e5ab8d57 tst_QMainWindow: port away from Q_FOREACH
These are all trivial: all are over (already or newly-made) const
local variables.

As a drive-by, replace a QList with a C array
("never use a dynamically-sized container for statically-sized data").

Task-number: QTBUG-115803
Change-Id: I1b1e8f093abf75093900631e6fe3cbc9e3019d34
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 6f5f10bea80eb9439a1498e7a19d8631fc791ed3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-17 17:45:24 +00:00
Mikolaj Boc
0136720e52 Support PRELOAD var substitution for WASM main html with qmake
The PRELOAD variable in wasm_shell.html wouldn't get substituted with
preload list when using qmake. Do that as it is done in cmake.

Fixes: QTBUG-115507
Change-Id: I3c659626dc6fa6f4fdf9e31bd62b87fc6a7d8bbe
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
(cherry picked from commit 2b0d6a068fcc6723fe3dfd8ac167307f352097ff)
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-08-17 16:41:10 +02:00
Safiyyah Moosa
8d96533c42 Doc: Add proj folders to antivirus exception list
Add a note to state that Qt projects and user project build folders
should be added to the antivirus exception list.

Task-number: QTBUG-114928
Change-Id: I4873dc75506d55a9e6c2a2614eb8f05c14f37142
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit c3470b20874d2460d5f4e1dc820bfaf5daee132b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-17 14:41:09 +00:00
Ivan Solovev
d77b12a9bb QUuid: use 'inline' keyword on method declarations
Some older compilers used to generate warnings if the 'inline' keyword
was used only on method definition, but not on its declaration.
It does not seem to be a problem at the moment, but still move the
'inline' keyword from the definition to the declaration of the new
QUuid constructor, toBytes(), and fromBytes() methods.
Split the fromBytes() declaration, moving the keywords to a separate
line, to fit into the 100 characters limit.

Found during Qt 6.6 API Review.

Change-Id: Ic5bd3ad094669cda76592968789cf83e9a72bccd
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 6616d4e1f3cc991ac723981d90b411a9cae7f795)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-17 14:41:09 +00:00
Toni Saario
3c2985a363 Use install from libexec for QNX on Windows
It moved to libexec at some point in 6.5.

Change-Id: I1e80c0dd1dc253c08bf509aeb605b863a5d67e47
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Simo Fält <simo.falt@qt.io>
(cherry picked from commit c6279001c73a11c3bc805cfd44fb3280d87b2e32)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-17 14:41:09 +00:00
Andreas Eliasson
2332b6ccde Doc: Remove references to non-existing current() method
There seems to be no current() method. Replace with the vkInstance
method.

Fixes: QTBUG-115853
Change-Id: Ifc0f741186092862b498fe4be2d39076b92fa725
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 50bce440277d4383dcf3a055cb9b5d513735bcbc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-17 14:41:09 +00:00
Volker Hilsheimer
7279e97dc3 Revert "QIconLoader: clear cache when the key becomes invalid"
This reverts commit e2f0495e7efffefe927e43b26fa3a3a610aa003f.
Cleaning the cache is not be needed, as the invalidated key will make
sure that the cached QThemeIconEngine engine will not reuse the previous
engine to generate the pixmap, but request a new engine from QPA.

This way, a new pixmap will be generated also if system settings
change that will influence the pixmap generated by the platform engine.

Change-Id: I9632c37c4ec86fe46acb701ec69a7868b3434322
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit fd5c2058ae089611200f00b8b7ba76a8d339c506)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-17 14:41:09 +00:00
Edward Welbourne
d5fbeeff52 Correct name of HanifiScript in enum documentation
This amends commit 923790832777f3e4d9d9be5eba13a9ffdedcf9e7, which
shouldn't have integrated, but apparently the qdoc check in Coin
wasn't running that day.

Task-number: QTBUG-111550
Change-Id: Ife6108eb49fb8988d43390200de480fc5b57e58f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d7bad11a87a5edcc55e6d0a45201b48f52f54e23)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-17 14:41:09 +00:00
Alexey Edelev
7265ab1897 Use the relative header path when checking if it's 3rdparty
If source or build directry contain '3rdparty' in their path, all
header files are marked as 3rdparty and will never be installed.
This commit is CMake counterpart of
ea4a3d78a776e10955caf6cf9b1054ddb50f40d3

Amends ea4a3d78a776e10955caf6cf9b1054ddb50f40d3

Fixes: QTBUG-116137
Change-Id: Ib93fb879867e3aeb6e44193c4253e73173c141d2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7544d91ae1948c21225c345e2c941ab40b37b518)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-17 14:41:09 +00:00
Marc Mutz
7cd5f6952e QMimeDatabase benchmark: port away from Q_FOREACH
The original code duplicated contained elements of a QStringList by
repeated appending it to itself, preventing the container from being
marked const.

Instead, keep a list of unique mime-types, and iterate over the list
eight times.

As a drive-by, port from QList to a C array ("never use a
dynamically-sized container for statically-sized data"), use u""_s
UDLs (since we're touching almost all lines of the function, anyway,
also in the unrelated mimeTypeForName() call).

This allows porting the Q_FOREACH loop (which anyway cannot deal with
C arrays) to a ranged for one (which can).

Task-number: QTBUG-115839
Change-Id: I844ae38104bb2980ea194b85f9017a3e95791ea2
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 47375a213f0751b5649ee7c4ae47fae020f9c77f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-17 10:51:46 +00:00
Marc Mutz
74f33348f2 QtWidgets tests: port remaining users away from Q_FOREACH
These are all trivial: all are over (already or newly-made) const
local variables.

As a drive-by, replace a QList legacy left-shift-based- with
initializer_list-construction.

Task-number: QTBUG-115803
Change-Id: I453e24272c4c4b7dce5b91a0bd04481d833c50bb
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 40afcb9d01713c02737f6f83a59437fc8320ef0b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-17 10:51:46 +00:00
Alexandru Croitor
8a1e204edf CMake: Allow installation of example sources into the Qt prefix
In Qt 5 times, if Qt was configured with -make examples, running
make install would not only build and install the example binaries,
but would also install the example sources into the prefix.
Installation of example sources was not implemented when the Qt 6
build system has switched to using CMake.

There is still a use case for it though, mainly for Qt Creator, which
only shows the examples of a Qt kit if the sources are available.

In contrast to Qt 5, in Qt 6 we will not install example sources
by default. It will be opt in.

To enable installation of examples sources, configure with

 configure -make examples -install-examples-sources

or

 cmake -DQT_BUILD_EXAMPLES=ON -DQT_INSTALL_EXAMPLES_SOURCES=ON

The -make examples part is required, otherwise
-install-examples-sources has no effect.

All example sources can be installed by calling
 cmake --install . --component examples_sources
in the qt repo build directory.

In a top-level build, per-repo installation can be done using
 cmake --install . --component examples_sources_<repo_name>
where repo_name could be 'qtbase'.

A single example's source can be installed by calling
 cmake --install . --component examples_sources_<subdir_name>
where subdir_name is the subdirectory name of the example, e.g.
'gallery'.

Implement installation of example sources by hooking into the
qt_internal_add_example command.
This means that all examples in all repos need to be added via
qt_internal_add_example instead of add_subdirectory, to ensure the
sources are installed. The majority of repos already use it.

For testing purposes one can configure with
-DQT_BUILD_EXAMPLES=ON -DQT_INSTALL_EXAMPLES_SOURCES=ON
-DQT_INTERNAL_NO_CONFIGURE_EXAMPLES=ON to allow testing installation
of examples sources without building them.

Take into account an additional variable called
QT_INTERNAL_EXAMPLES_SOURCES_INSTALL_PREFIX to allow installation of
example sources into a location different from the example binaries.

As a cleanup, the NAME option that could previously be passed to
qt_internal_add_example_external_project has been removed.
That's because it's never used anywhere and could not have worked
anyway because qt_internal_add_example_in_tree never handled it.

Fixes: QTBUG-112135
Change-Id: I52aa5ec643ff7e212276c88d8dd2dfecdbdbeb0d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 121f7f382badc0f8af6fdbb547f8649b5e1b75c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-17 07:38:18 +00:00
Marc Mutz
a44a81ceb7 QFileSystemModel: remove incorrect ### Qt 7 comment
QTimeZone is not trivially-copyable, so we shouldn't default arguments
of that type (cf. QTBUG-98117), but continue overloading.

Found in API-review.

Task-number: QTBUG-98117
Change-Id: I24e9d6c10512a50c172b5722c7d75bf74adf60a6
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 3adf81f09f019199d7e5bb008196657c8a76e840)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-17 05:40:14 +00:00
Mitch Curtis
11ca4ae1f8 Improve Qt Test documentation regarding skipping/expecting failures
- Mention QEXPECT_FAIL on the best practices page.
- Link to the best practices page from "Chapter 6: Skipping Tests with
QSKIP".
- Add some more links.

Change-Id: I0c9e0adb9fe500791dad44869434cf6ecdcf51a1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 5de991059e1590b0f40b73b5929953c3a6754478)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-17 01:47:22 +00:00
Volker Hilsheimer
ec4b9503e8 QTabBar: don't make current tab visible while tab bar is invisible
When changing the current index while the tab bar is not visible,
calculating the necessary scroll offset might result in wrong results if
the tab bar still has an old size. When the tab bar then gets shown and
resized, the scroll wouldn't be corrected, potentially leaving tabs
unnecessarily scrolled out.

We don't need to make the current index visible if the tab bar itself is
not visible, it's enough to flag the layout as dirty so that the next
show event (which either way makes the then current index visible)
triggers a laying out of the tab bar tabs.

Amends e851d4c06154bf02b23030ff1f7024a8b9edf874.

Fixes: QTBUG-115109
Task-number: QTBUG-113140
Change-Id: I3d8633f9f8b907a36190123839a6104a17bfe138
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 3965d52ad5a6376d593026a87831026a8a5f3469)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-16 22:52:20 +00:00
Fredrik Ålund
f656ffdb0a Fix architecture selection for Mimer SQL client library
Case-insensitively match the architecture string for x86 and amd64.

Fixes: QTBUG-111219
Change-Id: I775e81965f46bb7479e0e9a05e66b8a080656ee5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6e9f989eb61dd39562c47707cbd70d7f514b6e54)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-16 22:44:31 +00:00
Marc Mutz
3a9bbf235d tst_QHashFunctions: extend the consistency() test with int/FP types
It's ... broken. Found and filed lots of bugs. Add #ifdef'ery and
QEXPECTED_FAIL() to document the state of affairs, hopefully reminding
us to fix these things come Qt 7.

Task-number: QTBUG-116064
Task-number: QTBUG-116076
Task-number: QTBUG-116077
Task-number: QTBUG-116079
Task-number: QTBUG-116080
Change-Id: I29e89fdf995ddf60ef1e03c7af009e80980c9817
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c86cf385d6d66d8fd3de1666205aaf4b8fcec747)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-16 14:19:37 +00:00
Laszlo Agocs
3e09f3abbb Fix texture-based non-native child of a non-texture-based native child
Another one in the series of problems around having texture-based and
regular widgets in hierarchies where some widgets are native and some
are not.

Fixes: QTBUG-115652
Task-number: QTBUG-108344
Task-number: QTBUG-113557
Change-Id: I34306503cb17ccb915b90168ec3f39e209f668e5
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 373c08d03d39b6933a16a5b839aa7ae271cede42)
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-08-16 14:19:32 +00:00
Simo Fält
3e1a7eeabb COIN: Enable debian instructions for all submodules
Change-Id: Ic5ce96cb0dbcb85fbffb3af52d65b9c3fd7f9bb4
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit 77273f26935f0b2a6d75e0a8f1245b0516a4da22)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-16 14:19:32 +00:00
Jan Arve Sæther
a3346dbef3 Revert "Windows QPA: Add support to UiaRaiseNotificationEvent()"
This reverts commit 566def740ec58e842e6bb37177f80e20aebaa245.

The fix had some unwanted side-effects when the
QAccessibleValueChangeEvent carried a value of type string. Only
QComboBox uses QAccessibleValueChangeEvent in such a way.
The consequence of the reverted patch was that it broke QComboBox
so that the screen reader would read aloud the value change event
regardless of the visibility or focus state of the QComboBox. (Thus, if
you e.g. changed the QComboBox::currentIndex on a *hidden* combo box,
the screen reader would still read aloud the event)
This is also the root cause of what is described in QTBUG-93763.

Also, due to the usage of NotificationProcessing_ImportantMostRecent
the screen reader would treat it as such an important event that it
would abort whatever it was currently speaking.

In addition, the reverted change didn't fix any bugs and it failed to
implement the suggested behavior in a correct way (as was described in
QTBUG-75003 - albeit properly described after the change was merged).
QTBUG-75003 has already been reopened due to this, and the change can
therefore be reverted quite risk-free.

Task-number: QTBUG-75003
Task-number: QTBUG-93763
Change-Id: Ib91872adc563c31534fe2b30fd9c447bfcca6b40
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 193fb8bb68e35f6ad25a7d62a6e321bd41ecf688)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-16 14:19:32 +00:00
Ivan Solovev
bc88069890 QUuid: improve documentation regarding the order parameter
Clarify that the order is the expected byte order of the input data.

Found during Qt 6.6 API Review.

Change-Id: Iaa1f5eef22df60676e52197fbcf613f6e9970a3e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 17297e17927631f22dbb342c00f65af6a2b5a5e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-16 14:19:32 +00:00
Mats Honkamaa
9f0a95a806 Doc: Add example categories for Qt Network examples
Task-number: QTBUG-116001
Change-Id: I0c32df7752347f7c38996b3815d270dbd4c90707
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 4e009da7ef0eeb29851b7c9e95f89d4411c072b8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-16 14:19:32 +00:00
Morten Sørvig
8ac594b13f wasm: handle missing qconfig.h
There's no guarantee that qconfig.h will be present
when __qt_internal_get_qt_build_emsdk_version() is called
during configure, since the file is written by a file(GENERATE)
call which does not write the file immediately.

Handle this case and allow configure to complete.

Change-Id: Iab85790f9f133fd1ba5f276cdd7bc55f9af1d980
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
(cherry picked from commit f7953cdee6eed997f1b5f3e5085dac405f3d5e31)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-16 12:07:28 +00:00
Tor Arne Vestbø
001394acf7 wasm: Don't clamp y position of child QWindows to parent rect
A child window should be possible to place at arbitrary positions
within its parent, even outside the parent's current rect. Once
the parent size is changed, the child might become visible.

The current code also caused issues when the parent did not
have a size yet (0x0) at the time of the child's setGeometry
call, resulting in the child always being placed at y=0.

Change-Id: I1534b606ab6eb7d51216d3b305a1b60443c41ec2
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
(cherry picked from commit 89209c8eca985c290f8afec3e1aa8fd3426cda65)
2023-08-16 12:07:28 +00:00
Inho Lee
b4e7e6cfa7 Add a test case for an invalid min/max size pair
Task-number: QTBUG-113233
Change-Id: Iad3f2f5d98637dbbe2ad6b23027ffdd942fb05d3
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 8191be512d1e529423d8eda9cee787346346e18f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-16 09:11:37 +00:00
Nicholas Bennett
d53745d702 Docs: Add a macro for documenting something as a technical preview
Adds a warning symbol.
Adds a note to the brief string.

Change-Id: Ib036295bbcf7ab5eca7fd554fb2da836fedad8a0
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 5290ba4cbd1e5bcdc217b58b0495768263097ba3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-16 06:55:44 +00:00
Marc Mutz
9f1c5945b7 tst_QHashFunctions: use actual seed in consistent() test function
We were only ever testing with a 0 seed, even though the function was
called for all QFETCH_GLOBAL seeds.

Add the seed.

Amends 5e93361888e3d2b03e7b6da19517b44e0239fb47.

Change-Id: I3c78714ad6fb3f94233789dd2c8884d9b157fa76
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit fa522eb8becba3243aae8bee191f6f60672434f2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-16 04:44:19 +00:00
Tor Arne Vestbø
31a26a4f2e wasm: Apply window mask during QWasmWindow initialization
We need to apply properties of the QWindow the underlying "native
window", in this case our <div>, on construction, without waiting
for the user to call one of the QWindow setters.

Change-Id: Id422a9424f584e2269ef333e2c7c88a123ecb70b
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit b0827bf8d43768153186181a7ef8fde3f9c95d40)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-15 16:19:02 +00:00
Aaron McCarthy
23b4ab8f45 androiddeployqt: Fix generation of qtDataDirectory
Commit 9db5ca87897340873a4606c651a37e0356e8f1a0 sets the default
qtDataDirectory to the value of qtInstallDirectory, which results in an
invalid path when appended to the SDK. This results in build failures
for Android when building with qbs. cmake builds are not affected as
the data directory is explicitly set in the build scripts.

Change-Id: Ia29c5bae7648f5fccefe019c225e187985bd2592
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit c27798da2f5a426e50423a83a42d8ddaa0abbc13)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-15 16:18:58 +00:00
Tor Arne Vestbø
4c7553c30a wasm: Don't add window border, title bar, etc, to child windows
Only top level windows should have window manager features,
to match other platforms.

Change-Id: I7a0563ef34aeb430d0b1a16633a5626482ccd17d
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 3c438c5d4c218ce750d2dc5f8cb14c5b4a3f7385)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-15 16:18:57 +00:00
Assam Boudjelthia
9e0850b564 Android: fix content URI handling for non-ascii file names
Pass an encoded URI string before parsing them through the Android APIs.

Fixes: QTBUG-114435
Change-Id: I65131799fad81bfe7490d663d3b7996c94d37f0b
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit ea75e34d6968bb59624874411e793c95b26d0dbe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-15 12:23:47 +00:00
Axel Spoerl
15ed84677c QDockArealLayoutItem: recurse subinfo in QDebug operator<<
A subinfo has its own item list. Recurse into it when debugging.

Task-number: QTBUG-115058
Change-Id: Ide820e4440caa97b84a3366c2d385546fb6026ec
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit efc4bf5e63cd90c2e1f3bda1cce8dea957865f0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-15 11:22:03 +00:00
Axel Spoerl
95cdc8c1d3 QDockWidgetGroupWindow::adjustFlags() - don't show() empty group window
The method calls show() on a dock widget group window, when the window
flags have changed. When all of its contained, tabbed dock widgets are
programmatically hidden or docked on the main window, an empty group
window is shown.

This patch implements bool hasVisibleDockWidgets(). It returns true, if
at least one of the group window's dockwidget children is not hidden.
It replaces show() by setVisible(), passing the return value of
hasVisibleChildren().

It adapts tst_QDockWidget::floatingTabs() to test the fix.
(Drive-by: remove dead code)

Fixes: QTBUG-115058
Change-Id: Ifb8e2450e91a7c78decc06f592e160631ca2faf5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit e03bc88a80382b68359ba6ea5fc4cb9507ceb85f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-15 11:21:55 +00:00
Simo Fält
2c8a5b5051 COIN: Fix typo in debian packaging instructions
Change-Id: I2d13bd567f790fcf7cff51b133deb9f2220cb73d
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit 95768e38b74ea4189fd3a12b8848e0101e3ab944)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-15 08:40:13 +00:00
Axel Spoerl
ce3ca69dc6 QXmlStreamReader::readNextStartElement() - return false on document end
The method reads the next element in a loop, as long as valid elements
exist. Within the loop, it returns
- false if the end of an element has been reached
- true if a new element has started

When the document end has been reached, the loop continues, until
readNext() returns Invalid. Then, PrematureEndOfDocumentError is launched.

This is wrong, because reading beyond the document end is caused by a
missing return condition in the loop.

=> Treat document end like element end and return false without
reading beyond it.

=> Test correct behavior in tst_QXmlStream::readNextStartElement()

Fixes: QTBUG-25944
Change-Id: I0160b65880756a2be541e9f55dc79557fcb1f09f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ccd8a496cf46313ea0df9fe70f4e4b57f9434b24)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-15 07:36:39 +00:00
Thiago Macieira
f699962821 tests/tools: only run qdbus{cpp2xml,xml2cpp} tests if D-Bus is available
Strictly speaking, we don't need the *bus*, only libdbus-1, but some
machines in our CI appear to be misconfigured somehow. I don't
understand how they can both have and not have this library in the same
run.

Change-Id: I80612a7d275c41f1baf0fffd177a66a04951948c
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit 7a1ffacca0096125603b99a58f651c322468db27)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-15 03:19:52 +00:00
Thiago Macieira
7079c28664 Fix registration of QtDBus types' metatypes
By actually registering them.

Commit 850d850c5af8ff77a4b9d53457ec6b1ba6c20cb3 changed from
qMetaTypeId<QDBusArgument>() to QMetaType::fromType<QDBusArgument>() and
in Qt 6, fromType() does not register the type with the database. That
means the lines became runtime no-ops at that time or during the
QMetaType updates since 6.0. All they did was instantiate the C++ inline
variable.

The testing also detected we didn't register QList<QDBusVariant> as an
alias for the "av" signature. I'm not entirely sure you're allowed to
use this because QtDBus does not like re-registration of the built-in
types, and "av" is already assigned to QVariantList. This is no trouble
for the parser, anyway.

Minor change to qdbuscpp2xml to allow reading from stdin, so we don't
have to create temporary files.

Fixes: QTBUG-115964
Change-Id: I80612a7d275c41f1baf0fffd177a14925e7d23ac
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit 56bd5d60c9fb9b9078847e4c4919956af3cbf08a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-15 03:19:51 +00:00
Ievgenii Meshcheriakov
7864dcbe4e QDBusConnectionManager: Register metatypes in the constructor
Call QDBusMetaTypeId::init() in the cosntructor. This ensures that
the custom metatype registry is not destroyed before the instance
of the connection manager.

Task-number: QTBUG-58732
Change-Id: I8c7c4c23deab2c7e11c6389a8976666ccf6baf48
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e8e8e1082e8dea3ddecae98123156a24df96558d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-14 23:11:14 +00:00
Marc Mutz
5ab33c107f Remove QUuid(quint128) constructor again
This constructor matches way too many argument types (integral,
unscoped enums, FP types), so it's likely to cause mayhem, even if
left in as an explicit constructor.

We now have a named constructor for the same functionality, so just
drop the "unnamed" constructor.

"Unnamed" constructors are important when emplacement is more
efficient than construction + move, or when implicit conversion is
required.  Neither is the case here: The named as well as the
"unnamed" constructors just copy ten bytes around, and the compiler
can optimize those extra copies away just fine.

Found in API review.

Change-Id: I7faafd3ebf522fb2b0e450112fb95d643fece5ce
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 9c1d20337a5585c620e13776f9c33582f2e479d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-14 22:38:12 +00:00
Marc Mutz
849d7bee68 QtWidgets benchmarks: port remaining users away from Q_FOREACH
These are all trivial: all are over (already or newly-made) const
local variables.

We don't have a mechanism to mark a subtree as Q_FOREACH-free, and
adding QT_NO_FOREACH to each executable is overkill, so we just have
to hope that no new uses are being introduced until we can mark the
whole QtBase module as Q_FOREACH-free.

Task-number: QTBUG-115803
Change-Id: I13dc176756633674bab8c93a342ecdba6c5dd23e
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit d4ba15914871089df72ef1f4b5785d52df0fb4bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-14 22:18:46 +00:00
Marc Mutz
d2210aaf02 QHostInfo: port lookupHostImpl() to SlotObjUniquePtr internally
Avoids the manual deref'ing.

Change-Id: I1a51a468dfa704986f050b29322a424dc6fcd7b7
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5d8db914c9c557bc82b97b410270b6f85ef1e598)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-14 19:30:56 +00:00
Axel Spoerl
f0869a66ae QPlainTextEdit: update placeholder text when document is empty
When the placeholder text is changed after having been displayed, it
doesn't get updated on the screen any more, unless the entire viewport
is updated, e.g. because of a document change or a focus event.

This patch simplifies QPlainTextEditPrivate::updatePlaceHolderVisibility()
to update the visibility if the text document is empty.
It replaces the member QPlainTextEditorPrivate::placeholderVisible
by the function isPlaceHolderTextVisible(). It returns true, if the
document is empty and a placeholder text exists, and otherwise false.
It adapts and corrects tst_QPlainTextEdit::placeHolderVisibility():
- usage of new member function instead of data member.
- do not expect an empty placeholder to be visible.

Fixes: QTBUG-115831
Change-Id: Ic4427ce7f7f1b8cde89957b9de0b978bd34ba923
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit 4c7cac682fddfad274325ff82b5f212543e5373a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-14 17:11:39 +00:00
Timothée Keller
5c0dea4760 Windows QPA: also consider child windows for setting WS_EX_LAYERED
Child windows on Windows cannot have a frame, so checking only for
Qt::FramelessWindowHint is not sufficient. Add an additional check
to see if the window is a native child (has the WS_CHILD flag).

Change-Id: Ib5cbec0f6157da687a5585e12a6c4c6935919538
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f56fc425f9a103ed71697314196649641ef3691c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-14 16:06:03 +00:00
Alexey Edelev
a0981f1341 Fix the android paths check
Expand the prop_name.

Amends 575b8a7fa289a2e27984a6c322069f9e1b499024

Fixes: QTBUG-116007
Task-number: QTBUG-115119
Change-Id: I66537a6dbb97c89fdff1f721d091eae1d02907e6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 0e3815a7a85befe49b87370842814f5c23b6c8c4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-14 16:06:01 +00:00
Eirik Aavitsland
73880c92ea Revert "Add QBezier methods for computing a quadratic curves approximation"
Were added for 6.6, but turns out they were not quite ready, and also
live better together with the quadpath class in the curve renderer.
This reverts commit aaccd50224f9a5b22b717ac743634be77c5bc678.

Change-Id: I58399f8e280d5353cb9c3102e8a8e15dcfa4484a
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit 3cc693d2565c5633382517145822bb5edc3106cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-14 16:06:00 +00:00
Eirik Aavitsland
f06ad33e46 Avoid compiler warning
Under some configure options, gcc13 emits an intractable warning on
this line. This patch works around it.

Fixes: QTBUG-115809
Change-Id: Ib63f2ad81ebdb1f609a7f42c25119c5ae29f08bb
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit f8f23c43feb2fb233a8f047cd1b82259498d9aeb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-14 16:05:56 +00:00
Axel Spoerl
3ef96cc184 Harden QMenuPrivate::hideMenu() against menu argument becoming stale
QMenuPrivate::hideMenu() hides a menu and reposts events in case a new
action has become the active one. For that purpose, it waits 20ms and
60ms for visual effects to be rendered.
If the last action has been triggered, the menu's deleteLater slot has
been called before hideMenu(). In that case, it gets deleted while
events are processed during the waiting periods.
Subsequently, menu becomes stale.

This patch replaces the QMenu * argument with a QPointer. Early returns
are inserted after waiting. QSignalBlocker is replaced by manual signal
blocking, to prevent the signal blocker from recovering the state of a
stale object, when it goes out of scope.

An auto test is not added: The error scenario occurs, when a menu is
triggered by keyboard input, while a mouse event is sent to the main
window from outside the menu. Such a test scenario is complex to match
and exposed to flakiness.

Fixes: QTBUG-115597
Change-Id: I4f937fe66fb1b5cf78ebee70fd0006712172cb12
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e66cbdf68455263aa6b77d4ea9a4e621837dbad3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-14 15:05:51 +00:00
Axel Spoerl
2aa619d3b3 QAndroidPlatformInputContext: send composition text and cursor jointly
QAndroidPlatformInputContext::focusObjectStopComposing() sends an input
event for each character newly added by the Android virtual keyboard.
It then sends a second input event to notify that the cursor has
advanced to the position after the new character.
The implicit assumption is, that the receiver of the input event does
not change the text.

If e.g. QLineEdit::setText() is called in the QLineEdit::textEdited
slot, the text does change. If the change implies a cursor change,
QLineEdit notifies the platform input context about it.
However, by sending the second input event, QAndroidPlatformContent
returns the cursor back to the position after the last character added
by the virtual keyboard.

This patch joins the composed text and the cursor position into one
single input method event. A new cursor position, set by the receiver
of the input method event, is no longer overridden.
The patch adds test functionality to tst_QLineEdit::setText().

Fixes: QTBUG-115756
Change-Id: I85ffac5d6bab93ccb144be0f5b8083258a270550
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit be3b9b2ab12f664c196d649e8c4247d70805d667)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-14 14:24:57 +00:00
Mats Honkamaa
7effe20b59 Doc: Add example categories for Qt D-bus examples
Task-number: QTBUG-116030
Change-Id: I6ad7ddb69fc952d3bba7477ab804455d46d77866
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit b1c062d07889abda3aa8678331e56b721412ae6f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-14 14:08:46 +00:00
Ievgenii Meshcheriakov
89552df61d Revert "QDbus: Avoid memory leak in registerComplexDBusType"
This reverts commit 4c1df115ecfb14c353c0ec46efdb1f9d2fc0ea95.

We cannot guarantee that there are no more QMetaType
instances that reference the interfaces being destroyed.
All such instances will become invalid after the interface
destruction with no way to verify that.

Change-Id: Iad17fe88753143734b8b817dda184e3c3818575c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8a3330be38b5cac6098795f502fd54e7c8f555fb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-13 22:03:18 +00:00
Ievgenii Meshcheriakov
7ae5b002dc QDBusMetaType: Check that Q_GLOBAL_STATIC is not destroyed before using it
Combine the lock and the custom types list into one struct
so that the check code does not have to be duplicated.

Task-number: QTBUG-58732
Change-Id: Ib61d5be3a3cb6465acc5834e5dcbc735fb8b4d8e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit df485fff264265aaaa280d8039aff35a5e9af6fb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-13 22:02:53 +00:00
Axel Spoerl
e03c895be6 Pull QWidget::setTabOrder(std::initializer_list...) behind ABI boundary
Found in API-review.

Change-Id: I261aa450d25288e7a3e8caa033ce5000e5dd77f2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit a27cc5d72735dfd1504bb0be02f180a61932abc7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-11 18:54:14 +00:00
Edward Welbourne
5fb1bec201 Clear the _X version of alongside the enum deprecator
When QT_NO_DEPRECATED_WARNINGS is defined, we undefine
Q_DECL_ENUMERATOR_DEPRECATED as it's used raw (rather than via an
intermediary or version-variant). The same is true of its _X()
variant, so do the same for this - which involves redefining it to a
still function-like macro, so that its parameter gets ignored.

This amends commit 59b03992ab332a320ac7cff7c5b099b2c30e14b2 (and shall
get conflicts on older branches, before the defines in question moved
to qtdeprecationmarkers.h in 6.5).

Change-Id: If85c135cddbb33e93cb90f400af123c74e0298ac
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit ffaa1281d492d9ab1b0301944c12301dacff55cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-11 17:50:22 +00:00
Ahmad Samir
85a4749302 QGestureManager: prevent double-lookup in a QHash
First lookup with value(key), second lookup with remove(key). Use
constFind() to get an iterator and use that instead.

Change-Id: Idce585ad2269be91eda0381aeb2f2d164033f71f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 99c6190bdf3906bd84ed1368a4d41abe08470f78)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-11 17:50:22 +00:00
Axel Spoerl
ea9f37469e Improve diagnostic output in tst_QDockWidget::floatingTabs()
Use QTRY_COMPARE instead of QTRY_VERIFY.

Task-number: QTBUG-115058
Change-Id: I2bfb7c54476e8fdd4f34c74888f56a6f7942a7ee
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit 814b7fd3a82725a958af76282fcf56561bc92d42)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-11 17:50:22 +00:00
Ievgenii Meshcheriakov
6171141717 QtDBus: Remove assertion inside qDBusAddTimeout()
The assertion is triggered when a timer cannot be started. This
is normal occurrence when an application exits before all pending
D-Bus calls are processed. And there is a code handling such failure
in the same function. Qt also prints a warning message in this
case:

    QEventDispatcherGlib::registerTimer: invalid arguments

Task-number: QTBUG-58732
Change-Id: I37859443fa90ae1bf7da1572ac9b02a54c8e1b99
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 90e0c6693b3bd9c5272bd8e6255ca9aefd183912)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-11 17:50:21 +00:00
Marc Mutz
98e791bdca QUuid: add a named fromUInt128() ctor
This makes the API symmetric again (fromBytes()/toBytes(),
fromString()/toString(), fromUInt128()/toUInt128()), but also gives us
the option to remove the QUuid(quint128), should we so choose, because
of its overly-broad argument matching range.

Found in API review.

Change-Id: I91bd2450d62ed565ec3b8e46c875f4983bd9dc73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 70835a93351b3288a8df4361e648b9cd951ad436)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-11 11:09:13 +00:00
Marc Mutz
78165c6b83 QUuid: make (quint128) ctor explicit
It matches any integral type, any unscoped enum and any FP type, so we
can't allow it to be implicit. In fact, it's probably better to only
have a named contructor, fromUint128().

Found in API review.

Change-Id: I9b250e0b5e74a449b6df4efe3ea38b750c9744ed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7bbd707299581840fa0ab369dd826102899cd2ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-11 11:09:04 +00:00
Alexey Edelev
fa7a19e97a Use Release and Debug configuration for multi-config Qt builds by default
If user attempt to build Qt using multi-config generator set Release
and Debug configurations by default if they are not set, instead of
relying on what CMake suggests as default value for a platform.

Change-Id: I4bdb33e56818984c189b737acccc9ac50659db96
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d09a9f6de3cf672e52fd4081eec7b07b9ed0e877)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-11 11:04:49 +00:00
Marc Mutz
94a5d32343 tst_QImageReader: it's a rotate^Wadjacent_find!
Instead of copying a list, sorting it just to check it's sorted, and
making a QSet out of it just to check the size is the same as that of
the list (thereby checking there were no duplicates), simply apply
adjacent_find with greater_equal. If none of the elements is ≥ their
successor, that means all elements are < their successor, and _that_
means the range is sorted and has no duplicates.               q.e.d.

Change-Id: Id73c674ad4e29117370e8fc6af9fdfc690a3fba9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 29d07101e5dd7efbb0ffbab1acb5d8d4ef0ed731)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-11 08:51:26 +00:00
Axel Spoerl
b3c12b05e6 Remove assertion in QAndroidPlatformScreen::addWindow()
QAndroidPlatformScreen::addWindow() asserted the existence of a backing
store, when a window is added. But QQuickWindow neither needs nor has a
backing store.

This patch removes the assertion, which was introduced in
dbb072eb2838a04e89e34dad686394a496d5de87

Task-number: QTBUG-97482
Change-Id: Ifb43f83d39e16b972754e86d0ff9633f58dac3f8
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 9a39ad8dfb4e6d1a179bd0fa38026886f8f7cb8e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-11 06:43:51 +00:00
Marc Mutz
c79e71fe2c QHostInfo: use new QMetaCallEvent::create() overload
Move the SlotObjUniquePtr directly into the QMetaCallEvent, without
having to up and down the ref-count.

Change-Id: I029f71c60defce71ac8778547efe999ce0cf7b4b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 4cf51f46166b50904f0161f028a9ff1c9ba5ae3e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-10 21:58:52 +00:00
Ievgenii Meshcheriakov
94124571b5 Q_GLOBAL_STATIC: Use Q_FUNC_INFO for assertion contexts
Using Q_FUNC_INFO has an advantage that at least GCC includes
the variable type and name into the string. This makes it much
easier to understand access to which global static is causing
an assertion.

Change-Id: Ie6ce992921c0969df262fed22024a22650783f93
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 31e414d36e59424af5c459cf0f87333eba0f4a57)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-10 17:46:03 +00:00
Axel Spoerl
8442b05bdd QPlainTextEdit: clean up private slot definitions
Private slots connections have been migrated to QObjectPrivate::connect
by 2f3f3eb0d4d77743c135d95c792f66a4272903f7.

Remove redundant _q_ prefix and Q_PRIVATE_SLOT declarations.

Change-Id: I74075e6a822ecd5b2861aee29a65a5c93e6472a8
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit 214016835f198ce5150862d97288760820d9e494)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-10 16:54:17 +00:00
Marc Mutz
194848c5fd QMimeDatabase benchmark: measure only what it pertinent
Drag the QCOMPARE (which even dynamically allocated a QString
fromLatin1()) out of the QBENCHMARK loop. Testing performance of
QString::fromLatin1() and/or qCompare() is not pertinent to the task
at hand, which, ideally, doesn't involve any memory allocations, so
there's at least the chance that this skewed the result noticably.

Didn't run the benchmark as this was developed on an asan build.

Yes, this breaks comparability with the stone-age measurements
reported in comments there, so sue me.

As a drive-by, replace the fromLatin1() with a u_s UDL.

Change-Id: I9b2a8b2e3596ec9b07c6b4ea369257b1a86e09db
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 17dad4b88bcdacc144812d0b63664540177cff77)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-09 21:57:54 +00:00
Marc Mutz
0f272af5c8 embeddedintoforeignindow test: port itemwindow.h away from Q_FOREACH
As a header, it would otherwise make all TUs that include it (with
PCH: all) incompatible with QT_NO_FOREACH.

Without deeper analysis (which economy of time forbids in this case,
given this is just a manual test that's probably run 10 times per
year), and seeing as this is in an event handler, I opted to play it
safe and iterate over a copy (which is exactly what Q_FOREACH
does). Added a comment to indicate it may not be needed.

Task-number: QTBUG-115839
Change-Id: I7db75321dd34888f6dd7a64cccb7462ff35935fa
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit cc15e42e2c14ac40339620035b77d3f82f5480d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-09 21:57:52 +00:00
Marc Mutz
81d2137738 tst_QMimeDatabase{Xml,Cache}: make the two siblings behave the same
First include the common tst_qmimedatabase.cpp (and nothing else),
then implement the differing
tst_QMimeDatabase::initTestCaseInternal().

This will allow adding #undef QT_NO_FOREACH to tst_qmimedatabase.cpp
in the next step.

Change-Id: Icc1890229e9443bd35c81d4f0440ba7df5da906c
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit b7c6b670baf13cdf12b3ba93504e8df86e7b0af1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-09 21:57:48 +00:00
Marc Mutz
b1d28854f2 tst_QAccessibilityLinux: port away from Q_FOREACH
The single Q_FOREACH use here is simple, as it's over a local variable
that just isn't marked as const due to the way it's constructed, and
the loop body clearly doesn't modify the container, so the protective
copy that Q_FOREACH performs is not needed. But std::as_const() is, to
prevent a detach() (attempt). Add that.

Task-number: QTBUG-115839
Change-Id: If228f649efd87388f6e312078b24a5b46ac8dc36
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 5a8464b1f8fc88a47697012590dd4a8bb2201a61)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-09 21:57:45 +00:00
Simo Fält
5d9c7c9e35 COIN: Allow setting Debian rules branch as env variable
Change-Id: I5e28b78c9eea253c30e5a9eea6c5ea4cc672fd8e
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit 445c4adc24d76160706fe755e28228114db97bc3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-09 21:57:37 +00:00
Simo Fält
8823e00668 CI: Fix extra deb package location for sbuild
Change-Id: Id64f6f1ed21e2ea09187cabb5b4054a5643dc4bb
Reviewed-by: Toni Saario <toni.saario@qt.io>
(cherry picked from commit 861bb973d3db00db4c955fd82b4d77428f45a260)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-09 21:57:36 +00:00
Jonas Karlsson
b50d72a4cb Add missing include for Q_ASSERT_X
Change-Id: Ic2a52c6fe1d8a8c17bd722ac7c59a0d715dc8555
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit 5f72c822d06b30f2b7ae9fb845220e827a87730d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-09 21:57:31 +00:00
Marc Mutz
3ea8e8aef0 QHostInfo: de-inline -Result and -Runnable dtors
These classes are not exported, so we don't run into duplicate vtables
here, but the header is included in a few TUs other than qhostinfo.cpp
(all, when building with PCH), so make sure we compile dtors only once.

Change-Id: I51f6a6d27fc084ad469f82dc7aef3327bdd9a906
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit a2c8524ad7dd59f31b400b5da8979138dc835fcc)
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-09 20:53:54 +02:00
Alexey Edelev
a6b7a613c7 Fix typo in core animation docs
Change-Id: I9fdab0e3969a4d89695c70c4e44a8018a141c6bb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 4f686b7b78552282e47fce7640f0154efe091077)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-09 14:41:19 +00:00
Alexey Edelev
70e0b39114 Fix typo in QUntypedPropertyBinding docs
Change-Id: Id279760a40be56bea6456e57404348bd2619f64b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 91f5f44b1344fb64891c364a23e6aff2e5283e5a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-09 14:41:10 +00:00
Edward Welbourne
4fad4be7a8 Fix QMimeType::comment()'s use of UI languages and default
The MIME database appears to use underscore to join its locale tags,
where QLocale::uiLanguages() uses dashes. This meant that lookups by
anything but the raw language were failing even when there was an
entry in the MIME database for the desired locale. Also, since 6.5,
the uiLanguages() list always does contain the locale's own name, so
don't add it to the list again.

At the same time, the search was putting the "default" key (used by
the MIME database parser for the entry with no locale specified) at
the end of the list but macOS (at least) uses that for the "en_US"
version, omitting "en_US" itself from the locale-specific data, with
the result that those using en_US as locale, but with some other
languages later in the list, got the translation for one of those
languages instead of the en_US one, since they were found before
"default" was reached.  So insert "default" after the first block of
en-entries in which en_US appears, if it does, rather than at the end.

As a drive-by, amend a comment about using "pt" as fall-back for
"pt_BR"; as it happens, for pt_BR, uiLanguages() will contain "pt" in
any case, as pt_BR is the default for "pt". (Like en, pt anomalously
defaults to a territory other than the one the language is named
after.) So use de_CH -> de as example, instead (and place the comment
where the decision is taken).

Fixes: QTBUG-105007
Change-Id: I1f4835190748256ce53a51321a94ae450ab7f61e
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1b5e13c8d9db92cec41a1b50d74ce3af5853a7dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-09 13:53:30 +00:00
Alexey Edelev
5ab4764f1e Disable the 'openssl-hash' feature by default
Since the feature breaks Qt build in some configurations, disable it
by default and make private, so users should enable it explicitly and
make sure that openssl libraries are accessible for linking at build
time by either PATH or LD_LIBRARY_PATH.

Fixes: QTBUG-114783
Change-Id: I6eb53c43ed937ec1c0164025bc8953cc5170dc44
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d55c5e2a4384038c1deb5066e48d29444f891ebc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-09 13:53:28 +00:00
Eskil Abrahamsen Blomfeldt
b66fc29fb7 doc: Make docs for ElideNone a bit more precise
ElideNone was originally introduced as a way of modifying behavior
of specific widgets, such as QTabBar. The text would previously
always be a elided and an ellipsis character would be added somewhere
to indicate this to the user. Given that context, it makes sense
that the documentation says the effect of ElideNone is that ellipsis
does not appear in the text, since the text would still be elided
if it were too long, given that the painter would draw it clipped to
the widget.

When QFontMetrics::elidedText() was introduced later, this became more
confusing. In the context of this function, you would expect the text
to be returned truncated to the width but without the ellipsis character.
Instead it just returns the full string.

Since this has been the effect of ElideNone since the start and multiple
places use it as a way of disabling the truncation of the string, we
simply update the documentation to make this more clear.

Fixes: QTBUG-40315
Change-Id: If037430da6260020b1d99be7bd43e622f8afa844
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e7507d6cb706d28954343723438c4fc7d6fe5ba4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-09 13:53:26 +00:00
Marc Mutz
49ce591e69 tst_QMainWindow: for UB (use of reserved names)
Identifiers matching _[A-Z_].* are reserved for use by the C++
implementation. Replace the __ prefix of variable names with _v_,
making them non-reserved.

Change-Id: I35127d7473678e2efd93a4b21847db562c53abd2
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 8de746a96c4f83093d1bd50dc1bc3c68148097ac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-09 13:44:43 +00:00
Marc Mutz
7dda27c95e tst_QImageReader: fix missing checks for "newly"-added ImageOptions
The following commits neglected to amend
tst_QImageReader::supportsOption() with the ImageOption enumerators
they added to QImageIOHandler:

- c0ba249a48fd85ee8e047ff47448a4ed32d6cd91
- 163af2cf53d3441b453744b99254c07a175af5de
- ba323b04cd78fb43e9e63b891e973d24b08250af

Fix first and foremost by adding the missing ImageOption::ImageFormat
to the list of PNG-supported formats (which, curiously enough, predates
the public history and therefore the above three commits), and second,
by rewriting the whole test function to enable -Wswitch, so further
additions are less likely to be forgotten.

Change-Id: I102121b2c8a9067864b8ade2ebe2650be6fb6010
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
(cherry picked from commit 679bb388f09ca09f29ad23d22f9b381bf4f6eea0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-09 13:44:43 +00:00
Tor Arne Vestbø
1d84c2d479 macOS: Add qnswindow_cast helper function
Change-Id: If4394e4fbee271c926c0c1c32de1f9783319d994
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit ba2d109c5f091cf5307a15b096da56f50ad44412)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-09 13:44:43 +00:00
Marc Mutz
88dd567930 QStorageInfo manual test: port away from Q_FOREACH
In main.cpp, the loop is over a local variable which would be const
were it not for the multi-step initialization that I didn't want to
change. The loop body clearly doesn't modify the container, so port to
ranged for loop with std::as_const().

In printvolumes.cpp, the loop _does_ invoke unknown code (through the
function pointer passed as the second argument), but, as could be
expected, the two users of the function don't pass functions that know
about `volumes`:

- in the tst_QStorageInfo auto-test, an rvalue `volumes` is passed,
  so we don't need to analyze the qInfoPrinter function passed there,
  as it cannot possibly reference the temporary

- and in main.cpp of the manual test, we just pass printf (which is
  technically UB (taking the address of a standard library function),
  but I don't care right now).

Task-number: QTBUG-115839
Change-Id: Ibcd10a0e0b3229d8f2a1d98545d8fa6d473a0f75
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit bb11f7a9fa576b679fc64b09abadebf90dfbe9a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-09 02:26:39 +00:00
Marc Mutz
0be8f763d5 tst_rcc: port away from Q_FOREACH
Most of these are of trivial kind (loops over const locals).

The one that isn't, in cleanupTestCase(), is, however, also simple:
it's a loop over a local, too, but it would be too much churn to
change the initialization to make the container const, and the loop
body clearly doesn't modify the container, so just go with the
std::as_const() pattern here.

Task-number: QTBUG-115839
Change-Id: I188a78ea67a63be2d50a81fea431e5ea9f2783cb
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 961717d372ad94b90e8d06152e92f1af54810a25)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 23:06:00 +00:00
Marc Mutz
bdeaa4b3cc DynamicTreeModel test helper: port away from Q_FOREACH
This source file is included in four other test projects, so it makes
more sense to port it away from Q_FOREACH than to white-list it
everywhere it's used.

The change in ModelMoveCommand::doCommand() is trivial. I only dropped
the pointless top-level const of the loop variable as a drive-by.

The change regarding `parents` in ModelChangeChildrenLayoutsCommand's
doCommand() is also trivial, I just ported to braced initialization to
get the QList to be const. We're forced by the Qt API
(layoutChanged()) to use a QList here, therefore no array.

Ibid., the change regarding `persistent` is simple. The container
cannot be marked as const without a lot of churn to its initialization
(applying IILE, basically), but other than that, it's a local
variable, and the loop body clearly doesn't modify it.

Task-number: QTBUG-115839
Change-Id: I7a0e85804626a3cc612921b49e72e4b9f30b676d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit f493b72ee7e6c525159a6df5df13536021ed6b91)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 20:17:04 +00:00
Edward Welbourne
712db87ac4 Fix digit grouping: m_grouping_top doesn't mean what I thought it did
I'd previously understood CLDR's minimumGroupingDigits to mean the
most significant group must have that many digits. It turns out to
mean only that the first grouping separator doesn't get added unless
the more significant group has this many. Once we have one separator,
more can be added that do isolate a single digit.

In the process, I discover some of the prior arithmetic is incorrect;
it is now fixed. Added some basic testing, amended some existing
tests. In the process, fixed naming of some double validator tests.

Fixes: QTBUG-115740
Change-Id: Ia6ce011ba72e72428b015ca22b97d815ebf751b2
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit c5515f5eb17d525329e7adec6ea28ff4d5d5c24a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 20:16:59 +00:00
Marc Mutz
367cc461c1 QSslSocket manual test: replace QList with const array
"Never use a dynamically-sized container for statically-sized data."

Port the loop from Q_FOREACH (which can't deal with arrays) to ranged
for (which can).

Task-number: QTBUG-115839
Change-Id: Ib89d07fb751e3905a230ee5641e2e509e9415bed
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit ba4b88d9d2f1dd03906f445c55f8959e0165505f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 16:57:54 +00:00
Tor Arne Vestbø
9cd6cb67eb Fix embeddedwindows test on platforms without native window helper
Change-Id: I33074fc4a04982075a8c264bad41c56235e98cb6
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
(cherry picked from commit 5cf3d062f66677e77c0e288ba5544c6a835398e5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 16:15:33 +00:00
Marc Mutz
ed6914e017 manual repaint test: port away from Q_FOREACH
The Q_FOREACH is in a header, so we need to port away from it,
otherwise it makes any TU that includes it (in PCH builds: all)
incompatible with QT_NO_FOREACH.

This is a trivial case of marking the local constructor const, but go
a step further and replace the QList with a C array ("never use a
dynamically-sized container for statically-sized data"). Both
consumers of the container (after s/foreach/for/) can deal with array.

Task-number: QTBUG-115839
Change-Id: I142e438dcf2d785bb34022a3fb1ff46b8eaa0edd
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit c0738f9ff00801e58f47603de5742cf330e55c13)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 15:08:14 +00:00
Marc Mutz
dc9e677f7f tst_QImage: replace QList with constexpr array
"Never use a dynamically-sized container for statically-sized data."

Port the loop from Q_FOREACH (which can't deal with arrays) to ranged
for (which can).

Task-number: QTBUG-115839
Change-Id: I40773a0397b83cce0c803967ee3fd7ae274933d3
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 11c2a5b4778dc2c67cf21c020e8266067a99f3d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 14:03:54 +00:00
Marc Mutz
db8a15de70 tst_QTextScriptEngine: replace QList with const array
"Never use a dynamically-sized container for statically-sized data."

Port the loop from Q_FOREACH (which can't deal with arrays) to ranged
for (which can).

Task-number: QTBUG-115839
Change-Id: Ifef42704c4f695a8fb05ea5d9b3e095af3f35171
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 29f911ab92b77f402e1082b457f1d83d3da28943)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 14:03:52 +00:00
Marc Mutz
c9d8bcb9dd tst_QSctpSocket: replace QList with const array
"Never use a dynamically-sized container for statically-sized data."

Port the loop from Q_FOREACH (which can't deal with arrays) to ranged
for (which can).

Task-number: QTBUG-115839
Change-Id: Iecfc037c8bbfc0b3196ed0c65f680768a8d2353a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 3b6ae86ce8a1d45e735c748f1cc766d9c592755a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 14:03:44 +00:00
Marc Mutz
5bae58bb45 tst_macdeployqt: fix runVerifyDeployment()
QList rather pointlessly has a startsWith() function, which means this
code compiled. But the code makes no sense: it tests the same
condition over and over again, so I'm assuming that it should be
path.startsWith() and not path_s_.startsWith().

Amends 3f56950862181f4d50f30d66f577c933795522c3, but that just
imported the code from qttools. I didn't check whether the bug was
present there, already.

Change-Id: I98a4bbfe0400700655a5c2137f7a976a835a8d28
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 52ef958429cf09a46f71d0165bb4150c61f76ebc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 13:49:37 +00:00
Eirik Aavitsland
8d0833a81b Update bundled libjpeg-turbo to version 3.0.0
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 3.0.0

Change-Id: I960c4bfdef268eced93317ded814e2c84befa451
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 3498baef76ae17b7ef8c5828de33bdbc77024e47)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 13:07:04 +00:00
Christian Strømme
d150f5cf74 Update to Freetype 2.13.1
The build fix applied to the 2.13.0 update has also been applied to
this update.

Fixes: QTBUG-115340
Change-Id: I970b560948af3472b222690019a85a79c537b7d9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 0bdd01b7f7c248543c3cd44509d79011f7babd8a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 12:58:32 +00:00
Marc Mutz
a2dfc69730 tst_QGroupBox: port away from Q_FOREACH
These are all simple: QObject::children() returns a reference-to-const
QList, so we can leave the calls in the for loop (no detach()ing).

The loop bodies also clearly don't modify the list of the QObject
children (they're just QVERIFYs).

Task-number: QTBUG-115803
Change-Id: I9c5dcb2aefc433a1dead55dab669e645b6906963
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit ddcf716762e5100f56e23b4171f225ed1a97709c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 09:50:36 +00:00
Marc Mutz
31bfd89f6c tst_QWizard: port away from Q_FOREACH[5/5]: CombinationsTestData ctor
This is iterating over data member containers that are otherwise only
touched in the constructor of the same object. Luckily, the
initialization of these containers does not require *this, so use
NSDMI and mark the containers const, proving they can never be
modified and thus the protective copy of Q_FOREACH isn't required. Now
that we got rid of Q_FOREACH, we can and do make them arrays for extra
measure ("never use dynamically-sized containers for statically-sized
data").

Unfortunately, C++ neither allows us to use "flexible array
members" nor AAA in NSDMI, so grab the nettle and supply the array
size manually (ever so slightly violating DRY, but the compiler will
complain if we get it wrong).

Task-number: QTBUG-115803
Change-Id: Ibb2ce48b6dcaf2e9d3d1a625602f3865d280c7c6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e0c1ae09fd79160015c8399980d2bec4df2273df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 09:50:36 +00:00
Marc Mutz
4f3b16c491 tst_QWizard: port away from Q_FOREACH[4/5]: TestWizard dtor
This is iterating over a data member container that's otherwise only
touched in the constructor of the same object. The only reason why
it's not a const is that the initialization from QWizard::addPage()
makes that very cumbersome. So port to a ranged for-loop and apply
std::as_const().

Task-number: QTBUG-115803
Change-Id: I033e3725df95b29a8ef295c4e74d746d83234835
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 4741a7cd1c58dbb2adb85e7645ad552994b760ff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 09:50:36 +00:00
Marc Mutz
539e123f0d tst_QWizard: port away from Q_FOREACH[3/5]: OptionInfo ctor
This is iterating over the keys() of a member container we've just
filled in the same function. The loop body clearly doesn't modify the
container being iterated over. Port to the future-proof ranged
for-loop over asKeyValueRange(), using the _-in-SB pattern Christian
Ehrlicher showed me to indicate we're not interested in the value.

Task-number: QTBUG-115803
Change-Id: I3d86a1de9ea460b7d57fa421ea76e41d2c122f43
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit d67aa6291d62300567ae0b99806941eda683fe46)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 09:50:36 +00:00
Marc Mutz
6257ade025 tst_QWizard: port away from Q_FOREACH[2/5]: WizardPages::shown()
This is safe to port to a ranged for loop, as it's iterating over a
private member container that is not modified under iteration
(WizardPage::shown() is just returning a boolean member).

Task-number: QTBUG-115803
Change-Id: I50891e4b7509bd64399a128a5ee47d7795374f8e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit d0a4b29132c2d03e3f379d098a6fee4dba0a7ac4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 09:50:36 +00:00
Marc Mutz
9887252d14 tst_QWizard: port away from Q_FOREACH[1/5]: TestWizard::applyOperations()
This function is called only from one test function. Mark the
function's argument as const in the caller, bringing this use into the
const-local category, which is implicitly safe to port 1:1 to
ranged-for.

Task-number: QTBUG-115803
Change-Id: I9145c1ae2aed5ab3cafc4947dc3eaaf9a27c6a04
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 88464f7e9388f7a2df096ebb8b02026d0b229f15)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 09:50:35 +00:00
Marc Mutz
1f664fe9cf cmake helpers: support NO_PCH_SOURCES wherever NO_UNITY_BUILD_SOURCES are
The former implies the latter, so it makes little sense to treat them
differently. Even if some types of targets are (currently) never
compiled with PCH, users of qt_internal_all_x() shouldn't need to know
such details.

Change-Id: I8ead238a8d9e55da632b2929638b67724a42d73c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 51b3269eef20a6559f6f055ae4897ee7d6fe1f08)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 00:47:30 +00:00
Marc Mutz
fca06f50d1 tst_QMdiArea: port away from Q_FOREACH
These are all trivial: all are over (already or newly-made) const
local variables, albeit sometimes at the cost of an extra scope
(can't, yet, use C++20 ranged for loops with initializer).

In resizeMaximizedChildWindows(), decided to leave the container
construction as-is and use std::as_const instead (applying IILE to
make the container const would be too much churn).

In setViewMode(), removed a pointless clear() that prevented the
container from being marked const. There are no references to the
container following the clear(), and the container does not hold smart
pointers, so the clear() cannot have had non-trivial side-effects.

Task-number: QTBUG-115803
Change-Id: I00ce9c12ab696de30229f3605c16313af7eafffc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit af34c64d7f721bf7c003a2fcded7c909cecfe124)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-08 00:47:30 +00:00
Tor Arne Vestbø
13d3c7fb22 Add embeddedwindows manual test
For the child windows we have to use showNormal() explicitly,
as the default window state logic of platforms like iOS does
not have access to the QWindow, only to its flags, and we
can not use Qt::SubWindow as a proxy for being a child window,
as that's a window flag meant to be used for MDI sub windows.

Change-Id: I2b5e669f6180ffdcb75479dece38ae5e5430aef6
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit be03c9f1d9e509dafd2d6ee95cac4b67e775460f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-07 20:59:39 +00:00
Tor Arne Vestbø
540869f4c5 tests: Add iOS support to nativewindow helper
Change-Id: I3e22423734d25acb2ef04d22a1647874c2d10420
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 6a633221f3a98e8933ad5c2bbee89a8c5a938ca6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-07 20:59:31 +00:00
Marc Mutz
d680fe607f Normalize signal/slot signatures [2/2]: QPair
This is the result of running util/normalize. In this second patch,
the tool replaces QPair with std::pair. This is a bit surprising, and
suggests we should replace all QPair with std::pair in our headers
soon.

Change-Id: Iea0a2fb460a5da66fb534b3787c97d8300a04ca9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit aa48e212d7920d3c675ca5ad6d1675b4f24fa1da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-07 20:29:20 +00:00
Tor Arne Vestbø
9cb4100e7a Don't keep around old dirty region when entire window is invalidated
QPaintDeviceWindowPrivate::markWindowAsDirty() is used to signal that
the entire window needs repaint, for example when the window is being
resized. If multiple resize events come in before we have a chance to
redraw the window, we'll end up redrawing the window based on the
window's current size and exposed region, as we should, but we'll
still have a dirty region, because we didn't redraw the window at
any of its old (larger) sizes. Resetting the dirty region instead
of appending to it should be enough.

Change-Id: I37443cc1044779f847348a2303a6cebc1a8f3bcb
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 774095ed9aea96e3a9e56441079735cd726c072a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-07 20:29:19 +00:00
Edward Welbourne
b37be2387e Update QTimeZone data to CLDR v43
Ran the script, no new IDs to add. Revised tests of Central Standard
Time: America/Ojinaga has joined Matamoros for it, in Mexico.

Fixes: QTBUG-115732
Task-number: QTBUG-111550
Change-Id: I9b41d8c0156b9fbe3961dbe9a35d55493fc55501
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit c84d78d105a3d3a413ca61db911352bbf695e370)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-07 17:51:21 +00:00
Tor Arne Vestbø
99d0f997aa iOS: Implement QPlatformWindow::setMask() for masking rendering and input
Same implementation as for macOS.

[ChangeLog][iOS] QWindow::setMask() is now supported for masking the
rendering and touch input of child windows.

Change-Id: I2f9429f0f8fa278fdd8edc15c7b242c7c6bc0ff0
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit ed7c7a1458a0d903cea250e8b7272c6b5bf9c624)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-07 15:59:13 +00:00
Tor Arne Vestbø
1b583f39d3 tst_foreignwindow: Add basic test of foreign window reparenting
Change-Id: I008fad0f6527503a13ded4818eec5cb280f65cf4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 546d4c9d33ffe9c66b69798fef04a0355fe3f0b8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-07 15:59:08 +00:00
Tor Arne Vestbø
168b3b75e0 macOS: Use [QNSWindow closeAndRelease] for closing and releasing
Unifies code paths that end up closing and releasing the window.

Change-Id: Ie041079a22bbae0912df0406291c8146f02d0cd7
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 4eb127506277d1db02a34f3d73d906e32a749819)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-07 15:59:07 +00:00
Marc Mutz
aac6ba691f tst_QFileDialog/2: port away from Q_FOREACH
These are all trivial: all are over (already or newly-made) const
local variables.

The only noteworthy point here is that, in order to mark it as const,
I had to move a container definition to the more narrow scope in which
it was actually initialized. There are no references to the container
outside the narrow scope that would require it to be defined in the
larger scope.

Task-number: QTBUG-115803
Change-Id: I20890f48a48ca662679f55fa5db759419d4db8c5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 32e8b272858ded710930db7f314794eb2f77d04c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-07 15:44:23 +00:00
Marc Mutz
067adfbb11 tst_QComboBox: port away from Q_FOREACH
These are all trivial: all are over (already or newly-made) const
local variables.

Task-number: QTBUG-115803
Change-Id: Idd6e65065ee27c2d29ce1b49607aadb2eaf5e15d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit b8881ff2806f58f6da0027470663aac790bfae73)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-07 15:44:20 +00:00
Ivan Solovev
f10c8d3069 QJniObject: remove unused private methods
These three private methods were introduced in
4e60681c879a54cf5b34862a30e27c492ed36363 together with the QJniObject
class.
Digging through the whole git log for the qjniobject.h header shows
that the functions were never used. Not in template or inline methods,
and not even in the out-of-line methods.
Considering all the above, removing these methods would not cause BiC
or SiC issues, so just do it.

Change-Id: Iaeeefbc2f1002e9413fd16651abd71381362a536
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit f50e29568066e293a54104086a11e72c3abb3823)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-07 15:44:15 +00:00
Kai Köhne
bbe8c20ff5 Doc: Remove link to removed example
Example got removed to tesets/manual in
8937169c190246ebc85df242f85b3

Change-Id: Ica1470b6b478f49e318ea51f244c599cd12bf5a3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f350f69abe5cd4730384f49d57b2753268b3bb66)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-07 15:44:13 +00:00
Tor Arne Vestbø
a2f0d82503 tests: Move NativeWindow helper class to shared header
Change-Id: Ia7dc54aa761fdfde42d49a41475a4fbc74036aeb
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 5e6d46a9f7055163182b080f0daea063889bfbd7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-07 10:04:22 +00:00
Tor Arne Vestbø
e3f1695143 tst_foreignwindow: Run test with high-DPI disabled
To avoid having to take high-DPI scaling into account for geometry
calculations/comparisons.

Change-Id: I941b74781264455b70520df8d1e6e91592e00310
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 4ede419533b5fe148b2c47711f82739d36991ce4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-07 10:04:19 +00:00
Tor Arne Vestbø
830d4ee315 macOS: Ensure foreign windows can be reparented via QWindow::setParent()
In b64b0c7947f9f2b0ab4ed33fe526880f54e3981f we bailed out from
QCocoaWindow::recreateWindowIfNeeded() for foreign windows, as
we should not manage any NSWindows on their behalf.

Unfortunately QCocoaWindow::recreateWindowIfNeeded() also took care
of adding the view as a subview to the potential non top level view,
which we do want for foreign views.

Ideally we'd move the reparenting out of recreateWindowIfNeeded()
and into QCocoaWindow::setParent(), but this is a more intrusive
change, so for now just restore the original missing logic.

Change-Id: Ic35ebf94d4adc2f19cedb1cb6a5d0215a1c9c2b4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit 3f3b2be870c34ef72034d4b853ef202e478c7cb7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-07 10:04:14 +00:00
Dennis Oberst
665c7b757b QFreeList: Resolve symbol ambiguity in unity build
Remove 'qfreelist.cpp' from the NO_UNITY_BUILD_SOURCES section
and fix the underlying problem of the clashing symbols with
'qabstracteventdispatcher.cpp', by wrapping the unnamed enum in
a namespace.

Amends: a07426d23a02bd4029c6576f92fa43d324ff56be.

Task-number: QTBUG-109394
Change-Id: I585ab06a33d46a11a48220f504c53a5f4fa91d7e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit da5f2fc6be6768275501be6ec3e1b742fb995e9e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-07 07:08:05 +00:00
Marc Mutz
e54810d86b Add copy(SlotObjUniquePtr), use it in QHostInfoResult & SlotObjSharedPtr
It's a free function, because a) it rhymes with move(ptr) and, of
course, SlotObjUniquePtr being a std::unique_ptr, b) we can't add
member functions to it (and no, inheriting from a type whose dtor is
neither protected nor virtual is nothing you will catch yours truly
doing).

Change-Id: I2026126857a7bba204d683bad118e8a2c5cb2924
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit a9982a3b637e482c52a1ca97f9e235eb302048c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-07 06:28:48 +00:00
Mårten Nordheim
6354e7d37c QHostInfo: use SlotObjUniquePtr
Drops the direct deref'ing.

Change-Id: I9f159244d50572659fa8e9cabfbef47e769ac54e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 5bb4020cbe3ce0619d6046708b677469415de850)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-07 06:28:44 +00:00
Shawn Rutledge
426740ba1d QMutableEventPoint::update(): update the touchpoint uniqueId too
Most touch events don't have uniqueIds, but it happens with TUIO
fiducial objects.

Fixes: QTBUG-115758
Change-Id: Ibacce255898ce63090bc5b888c12242838603dd5
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 17f61ddc63291914cbd4402f8398a6e9709f7b37)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-06 20:24:31 +00:00
Marc Mutz
3858614666 QtWidgets: use NO_PCH_SOURCES instead of manual no-pch handling
This is how all other libraries handle this, so use it here, too.

Amends 0c8b98774cd0f3dad939d31e820e7e47c1da088a and
09d1196281ccd03dac55781ac91f6c4eb7bb4de9.

Change-Id: Id3b8fa1b834e2bebe5e6ddc1f67e43c66ccd9aab
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit a631fef20f0ad59cd85e2247731641ece2338c30)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-05 18:21:29 +00:00
Marc Mutz
70eab2cfd2 Drag qstring.h out of the qstringbuilder.h guard
qstringbuilder.h needs qstring.h completely parsed. Without this
change, we won't be able to include qstringconverter.h even at the end
of qstring.h (needed for QTBUG-114208).

Picking back to 6.5 to reduce the diff with our LTS going forward.

Task-number: QTBUG-114208
Change-Id: I83d5bcc0939b698209481793f60a0199aa95a06e
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit edcb8e901b9353eacaefc5ba646800125edafb51)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-05 16:15:41 +00:00
Marc Mutz
14a2bd7adb [docs] Link from QtConcurent::run() to QThreadPool::start(Callable&&)
The latter is a better choice if you don't need the result QFuture.

Describe the QThreadPool::start() overload in prose, since the
signature changed in 6.6 from std::function<void()> to Callable
auto&&. The chosen wording is compatible with both.

Fixes: QTBUG-111875
Change-Id: I9f67c2f7e4b221602bf1c35b72e5d38898a4f0c9
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 47a0282707d6a0d12f6f584c81a982632d09cfb7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-05 16:15:33 +00:00
Marc Mutz
ee09dbe13d QHostInfo: fix remaining slotObj leaks
We failed to delete the slot object when lookUpHost() was called in
these (exceptional) circumstances:

- on a thread with no event dispatcher

- after application shut-down, when the QHostInfoLookupManager
  Q_APPLICATION_STATIC was destroyed already

Fix by adding the missing destroyIfLastRef() calls into these code
paths, too.

Amends ad5eb297e179a164e297a7c2eb3b9674a1196605.

This would be so much easier if we had SlotObjUniquePtr...

Task-number: QTBUG-115263
Change-Id: Ief8bf125bc196742c0ce59c1fd87ab93242fc0da
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 693c9e6b1b2f160862a7490af78072a244fa5b9f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-05 16:14:19 +00:00
Axel Spoerl
a92ee82651 Fix link to platform window in QAndroidPlatformBackingStore::flush()
The Android QPA implementation requires a 1:1 link between a platform
window and a platform backing store, to correctly flush a backing
store to the screen. QAndroidPlatformBackingStore has a bool member
m_backingStoreSet, to remember if this link exists. It defaults to
false and is set to true, when setBackingStore() is called in the
constructor. It falsely remains true, when a platform window is
deleted, e.g. because a QWindow has been hidden. When the QWindow is
shown again, a new Android platform window is created. With
m_backingStoreSet still being true, this new platform window will
never be associated with a backing store. As a consequence, it will
never be displayed on the screen.

The 1:1 relationship of an Android platform window and an Android
backing store is neither ideal, nor in line with other QPA layers
(e.g. XCB). Changing the Android QPA implementation is complex and a
short term fix is  necessary.

This patch removes the member m_backingStoreSet. Instead of it,
QAndroidPlatformBackingStore::flush() directly checks, if the platform
window corresponding to the QWindow argument is associated to a backing
store. If that is not the case, setBackingStore() is called.

QTBUG-97482 has been fixed with another approach, which this patch
reverts.

The following commits are effectively reverted by this patch:
9a39ad8dfb4e6d1a179bd0fa38026886f8f7cb8e
f91588923b1e7b68f1bd79b38af44d024df85996
a4ca9e80658bca7dad1529f03c1b59173a6ecf62
dbb072eb2838a04e89e34dad686394a496d5de87
959a8b3967ac3b6315f5b458628ec5661dfc367e

Fixes: QTBUG-97482
Change-Id: Ic4344f8df2e954c057dd2705340f11dfd2d4c6fe
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 86fe84f5f7fd9a55e0f26a9572996caf443ff834)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-04 12:40:08 +00:00
Edward Welbourne
6fedc36483 XBEL stream reader: rework documentation
Document previously-undocumented methods. Document in terms of what
each thing achieves, not how it does it. The U+00B7 is not the period,
it is the centred dot. Fix various anachronisms; the existing docs
were out of date with the actual code.

Task-number: QTBUG-111228
Change-Id: I17da880e0afd7260aa6f3b7bdddb430c437f4562
Reviewed-by: Jaishree Vyas <jaishree.vyas@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit fd7fbaf887f951c34389aa58925ddc680ee544df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-04 10:30:05 +00:00
Edward Welbourne
5221fbc4b0 Tweak lookup of en.xml names for languages, scripts and territories
Prefer stand-alone versions of the names when available. This saves
the need for a Han-specific kludge in the check for discrepancies
between our enum names and the en.xml names. Causes no change to
generated locale data.

Change-Id: I162f3107d6ffc1f8b893b206e0b78b61cf7254f6
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit 40b063cd745136c1c0be4c9903955218ef647a02)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-04 10:30:05 +00:00
Edward Welbourne
a1ec66e7a3 Canonicalize space in lists of IANA time-zones
In the Windows zone-ID code, we tokenize() a text extracted from CLDR
data. However, a leading or trailing space (or a repeated internal
space) would then give an empty "IANA ID" for us to match, causing the
empty ID to be mapped to the Windows ID for the entry with the
superfluous space. This was uncovered by an entry with a trailing
space in CLDR v43's data.

Canonicalize spacing in the IANA ID lists extracted from CLDR so as to
ensure this doesn't happen. (We could pass Qt::SkipEmptyParts to the
tokenize() call, but fixing the issue when generating the data is
cheaper and more robust than fixing it at run-time every time it's
consulted.)

Task-number: QTBUG-111550
Change-Id: Ib3883419558d6574141e9ab0bc929ade2d73e020
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit 69a0cec4d0b0a498dd7303c636678990791e65ba)
2023-08-04 09:45:48 +02:00
Edward Welbourne
8c2e80e9e2 Update QLocale to CLDR v43
Ran the scripts, added the new enum members to docs.
Updated tests:
* Two of the new languages are right-to-left,
* Canada has replaced a silly date format with a sensible one.

Fixes: QTBUG-111550
Change-Id: Ie6f1e6e94477167c9e2b5c67e6518ca0f6a7e7fb
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit 923790832777f3e4d9d9be5eba13a9ffdedcf9e7)
2023-08-04 09:45:41 +02:00
Edward Welbourne
5b97f49777 Add new languages and a script for CLDR v43
Also add a comment to check the locales new additions enable do have
substantial data. Some of those added in the past are more or less
stubs, for all that they're officially present.

Task-number: QTBUG-111550
Change-Id: I04d46ee96303ecec56c056a0deff6a9457b863e9
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
(cherry picked from commit 5db5d3e4b1e4c3ba996f9cc6109d1d0309255aa3)
2023-08-04 09:45:35 +02:00
Edward Welbourne
bf650edb2e Cope with CLDR data conflict decimal == group
The digit-grouping and fractional-part separators need to be distinct
for parsing to be able to distinguish between two thousand and one vs
two and one thousandth. Thakfully ldml.py asserted this, so caught the
glitch in CLDR v43's data where mn_Mong_MN over-rode mn's decimal, but
not group, and thereby clashed with group. Fortunately the over-ride
is marked as draft="contributed" so we can back out of the collision
and limit the selection to draft="approved" values (but only when
there *is* such a conflict, as plenty of locales have (compatible)
draft data), thereby ignoring the conflicting contribution.

Brought to the attention of cldr-users at:
https://groups.google.com/a/unicode.org/g/cldr-users/c/6kW9kC6fz3g
hopefully that'll lead to a saner resolution at v44.

Task-number: QTBUG-111550
Change-Id: I1332486e60481cb4494446c0c87d89d74bd317d4
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit 8a762c6f0f1155d402fbc31f422fd4aa7fffaddd)
2023-08-04 09:45:28 +02:00
Edward Welbourne
afe038bb0e Ignore parentLocales nodes with component="..." attributes
From CLDR v43, "The parentLocale elements now have an optional
component attribute, with a value of segmentations or
collations. These should be used for inheritance for those respective
elements." Since we aren't extracting collation or segmentation data
for the present, omit these elements from the scan for parentLocale
information.

Task-number: QTBUG-111550
Change-Id: I42871929f539c1852471812801953f2fc8be0e8a
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit 615047e98f1ef2a6d1d1d1830c74d1d02dcec336)
2023-08-04 09:45:21 +02:00
Edward Welbourne
a5756053b3 Fix typos in QLocaleXmlWriter
The script and territory to exclude from reports about unused ones
were swapped, so we excluded a territory from the script list (which
didn't contain it anyway) and vice versa.

The test for whether to report used the non-existent .territories
attribute by mistake for .__territories

Change-Id: I29e9d9f8f34883d7c3a5ac15470d9e7a0366e3db
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit 37c5a9f20b9973a0f29c05965e243622f5596da0)
2023-08-04 09:45:15 +02:00
Edward Welbourne
a8c5512798 Correct enumdata.py's new-at-v42 entries to match generated data
Amends commit 9a8b9473d5f0fd4639193481ba9b344d91f3f00a - apparently
the enumdata.py entries were tidied up after the data had been
generated, leading to them being inconsistent (and I missed that in
review). That, in turn, meant the next update would have changed the
public API enum members, backwards-incompatibly; so make enumdata.py
consistent with the released public API. We'll be tidying the order up
at Qt 7 in any case.

Task-number: QTBUG-110333
Change-Id: I3eed2924ce8b69deb552e923d9b0dc142c5f3a65
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit 4e23da908621d3bc02e8f0a661ee0946f9a124f6)
2023-08-04 09:45:09 +02:00
Liang Qi
763c56028c tests: skip three tests in tst_QDockWidget on Wayland
Task-number: QTBUG-107153
Change-Id: Iad2bc83db96c25508b54ecc5b7c74280cfe90270
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 6f6e62650de3d71e27c5bcbc02f10d8b635ffdd8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-04 07:09:58 +00:00
Liang Qi
49d0e34f06 tests: blacklist tst_QWidget::render() on Wayland
which is flaky.

Task-number: QTBUG-115598
Change-Id: Ibb0a0c6b1e225144e2ce796691c40bb7510bfd56
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit c41733b06bd61d4710a9f6ec849f0d913c4497bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-04 02:00:34 +00:00
Thorbjørn Lindeijer
55d3a2442c Fix memory leak in QGtk3Interface::themeName
Change-Id: Ib8c90f7ef66c095f0c1fc04f4cc72bf5eea72ddb
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 233e7e6be35a5a455b6ecd7c15de8c9cfc70ca10)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-03 21:56:30 +00:00
Marc Mutz
57a7efe4dd eglfs plugin: port away from Q_FOREACH
Mark the module are Q_FOREACH-free, so it stays that way.

These two instances are risk-free, because the loop is over local
variables that the loop bodies clearly do not touch, so the safety
copy that Q_FOREACH takes is not required here.

Change-Id: Ida3c1d51c661d77a59a2ad105e080c3c9b66c53f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit c91146b9eff65cd8c860d26e09242795300a6b14)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-03 19:26:59 +00:00
Marc Mutz
65eae6ad45 Port QCoreApplication::requestPermission() to SlotObjUniquePtr internally
Well, except that the ownership of the slot object here is actually
shared between the PermissionReceiver and the lambda passed to
QPermission::Private::requestPermission(), which eventually may hand
ownership over to QMetaCallEvent, so we can't really use
SlotObjUniquePtr.

While we can, of course, manually copy and call ref(), even if the
slot-object is stored in a SlotObjUniquePtr, unfortunately, the lambda
is subsequently stored in a std::function, which infamously cannot
hold move-only objects, so we actually need something copyable.

So grasp the nettle and implement a SlotObjSharedPtr.

I was originally planning to just make this a typedef for
QIntrusiveSharedPointer, but that's not in dev, yet, let alone 6.5, to
which we're picking this, and there was always this nagging impedance
mismatch between the QIntrusiveSharedPointer behavior, inherited from
it's Q(Explicitly)SharedPointer roots, on the one hand, to always
ref() in the constructor from raw pointer, and, OTOH, QSlotObjectBase
starting its life with a ref-count of one (1) (not zero (0), like
QSharedData).

I eventually found the (elegant, if I may say so myself) solution to
just not provide a constructor from raw pointer, only one from
SlotObjUniquePtr, which, granted, has the same issue, but which is, by
now, probably, hopefully, more fully grasped by QtCore regulars, and so
we can piggy-back on that for SlotObjSharedPtr's constructor
semantics.

Add a comment nevertheless.

Inside the lambda, we could theoretically move the slotObj into
QMetaCallEvent::create(), after adding such conversion to
SlotObjSharedPtr, but that would require making the lambda mutable,
and seeing as it's stored in a std::function and copied around, I was
not ready to make that change just yet.

As a drive-by, make PermissionReceiver's constructor explicit.

Fixes: QTBUG-115330
Change-Id: I4e0cec13d19a19eeec31e4101ce289d07c92ce46
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit f1411088879b31ec381e2e708625c13c321549d7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-03 17:00:02 +00:00
Marc Mutz
66d3682264 QSlotObjectBase: fix return value of ref()
QAtomicInt::ref() returns bool, not int, so do the same in our ref().

As a drive-by, drop the superfluous inline keyword.

Change-Id: I60712df3640b67dfd857355d364e0fc5a3a40650
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 902063628ff3e4539d276095009bdd024faf0a41)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-03 16:59:59 +00:00
Marc Mutz
95291e4a8a QPlatformWindow: add a macro when setBackingStore() is virtual
This is the only way to detect, and act upon, the addition of the
virtual function in other Qt modules.

Amends a4ca9e80658bca7dad1529f03c1b59173a6ecf62.

Task-number: QTBUG-97482
Task-number: QTBUG-115691
Change-Id: Id32fdd3d8af1fced17983dd104318645a5578b8c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit f91588923b1e7b68f1bd79b38af44d024df85996)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-03 16:59:56 +00:00
Marc Mutz
cbaecba8dc Don't protect qstringbuilder.h indirect includes
It's a) not needed, because qstringbuilder.h simply just defines op%
and not op+ when these defines are not set and b) surprising for users
that they have to include <qstringbuilder.h> if they want to use op%
without also setting one of these defines. Finally, it just throws
readers of the code off the track for no good reason.

So, drop the external guards for qtringbuilder.h in qstring.h and
qstringconverter.h.

Task-number: QTBUG-114208
Change-Id: I00b3e405d905d319437c32a7253b39de1625d096
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
(cherry picked from commit 15ff5bafa0cdb21134c6c4660206c16d26960da8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-03 16:36:53 +00:00
Paul Wicking
326240ef79 Doc: Move \target command to inside table cell
`\target`s generate a span where they occur. If they occur outside a
table cell, QDoc generates illformed html. Fix such instances by moving
the offending line into the table cell they target.

Task-number: QTBUG-115247
Change-Id: I677e909ec73a6d0af8195d88d23581d8dd97c6e5
Reviewed-by: Luca Di Sera <luca.disera@qt.io>
(cherry picked from commit 78bc1a9a25602ba898b1f84a6c41c3804758f6cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-03 13:29:27 +00:00
Dennis Oberst
69eec3cd48 Use new QBA::assign in QXcbMime::mimeDataForAtom
QByteArray::assign() re-uses existing unshared capacity(), if any, and
is therefore potentially more efficient than '= QByteArray(~)' (and
never slower).

Task-number: QTBUG-106201
Change-Id: I5e5114064c8aaa23892e95c235335632d7c5cd0a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit d7d15c1a47c01fd75e073f82345aad826887350f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-03 13:29:27 +00:00
Antti Määttä
e395b1eb3f CTF: Clear output location at startup
Remove old files from the output location before saving new ones.

Change-Id: I75181126c6c920e13951e9a46a6be1c666d457fe
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
(cherry picked from commit c6ab516f71efeeaaf2a10dbc0368fb437f8b3a6c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-03 13:29:26 +00:00
Fabian Kosmale
068e0cbb2f QDbus: Avoid memory leak in registerComplexDBusType
QMetaType does not own the interface from which it is constructed.
Consequently, we end up with a memory leak.
This is not a huge issue, given that the map of meta-types is static,
and the application is about to be close when can discard it anyway, but
it causes avoidable sanitizer warnings, which are annoying when
debugging more severe memory leaks.

Change-Id: Ifee3f4e19835536f4a6cfa4f6866ab621581ad4f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4c1df115ecfb14c353c0ec46efdb1f9d2fc0ea95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-03 09:28:51 +00:00
Ahmad Samir
eb21238015 Moc: fix generated code for nested enum class corner case
Fixes an issue with generated code where the name of an enclosing
namespace is identical to an enum class type, when Q_ENUM_NS is used.

Consider:
namespace a {
    Q_NAMESPACE
    namespace b {
        enum class b { Key, Key2 };
        Q_ENUM_NS(b);
    }
}

moc generated code such as:
Q_CONSTINIT const QMetaObject a:🅱️:staticMetaObject = { {
    ...
    qt_incomplete_metaTypeArray<qt_meta_stringdata_CLASSaSCOPEbENDCLASS_t,
        // enum 'TestEnum'
        QtPrivate::TypeAndForceComplete<b::b, std::true_type>,
        // Q_OBJECT / Q_GADGET
        QtPrivate::TypeAndForceComplete<void, std::true_type>
    >,
    nullptr
} };

which confused the compiler:
error: ‘b’ is not a member of ‘a:🅱️:b
   83 |         QtPrivate::TypeAndForceComplete<b::b, std::true_type>,

Fixes: QTBUG-112996
Change-Id: I37aee83c32efe96cc9d6c2bd0bdb9ba80bb7b8a7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 7779400ba6fee98b1f90702f92c17a5a4089c5ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-03 09:11:43 +00:00
Alexey Edelev
5699b77aa2 Fix standalone headersclean_check targets
If module depends on some module Private part only the sync_headers
dependencies from this public part of this Private module is skipped.
Check if the module is Private and use the public module to read the
_qt_internal_sync_headers_target property.

Amends 0006a564c85d49153288cd3834197effed53394e

Fixes: QTBUG-115712
Change-Id: I4678e2a6c9ec8f80862a97d48f0a3b4214ae2307
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d7a3733056c8b3c72b243fe486c2a2b553c8c825)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-02 20:57:19 +00:00
Marc Mutz
b0ed8d1058 QDateTimeParser: unbreak C++20 build (implicit capture of *this by [=])
Use [&] instead and remove overparenthefication as a drive-by.

Amends c888e3922d73df791f0f31553536abf03b241a65.

Change-Id: Ic7930d5011c247122a1b3396ea0d6a9a2d6107de
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 19c70f40d257d528df65fac44eb847676425d03f)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-02 09:16:04 +02:00
Axel Spoerl
2a748c164e Implement private visualRect() in QTreeView and QAbstractItemView
QTreeView::visualRect() returns a given model index's visual rectangle.
The method is used to toggle the background during hovering.
The previous implementation included the row indicator, when the first
row section was hovered. When it was unhovered, the row indicator
remained highlighted, until the mouse had left the view port.

The reason is, that the highlighting implementation changed the
rectangle returned for the first section, to include the row indicator.
The implementation for neutralising a highlighted section relies on
QAbstractItemViewPrivate::setHoverIndex() and
QAbstractItemView::update(). These methods don't know about the row
indicator to be included, and therefore do not update() its rectangle.
As a consequence, the correct background gets painted but not updated
on the screen.

This patch moves the calculation of the visual rectangle to a new
QTreeViewPrivate::visualRect_impl(). In addition to the model index,
the new method expects an enum argument, representing the calculation
rule:
- SingleSection: Calculate the rectangle of the given section.
- FullRow: Returns the rectangle of the entire row, regardless of the
index's column.
- AddRowIndiCatorToFirstCulumn: Adds the row indicator to the rect,
if the model index points to the first column.

The patch updates all calls within QTreeView, to use the private method
with the right calculation rule for the use case at hand. It elminates
manual (and repeated) modifications of the return value.

The patch implements QAbstractItemViewPrivate::visualRect(), which
returns QAbstractItemView::visualRect(). It is overridden in
QTreeViewPrivate, so that QAbstractItemViewPrivate::setHoverIndex()
and QAbstractItemView receive the rectangle including row indicator.

As a drive-by, several local variables have been constified and/or
renamed to indicative variable names.

Fixes: QTBUG-115149
Change-Id: I4838bcf744f87d8cfb259c5d8758fb65e091e9fe
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit d35e8ad754ebb08430669cef64f10d34e4277d1f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-01 17:25:19 +00:00
Dennis Oberst
a835abd6e3 Use new QBA::assign in QCoreApplication::applicationFilePath()
QByteArray::assign() re-uses existing unshared capacity(), if any, and
is therefore potentially more efficient than '= QByteArray(~)' (and
never slower).

Task-number: QTBUG-106201
Change-Id: Ieeb254afd94e26f1b425795feb53c59ebb2322c6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5e2d95db97310492ef73220f087f00dabae79ab1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-01 14:06:45 +00:00
Edward Welbourne
cc7079e5b8 Correct some testlib selftest data: blacklisted does not qFatal()
The blacklisted test does not crash, as its expected output indeed shows.

Change-Id: I07522a7d065b5f39620975a3546bcd156024c41d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 5993480b691da713da1501190d1207e2724fa565)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-01 12:03:17 +00:00
Dennis Oberst
cb1489314c Use new QBA::assign in QStorageInfoPrivate::retrievePosixInfo
QByteArray::assign() re-uses existing unshared capacity(), if any, and
is therefore potentially more efficient than '= QByteArray(~)' (and
never slower).

Task-number: QTBUG-106201
Change-Id: Ic51fc57eb0f84d3624ad3447c93a74241ab3612b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b40bb99a60dcccb1dcbb72ac3d3349607d5b3358)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-01 11:22:50 +00:00
Ivan Solovev
48866bb73f Use QT_SUPPORTS_INT128 macro to handle 128-bit integral types
Introduce QT_SUPPORTS_INT128 and QT_NO_INT128 marcos to handle 128-bit
types. These macros allow to undef Qt's own 128-bit types and the
related code, but keep the compiler definitions unchanged.

This is required for Qt Bluetooth, where we need to use
QT_BLUETOOTH_REMOVED_SINCE to get rid of the APIs using
QtBluetooth-specific struct quint128 which clashes with the 128-bit
types. The idea is to use QT_NO_INT128 in Qt Bluetooth's
removed_api.cpp instead of directly undef'ing __SIZEOF_INT128__,
because the latter is UB.

This commit amends befda1accab417ce5f55cb11816e6ded51af55e3.

Change-Id: Ia2c110b5744c3aaa53eda39fb44984cf5a01fac2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit eb0abd9789062d95bc62dbbc29b2038dc40472b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-01 10:50:28 +00:00
Tor Arne Vestbø
de200cc91f tst_selftests: Fix mistaken early return when checking error output
In porting the selftest machinery to Catch2 in 24e83de8d192 we
accidentally added an unconditional early return when determining
whether to check for unexpected stderr output, resulting in not
checking error output on any platform.

The return statement has now been moved into the Q_CC_MINGW
condition, but as we now seem to have similar issues on macOS
and Linux with some of the tests outputting "Received signal 6
(SIGABRT)" as we do for QEMU, we need to add a few more explicit
early return conditions to the function.

Change-Id: I7a25f000843b5f1003a5db883f08285185046b46
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 118f2210c6279803b9a4103a796ce75e88f8beb2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-01 08:34:19 +00:00
Antti Määttä
94e83053ed CTF: Simplify writing endianness to metadata
Change-Id: Ie10533dc22746c31941d5d60d2cc7aa81436fee0
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
(cherry picked from commit 8cedef62cf1b401d2c5ae08b03f92f95fd09df75)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-01 08:15:13 +00:00
Antti Määttä
4f5b6967bb CTF: Use wfopen in windows
Change-Id: If54fe2b0af32a097cac6f485900ec5e353d92dd9
Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
(cherry picked from commit cc3f18e5e91c3c378ade45ec4c13d756bb9b5ae9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-01 08:15:03 +00:00
Thiago Macieira
687415e10c QMetaType: fix recursive detection of std::optional operators
Commit ca54b741d6edda24773137aacee229db31dd3585 used the internal
has_operator_equal (and commit 01d94760d8d34e51e1442682fc151747943c7e25
copied that for has_operator_less_than) instead of using the recursive
expander that was being used here. That assumed that the contained type
in std::optional would always be the last final check, which is an
incorrect assumption.

Fixes: QTBUG-115646
Change-Id: Ifbf974a4d10745b099b1fffd177702934bec27ff
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit cff13c2417225fcb5e2cca4c9a045bfe49c1034c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-01 04:07:12 +00:00
Laszlo Agocs
5bf290776c rhi: Guard QRhiVulkan more in qrhi_platform.h
Replicate qvulkaninstance.h's logic. The idea being to allow
to compile code that uses QRhi (so includes qrhi.h) with a pre-built
Qt that was built with Vulkan support, but there is no Vulkan SDK
(and so vulkan.h) on the developer's system. Normally this is not
something we care about, e.g. compiling an application using
QVulkanInstance or any other Vulkan functionality implies one has
to have the SDK installed or at least the headers available in one
way or another.

However, including qrhi.h (and so qrhi_platform.h) happens in some
cases in applications that do not themselves initialize a QRhi,
i.e. they do not care about the QRhiVulkan* structs, because
they only ever use a QRhi retrieved e.g. from the QQuickWindow.
Design Studio is one example. To allow building DS against a Qt
that is Vulkan-enabled (e.g. the official Qt releases) but in
an environment that has no Vulkan headers, we skip the QRhiVulkan*
stuff when there is no vulkan.h available.

Change-Id: Ic81250e6c90939a38f79cab1438fbb9f483f56df
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
(cherry picked from commit c6fce818db7e56f659ea88784d2f9278f9ce1436)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-08-01 03:04:29 +00:00
Michael Brüning
7294226274 qt_enable_separate_debug_info: Enable custom location of dSYM directory
It is part of a solution to produce notarizable binaries for
application using Qt WebEngine.

Task-number: QTBUG-99555
Change-Id: Ice0bbcfb12829906328f55158b0c37f03878f17c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit ebb361ee3f02d677460fc2b55a47c6cd4bbbc489)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-31 22:37:48 +00:00
Jens Trillmann
c905f18e37 Improve Intent source app detection
Activity.getReferrer does not only return app IDs but also URLs if
Intent.EXTRA_REFERRER is set on the Intent. In the case of Chrome the referrer
is set to the website triggering the Intent. To improve the detection of the
calling app we check first if the browser specific
Browser.EXTRAS_APPLICATION_ID is set. If it is not set we fall back to
Intent.getReferrer.

Change-Id: I33d1edd52de98486d9616713e531ea20ada87bcb
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 7012bea614fb47a07a4626c2e2e2855dba3742b4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-31 14:01:53 +00:00
Liang Qi
687af7b1a9 xcb: guard a pointer before usage
in QXcbAtom::initializeAllAtoms().

See also the example in
https://manpages.debian.org/testing/libxcb-doc/xcb_intern_atom_reply.3.en.html

Fixes: QTBUG-115599
Change-Id: I6590fe1aa11deec7fef7ce6d8f5c49a71d636648
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 552e3b9b78c136aebedf0a591af04661f0dedbbf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-31 13:39:53 +00:00
Tor Arne Vestbø
938c442e8a QMessageBox: Respect clients overriding QDialog::done()
As a result of d8bbb5ee0e60d44a70d29306e607a59caf7fe5bc, we
were no longer calling QDialog::done(), which users may have
overridden.

We now pull out the dialog code to determine whether to
emit accepted/rejected directly in done(), so that we
can go back to calling QDialog::done().

Change-Id: Ie08270123d61d9010acd8c989b66986f71960ad0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1f70c073d4325bc0eb9b0cec5156c3b89ce1b4df)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-07-31 13:22:37 +02:00
Tor Arne Vestbø
68b0ad4201 QMessageBox: Plumb native button clicks back to dialog's QAbstractButton
The native dialog helper is populated with buttons based on the message
box buttons, which are still represented as QAbstractButtons, either
by adding custom buttons, or by turning QMessageBox::StandardButton
into QAbstractButton.

To ensure as little difference as possible between the native and
non-native backed dialogs, we plumb the dialog helper clicks back
to the corresponding QAbstractButton. We were already doing this
partially for custom dialog buttons, but now we also do it for
standard buttons.

As the click() will plumb back to _q_buttonClicked, which calls
setClickedButton to finalize the dialog, we don't need to do
this explicitly anymore.

For custom buttons it now means the result() of the message box
will be the custom button's index, not its role, but the result
in this case is documented to be an opaque value, and it's best
to keep these the same for native and non-native dialogs.

Change-Id: I5fe3b28e4c4ed879775610103cd1b591b3353f7e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4a4283e3e98d779e6eb6cb47d408fe4fd402cdf8)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-07-31 13:22:36 +02:00
Tor Arne Vestbø
eb8605ed2d QMessageBox: Emit accepted/rejected for native message boxes
In d8bbb5ee0e60d44a70d29306e607a59caf7fe5bc we started respecting the
button roles of buttons added to QMessageBox, by emitting accepted()
and rejected() if the appropriate roles were found.

Unfortunately this only touched the QMessageBoxPrivate::_q_buttonClicked
code path, for non-native dialogs, leaving the code path for native
dialogs in QMessageBoxPrivate::_q_clicked alone.

We now follow the same approach for the native dialogs as for the
non-native ones, by calling QMessageBoxPrivate::close() and
QMessageBoxPrivate::finalize() explicitly, instead of going
via QDialog::done(). This allows us to pass a dialog code
to finalize().

One side effect of the original change was that overriding
QDialog::done() for non-native dialogs no longer had any effect,
as we were using lower level plumbing. Since we now align with
the original change for native dialogs, we will adopt the same
limitation, but this will be fixed in a follow up for both
cases.

The callback code for custom buttons in native dialogs could also
use some alignment with the non-native path, but this is also
left for a follow up.

Fixes: QTBUG-113685
Change-Id: Iea03a0007f884d6c7f11d2bd891446bdaa5ddc67
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Erik Verbruggen <erik.verbruggen@me.com>
(cherry picked from commit 6da1ecc8c2b9f7fd488194b6e81b41a314b678d5)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-07-31 13:22:35 +02:00
Tor Arne Vestbø
94c9ce85c7 Clarify documentation about aboutToQuit being emitted with main loop running
After 449b45ff34ce4a45e5d6a24967566f69f43ebbb6 we emit aboutToQuit
before quitting the main event loop, matching the documentation and
semantics of "about to". Clarify this in the documentation, so that
client do not rely on a missing main event loop to trigger processing
of root level deleteLater() calls in a nested event loop.

Change-Id: Ifd116394a1960814edf69f20c5aaff6a8e5cfc24
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 04b619d950b65c99fc934ffbe4f2fd0e1fccf4a9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-31 11:22:34 +00:00
Tor Arne Vestbø
7b6682cfbb QIcon::fromTheme(): Always consult "hicolor" theme last
The Freedesktop Icon Theme Specification [1] describes that,
if a theme does not specify anything for its 'Inherits' key,
"implementations are required to add the 'hicolor' theme to
the inheritance tree. An implementation may optionally add
other default themes in between the last specified theme and
the hicolor theme."

And later, when describing the lookup algorithm, that "The
lookup is done first in the current theme, and then recursively
in each of the current theme's parents, and finally in the
default theme called 'hicolor' (implementations may add more
default themes before 'hicolor', but 'hicolor' must be last)".

But it doesn't explicitly describe the behavior when a theme
does specify a list of inherited themes via the 'Inherits' key,
and this list explicitly includes 'hicolor'.

In that case, our custom fallback theme, which we inject after
the theme's explicit parents, will be prioritized after 'hicolor'.

As it's likely that the theme author added 'hicolor' to their
parent list to ensure that 'hicolor' is at some point consulted,
but didn't intent it to be priorized, and that the spec puts focus
on 'hicolor' being last, it seems reasonable that we can move the
'hicolor' theme to the end of the fallback list, and as a result
always prioritize fallbackThemeName() over 'hicolor'.

[ChangeLog][QtGui][QIcon] The 'hicolor' theme will now always be
prioritized last when looking up fallback themes, even if
explicitly declared as a theme parent in a theme.

[1] https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html

Change-Id: I76538e4e7e9e395f9e5a38e704c60fb6b9688885
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit e603661c48903fa674332a218b21cb35b288de4c)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-07-31 11:22:27 +00:00
Laszlo Agocs
6843a4a69e Handle Null rhi backend in backingstore
Was missing for some reason when this got added in 6.4.

Change-Id: I4f8b780c7119649688d8d8a197e8ef59730b0b61
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit cdae120f7f23fefcb4adbc34c6f082c60faa2952)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-31 10:39:05 +00:00
Laszlo Agocs
226f84d5ac rhi: vulkan: use the clamped api version for vma
caps.apiVersion is inst->apiVersion() limited by the version the
physical device reports. Therefore, use caps.apiVersion when
setting up the memory allocator, like it is done everywhere else.

This is expected prevent vma init failures on lavapipe in some Linux
distros.

Change-Id: I4e693820c95a5e0174846afb20e42aadd56034d6
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit f9d473ac726fe012fe05a9e6f7502ca50c2245e5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-31 10:39:02 +00:00
Laszlo Agocs
ac6fcaf565 Handle rhi init failures better in rhi backingstore flush
One may very well force a 3D API not functional. In this case there will
be no QRhi. A bunch of warnings will be printed (which is good), but
then flush() should not do anything, and that was not handled before.

Change-Id: I82139070311152c959d39a553842f4462d8e7811
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 108b1014415a491cb0abb58c04a28a5c691085a1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-31 10:39:01 +00:00
Amir Masoud Abdol
908bf2bac4 Fix the project name
Fixes: QTBUG-115327
Change-Id: I77fc3a98d1658609caa9618430f6e6823b8e1bb5
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 95ed8d1fd9ccc5270b825550085c3a3df2830d5c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-31 10:38:57 +00:00
Laszlo Agocs
4595ad68a9 rhi: Run cleanup callbacks before the pending deletes
If a callback deleteLaters a QRhiResource that should still be
handled and not left unreleased. Swap the order.

Change-Id: I8419a28a9db5bb59f768ab5820dfaf593464d6d2
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit d907f1aa92dbd4500a18db2c2492491c34c66087)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-31 10:38:55 +00:00
Laszlo Agocs
618abdcd80 doc: Fix QVulkanFunctions code snippet
Showing code that cannot possibly compile is bad practice.
(vkAllocateCommandBuffers is in QVulkanDeviceFunctions, not
QVulkanFunctions)

Rather use a member function that is actually in QVulkanFunctions.

Change-Id: I3063a8a229152144ce866e915eb4c14ecc58e9ce
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit e8e9c287ec6a086a96b36e692ab6d5ed11b64951)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-30 19:54:26 +00:00
Laszlo Agocs
095bfbd3e4 rhi: metal: Disable MTLBinaryArchive usage regardless of OS version
Ironically enough when the old macOS 13 problem is no longer occurring
(at least on an M1 Mini with 13.2.1), so the OS version based
differentiation could likely be removed, there are now reports about
problems with old Intel hardware and earlier OS versions.

Therefore, get rid of the OS version based logic, and rather add
a global flag that is enabled unconditionally for now, which
disables MTLBinaryArchive usage altogether.

How much we lose is not very clear anyway. The OS performs its
own persistent caching (most likely), hidden from applications.
Thus what we lose really is the fine grained control over the
data (e.g. specifying a custom storage file via
QQuickGraphicsConfiguration), with the possibility of pre-seeding
for the first run. As the performance of subsequent runs is less
likely to change in any significant way, this is seen as not
a big deal for Apple hardware in general so we might just live
with this. (and on macOS 13+ this was already crippled anyway
due to the OS version logic)

Fixes: QTBUG-114338
Task-number: QTBUG-108216
Change-Id: If7b908baea2093f6882674ebfbdc18e770d6503e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit fa96e76ab124965f3112ae63298c69782b1bb311)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-30 19:54:20 +00:00
Laszlo Agocs
d3d8a717fd android backingstore: Drop out-of-date surface type check
Running a Vulkan-based QRhiWidget (upcoming in 6.7) and QQuickWidget
shows the "...does not support OpenGL-only windows" warning which is
pointless nowadays. Since Qt 6.4 RasterGLSurface is not in use,
whereas the surface type can very well be VulkanSurface too.

Change-Id: I790767e683b2a4cffc99cbc38015aca809cf83c5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 4abf862bca3a4942afc1953411fb7ad3871f032e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-29 07:12:26 +00:00
Laszlo Agocs
6909fb0019 rhi: Add a note to sampler docs about mipmaps
Fixes: QTBUG-115521
Change-Id: I774cdc4d1b9e09624a9b5f9969eae5085b40a6c0
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 803e5f0ff771944c8d5350b28940860d6b54a394)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-29 07:12:18 +00:00
Laszlo Agocs
4f75b1cdb7 cocoa: Handle VulkanSurface for backingstores
Should be no different from MetalSurface and OpenGLSurface.

Change-Id: I529f2904a43e44376e9f2da2489fac57670d954d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e310bc1646eab51b70eb68e7d4ed344dd263167f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-29 07:11:55 +00:00
Tor Arne Vestbø
c9111d1ca3 Move simple widget mapper example to manual test
Change-Id: I703843b5ee935794c2e2fd0407f9a1508b088ab6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 72a153a7f573008f071986030e73c7be6765bc88)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-07-28 14:50:53 +02:00
Tor Arne Vestbø
c7a767660a Move dials example to manual test
Change-Id: Ib99a3890b814c2089db62485f0a10cf308ff9b66
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5654fbffd588fb3362faec49b2da2e669e02fa8a)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-07-28 14:50:53 +02:00
Tor Arne Vestbø
1a5691c189 Move textedit example to manual test
Change-Id: Ic3189044598be8e121c1f065e68e04a3547a87d0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 81db1766dd0dc7c6f1c186688e90dc817a65a65c)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-07-28 14:50:53 +02:00
Tor Arne Vestbø
ad7a711c3d Move main window example to manual test
Change-Id: I7d9281f173ce9fb24c0f565797b6fbcfba10459f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c5ee7c8b8f214dde6f5e9c513ef3a8592cc4dd7a)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-07-28 14:50:53 +02:00
Tor Arne Vestbø
be1185ad32 Move fade effect example to manual test
Change-Id: I7f4e1d9b57be2d0ef22eb56d5d1f7abc5074ebae
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9a320b037ce7b63c5f9de6fbb4e391612e857a95)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-07-28 14:50:53 +02:00
Tor Arne Vestbø
56e4691407 Move MDI example to manual test
Change-Id: Ide698a171a4600cb4bac6574b6be74c17f779051
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4b79834e1a88461eb0cd8d19125130ed973651fa)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-07-28 14:50:52 +02:00
Fabian Kosmale
8ac712968a moc: handle "L" integer suffix
This commit adds some initial support for handling the 'L' suffix after
numbers. This one is especially important given that the __cplusplus
define is using it.
Other suffixes will be handled in some later commit, which should also
unify the already divergent parse behavior between DIGIT and PP_DIGIT
parsing (e.g. when it comes to byte prefixes).

Task-number: QTBUG-83160
Task-number: QTBUG-115558
Change-Id: Ie61eae49c468abfaee80e7e4f7097917a254dc0e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f0039bd5170ad84d972a023316e8d153b89f841a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-28 12:50:52 +00:00
Edward Welbourne
9758650a37 Correct feature test in tst_qtranslator's CMake config
There is no QT_CONFIG_thread.
Thanks to Alexey Edelev for spotting why I couldn't run the test.

Change-Id: I11c99d9b1ff8fed67b118028b76fba8ee6db3c42
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 4693c812684a08b2e34dfcfc76ddd6f58bfc8acb)
2023-07-28 11:55:23 +02:00
Axel Spoerl
aa0f395fd1 QColorDialog: Ignore mouse move events when no mouse button is pressed
mouseMoveEvent overrides in QColorLuminancePicker and QColorPicker
have triggered value changes unconditionally. This happened under the
assumption that the widget attribute WA_Hover is not set (which is the
default behavior). In that case, mouseMoveEvents are only delivered if
a button is pressed.

If WA_Hover is set - e.g. by applying a style sheet - mouseMoveEvents
get delivered also when no button is pressed. This leads to faulty
behavior: The color and the luminance change, whenever the mouse is
moved into the respective widget. Color/luminance are changed to the
value representing the edge on which the mouse has left the area.

This patch changes both mouseMoveEvent overrides. They return early
to avoid hovering changing the colors of the luminance/color picker,
but ignore() the event in case anything behind the picker needs hover.

Since this is a purely graphical effect, an autotest was not added.

Fixes: QTBUG-115516
Change-Id: I000d113a1c81c46799cbb5197bf9acb3849e7d3b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit a2ec43b8ebcbf8462928800a7db4f6af7e482b18)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-28 09:20:39 +00:00
Wladimir Leuschner
1a628e82cc Return 0 in QWindow::winId in case of failed platform window creation
Task-number: QTBUG-114613
Change-Id: I93184d95f8f448ab115570a18cdb720449a0637d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 63824363ab4844816a4ea16a4d315c74ae21344a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-27 18:06:17 +00:00
Kai Köhne
63e7dc7bd6 Doc: Generalize statement about QLibrary::unload() and macOS
We dropped support for macOS 10.3 in Qt 4.6, 14 years ago.
But the logic to only 'fake' the unloading on Q_OS_DARWIN
remains. Also, add a statement explaining the behavior
in more detail.

Change-Id: I62ec7df7c4b807f84c96619f78b3cef704c51335
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit ea0b7dafb287ed3d044b574fb7671346bca087e4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-27 16:02:19 +00:00
Oliver Wolff
bb08829eb7 windeployqt: Do not deploy insighttracker plugin by default
Qt insight's TP is using plugin type "generic" so that insight plugins
can be deployed for every Qt application. As "generic" plugins are part
of QtGui windeployqt deploys these if a dependency to QtGui is found.

As defaulting to a deployment of insight plugins might cause confusion
among users, we make deployment of these plugins explicit if the module
is available.

Change-Id: I9d2a8595373d5a15b7afbeaf7174226563b1cb6f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ae7bc8803f16219b4fde93bf7312976cb28f7c2f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-27 12:10:46 +00:00
Alexandru Croitor
8cf1b2b53a CMake: Make sure to follow BuildInternals CMAKE_BUILD_TYPE on Windows
A regression was introduced in
48841c34d2e86a741ec9992b9704c0fa5973503c
when configuring qtshadertools with -prefix -debug and
no -developer-build.
qtbase would have been built as Debug, but qtshadertools as release.

This caused qsb.exe to link to a debug c++ runtime via QtCore, and a
release one via QtShaderTools libraries and thus cause heap corruption
crashes during runtime due to the mismatch.

This happened because the check in cmake/QtSetup.cmake thought Debug
was the default build type (nothing was specified on the command line)
without knowing it was explicitly set BuildInternals.

Set a variable when BuildInternals sets CMAKE_BUILD_TYPE and make
sure QtSetup does not override it then.

Augments 33af62db3747bb6fcb7490ef2d2abc5bb53925b6
Amends 48841c34d2e86a741ec9992b9704c0fa5973503c

Fixes: QTBUG-114958
Change-Id: I5e0a27b4d77512494c026dd911ec5757889a5a1a
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 8c912cddebe544010e7da3f87af5b21f3328d7ec)
2023-07-27 10:07:28 +02:00
Alexandru Croitor
aa2c0eb7eb CMake: Unify CMAKE_BUILD_TYPE behavior on all platforms
Before this change, we had the following behaviors.

On platforms other than Windows-MSVC:
- when no build type was specified, we defaulted to Release
- when -developer-build was specified, we defaulted to Debug
- regardless of platform, unless the option was explicitly specified,
we never defaulted to -debug-and-release.

On Windows-MSVC, we always defaulted to Debug. Which is inconsistent
with the rules above.
The difference happens because CMake always sets CMAKE_BUILD_TYPE to
Debug during the first project() call when targeting the Windows-MSVC
platform.

We interpreted that as the user setting the build type, and thus we
didn't want to override what the user specified.

After this change, if we detect that it's cmake setting the build
type, we assign a build type that follows the non-Windows-MSVC rules.

This change unifies the behavior across all platforms.

Adjusted the configure help with the new reality.

Augments 33af62db3747bb6fcb7490ef2d2abc5bb53925b6

[ChangeLog][configure] When no explicit build type is specified,
Windows will now default to building Release like the other
platforms.

Change-Id: Id2bf269c51cf300ec09751ece2ad721869e0f90c
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 48841c34d2e86a741ec9992b9704c0fa5973503c)
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-07-27 10:07:27 +02:00
Giuseppe D'Angelo
9fcc290b1d QSet: document removeIf
The docs were never added (unlike the docs for erase_if).

Change-Id: I7857c5eded68791ddfc4e6ce42a60d5736f5a438
Fixes: QTBUG-115473
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 76e650045e342c977042195059a6eedd7809a260)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-25 21:06:03 +00:00
Ivan Solovev
799bdf5c53 QIntegerForSize: fix check for 128-bit ints
We do not need the Q_CC_GNU check, as the __SIZEOF_INT128__ check is
enough.

Change-Id: I12bdd02186c4f5dad0ab3f4596f4b37e5c3f7eee
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 27b06e50e0c864ee50f9bab8eeb97ac038d0306a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-25 18:19:41 +00:00
Ivan Solovev
7050aec00b QProperty: improve QPropertyAlias deprecation
Use QT_DEPRECATED_VERSION_X_6_6 and provide reasons for deprecation
for the enum value and for the QPropertyObserver constructor.

Change-Id: I0f9b4c6dc8bb9fd5eac692a6953c90059f3c77ef
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit aaa8c3835303e6eb3579df300e06ea6696ca769f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-25 13:43:15 +00:00
Edward Welbourne
392131feb4 Clarify QElapsedTimer::hasExpired()'s documentation
The description in terms of timeouts was confusing. Instead, say what
it actually does, in plain terms. Mention that you can do similar for
a duration.

Task-number: QTBUG-115447
Change-Id: I4618d7fa290e7959ed3cb51e5c2576b041f77091
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 669470e2be99dbeef2ec1b2083cf6a86c8c9d917)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-25 10:31:18 +00:00
Dennis Oberst
ff157648d6 QNativeIpcKey: add qHash() function
Equality comparable types should define a qHash() function.

Change-Id: I1677fbefa3d09d49a292d369b808793f884c32e9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c2310f8e03cf30222cea59b3c556d060e1710015)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-25 10:31:17 +00:00
Axel Spoerl
abc9fd2023 tst_QExplicitlySharedDataPointer: Remove stray comment
Remove stray comment at the end of tst_qexplicitlyshareddatapointer.cpp

Change-Id: I31a6c38002e56e7c43e527864ba3d9324950079f
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit 93e9d214904b73d4d89ea4f2c1b836d768cf7284)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-25 10:31:16 +00:00
Axel Spoerl
f655c6c9b9 tst_QXmlStream: Remove stray comment
Remove stray comment at the end of tst_qxmlstream.cpp

Change-Id: I88550e2b75194e7895d8578ca0e8350af59d4dfe
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
(cherry picked from commit 3bb991ca05b7b727b66f117ef362edf10a1850c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-25 09:43:24 +00:00
Axel Spoerl
3094ac8e55 QColorDialog: React to HSV values during manual edit instead of change
The existing signal connection can cause a loop and undefined behavior
in the interaction between the line edit for a hex rgb color and the
individual rgb values.

=> Change connection to textEdited, to react only on manual editing.

Fixes: QTBUG-115189
Change-Id: Ie3062c575652b905a8ab16edb2f5f77f8d150f36
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 4a26ae1b270bfeaac5cf60850407fadfbe5db3ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-25 07:14:59 +00:00
Friedemann Kleint
e067969ef7 QXmlStreamReader: Fix translation context of error messages
QObject::tr() should not be used.

Amends c4301be7d5f94852e1b17f2c2989d5ca807855d4.

Task-number: QTBUG-92113
Task-number: QTBUG-95188
Change-Id: I09547c3d048d6b3726e33be74b06035f0eec4f31
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit d164ec4abe75726469f2cfcff418602ad710408e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-25 05:35:02 +00:00
Edward Welbourne
c4a7f22e3e Update system collator when system local is default and updates
Amends commit 94de5f9b25e1816039885c765e2a5b312f7daa7e so that every
change to the default locale is reflected in an update to the default
collator used by QString::localeAwareCompare().

Although the change to the system locale does update the QLocaleData
object shared by all system locale objects, the possible change to its
collator() may imply the default collator needs an update; and the
collator backend's init() may use the language, script and territory
that's changed in setting up the revised collator, even if the QLocale
instance referenced has the same QLocaleData.

Change-Id: I957486c03c3d779fc9a2f0b889346ec13b1af868
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit df736da245bf1ea04fadffa1f5d35c37252930a4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-24 09:46:01 +00:00
Edward Welbourne
47f219c798 QDTP: match local-time by preference to its zone
When parsing a string whose time-zone part matches local time's name,
use local time in preference to the QTimeZone with that name. The case
is ambiguous, and the bug was already fixed (by something else) in
dev, but this caused a failure in 6.2 through 6.5; and using local
time is more natural to QDateTime in any case. The fix incidentally
makes the the logic of the zone-resolution code more straightforward
and a closer match to how findTimeZone() found the match.

The issue was hidden from 6.6 by a change [*] to the handling of POSIX
rules, that lead to plain abbreviations such as CEST and BST - for
which the IANA DB has no entry - no longer being considered "valid"
zones, despite being technically valid POSIX zone descriptors
(effectively as aliases for UTC).

[*] commit 41c561ddde6210651c60c0789d592f79d7b3e4d5

Fixes: QTBUG-114575
Change-Id: I4369901afd26961d038e382f4c4a7beb83659ad7
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ca6a0fd63fdd5209f2cc1ff59e6b31c0bed14597)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-24 09:46:01 +00:00
Edward Welbourne
89db6ceef0 Check QDT's local time abbreviation as well as the qTzName()s
Since QDateTime uses some fall-backs if qTzName() doesn't give it
something useful (as happens on MS-Win when local time is UTC),
QDateTimeParser should check the result of those fall-backs as well as
the qTzName()s when checking for local-time as zone.

Change-Id: Ic809b7e44cd0c83fb076b24c27547268345fa379
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit c888e3922d73df791f0f31553536abf03b241a65)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-24 09:46:01 +00:00
Marc Mutz
bd45bd2769 Long live QSpan!
QSpan is Qt's version of std::span. While we usually try not to
reimplement std functionality anymore, the situation is different with
QSpan. Spans are non-owning containers, so the usual impedance
mismatch between owning STL and Qt containers doesn't apply here:
QSpan implicitly converts to std::span and vice versa, making STL and
Qt APIs using spans completely interoperable.

We add QSpan mainly for two reasons: First, we don't want to wait
until we require C++20 in Qt and can use std::span. Second, in the
view of this author, some design decisions in std::span hurt the
primary use-case of spans: type-erasure for containers. This results
in two major deviations of QSpan from std::span: First, any rvalue
container is convertible to QSpan, allowing seamless passing of owning
containers to functions taking spans:

    void sspan(std::span<T>);
    void qspan(QSpan<T>);

    std::vector<T> v();
    sspan(v()); // ERROR: rvalue owning container
    auto tmp = v();
    sspan(tmp); // OK, lvalue
    qspan(v()); // OK

This author believes that it's more helpful to have compilers and
static checkers warn about a particular wrong usage than to make
perfectly valid use-cases impossible or needlessly verbose to code.

The second deviation from std::span is that fixed-size span
constructors are also implicit. This isn't as clear-cut, because an
explicit QSpan{arg} isn't per-se bad. However, it means you can't
transparently change from a function taking decltype(arg) to one
taking QSpan and back. Since that's exactly what we intend to do in Qt
going forward, in the interest of source-compatibility, the ctors are
all implicit.

Otherwise, the API of QSpan follows the std::span API very
closely. Like std::span, QSpan isn't equality_comparable, because it's
not clear what equality means for spans (element-wise equal, or (ptr,
size)-wise equal?). The major API additions are Qt-ish versions of std
API functions: isEmpty() on top of empty() and sliced() instead of
subspan(). The (nullary) first()/last() functions (Qt speak for
front()/back()) clash with the std::span function templates of the
same name, so are not provided.

This patch adds QSpan as private API. We intend to make it public API
in the future.

Fixes: QTBUG-108124
Change-Id: I3f660be90eb408b9e66ff9eacf5da4cba17212a6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit f82cf6333e4e21c96d8b6bb272392f8142ead2b7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-24 07:10:36 +00:00
Marc Mutz
c5b083dd13 Short live q20::iter_reference_t
Another building block for QSpan.

Task-number: QTBUG-108124
Change-Id: Ic7205ec693d953f6b054282380e87e79dead8816
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e86e2752845ede635840851198c334f550fafb8f)
2023-07-24 07:10:27 +00:00
Marc Mutz
da4820419e Short live q20::type_identity
Trivial implementation. No test necessary.

Task-number: QTBUG-108124
Change-Id: I20ec14e49f4db6399502f953b569c889d30bb5a7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 62801532a33ab11d9bce42340c50619d49a7d0c8)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-24 07:10:21 +00:00
Ahmad Samir
79f7000099 QTimer: fix API docs of callOnTimeOut overload
It actually takes one parameter, because in this overload the connection
type can't be specified, for example:
QTimer timer;
timer.callOnTimeout([]() { qDebug() << "slot"; });

The call chain is:
QObject::connect(timer, &QTimer::timeout, functor);
connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, Func2 &&slot)
connect(sender, signal, sender, std::forward<Func2>(slot), Qt::DirectConnection);

the connection type is always DirectConnection.

Spotted by Giuseppe in code review.

Change-Id: Ia8bbd91e98a357244cbfae4e3ed63d4c73038fa2
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 794e0d1ac6b99c9398e4802b4f9e60012dcf055d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-23 00:38:44 +00:00
Thiago Macieira
cf910cc4a0 tst_QAtomicInteger: remove macros to force C++11 atomics
They aren't used because the C++11 atomics are the only atomics we've
supported since commit 9d1fab424e38d0ed40677926c0a434272ad41320 (5.6).

Change-Id: I53335f845a1345299031fffd176f84ccd054b804
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 9bcf82afb35a90430bbb8cc15b4eead45179a825)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-22 19:39:21 +00:00
Marc Mutz
5078becc41 QMetaObject: port invokeMethodImpl() from QScopeGuard to SlotObjUniquePtr
... so it can use the new QMetaCallEvent() ctors taking that type.

As a consequence, the slot object ref-count is now no longer touched
on the way into the meta-call event (was: upped in QMetaCallEvent
ctor, then downed in QScopeGuard).

Manual conflict resolutions:
 - QScopeGuard -> custom Holder struct

Change-Id: Id9bd157792458a3834809c23e94ca5f504f7abd1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4015f81d31d783549bfe0bd26ab1504789e056fe)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-22 16:40:20 +00:00
Marc Mutz
4395e1e06b QMetaCallEvent: add ctors and create() overloads taking SlotObjUniquePtr
This makes it clear who is responsible for obtaining additional strong
reference to the slot objects, because these functions no longer do.

Change-Id: I39187e3c441d8f82d50d907731f1cbdfb2a95b9d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 00dbd3cd26d2cf4dbcde3a8f517d0d6b6d0bc9ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-22 09:28:38 +00:00
Marc Mutz
52cd08293f Port QObjectPrivate::connect() to SlotObjUniquePtr internally
This is for consistency with QObject::connectImpl() and
QObjectPrivate::connectImpl(), if nothing else.

See the commit message of the QObject::connectImpl() porting patch for
why we leave the function signature unchanged (key-word:
tail-callability).

Change-Id: I515d3be4a5126f9f4738dd7bde5174377faf2343
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ff75ace02d62572be5a8b686b0ea15e909081575)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-22 05:38:38 +00:00
Marc Mutz
f9ea1604a5 Port QObjectPrivate::connectImpl() to SlotObjUniquePtr internally
... removing the custom scope-guard which was .dismiss()ed too early
(the allocation of 'c' could theoretically fail, and the old code
would leak the slot object in that case; nothing we're generally
guarding against in Qt, but it's a nice drive-by gain, probably shuts
up static checkers, and makes readers wonder less about the lifetime
of the slot object).

As mentioned in the patch porting QObject::connectImpl(), leave the
unique_ptr out of the function's signature, see there for rationale
(key-word: tail-callability).

Change-Id: Ib90371b9768a72fd62d080b71eef2c82f851db81
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 18857db2dd0ededda0c9a6ba1731327f4121042a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-22 05:38:34 +00:00
Marc Mutz
8fada6f0c8 Port QObject::connectImpl() to SlotObjUniquePtr internally
This gets rid of the smell that one destroyIfLastRef() call guarded
against nullptr while the other one did not.

Don't change the function signatures, as passing by unique_ptr, while
making the transfer of ownership clear, makes it impossible to call
the function as a tail-call: Non-trivially-copyable arguments live in
the caller's stack frame and the caller has no idea whether the object
was moved from in the callee or not, so it needs to run the dtor,
which prevents this from being tail-callable.

Passing .release(), OTOH, makes it obvious that the unique_ptr is
nullptr afterwards, so leaves the door open for tail-calling.

However, the QObjectPrivate::connectImpl() wasn't, and continues to
not be, a tail-call. Investigating why, while intriguing, is for
another patch (and much more important for the template wrappers of
these functions than then one out-of-line function we're dealing with
here).

Change-Id: Ib951ed2a2b622d70cb12ddbf01c83ec56b1ce70d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 93382070183ff5a0bf9a09f7f0e8264472888117)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-22 05:38:29 +00:00
Marc Mutz
30ffd6639f QFactoryLoader: fix mem-leak on setExtraSearchPath()
When, like in tst_QFactoryLoader::extraSearchPath(), where asan caught
it, or, presumably, on re-creation of a QGuiApplication with a
different QT_QPA_PLATFORM_PLUGIN_PATH, setExtraSearchPath() is called
with a different path than before, then it would leak QLibaryPrivate
objects in the call to libraryList.clear().

Fix by adding QLibraryPrivate::Deleter and holding the objects in
unique_ptr<QLibraryPrivate, Deleter> instead of as raw pointers. This
statically guarantees we're not leaking these objects anywhere else in
QFactoryLoader.

Change the name of the container from libraryList to libraries to catch
any unported users, incl. in older branches.

Since libraryList is now a std::vector (QList cannot hold move-only
types), statically assert that it was never attempted to be copied or
moved, even in older branches, with Q_DISABLE_COPY_MOVE().

Amends ddba24535fb5732c3cb757414cf1a393bd98f693.

Not picking to 6.4 and 6.3, as they are closed at this point.

Fixes: QTBUG-115286
Change-Id: I6d1272622b12c505975cc72f9aba0d126d2817e2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e60aed5ed000b635d8424f9120249725d9e68c78)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-22 05:37:13 +00:00
Marc Mutz
b528f9b1c6 tst_QFuture: fix UB (call of member function on wrong object)
By the time QObject::destroyed() is emitted from ~QObject(), sender no
longer is-a SenderObject, only a QObject, so calling a SenderObject
member function on it is UB.

Says UBSan:

    tst_qfuture.cpp:3854:84: runtime error: member call on address 0x60200000e550 which does not point to an object of type 'SenderObject'
     0x60200000e550: note: object is of type 'QObject'
      00 00 00 00  e8 3f 96 c9 51 7f 00 00  80 3e 00 00 c0 60 00 00  02 11 00 00 08 00 00 00  16 00 00 72
                   ^~~~~~~~~~~~~~~~~~~~~~~
                   vptr for 'QObject'

Fix by removing the QObject::connect().

This, of course, breaks the test's WHEN, but I don't see how to keep
that WHEN without the UB. At least the THEN part is not invalidated,
and there doesn't appear to be another test that tests that destroying
objects before signal emission results in a cancelled future.

Amends 612f6999c81a500a024f128bdf739342d659754a.

Change-Id: I38ca4611c071e8fd200393b600210e36d4030bc6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 4b0261fed08dc766a7eeeb1e41121f8634e9b8cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-22 05:36:59 +00:00
Alexey Edelev
3ace2833ea Check the QTP0002 policy only if paths are set
It doesn't make sense to disturb users with the policy warning if they
don't specify Android paths. Suppress the policy check if Android
paths are not set for the target.

Fixes: QTBUG-115119
Change-Id: Ice9d0459c01feb505857133bb942b1b6e775e55a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 575b8a7fa289a2e27984a6c322069f9e1b499024)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-21 15:39:27 +00:00
Venugopal Shivashankar
023aecc885 Doc: Change the Qt Testlib example pages
These pages are designed as tutorials, so
they can be \page instead of \example.
Also, reorganized the tutorials, moving them out
of the testlib manual, into several qdoc files.

Task-number: QTBUG-115248
Change-Id: I2cbd66ecc1082ecc9d3d1742b621ee009daf1031
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 28defcfb78f3f70ad91a43a641012bd914e4e6b6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-21 13:38:38 +00:00
Marc Mutz
aea3d99a39 QtWidgets: unbreak unity-build-batch-size 100000
Exclude TUs that cause problems in a build where all of QtWidgets's .cpp
files end up in a single unity_0_cxx.cxx. This should ensure that the
build will forthwith not fail because someone added a new .cpp file in
the "wrong" position.

Of course, this is just a snapshot, with my configuration: GCC 13,
Ubuntu 20.04, -developer-build, C++23, -sctp.

Task-number: QTBUG-115352
Change-Id: I6a445701e2ac41d67a3ec69715b7bf6ed5ec65f7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b91891a76bc2d9b47ba84e9ebefeccd77a76a87e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-21 12:13:12 +00:00
Marc Mutz
bdaeee9736 QtCore: unbreak unity-build-batch-size 100000
Exclude TUs that cause problems in a build where all of QtCore's .cpp
files end up in a single unity_0_cxx.cxx. This should ensure that the
build will forthwith not fail because someone added a new .cpp file in
the "wrong" position.

Of course, this is just a snapshot, with my configuration: GCC 13,
Ubuntu 20.04, -developer-build, C++23, -sctp.

Task-number: QTBUG-115352
Change-Id: If33a485b697f60a2f4d6198f0798c953fa47af51
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit a07426d23a02bd4029c6576f92fa43d324ff56be)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-21 12:13:11 +00:00
Volker Hilsheimer
33f22d821f QIconLoader: clear cache when the key becomes invalid
Change-Id: I6f2745715b902ccbc87d78b1c90f6883cfdd76ae
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit e2f0495e7efffefe927e43b26fa3a3a610aa003f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-21 12:13:11 +00:00
Volker Hilsheimer
bd55ecbbce QIconLoader: reset search paths when theme name is cleared
When we reset the theme so that icons should be provided by the
system theme, then reset the search paths to the system-provided
paths as well. Otherwise we'll keep looking for the system theme
in user-provided search paths, which can't work.

Change-Id: I10bcb404db9924e038f6fdc8970e53bbb69ac7d1
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit e1a93b3d9a9f18013b28b4136866a76df11c2ea1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-21 12:13:11 +00:00
Volker Hilsheimer
b01710cba8 QIconLoader: add some more debugging help
As a drive-by, re-use the result from the first QFile::exists
check.

Change-Id: I6b36b165ba3d1f82c9b4be18d44a671f71e8507e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 510224f4463c2a372b83d91f0daf24a91069a9fe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-21 12:13:11 +00:00
Volker Hilsheimer
e861274f27 QIcon: use fallback also with platform icon engine
Amends a452e2254644ffbed289fdf051eaf41d7e6a3b0d. No new tests, existing
tests fails when QPlatformTheme returns a QIconEngine implementation
that provides the tested icons. However, the existing test fails when
the platform icon engine provides and address-book-new icon, and depends
on the order of test functions, as the name() test function modifies the
global theme name and search path. Fix those issues in the test.

Change-Id: Ie1c1d14f08fad5e906296bab662df5cfacdbbf07
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit cb16ba59804e312ba809cf078c8695c7e6656947)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-21 12:13:11 +00:00
Marc Mutz
ec1248b183 QMetaCallEvent::create: extract template-argument-independent code
Extract Method create_impl() with all the stuff that doesn't depend on
create()'s template arguments, which will reduce compile time and
amount of generated code.

Change-Id: I9d8f59c168873ac3527b570ef6142079824061cf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit dc7820a296d58cc61628addd010e28d893d4950b)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-21 12:00:16 +02:00
Edward Welbourne
a2bbbfaa02 Simplify (and fix) initialization of a list of time-zones
Looping over the entries had a typo in it and was quite unnecessary,
as it just made a fresh copy of a list we already had.

Change-Id: I0f3023b06163e5854d425d816e465785cda5fc91
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 07e4015687c52ded043345605b7c9426f1424c77)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-19 20:50:44 +00:00
Alexey Edelev
4d2c405fe5 Make sure that the 3rdparty directory belongs to the module
If the path where Qt sources are located has 3rdparty in it we skip
headers processing since all headers are treated as 3rdparty.

Use path relative to the source directory when indentifying the 3rdparty
header files using regex.

Fixes: QTBUG-115324
Change-Id: If97328cb9a9ece01d43c56022f4613da9b29c03f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit ea4a3d78a776e10955caf6cf9b1054ddb50f40d3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-19 19:54:51 +00:00
Dennis Oberst
95befb165b QString: make isEmpty(), length() and size() noexcept
They have no preconditions and cannot throw.

As a drive-by, merge the definition of isEmpty() into its declaration.

Change-Id: Ifffa0d4cb2a285bb802d39d10a757be9c31cfae1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 464461dea6cab1808cdba7987e50026289afae56)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-19 15:08:58 +00:00
Marc Mutz
742dc3ff40 QFutureInterface: port to new SlotObjUniquePtr
... removing a ### comments to that effect.

Change-Id: I635ca9593ec72a66d328ff6de61cd311c1b4e89f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 56651915e8dbb61ef6832531b6752059ec7237fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-19 12:55:02 +00:00
Marc Mutz
e2b8476151 QSlotObjectBase: add Deleter and typedef for a unique_ptr using it
Use it in QMetaCallEvent, to have some automatic test coverage. Other
code that might benefit has undergone changes since 5.15, so will be
ported one-by-one to avoid conflicts on cherry-picks.

Change-Id: I566bab1803e3675f75a9fdf294a4b0f047d21c11
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c58074b42dcd48a293fe493795d51ca2b101a280)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-19 12:54:56 +00:00
Alexandru Croitor
d32e1153c1 CMake: Specify correct \since version for android variable
The QT_ANDROID_DEPLOY_RELEASE variable was added in 6.5.1, not 6.5.2.

Amends 64db65ae907b2d987c01768438dcae9643ceac96

Fixes: QTBUG-115318
Task-number: QTBUG-112921
Task-number: QTBUG-108132
Task-number: COIN-882
Change-Id: I912fecfc918914709aa5cb9c42c67317f7d3dc89
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 0cae76c2af9b421eb3bfb865dc9442696e8438dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-19 12:54:51 +00:00
Alexey Edelev
074cec7683 Put arguments in correct order in syncqt parseVersion
Amends 4d4e74e1bcad47476b947b6e3781b046f9505f83

Change-Id: Ie3a0147b414303c528b78c20f6502b83c5102344
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f73249b94d94b40ffa75e644cee014055eb650cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-19 12:54:51 +00:00
Mårten Nordheim
2adc225391 QHostInfo: fix leaking slot object
We were not ref'ing or deref'ing the slot object in the various places
that owned it. So, if, in the end, the QHostInfoResult object didn't
call the slot we would leak the slot object.

Fixes: QTBUG-115263
Change-Id: I45f43756c7589470045d97b59257ccfd85a325b7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 061ab84e98a3457c361287084e0c1e9a396ab197)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-19 12:54:51 +00:00
Marc Mutz
46af7d3d1f Port SlotObjectGuard to SlotObjUniquePtr
Change-Id: I81e64db7e1be9076494bee15bbca372ebffeb3e0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit cec711092f7df10ee90ccac6784da4bbea491e16)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-19 12:54:51 +00:00
Ivan Solovev
d760569dee Guard xmlstream header in a source-compatible way
Using QT_REQUIRE_CONFIG results in a static_assert if the xmlstream
feature is not available. This is a SiC change, as the user has
no reasonable ways to guard against it.
Fix it by using

 if QT_CONFIG(xmlstream)

instead.

This commit amends 7337474d041d7e4a7a33157ebd7d84406ed13966

Change-Id: I0c55e4cff06157743c05a543a092f9be1eb67c2d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 4601717378fb6822226cf4ad1e5e52960bf0a773)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-19 09:57:02 +00:00
Jaishree Vyas
303d7cabd3 Doc: List of all Qt overviews which are now termed as explanation
The autogenerated list of overviews was adding the \group command which
included all the groups instead of overviews.
The idea here is to categorize the overviews later on once we have
the list of all overviews.

Task-number: QTBUG-114762
Change-Id: I3cf53886be277abc86b5ec54d399cd6933fbe882
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 7c2ecfcf2970cdce8aef043deb38aabdc3baffd8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-19 08:37:10 +00:00
Marc Mutz
0749d1fa33 QMetaCallEvent::create(): re-order operations
... so that everything that requires argv is done first.

Also introduce a new variable, argc, for sizeof...(Args) + 1.

This will allow us to apply Extract Method to the tail end, which now
no longer depends on argv or Args.

As a drive-by, port from std::array to C arrays so we can use
automatic array size deduction: There's still no such thing as partial
CTAD (certainly not in C++17), so if we wanted std::array to deduce
the size, we'd also need to let it deduce the type; and we don't want
to add an ugly cast to the nullptr). C arrays, OTOH, can deduce the
size while fixing the type since K&R C.

Change-Id: I5a694d4f4d41974eb4b1075ff030bbef902ed492
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 74707948652d1b251b2296ce0b3a515b2ddbcc08)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-19 07:46:27 +00:00
Marc Mutz
22d8539016 tst_QSortFilterProxyModel: fix mem-leaks II: sortStable()
Like in 9f8449a054a165ae560c91d3e31409bc293df80d, for
doubleProxySelectionSetSourceModel(), the sortStable() test also
leaked _everything_. Fix in the same way, by allocating model and view
on the stack intead of the heap.

With this patch, tst_QSortFilterProxyModel is now asan-, but not
ubsan-clean (and, because of
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110704, asan still
reports a leak in cp-demangle.c, which should be™ gone once we fix the
rest of QTBUG-99563).

Task-number: QTBUG-115264
Change-Id: Ic0e833d7336435e324457f9d9667ee8573a7dafc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 65647d54b9fddb0b0e3238024d79e12e4bf53295)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-19 07:46:21 +00:00
Marc Mutz
db1bf57a29 tst_QHostInfo: fix mem-leaks in threadSafetyAsynchronousAPI()
Allocate participating threads and objects on the stack, not the heap.

As a drive-by, port from QList to C arrays (never use a
dynamically-sized container for statically-sized data™).

Code predates the public history, all active branches are affected.

Change-Id: If8def658c1c7b505074938d637e78ad2d1f9fd57
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 69d767bec265587a5645a08f14bb7e7540f01867)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-19 07:46:18 +00:00
Yuhang Zhao
7d55bf65fb Windows QPA: fix mail launch in case parameter is wrong
Done-with: Ilya Fedin <fedin-ilja2010@ya.ru>
Change-Id: I7b24ed64533cdf26f3f3d7dba4b5e80490be269c
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
(cherry picked from commit b3930b03cd6519db068bf0fca45d3e32ff7ce2df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-19 04:43:18 +00:00
Mitch Curtis
7d042a0d37 Doc: explain how to create a QToolBar
Surprisingly, this wasn't mentioned in the detailed description at all.

Users would need to click on the link for the example in the "See also"
section and then read through it to find any mention of how tool bars
are created.

Change-Id: I9db23b475009072f34defab38b6d6200a45f2f35
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 14d10c632bad3346d404271535e6225d226afaa5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-19 04:28:39 +00:00
Mårten Nordheim
a8b0b7798e Handle authenticate challenge for Negotiate
Because we didn't handle Negotiate in the "Start" phase during
handleAuthenticateChallenge, we would not emit the auth signal before
our second attempt, assuming the server prompts us for one.

Emitting the authenticationRequired signal is needed for users
to be able to set the Service Principal Name (SPN) option.
Alternatively, username and password if not relying on Single sign-on.

Done-by: Emil Wipplinger <>
Fixes: QTBUG-114559
Change-Id: I833c08dfeda36a6548c5ad6b8af4b8aa9d644c45
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 90af40ccd07fda57f966107c5fd8ffcbd955b384)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-18 19:30:08 +00:00
Axel Spoerl
163a97fdd2 QGenericUnixThemesDBusListener: Remove stray qDebug()
Remove a stray qDebug() statement, that was forgotten in the source.

Change-Id: I5c413b4356f05570474fa2a0d6ad661785c818b0
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit 31da99954282908fc896989344c4be104ae6e62f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-18 19:28:10 +00:00
Tim Jenssen
e6b1d99ff2 QMacCGContext::initialize: Handle QPixmap without platform pixmap
Regression after 585150e3d947d0ee30489f275e7fc39bce4fe059.

(cherry picked from commit 195c893424a386d66cbec01c777e08c54d6af49a)
Change-Id: Ie728904736dd41fb8dfa6ecc9f843beea95b4604
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2023-07-18 14:31:48 +00:00
Ivan Solovev
ad330d9f61 QMutex: add missing <chrono> include
std::chrono is still used in the header.
Do not rely on transitive includes, instead include the header
explicitly.

Change-Id: If9140499e5dccf0065a4826831d3b83813910318
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 32d44b612c0e412b10af021c9c6bc911e2f01d04)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-18 13:53:26 +00:00
Ivan Solovev
2b7854bd31 QSemaphore: add missing <chrono> include
std::chrono is still used in the header.
Do not rely on transitive includes, instead include the header
explicitly.

Change-Id: I2cf5dc275c3272151efd655a4fa85936942c5708
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7a33a08376a30bb7b788cafc2343378131fd1e8d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-18 13:53:18 +00:00
Marc Mutz
9244100789 Use new QByteArray::assign() in QTlsBackendOpenSSL::dhParametersFromPem()
QBA::assign() re-uses existing unshared capacity(), if any, and is
therefore potentially more efficient than = QByteArray(.,.) (and never
slower).

Task-number: QTBUG-106201
Change-Id: I2c45aa268c4c06396e9d7e0490666a13d8cfd532
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 3bb488fb2ac2e11602fe74dae35d074223d3192a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-18 12:47:58 +00:00
Marc Mutz
41388a7ce4 QSslDiffieHellmanParameters: fix mem-leak
Says ASAN:

    Direct leak of 524 byte(s) in 1 object(s) allocated from:
    #0 0x7f708f0a67cf in __interceptor_malloc ../../../../gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f707d94bf9e in CRYPTO_malloc crypto/mem.c:196
    #2 0x7f707d7bd248 in asn1_item_flags_i2d crypto/asn1/tasn_enc.c:65
    #3 0x7f707d7bd1b7 in ASN1_item_i2d crypto/asn1/tasn_enc.c:45
    #4 0x7f707d85b7be in i2d_DHparams crypto/dh/dh_asn1.c:54
    #5 0x7f7075a82223 in q_i2d_DHparams(dh_st*, unsigned char**) qsslsocket_openssl_symbols.cpp:435
    #6 0x7f7075a82223 in QTlsBackendOpenSSL::dhParametersFromPem(QByteArray const&, QByteArray*) const qssldiffiehellmanparameters_openssl.cpp:139
    #7 0x7f708ca9b588 in QSslDiffieHellmanParametersPrivate::initFromPem(QByteArray const&) qssldiffiehellmanparameters.cpp:285
    #8 0x7f708ca9b588 in QSslDiffieHellmanParameters::fromEncoded(QByteArray const&, QSsl::EncodingFormat) qssldiffiehellmanparameters.cpp:94
    #9 0x55fd8a545ebe in tst_QSslDiffieHellmanParameters::constructionPEM() tst_qssldiffiehellmanparameters.cpp:98
    [...]

The pointer returned in the out-parameter of a i2d_DHparams() call is
supposed to be OPENSSL_free()ed by the user (this is not at all
obvious from the docs¹, but an SO answer² indicates that's how it
should be (as well as asan stopping from complaining with this
patch applied)).

¹ https://www.openssl.org/docs/man3.1/man3/i2d_DHparams.html
² https://stackoverflow.com/a/53563669.

Amends 2cf63c71ebe139890526057dcc51b24ea6df6c30.

[ChangeLog][QtNetwork][SSL] Fixed a memory leak in parsing of
PEM-encoded Diffie-Hellman parameters.

Change-Id: I9ed4a26c4676db1c0d54a1945a4fb5014ce568cd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 676087ef1f7cc885d51256ec30e242d972dccb65)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-18 12:47:52 +00:00
Marc Mutz
360e71d5be tst_QNetworkDiskCache: fix mem-leak
A caller of Q(Abstract)NetworkDiskCache::data() is supposed to delete
the returned value, and this caller forgot.

Do it now; better late than never.

Amends feb1afc78290433b0c22b1b3f6d65542eeb5b957.

Change-Id: I1b27663df9ad49e0203172265d224fdb6ec06646
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit bad3b8f78b9eddb9dd5c08d96f9ee8137d98c19e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-18 12:47:51 +00:00
Marc Mutz
09cebbd128 tst_QAbstractItemModelTester: fix mem-leak
QThreeWidgetItems that have been removed from their parents (or the
widget) must be deleted manually. The treeWidgetModel() test forgot
that, driving asan nuts.

Code predates the beginning of the public history, so picking to all
active branches.

Change-Id: I139549b0bd8baf4abfb90f926f6290119471046f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 51edc438dd88d3260b6d824a95d4b4782c59fb03)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-18 12:47:48 +00:00
Liang Qi
5edba15ab3 tests: blacklist tst_QGraphicsItem::itemUsesExtendedStyleOption() on Wayland
Task-number: QTBUG-115293
Change-Id: I0a9251b5656a5d5a1048fa0cb1606df1c42dd85d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 43c4d17e4d5a50790085d8e2429f355b4c666f09)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-18 10:18:38 +00:00
Marc Mutz
147ad81c1f SlotObjectGuard: mark ctor nodiscard
QUIP: 19
Change-Id: Idaf8cda12fe2ca97a763d78ff4c8cd7304d178e5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3a166fa45ddd4435c15b94a8c9c77871c0aae43d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-18 10:18:38 +00:00
Axel Spoerl
a966e35ec0 tst_QXmlStream: Fix CMakeLists.txt
Remove non existing path from GLOB_RECURSE statement.

Change-Id: Ie122bd062acf8cc26f2ddead808c101af4da9573
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit bc9ad7db6b6a6121919a7c2400f8a11e2a29dda4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-18 10:18:38 +00:00
Ivan Solovev
2ead07f210 Explicitly specify the alignment of QUuid::Id128Bytes union
... because otherwise the union can change its alignment based on
the presence of the data128 member.
For example, QtBluetooth explicitly #undef's __SIZEOF_INT128__ in
its removed_api.cpp, which leads to UB without this patch.

Found during API review

Change-Id: Ia17122cc9f3d422530cf722ea528591fce7ab7ff
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0b3c5816c6d6be52918aa51178f03bd760449eb9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-18 10:18:37 +00:00
Ivan Solovev
9a55243e53 QUuid: handle quint128 and Id128Bytes data in the same way
The QUuid(quint128) ctor was handing the incoming data differently
from the QUuid(Id128Bytes) ctor. Same was valid for the return
values of QUuid::toUint128() vs QUuid::toBytes().
The provided test didn't reveal it, because it was treating the same
128-bit input value as BE in one place, and as LE in another place.

This patch fixes the test, and updates the implementation of
QUuid(quint128) ctor and toUInt128() method to verify that the
updated test passes.

This commit amends 8566c2db85a6f579a1a0432d0b7621633158e04c

Change-Id: I24edb8ba0c8f7fd15062ba0b2a94ad387c3e98b6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0393fa6bf244c1135a9ed20cba8649687da45b9b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-18 10:18:37 +00:00
Ivan Solovev
9f1f2e3eed QUuid: remove pointless inline keyword
constexpr functions are implicitly inline

Found during API review.

Change-Id: I94daa0a67336fa99a1465115edb83e545580a78a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit ef4e36aa3c816d9d8d07db412e72821a75de4e40)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-18 10:18:37 +00:00
Edward Welbourne
95ed706e82 XBEL stream example: use constructor initialization
The treeWidget member of MainWindow could be initialized before the
body of the constructor, enabling it to be a *const variable.

Task-number: QTBUG-111228
Change-Id: If4a3b04729bc7fa5859ca88183eec376f6992455
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 5651be517a9f25798a051f7dd7548d40381148df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-18 07:33:14 +00:00
Edward Welbourne
bda8c5216c Treat simple spaces as equivalent in date-time format separators
The user might not be aware of, or able to see, the difference between
Unicode's assorted horizontal spacing characters, leading them to
expect their input to be accepted for a format despite differences in
spacing. So treat the various horizontal spacing (other than tab)
characters as equivalent when matching the separators in a date-time
format. Add a test-case that failed before this fix.

Fixes: QTBUG-114909
Change-Id: I3e798d3e5b89adb8e86168ebd3954904b258d630
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit 144e10eafbba82d8ac554bbd25afab112482f509)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-17 23:24:53 +00:00
Edward Welbourne
7bbb12b5d8 QDTP: Fix handling of no-digit numeric fields
A numeric field with no digits is Intermediate, since digits can be
typed into it. The testing for this was complicated by the fact that a
sign might be either a sign in the field or the start of a following
separator.

Break out the testing of separator matching at the start of a view.
This simplifies the existing checks for full separator match and we
can use it in the no-digit numeric field's handling to make the check
more robust (matching the whole separator, rather than only its first
character). It incidentally prepares the way for other changes.

Task-number: QTBUG-114909
Change-Id: I5abfccbcae3cba0979b4723c400de038fe2bf324
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 61b2a6f5874275e92e37f4270a1817a4c101778d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-17 23:24:45 +00:00
Edward Welbourne
f46856ae16 Avoid using Darwin date formatting before 1583
It turns out that Darwin's date formatting uses the Julian calendar
for dates before 1582-10-15, when the Gregorian calendar first came
into use (in some countries, while many others continued using
Julian).  This leads to discrepancies between the (Gregorian) dates we
pass it for formatting and the (Julian) dates it actually prints, that
are the same number of seconds before 1970.

Previously the QLocale system backend for Darwin already had a kludge
to work round its handling of negative years, so it suffices to extend
that to years before 1583.

Fixes: QTBUG-54955
Change-Id: I70f219b73bf20c0cd63bcda2b0e99042354872ca
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 207954d5f0751c61f8d8b325797a806ef5f8c854)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-17 12:44:20 +00:00
Kai Köhne
56c40449ae Testlib: Make QTEST_ASSERT usable in constexpr functions
Commit 8ea27bb1c669e21100a6a042b0378b3346bdf671 adapted the definition
of Q_ASSERT already.

Adopt the same logic for QTEST_ASSERT.

Change-Id: I5a5d0f62df79b18635d3b426a439c35b25d739c2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit d4d600d411333bdfbcd116993ce30abd97b2a9aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-17 11:29:57 +00:00
Piotr Wierciński
b9c4fb7e61 wasm: Render Qt::SubWindow borderless
Windows with Qt::SubWindow flag should not have platform decoration.

Fixes: QTBUG-115054
Change-Id: I7111df6057a087080194c1d46e350df839bec437
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 0493504f34c6673e05be630d8096cf2a78a780b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-17 11:29:48 +00:00
Liang Qi
c3efe23ad1 Examples: Revamp sql/books
* use nullptr
* use member init
* set ExpandingFieldsGrow fieldGrowthPolicy for QFormLayout, which
makes it behaviors similar on macOS as other platforms
* select first row to make up/down keys works by default

Change-Id: I25d9869d2ca1c7274c2b750aada8270734787546
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit ed1fbc7a88008ddf118556a97f1ee34989151c75)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-17 01:31:18 +00:00
Liang Qi
e9bd092bda tests: blacklist tst_QMenu::pushButtonPopulateOnAboutToShow() on Wayland
Task-number: QTBUG-114997
Change-Id: Ic6f0e9e3ec550b9d08cb70102bbe553328b29273
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 81ae227614e0b60d1e6607bdee5bf328e1aad6ac)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-16 23:29:03 +00:00
Axel Spoerl
1c0029070c Adapt setBackingStore() overrides in QWasmWindow and QEglFSWindow
This is a follow up to a4ca9e80658bca7dad1529f03c1b59173a6ecf62,
adapting the backing store setters to become proper overrides of
the newly implemented QPlatformWindow::setBackingStore();

Change-Id: Id4f5ff8650ca4e4d3cab1d71d27041c6129bf4ea
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 959a8b3967ac3b6315f5b458628ec5661dfc367e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-16 20:23:35 +00:00
Marc Mutz
ce7a1aa628 tst_QSortFilterProxyModel: fix mem-leaks
tst_QSortFilterProxyModel::doubleProxySelectionSetSourceModel() leaked
_everything_, driving asan nuts.

Allocate objects on the stack instead; now it's asan-clean.

Change-Id: I721e797e02b1daec9e2b5e3d4ef612a42b2e3492
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 9f8449a054a165ae560c91d3e31409bc293df80d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-16 12:16:04 +00:00
Alexandru Croitor
44949ea13e CMake: Fix gc_sections genex evaluation in pkgconfig file creation
The gc_sections linker flag was recently wrapped in a
$<CXX_COMPILER_ID> genex to prevent adding it the command line when
using an incompatible compiler.

This causes an issue when generating .pc pkg-config files because
$<CXX_COMPILER_ID> can't be used in the output of a file(GENERATE)
call.

Record the flag in a global property, both the genex-wrapped and bare
forms, so that we can perform a string replacement when generating
the pkg-config file to remove the genex wrapping.

This is not perfect, in the sense that consumers of the .pc file
might get the wrong flag if using an incompatible compiler, but
it's better than outright failing the Qt build.

Distros will be expected to patch the .pc files if necessary.

Note the issue does not usually happen for regular Qt builds because
gc_sections is only enabled automatically for static builds, but for
static builds we don't currently generate .pc files.
So the issue only happens in shared Qt builds where the gc_sections
feature is enabled manually.

Amends a2b6c2f3437bf1779da787e719bea08bc6f28622

Fixes: QTBUG-115243
Change-Id: I3f6bdf86c24ee90b6da04994e458b438cc41fc7a
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
(cherry picked from commit 53b6c88a2529a5767b2f4c6ff91680b93dc5e357)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-16 07:13:24 +00:00
Marc Mutz
e46c3c3e5a QCborValue: fix memleak on Array to Map coercion
When converting from an array to a map, we double the number of
elements, spread the old elements out to make one free slot of space
in front of each, and then place Integer values counting from 0 into
the free slots.

The old code contained a loop that would add a strong reference to the
original elements that happen to be containers and thus are
ref-counted in the first place. But this additional strong reference
is not needed: In both cases, detached or in-place, the detach() call
that ensured unique ownership of 'map/dst' will have either directly
or indirectly updated the ref-counts of the elements correctly, and
the following loops just reshuffle the elements in the QList, they
don't create new copies (QtCbor::Elements doesn't by itself manipulate
container->ref, but even if it did, the copy would have increased, and
the assignment of the Integers would have decreased, the ref-count
again). Adding the strong ref without a user then caused the container
members to be leaked.

Fix by removing the loop.

[ChangeLog][QtCore][QCborValue] Fixed a memory leak when an array was
coerced into a map.

Amends ccea34464075759424e61806c7bc98ee3e658670.

Not picking to 6.4 as it's closed at this time.

Fixes: QTBUG-115249
Change-Id: I369c372e91c3f0cfe3c65f9b0ea8507d08fdaf48
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ecab68989e623737f7f930d7b123471ccffbfb95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-15 16:02:16 +00:00
Marc Mutz
2be472a07c tst_QTcpSocket: fix mem-leak
earlyConstructedSockets is a QObject, but had no parent and was never
deleted, leaking all the data is holds.

Fix by giving it a parent.

The code predates the begin of the public history.

Change-Id: Ibc5688afd6111e84f591c37e39b6bb618d76c47a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8cb542c2d430ffc5a6d63c404c7e700132e6364a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-15 15:12:23 +00:00
Marc Mutz
8d4945fb65 modulecppexports.h.in: replace non-ASCII with ASCII characters
Qt 6 requires /utf-8 for user-projects by default, but allows users to
opt-out (cf. 0cdcbb40a1f7fe0288698898027717959f4fbee1), so we shouldn't
use non-ASCII characters in public headers.

Amends 97f643faee876cadb36f110ef5a96abf1b68acff.

Fixes: QTBUG-115229
Change-Id: Ieb93ea9f3526e7bcc2e5aeffb5e69c68d10db792
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7a1625abf1648c4161c334a8f497a676fdaf17dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-15 13:05:47 +00:00
Marc Mutz
8bf8c9113c tst_QNetworkCookieJar: fix memleak
QTest::toString() returns a new[]'ed char array, which needs to be
manually deleted and QVERIFY2() doesn't take ownership of its second
argument.

Fix by wrapping in unique_ptr<char[]>(...).get().

Bug exists since the dawn of the public history.

Change-Id: I19ec09f46ec0ce5eacf1437f62dc625bc9343831
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit d3c08df330f615dc3a248fd0c346a5c1ad6e1c38)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-15 13:05:44 +00:00
Marc Mutz
2d9d633cce tst_QParallelAnimationGroup: fix memleak
Setting the parent of a QObject to nullptr means the ex-parent no
longer owns and deletes the object as its child, leaking it.

Fix by creating a scope-guard to defer deletion until the tests have
run.

This is simpler than the alternatives:

Putting it into unique_ptr would require a new variable name, or a
larger refactoring of the function, because the `test` variable is
being re-used for many different objects in the course of the
function, most of which should not be deleted.

Using QAutoPointer would drag in QtWidgetsPrivate, and the class is
probably not available in all active branches.

Finally, deleteLater() would require reliably returning to the event
loop, which may not happen if the test is run in isolation.

Bug exists since the dawn of the public history, and QScopeGuard is
available in all active branches.

Change-Id: Ib4fcb44b0b68d4ccbcf5af144a18ffb378a72213
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit e667624371613fad17b09d106e2eb80d581e0e0f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-15 13:05:40 +00:00
Axel Spoerl
1781eb50ac QWidget: Don't re-use backing store on Android
QWidget re-uses backing stores created in QWidgetPrivate::create().
The Android platform plugin creates a new platform window, when a
widget becomes a toplevel window. When it is hidden, the platform
window is deleted. The link between QAndroidPlatformWindow and its
backing store is made in the constructor of
QAndroidPlatformBackingstore. When a new QAndroidPlatformWindow is
constructed and the backing store is re-used, there is no more link
between platform window and platform backing store.
This has lead to screen assets not being painted, when shown more than
once.

This patch forces QWidgetPrivate::create() to construct a new backing
store on Android. This way, toplevel windows always have a backing
store associated with it. It adds an assertion to
QAndroidPlatformScreen::addWindow(). That will make e.g.
tst_QWidget::visible() crash without the fix.

Fixes: QTBUG-97482
Change-Id: Ib1b172068b03549df161ab93ac24a273221d5423
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit dbb072eb2838a04e89e34dad686394a496d5de87)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-15 03:46:23 +00:00
Axel Spoerl
c5986c9e59 Implement virtual void QPlatformWindow::setBackingStore()
QWidget re-uses an existing backing store. Platform windows depend on
being associated to a backing store, in case they become toplevel
windows. If a platform window gets deleted and re-created each time it
is shown or hidden, it has to be manually associated to the re-used
backing store.

This patch partly reverts fbf0aeea7d3b38ced7a16fcd5c3e2e9b45536292.
It removes Android specific code from QWidgetPrivate::create(), which
has been added to suppress re-using backing stores in the absence of
the new API.

Fixes: QTBUG-97482
Change-Id: Iaa1b7652efa120ec1955914c0383e8ccd8a41429
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit a4ca9e80658bca7dad1529f03c1b59173a6ecf62)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-15 03:46:12 +00:00
Dennis Oberst
b2004620bd QNativeIpcKey: add implicit default ctor
Add an implicitly callable default ctor, to enable default returns,
but still disallow implicit conversion whilst assigning:

  QNativeIpcKey k = QNativeIpcKey::Type::~~      // not allowed
  auto fn = []() -> QNativeIpcKey { return {}; } // allowed

Change-Id: I0f8476a588b3931f0e1f41a6c3a3fd8f2eb75b93
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 08605f0d7848533bd62b9114dd0e5b175dd00aa3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-14 12:12:23 +00:00
Dennis Oberst
8783783cfc QNativeIpcKey: make isEmpty() and isValid() noexcept
They have no preconditions and cannot throw.

Change-Id: I9c3020e00cffc84dfc3a14469cbb80557a4df5cf
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit ba95594ea211a045f0e28326a066917a662c89db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-14 12:12:22 +00:00
Dennis Oberst
2373c70e2d QNativeIpcKey: add missing noexcept to swap
Change-Id: I57d5f22823597a56d93fc2f8f30b538684ce77ad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 56a776da406c710de3dbf8832b7c20add2e4ca3a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-14 12:12:22 +00:00
Edward Welbourne
f329934052 XBEL streaming example: renumber xbelreader.cpp's snippet fragments
I'll be adding docs for parts currently lacking them; fix up the
numbering first, to disentangle from "real" changes to docs.

Task-number: QTBUG-111228
Change-Id: Ia10f212626bf5ca9fab2b6ba6cf02dbd560a2f02
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit e8a68b556cfa7f4e72faecb400db625608bf6460)
2023-07-14 14:12:21 +02:00
Edward Welbourne
e4d9303a46 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
Change-Id: If43ccf37c2b27837e5462cb4a0eeb07f0045cbfe
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 77d0f3753643fa818c4bef7542f7e5d97812252c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-14 10:01:53 +00:00
Edward Welbourne
5b2e3475ba Do XBEL example's last !QT_NO_... -> QT_CONFIG()
Amends commit 723e331f0a811294e43207db162698c3ff8fde51

Task-number: QTBUG-111228
Change-Id: Ib9a094ab432a80b8b2dbbbecb497dca13d23a553
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 4b6986db32eef511718e9010636c5485b6512ac9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-14 10:01:29 +00:00
Edward Welbourne
84ec6b1dc6 Core examples: consistent #include order
Task-number: QTBUG-111228
Change-Id: I014a895a8abeccc9d17b68fb67c00cea22957fed
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 59d28697655cbd41baa40804cdc43c96983261d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-14 10:00:50 +00:00
Marc Mutz
979d367ef7 tst_QThread: Unbreak UBSan build
tst_QThread peeks into QThreadPrivate, which means that a UBSan build
needs access to QThreadPrivate's type_info, for which we need to
export the class.

Amends 268ff00ef50a74ffa58e53c2c8897b7a7319be41.

Change-Id: Ic26df3d323d50b51d369d5f2bd78db7e047b5341
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 22b3eca55dfa409fd5184b033be84f5a600fe283)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-13 18:01:35 +00:00
Marc Mutz
220f86d1ee QBasicFutureWatcher: get rid of the Private
It's not needed anymore, because the class is no longer part of the ABI.

Change-Id: Idfacc6023288ce603b30ab5aa904106e8c850444
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 3fb0208d4b164f10131aeb48774a099cae4f8415)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-13 18:01:27 +00:00
Marc Mutz
2634898e2e tst_QLineEdit: fix -Wsuggest-override
Amends 8afe4faf298798783278f992d14fb78cecee9588.

Change-Id: If2b87f8db3e1a60ff5f5d34c68b3ecd45ff25f96
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3ad359d44f6b1cd94ba35d77be258212cd205fd5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-13 15:07:28 +00:00
Kai Köhne
5d05532c32 Doc: Add remaining SQL examples to Data Processing & I/O category
Task-number: QTBUG-115174
Change-Id: Idd8ba8504efb17f0e4a11b3c36b991739251f2ef
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit c07a3f10ef27b42ab2f87bde74d86831c79317cf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-13 15:07:28 +00:00
Edward Welbourne
1beb9335b4 XBEL streaming: shuffle mainwindow parts into more pedagogic order
Renumber the code fragments to match their order, while adding a
number for the previously undocumented custom method. Add a brief
description of it. Move the createMenus() part up to after it, combine
the createActions() with its (as createActions() is long gone, fused
into it and sharing its snippet number).

Task-number: QTBUG-111228
Change-Id: If0fbcadfa058fc12cbd74ba1897646113bd016b0
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit 98765cab974d02ccd364355a44dfeb8e8ef969d5)
2023-07-13 17:07:28 +02:00
Edward Welbourne
9dcff27fcf XBEL stream example: move createMenus() earlier
This will make the description of the type flow more naturally.

Task-number: QTBUG-111228
Change-Id: I751bdaf420be7afc9cb4925af4f2a94367840605
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
(cherry picked from commit bb69def7d14795b64580ed68cc49ae31bff90340)
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-07-13 17:07:28 +02:00
Edward Welbourne
1671172375 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.

Task-number: QTBUG-111228
Change-Id: I1887a3c999d752a24c7c4d3cabc4a5d63b29b966
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 3ccf2f8308ba33cab575c22ad2e246b987a3dc0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-13 17:07:27 +02:00
Edward Welbourne
e57bf5b99d 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.

Task-number: QTBUG-111228
Change-Id: Ibcf438c7ef3b2464ddfa8b96a79fb15523e4a468
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit e54a7c56677280d9a9eb976dd455085dcce10c40)
2023-07-13 17:07:27 +02:00
Edward Welbourne
f339262217 XBEL stream reader: shuffle order of functions
Put readBookmark() first of the constituent parts, as it's the most
intelligible (albeit currently undocumented) and gives some clue to
the purpose of readTitle(), which is next.

Task-number: QTBUG-111228
Change-Id: I91d3d6bf8adc3f3001c90274bb62a9da6bf05362
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit b610c7aa89dd6224fbf58983ad8c2a391b2a559e)
2023-07-13 17:07:27 +02:00
Marc Mutz
fde0d8a017 Move QBasicFutureWatcher behind the ABI boundary
... and out of QtPrivate.

No inline API requires it anymore, so move it into the only TU using
it. Can't move it into the unnamed namespace because of the friend
declaration in QFutureInterfaceBase.

Change-Id: I27452960492bc1193a4d0eaeb2acd913d4dd02a5
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit d41db62154dfbf6cb78f6a64e962939a79eec03c)
2023-07-13 15:08:04 +02:00
Joerg Bornemann
b386b5b00b CMake: Fix error in qt_generate_deploy_app_script
...when using a Qt cross-built for embedded Linux and
NO_UNSUPPORTED_PLATFORM_ERROR set.

Attempting to install such a project will now give the following output:

-- Skipping runtime deployment steps. Support for installing runtime
dependencies is not implemented for this target platform (Linux, shared
Qt libs, cross-compiled).

Fixes: QTBUG-114069
Change-Id: Idd2af2135d2ca3cc0e5eeafb7701e891f8a0cc25
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7c82a49e6fc4ec606cffa4fa8d3ceb42c87439cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-13 10:43:20 +00:00
Mårten Nordheim
f66dd99261 QRecursiveMutex: remove QDeadlineTimer::Forever leftover
Amends 5f531ae2ac873c09deda096d292777422c4dee4d
The overload taking QDeadlineTimer::ForeverConstant was required,
prior to making it an enum class, because the conversion preferred
'int'. It was made an enum class for 6.6 and most overloads were
removed, including the one for QMutex, but QRecursiveMutex was
missed.

Change-Id: I4490dd3d7641c06346ea502f10c09915411319ad
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 93fe8cb305791ab0099831361ff1634a047dd13f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-13 10:43:17 +00:00
Marc Mutz
abb28791b7 QFuture: Extract Method watchContinuation() (DRY && SCARY)
The old code violated the following principles:

- DRY: the same code occurred 3× in the code-base

- SCARY: the vast majority doesn't actually depend on template
  arguments, causing template bloat

Solve both with a tiered Extract Method.

We cannot change the order of the operations performed on
QBasicFutureWatcher, in particular not the connect() to the
contination w.r.t. setFuture(), so we cannot leave the connect to the
continuation lambda outside the function, as it would mean to also
leave the setFuture() call outside.

Thanks to Volker's makeCallableObject(), we can, however, type-erase
the lambda using QSlotObjectBase, which is what connect() internally
creates, anyway, therefore bringing the whole function behind the ABI
boundary.

As a non-QObject, non-QMetaObject friend, we're lacking support for
actually doing something useful with a QSlotObjectBase, but that can
be fixed in the implementation now. The interface is stable, which is
what matters for 6.6 now.

This will allow a subsequent commit to drag QBasicFutureWatcher behind
the ABI boundary, unexporting it.

Saves a whopping 8KiB in tst_qfuture text size on optimized C++20
Linux AMD64 GCC9 builds.

Done-with: Fabian Kosmale <fabian.kosmale@qt.io>
Change-Id: I0e5c2564907d92f6938689ab249be11fc0332ba5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit dfd07205e58d67324a82e5aed0ce7fec63bd9368)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-13 10:43:16 +00:00
Marc Mutz
96a67452b1 QVariant: make customConstructShared() SCARY¹
Extract Method non-template customConstructSharedImpl() to avoid
instantiating std::unique_ptr with a different per-F Deleter over and
over again.

Not picking to 6.5 because the function was confined to the
qvariant.cpp TU in those versions.

Cf. 11791e2a50417661679f84aeae21ce959cab638f and
d783363f60173f1bc6525f1a8bbbd87f1e3afc1d for similar issues.

¹ https://www.open-std.org/jtc1/sc22/WG21/docs/papers/2009/n2911.pdf

Change-Id: I73d21d929a7db2ab47f62a3246cf913d82e3db75
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0ecf8a21587e33c5c5b554d5bc059488001c8990)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-13 10:43:14 +00:00
Axel Spoerl
4f89eb5a7a tst_QXmlStream::tokenErrorHandling() - register test directory in CMake
Register the directory tokenError in the build system to expose it to
embedded devices / for cross compiling.
Do not fail the test function, when a test file isn't found. The tested
functionality is platform independent and will be tested on other
platforms.

Task-number: QTBUG-92113
Task-number: QTBUG-95188
Change-Id: I885d8fdfbbf8ec60e6326bfd871fa85a4390247d
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit b476570932dcfc1b32e8405bcdd219c2dcc421f7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-13 08:26:25 +00:00
Bartlomiej Moskal
477ecafaee Android: Fix for checking clipboard text mime type
Different mime types are widely used on mobile devices. For example all
text copied from gmail is copied as text/html type.

After 2937cf91c74b6562bf56e8872dfd2bfaafebb3cc commit there is a
regression that makes it impossible to paste any text different than
"text/plain".

To fix it, any "text/*" mime type should be treat as it contains a text
(not only "text/plain"). That will allow to paste different text mime
types.

During this work also tst_qclipboard testset was turned on for Android
and new test (getTextFromHTMLMimeType) was added.

Fixes: QTBUG-113461
Change-Id: I3ef9476b8facdc3b61f144bd55222898390127c9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit fdccb66a4e9a8b22c881c4775895b7af174b0b24)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-13 06:14:13 +00:00
Marc Mutz
98ff5a2676 ThreadPoolThreadReleaser: add Q_NODISCARD_CTOR
QUIP: 19
Change-Id: I465a2ef8edc103f0655a7732f3aaaf18748854c4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit df96d39c048a467213c6170dc8e225116f31a7e3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-13 00:54:59 +00:00
Ivan Solovev
90beb456f7 Revert "QUuid: use NSDMI to initialize the members"
This reverts commit c3c5d2cab07ffed1ddfb7978870c05917d89fa39.
Reason for the revert - it breaks the purpose of the Qt::Uninitialized
ctor

The commit also updates the QUuid(quint128, QSysInfo::Endian) ctor
to avoid the compiler errors:

 error: member ‘QUuid::data*’ must be initialized by mem-initializer
 in ‘constexpr’ constructor

Change-Id: I0057fab3d7203adaddad3e890129668923a9eef6
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f1ffc11e613ebe3132d94937eb60d59c2095e7ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-12 20:10:57 +00:00
Alexey Edelev
ec14d91a09 Add the 'version' argument to 'qt_deprecates' pragma
syncqt uses qt_deprecates pragma to generate deprecated header files
that might live forever in Qt packages. This adds the version argument
to the pragma, that allows specifying the version when the respective
header file should be removed. The new pragma format is the following:
  pragma qt_deprecates(<header>[,<major.minor>])

If deprecation version of the deprecated header file is lower than
the current Qt version, syncqt will display the respective warning in
the log and skip generating the deprectated header file.

Also the user warning message now displays the exact version when the
header file will be removed.

Task-number: QTBUG-115029
Change-Id: Ifd7464b8539b8be93b95690fd1ca70ef0b14e436
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 4bc0a08bea3c262ebda26163f9271c946c430ff0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-12 20:10:57 +00:00
Volker Hilsheimer
2eae708fad Fix build with latest MSVC
Amend 813bbc515bdd8af843ef56115711691e926d0bcb. Unclear why this
passed CI, but we can't use implicit conversion of string or character
literals.

Change-Id: I1b3515e42b09a5caae1e632320b8251c27177f52
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 8f3f765dad8757a9307f8b538c0f3af2b7bb245f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-12 18:26:28 +00:00
Volker Hilsheimer
667a99c322 Add porting documentation for QMacPasteboardMime/QWindowsMime
Task-number: QTBUG-93632
Change-Id: I38294aef304adea86ecf5fbb118024037afedfe8
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit 84a33c67c6cc247b92b4bd9e2769b4a0736a2589)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-12 18:26:28 +00:00
Marc Mutz
ac328eec8d QAtomicScopedValueRollback: fix CTAD for Q(Basic)AtomicPointer
We need deduction guides to turn the AtomicPointer template argument
(the pointee) into a pointer:

    QAtomicPointer<int> → QAtomicScopedValueRollback<int*>

Extend a test to cover pointers, too.

Fixes: QTBUG-115105
Change-Id: Ib416c6a43e4da480b707a0bf6a10d186bbaad163
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 97ec1d7d8ecb07be20cf43f475067faba04f5aa5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-12 18:26:28 +00:00
Marc Mutz
40024a24f0 Normalize signal/slot signatures [1/2]: non-QPair
This is the result of running util/normalize, dropped some false
positives:

- it removed the space after "d, " in Q_PRIVATE_SLOT(d, foo())

- it removed spaces in moc text streaming of "SLOT(" << ... << ")"

In addition, the tool replaces QPair with std::pair. This is
surprising and therefore performed in a separate commit.

Change-Id: If4e3815d7c0840defc1b82bcbf41a8265acda0d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 25f5983ea8f53aca24eae1cc57a6070c7d07aa67)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-12 18:26:27 +00:00
Laszlo Agocs
46abad6741 rhi doc: Make getShader in the snippets more compact
One line is better than three.

Change-Id: Ib738ec18b51accead3897b450b26207b3fba87d8
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit bcf14392df0d83e79e10022112aea7dd91c5a1f9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-12 18:26:27 +00:00
Timothée Keller
65b2832503 Windeployqt: also add internal modules to module list
Not adding internal modules to the windeployqt module list makes it
give off nonsensical warnings, and can force the deployment of debug
libraries despite a --release tag. Add them in to prevent this, and
shave off the "Private" part of the module name if it exists to maintain
compatibility.

Fixes: QTBUG-114854
Change-Id: I884fdc495f340ad20ba6257587da170d6c1a1415
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 87bfd3308209c3f859d116c024de1d2c35bf18b3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-12 18:26:27 +00:00
Thiago Macieira
91a3ba1496 QSocketNotifier: firm up the ordering in unexpectedDisconnection()
The test was relying on the fact that, having written 1 byte to both
writeEnd1 and writeEnd2 (and ensured those bytes were written with
waitForBytesWritten()), both read ends would be activated by the next
event loop. It turns out that this was an unreliable assumption, because
the processing of that 1 byte on the second socket may not have happened
yet. So firm up by waiting that both read ends are readable before even
creating the QSocketNotifiers we will read on.

I'm not entirely sure what this test is attempting to test. Its
documentation says it's testing a QAbstractSocket condition, but the
read ends aren't QAbstractSocket (this test should have been in
tst_QAbstractSocket if so). It may be testing the condition that caused
that QAbstractSocket behavior, but that wouldn't be a good test.

Drive-by remove redundant flush()-after-waitForBytesWritten() calls.

Fixes: QTBUG-115154
Change-Id: I61b74deaf2514644a24efffd17708f8071f707ed
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 93b87b5cbfae3c50e539f6ec37bd7b95e89e455e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-12 15:59:12 +00:00
Thiago Macieira
8d86ae9f90 QNetworkInterface/Linux: fix mismatch of pointer and pointee
It was hard to see the problem because of the lambda, combined with
reinterpret_cast on the output of non-typesafe C macro. NLMSG_DATA
returns a void*, so use static_cast to be sure not to do something
wrong.

This only affected the code that dealt with unexpected replies from the
Linux kernel, which it doesn't send. So I don't expect this fixes any
improper QNetworkInterface behavior.

Found by CodeChecker.

Change-Id: I61b74deaf2514644a24efffd1770d75e5a4f2636
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 5bcacdbd1aa237cb3d39ffafbe378688a00ea502)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-12 15:55:10 +00:00
Mårten Nordheim
ae6e27d601 ipc common: move end-of-namespace into same scope as start
To avoid issues building with shared memory & system semaphore disabled.

Change-Id: I525abe97f82266b8cca0e4f1847849054c016a4b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 42022f8b3848f806feec7bf3fe86c15312f1596e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-12 15:54:59 +00:00
Alexandru Croitor
a9e8aa565c moc: Print sterror(errno) when moc can't write the output file
Also prepend a "Error:" label to all strrerror handling locations,
to make it clear where the error starts.

Task-number: QTBUG-101926
Change-Id: I1a781b4c5716636eff4d47a6c8554dcbd51d2697
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 3ba3f322b6b1781cfc1a64be8240b1ae74c36840)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-12 15:49:10 +00:00
Edward Welbourne
b09ff420e4 Doc fix: QDomDocument::ParseResult is false on error
The documentation claimed the exact opposite of what the
implementation did. Since callers use it the way it's implemented, fix
the doc.

Fixes: QTBUG-112895
Change-Id: I74d6259727c7af7265224c6d79ba39265663704b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 258e7ed9fd04c39c14d9365fd7aaeb7ba20e64f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-12 15:49:04 +00:00
Laszlo Agocs
64a4f7120f rhi: metal: Remove out of date / unneeded comment
E.g. the view.layer thread checker problems are eliminated
for some time now. The other mentioned XCode warning is
likely not there anymore with newer XCode. Whereas the
rest (that we pass validation) should be obvious.

Change-Id: I9754077aa6e178ee2b866b64538991412af5bb5a
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit f88ac070295c1efacc6b5422e7835c2267fd061a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-12 15:49:02 +00:00
Alexandru Croitor
c1425724d7 moc: Store errno after fopen call
To avoid QFile::encodeName() potentially overriding the value.

Task-number: QTBUG-101926
Change-Id: Ie751df877d6624238ded344474b5eccc324ec541
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit dd1b7b5539d6aecdd5f8342ef0fa260e40f5c483)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-12 15:49:01 +00:00
Yuhang Zhao
06d434ef28 Windows style: use correct value for title bar height
The title bar height = caption bar height + resize border thickness.

This calculation is used by many open source repositories for quite
a long time, including Microsoft's own famous products such as
Windows Terminal. And if you use AdjustWindowRectEx() to get the
title bar height, the result is also exactly the same, so this should
be the correct calculation.

Normally, when DPI is 96, it should be 23 + (4 + 4) = 31px.

Change-Id: I0a2de3b55d5b62327eacc7e2ff5dc23771b8efdb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 47ee4eae6ad361e9d3a1df4415562ff092de6644)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-12 09:14:06 +00:00
Axel Spoerl
b5d66b52df QXmlStreamReader: Fix variable naming
Replace variable names referring to XML "location" with names referring
to XML context.

Task-number: QTBUG-92113
Task-number: QTBUG-95188
Change-Id: If00e92dce237d95fa1850f0b45192995724ba99f
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit f67a497dbe70dd3258997010c286654aaf963d1c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-12 05:44:32 +00:00
Volker Hilsheimer
acc2cdb6c8 Refactor QStyle: const'ify some local variables
Task-number: QTBUG-114473
Change-Id: I49483dc9c000fac024c81a8210515c8dd5e35559
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 022657d7d03d804c10bb20b8303a6f4f023e96cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-11 19:42:07 +00:00
Volker Hilsheimer
4a15c6bdf5 QStyle: don't use the QPixmapCache when a style sheet is set
If a style sheet is active, then the palette in the QStyleOption might
be a generated, short-lived, temporary QPalette instance. As QPalette's
cacheKey is based on instance-counters of the private data structures,
it will always be unique for such a QPalette, even if the brushes are
the same as in a previous instance.

(QPalette::cacheKey is just a 64bit integer, we cannot possibly encode
the entire QPalette data in it in a collision-free way, and since a
brush in the palette might contain a pixmap or a gradient we couldn't
even generate an efficient string representation for it. We could at
most cache and reuse QPalette instances based on the attributes in the
style sheet rule and in the base palette of the widget. However, this
seems fragile; it might be an opportunity for future optimization.)

Some styles use the QPixmapCache, with a key that includes the
palette's cache key. The key will always be unique if the palette is
based on style sheet rules, and then we fill pixmap cache with pixmaps
that can never be reused, making the cache both useless and wasteful.

To solve this, generate an empty key if we detect that it is for a style
object that is the target of a style sheet. Return an empty cache key
string from QStyleHelper::uniqueName, which will make QPixmapCache
return immediatey when trying to insert or find an object.

This is not pretty, but it makes the change minimal and low-risk.
Refactoring the respective code paths to e.g. consistently use the
BEGIN_STYLE_PIXMAPCACHE helper macro requires larger changes that
can only be verified visually, and so are out of scope for a bug fix.

This requires changes to code that uses QStyleHelper::uniqueName, as we
need to avoid that other key elements are appended to the generated (and
maybe empty) key. As a side effect, this ends up with code that makes
better use of QStringBuilder.

Fixes: QTBUG-114473
Change-Id: I011aed0885f105cbf1e8c0bc6b94c46df47761a3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 813bbc515bdd8af843ef56115711691e926d0bcb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-11 19:42:04 +00:00
John Chadwick
31a3e82b70 Fix transparency in 16 bit and 24 bit ico files
As a result of the fix for QTBUG-75214, Qt inadvertently no longer
reads the AND mask that specifies transparency for 16-bit and 24-bit
ico files. This is because it tries to detect 32-bit icons by checking
icoAttrib.depth == 32, but icoAttrib.depth is set to the depth of the
QImage, not the depth of the icon, and 32-bit QImage is used for all of
the non-indexed cases (16-bit, 24-bit and 32-bit.)

This commit instead uses icoAttrib.nbits, which should reliably
determine whether or not the icon is 32-bit. This makes the behavior
consistent with other ico reading software, including Windows.

Also, adds a unit test that verifies correct behavior of icon masks,
checking for both QTBUG-75214 and QTBUG-113319.

Amends 1d128ed1dfbcf49453ada922e54381c37264fde5.

Fixes: QTBUG-113319
Change-Id: I89ac86ff16054c8925fff6afc8c530fa737f8385
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 1079b537396fcf5cd6c50cc8af19b078a50cf547)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-11 18:35:54 +00:00
Axel Spoerl
66217fe0ae QTabBarPrivate::setupMovableTab() - fix initialization of tab position
The method initialized the tab position with the enum value OnlyOneTab.
=> Change this to the correct initial enum value Moving.

Fixes: QTBUG-115147
Change-Id: I4ce04f0a41dac6e93affd300eb424f4087eb7867
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4b43a329b799f2b5d0fb2f850f03773abc6aa21b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-11 15:32:36 +00:00
Edward Welbourne
8bad89cf53 XBEL examples: construct the text of the separators cleanly
Create the fixed string once and reuse it. Also give a name to the
escape code that's its repeated character.

Task-number: QTBUG-111228
Change-Id: I3d6416070f1d5490ec137e251daff0e1637fb788
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 97f68cd3068587103c8b0a0ccdcd6e61431efc1e)
2023-07-11 14:50:39 +02:00
David Faure
03ee1e1002 Fix assert in qCleanupFuncInfo when using QDebug from a lambda with auto
ASSERT: "size_t(i) < size_t(size())" in file qbytearray.h, line 492
due to info being emptied out completely and then the code does
while ((info.at(0) == '*')

info was empty because the recent fix "that wasn't the function argument
list" would exit the loop with pos at end.

Incidentally, this change fixes the fact that qCleanupFuncInfo was
removing lambdas:
  main(int, char**)::<lambda()>
became
  main(int, char**)::
which was, well, shorted, but weird.

Change-Id: Ic7e8f21ea0df7ef96a3f25c4136a727dc0def207
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 056bdef045867dad07066351787b2edb771be569)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-11 00:38:10 +00:00
Volker Hilsheimer
0c9787babd QAbstractScrollArea: Don't include size of invisible scrollbars
Amend 3e59a88e8968c6cdac788926bec34c259146b6a8, which incorrectly used
isHidden() to test whether the scrollbar is visible or not.
QWidget::isHidden() is only true for child widgets that are explicitly
hidden (or created for visible parents, which the scrollbars are not).
Since the scrollbars are children of a container that is hidden and
shown, isHidden always returns false.

Instead, use QWidget::isVisibleTo, passing the scroll area, as that
tells us if the scrollbar's visibility is relevant for the layout of the
scroll area.

Add a test case for QAbstractScrollArea, verifying that the scrollbar's
size is correctly taken into account when calculating the size hint.
This change revealed an instability in the tests introduced in the
earlier commit: the layout process is asynchronous, requiring event
processing to update the visibility of the scrollbars. Add a call to
processEvents before storing the reference size hint. Also, explicitly
set a style that doesn't use transient scrollbars as otherwise we cannot
control when the scrollbars are shown.

The chagne also revealed an inaccuracy in the QListView test, which
only passed because the width of the vertical scrollbar was included.
We cannot use font metrics results to compare expected width, as the
item delegate's text rendering uses text layouts.

Task-number: QTBUG-69120
Fixes: QTBUG-109326
Fixes: QTBUG-113552
Change-Id: I1f06f9e88046a77722291ac17c56090f8dff7cf3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 8c18a245b0245de20c064cd53d03498088bd57df)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 23:34:30 +00:00
Axel Spoerl
b35f5a187d QXmlStreamReader: Raise error on unexpected tokens
QXmlStreamReader accepted multiple DOCTYPE elements, containing DTD
fragments in the XML prolog, and in the XML body.
Well-formed but invalid XML files - with multiple DTD fragments in
prolog and body, combined with recursive entity expansions - have
caused infinite loops in QXmlStreamReader.

This patch implements a token check in QXmlStreamReader.
A stream is allowed to start with an XML prolog. StartDocument
and DOCTYPE elements are only allowed in this prolog, which
may also contain ProcessingInstruction and Comment elements.
As soon as anything else is seen, the prolog ends.
After that, the prolog-specific elements are treated as unexpected.
Furthermore, the prolog can contain at most one DOCTYPE element.

Update the documentation to reflect the new behavior.
Add an autotest that checks the new error cases are correctly detected,
and no error is raised for legitimate input.

The original OSS-Fuzz files (see bug reports) are not included in this
patch for file size reasons. They have been tested manually. Each of
them has more than one DOCTYPE element, causing infinite loops in
recursive entity expansions. The newly implemented functionality
detects those invalid DTD fragments. By raising an error, it aborts
stream reading before an infinite loop occurs.

Thanks to OSS-Fuzz for finding this.

Fixes: QTBUG-92113
Fixes: QTBUG-95188
Change-Id: I0a082b9188b2eee50b396c4d5b1c9e1fd237bbdd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c4301be7d5f94852e1b17f2c2989d5ca807855d4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 23:14:44 +00:00
Amir Masoud Abdol
743a23b897 Introduce macro.qtpolicydeprecatedbehavior for Qt CMake Policy
Added a template that we can use instead of rewriting the message for
every policy.

Change-Id: I13cc182244d5f092e3d5677664bc149c6b126da5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 8b4dbce54e5e1bf53a1610ac0010e236fc9b2be9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 19:47:21 +00:00
Marc Mutz
f732833eaa tst_QScopeGuard: test if and how guard in optional<> works
It's a bit cumbersome, but works, in principle, using CTAD.

Task-number: QTBUG-114200
Change-Id: Ib7354180e870a695a978edabf684aedfcf9d9ecc
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit b08ddd2c4ecedccd0bc08e9f2390a7b86ed861f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 19:47:20 +00:00
Thiago Macieira
a83d59b901 QLibrary: make isLoaded() report whether this object has load()ed
This reverts commit c2a92199b57b195176d2a0d68d140d72c1cbfb71
"QLibrary::setFileNameAndVersion: reset the tag after findOrCreate".
This restores the behavior of resolve() and compatibility with Qt 4 and
5, which is documented to imply a call to load().

Do note that if you call load() or resolve() and don't call unload(),
the library you've loaded can never be unloaded now. So don't leak!

[ChangeLog][Important Behavior Changes] QLibrary::isLoaded() now reports
whether this instance of QLibrary has succeeded in loading the library,
via direct or indirect call to load(). Previously, it used to reported
whether the actual library was loaded by any QLibrary instance.

The change to QLibrary::resolve() itself is effectively a no-op in this
patch, because isLoaded() would have returned false, but it ensures that
the implementation does what it says it will do.

Fixes: QTBUG-114977
Change-Id: I907aa7aea8ef48469498fffd176d7a76ae73e04a
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 1ca71cbff0fe28185b4854a162f924af700d57e0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 19:26:17 +00:00
Joerg Bornemann
66044f94cb Doc: Document QMAKE_APPLE_DEVICE_ARCHS
Fixes: QTBUG-114847
Change-Id: I8211025d470cf2ef1d1755a5a18195f318661e69
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit d10316d5f52899e4e68d7fbea9ceb08541061b80)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 17:12:21 +00:00
Marc Mutz
4d4e88beb5 QDebug: rewrite timeUnit() into putTimeUnit()
This avoids us committing to the QByteArray return value, which is
overkill for short strings. Instead, pull the streaming of the unit
behind the ABI boundary, so we're free to change the implementation to
either stream directly or use SSO'ed std::string.

Change-Id: I10927acb9d64077d9018b667958ca16be218012a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 568ab62185bfa7876db4d8804101a8f946b04898)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 17:12:13 +00:00
Volker Hilsheimer
78bd3bd006 Update blacklisting of tst_QSocketNotifier::unexpectedDisconnection
The test hasn't failed on Windows for a long time, but regularly fails
on macOS in CI, so replace the entry accordingly.

Task-number: QTBUG-115154
Change-Id: Ib89d15cb9edafad5dd71f6e3f830d03aaeb16331
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 6ee9adc43aef1da47fcd9fee13140af81549e875)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 17:11:53 +00:00
Joerg Bornemann
2c0e78e7b1 CMake: Prevent infinite loop when generating module .pri files
CMake find modules of third-party libraries may create dependency cycles
in their imported library targets. For example, Conan's Vulkan::Vulkan
is such a candidate.

Prevent an infinite loop when generating .pri files for Qt modules that
link against such targets.

Fixes: QTBUG-95569
Change-Id: I09b4a281930f7c6ce5e8c716fe0ab91e2453a24a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f7b7262f110ee44f649d2c061832de26d1b3ee5c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 17:11:48 +00:00
Alexey Edelev
e333057970 Make sure that exception flags are not overridden in syncqt tool
qt_internal_add_tool has the implicit logic that disregards the
previously installed flags and adds new flags that overrides the
exceptions behavior. Add the tool-specific option to make sure
that this won't happen.

Ammends 0f5fbe369b84c422003e24322abc90a1b09520d2

Change-Id: Id149d8d8002390581813475124ba37dd39d56b9b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d4e3d008fe95be309f40e25cb08b0639c926bf76)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 17:11:43 +00:00
Volker Hilsheimer
e7ce9a6546 QPixmapCache: assert that the key is invalid if we failed to insert
QCache::insert on failure destroys the QPixmapCacheEntry, which calls
releaseKey(), which invalidates the key. That's hard to follow, so add
an assert to make it more explicit and prevent future errors.

Change-Id: I9c062ef5a6e34c783c064330c914ce4f9a3f9984
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit ee956824db495c12f51dd0d864e009f0417464d5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 17:11:34 +00:00
Edward Welbourne
2d4827ac53 XBEL DOM example: update the screenshot
The old one showed an old XBEL file's content, with trolltech URLs.
Update to match the new XBEL file's content.

Task-number: QTBUG-111228
Change-Id: I2b3bb7d67c6f96b04208fe4b1f9af10055dc0496
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Kimmo Leppälä <kimmo.leppala@qt.io>
(cherry picked from commit acb950c129f9bbaa7864de2a7a507ee870551dd8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 10:58:58 +00:00
Edward Welbourne
fd29e6ddb9 XBEL streaming: replace images with up-to-date version
The old screenshot showed an old XBEL file's content, with trolltech
URLs. Update to match the new XBEL file's content.

Task-number: QTBUG-111228
Change-Id: Idacc31b7786b1e6ed1425857470b1d37227096cd
Reviewed-by: Kimmo Leppälä <kimmo.leppala@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a028e53fa49c995a7dc06ffaac2be1ebe0923f9c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 10:58:58 +00:00
Joerg Bornemann
f4db3a83b5 CMake: Properly respect user setting of AUTOGEN_TARGETS_FOLDER
There was a typo in the code that reads the property.

Change-Id: I6a26899ecc6de800fcfaff6da659a611939753ff
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
(cherry picked from commit 9f016e96564e0472e54514c7ba21c87f87bfd54b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 10:58:57 +00:00
Edward Welbourne
0114514c0a Update XBEL examples' sample data file
Most links are now https, several have relocated, one entirely
rebranded. Same example in both QXmlStream and DOM forms.

Task-number: QTBUG-111228
Change-Id: Ifbc58dadc834cf51113adb1c82de971a8768ee58
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
(cherry picked from commit 4731cdc09d21050dacaaa66ddd79e50682a476f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 10:58:57 +00:00
Edward Welbourne
8adf5b9316 Correct name of Ukraine's zone
Change-Id: I90066ad5ca4ee5f2483cb5eb3208fb9ba98c873d
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit 08b40f169fd33dfb0a66ec378e649e478c8bd7ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 10:58:57 +00:00
Edward Welbourne
d450c94203 Add tests of QLocale's toDate() and toTime()
Previously only toDateTime() was tested. Adding a test-case for
toTime() provoked adding full testing for both it and toDate(), based
on toDateTime() tests.

Task-number: QTBUG-114909
Change-Id: I5c24b3869b3deefc36a7125133822e8f41cd24ba
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit 95a74de486f377a218adeb44a408c8656426de99)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 10:58:57 +00:00
Edward Welbourne
8c75df013a Update Qt Documentation link title in XBEL examples
doc.qt.io was described as Qt 5 documentation; no need to version-limit it.

Task-number: QTBUG-111228
Change-Id: I1c5abe3d805c2b845a74b9fe454c494fa1eff4c7
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 54f65187ec2efb0c28582fbb0320d847556cb3f0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 10:58:56 +00:00
Kai Köhne
4756d5bb6c Network: Remove unneeded Q_QDOC check for http feature
http is enabled by default if you have threading support, which is true for qdoc. There is therefore no reason to believe that a normal
qdoc configuration won't have it configured, and hence no need to
check also explicitly for Q_QDOC.

Change-Id: I118388fedaa87225ce81a211d361d593da61105d
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 9c43bb61349bb73563461819fa02255875c24201)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 10:58:56 +00:00
Michael Weghorn
08c1f77c9a a11y: Report app as parent for top-level item views
As happens for other widgets
(s. QAccessibleWidget::parentObject), report the app
as accessible parent for item views that don't
have another parent set.

Otherwise, the accessible tree is broken when
there's a top-level item view:
The application has the item view as a child,
but the child does not have any parent set.

Extend a QListView autotest accordingly.

Fixes: QTBUG-115135
Change-Id: Ie06874681180a30fc6248dc98f80c4158d837278
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6ec35ff8c56222a317b838b6aac390eb6974de85)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 10:58:56 +00:00
Kai Köhne
be9797b6b6 Doc: Update example category names
Change-Id: If4a50c403ed0fb299ac0d9a66f1f606151c55930
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit 60f706063aebee22f7fc1bb80f0003afb50fe73e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 10:58:56 +00:00
Amir Masoud Abdol
52f665ebaf Silence the missing BundleIdentifier warning for non-Xcode generators
It's a bit excessive to warn every developer about this, especially if
they are using non-Xcode generators; besides, we are already generating
a bundle identifier if it is missing anyway.

Change-Id: Ib11ad51a0e516e0ea61ad2f7bf499b846bc0b792
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 594b932c589f6ec538240d6b5022298f9abc3e95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 08:53:14 +00:00
Mitch Curtis
f5479dda74 Doc: state blacklist condition requirement explicitly
Each line with a test function must be followed by a line describing
the conditions for ignoring that test function.

From what I can see, this wasn't explicitly stated anywhere.

Fixes: QTBUG-114825
Change-Id: I1941d6c9a6d56a8374a0c5a99c538cf1eaebd544
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 6b6678bc88e1b53f055b3a7cb8cd30da8ac0e248)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 07:47:43 +00:00
Morten Sørvig
e3b08a61eb wasm: clarify qtloader onExit behavior
onExit is called whenever the application exits, i.e.
when the app canvas should no longer be displayed and
the loader/embedder code should take some action.

Emscripten provides two callbacks which can be used
here:
  - onExit, called when the app exits (but see EXIT_RUNTIME)
  - onAbort, called on abort errors.

These map to the two cases Qt's onExit supports. onExit
is not called when EXIT_RUNTIME is disabled, which means
we don't need the special case for exit code 0.

In addition call onExit on any exception. The second
call to showUi() in html_shell.html is then not needed
any more and we avoid duplicating the UI state handling
in user code.

Update the qtloader_integration test to handle changes in
behavior (we no longer set the error text on exit). Use
emscripten_force_exit() to simulate application exit -
using this function makes Emscripten call onExit even
when EXIT_RUNTIME is disabled.

Change-Id: I72b5463c1836e8d5054e594abbd304fbc67032b7
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
(cherry picked from commit a4d1c30a1b52e797cce504f90bcf20d7943dd1f9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 06:46:22 +00:00
Morten Sørvig
2b62922e2e wasm: Add qtloader compatibility API
Implement the main features of the pre Qt 6.6 loader
as adaption layer on top of the new loader.

Task-id: QTBUG-115049
Change-Id: Iabe860d3fb0488fd003876508787da3688e0c87b
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 20d17b1a3b0e3a17a0ed1214cc21d84d79d3c829)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 06:46:22 +00:00
Lorn Potter
5bc7d8b2e8 wasm: add iOS to platform detection
Add iPad and move iPhone platform to iOS

Fixes: QTBUG-114446
Change-Id: I3f601fbe5f3899c0658ee65acf72bbf37d51bf73
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
(cherry picked from commit 65f09d4e10e435846b6669945e37f807de127199)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 04:23:25 +00:00
Marc Mutz
75d5ad3ac9 QEventLoopLocker: rewrite to hold public classes
... instead of Private ones, at the cost of having to befriend of all
the lockable classes, because we need access to their d_func()'s.

This simplifies the code, because we don't need the manual QClass to
QClassPrivate mapping (o2p) anymore, we can just use d_func(). This also
paves the way to make QEventLoopLocker almost completely inline and use
a 3-pointer form of QBiPointer, once available, to hide the bit
fiddling. We couldn't make such a change if the class continued to hold
pointers to QClassPrivate's.

Task-number: QTBUG-114793
Change-Id: Id300e4d45d6cacabe090a46cd6433c5ead3c8b0c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 416e07e0575922323b76e4e7768409b203292837)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-10 00:06:08 +00:00
Ahmad Samir
ad010d77d9 Moc: fix narrowing conversion warnings by using iterator-based for-loop
The alternative would be to explicitly cast each list.size() to int. I
think using iterators is a cleaner solution.

Drive-by changes:
- Give a std::pair's members better names than first/second, by using a
  structured binding
- Port to qsizetype

Change-Id: Icff3126192f9813fba698d5722b209307011ca48
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit c88961bcf4779933457bc8965b1281f83165a12d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-09 17:53:37 +00:00
Ahmad Samir
002e495903 ipc.qdoc: fix typo in API docs
Change-Id: Ifb999b7b96583c7ffa42b91078535b4bfa91616f
Task-number: QTBUG-2443
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4fe704eff9f5352bb7b4c011fb6b010b45485d95)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-08 22:45:00 +00:00
Christian Ehrlicher
64335e3ceb QtSql: Stylistic fixes based on the Qt 6.6 api review
Amends 12909d7c3df74b88382b727cfd3e215914f291ba and 0efd8854c4b32ec0b011efbf6b3a1990fe684e32.

Change-Id: Id7cb7377bcd1f32092330d2fc5b2fa5b83ce941f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7a732413ffbba41e365fde7aa73351f9f98bd07d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-08 20:41:51 +00:00
Axel Spoerl
b34d5dcf68 tst_QDialogButtonBox::hideAndShowButton: Wait for focus widget
Spin the event loop with QTRY_VERIFY when checking the dialog box's
focus widget, to stop flaking.

Change-Id: I24fab1264796e05645da4c12e4672daec9b06067
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 25f7d95fce7e3082f9951fc5403ac7047e62c087)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-08 19:54:30 +00:00
Thiago Macieira
cf9e5d0dd8 Remove QGenericAtomicOps
Commit c5b816393d1ea88f047ae05568786d54b5bd5f56 ("Get rid of
bootstrapped atomics", 6.5) removed the last use of them.

Change-Id: I53335f845a1345299031fffd176f52293e4b9752
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 7c25358144976d8f7b7d2b56f81782d607bb8cbf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-08 17:35:21 +00:00
Andrius Štikonas
23982baf56 QStorageInfo: Correctly decode backslash in file system labels
At the moment labels such as "one\two" are incorrectly
decoded as "one\x5ctwo".

Backslashes were originally excluded after Thiago Maciera's review,
see commit 8f1277da8c137270ff857128d8fea1423d8a7700.

Now Thiago agrees that original reasoning for excluding backslash
was incorrect and we do want to decode them.

Change-Id: I8f13fc678b40a7a9474a0171c50e3e221dfe85c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 25b4bd5841401119c90f2ac1d49b74f2415ec40f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-08 11:54:24 +00:00
Ahmad Samir
dacc75de29 QFileInfo: keep member function overloads in Qt7 too
The goal is to use overloading instead of default args that are
non-trivial.

Task-number: QTBUG-98117
Change-Id: I120befcbab2afbfe5894bfffe6a2d882d8efd250
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 71d9ebfb1f9924b81b431150c9722b683150769b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-08 11:54:24 +00:00
Safiyyah Moosa
84a5667cd8 Docs: State that OpenSSL3 is available from 5.15.1
Task-number: QTBUG-114138
Change-Id: I4d2ef35f99065e6c858044bdd07882e6315129f9
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 44fd4a3ba0814761a87b8ec69f9670020aba5db8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-08 11:54:23 +00:00
Ahmad Samir
c1ad580dca qcompilerdetection.h: check __cplusplus is defined before using it
Change-Id: I6f6daabcaf393ffa855461b4cd93863723751343
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 644bd3367c342bc55f2cd612af7c0df7b3ddc12a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-08 11:54:23 +00:00
Ahmad Samir
cb562418fb QProcess: make UnixProcessFlag an enum class
See: https://lists.qt-project.org/pipermail/development/2023-May/043804.html

Not being an enum class looks more of an oversight, in most places usage
of the enumerators was already prefixed with QProcess::UnixProcessFlag.

This is cherry picked from 22c540a66dbb849bf6b8bf49027cfaf8510ef066, but
much smaller.

Change-Id: Ie37d74e0039d3f65f90af560cb85bb11b77ae20c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 22c540a66dbb849bf6b8bf49027cfaf8510ef066)
2023-07-08 14:54:23 +03:00
Giuseppe D'Angelo
6a04d4dc9c qtpaths: generate proper JSON
The "manual" generation left a trailing comma in the object definition.
This is illegal, as per RFC 8259:

      object = begin-object [ member *( value-separator member ) ]
               end-object

Hence, the resulting JSON does not get accepted by any parser.

Let's just not do that and use QJsonDocument.

Change-Id: I882486e55f66c52d142638f37584088091bbc123
Fixes: QTBUG-115124
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 04f2acf93ad28848808822c9a8e0479509ec5555)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-08 11:54:23 +00:00
Marc Mutz
c5f650af76 QLockFile: remove unneeded tryLock_impl middle-man
It's perfectly ok to de-inline a function, even an exported one, so
remove the tryLock_impl() middle-man and pull the Qt 7 pre-programming
into the here and now.

Amends 5cea5fc80b9e1b19d620ec6be1acd5cdbd220971.

Change-Id: I7e9626a91d8ebd64e02c3784c74621950da669fb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 508629522d8c6580161a2fd9bfd2fe26f6c4c034)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-08 11:54:22 +00:00
Christian Ehrlicher
5d19dfb915 QSortFilterProxyModel test: fix failing appearsAndSort
Testcase appearsAndSort failed when running the complete testcase but
not as single test. More irritating was the fact that the error was in
QAbstractItemModelTester::headerDataChanged() but the affected test did
not change any header nor does it use the blamed model...
The reason for this is, that QAbstractProxyModel emits a queued
headerDataChanged signal when the header item count changes and
therefore only evaluated when the event loop is run.
Fix it by calling processEvents() after the rowCount change in
filterColumns().
Amends 72e802f3b0cc7a0f36fe3c445d401d38af97ca99

Change-Id: I10cb5aa9c40a6925113cc9c23616774bf15784a4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit cdc608359a54a4b286494c1563f3cd94609030c0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-08 09:01:28 +00:00
Mårten Nordheim
732b0ca949 QSslServer: include moc
Change-Id: I7849a47b50930640f1937ba34976d2465390daf9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 0e007efd7ffa5c36829316f3be8f168faa8ee8fb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-08 06:56:16 +00:00
Marc Mutz
3cc1885370 QEventLoopLocker: inline Private into public class
The Private class consists of just one quintptr member now, so it fits
into the ex-d_ptr member of the public class.

Since no allocations take place anymore, and we widened the contract
to allow for nullptr arguments, mark the constructors as noexcept.

[ChangeLog][QtCore][QEventLoopLocker] No longer allocates; all
operations are noexcept now.

Fixes: QTBUG-114793
Change-Id: I89699e331711f517d0502392dba106a47ccc9a0f
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d8a8a3a5dc035c36756c1deb1a9cfe0da9796818)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-07 18:40:14 +00:00
Kai Köhne
a81d214463 Doc: Fix license of foreignwindows example
Example source code should be LicenseRef-Qt-Commercial OR BSD-3-Clause

Change-Id: Ia9cf6f4783fde0e25f72a31bbe6d809118fd4240
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 3040eadd832b8dadaae04660047fdcd42519b0a2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-07 15:05:44 +00:00
Alexey Edelev
7c9dcaf2aa Add '_sync_headers' for interface libraries to "ALL"
Interface libraries don't build anything, commands that belong them
might not run if nothing depends on an interface library. We still need
to make sure that we run syncqt for interface libraries.
Add '_sync_headers' for interface libraries to "ALL" explictily.

Amends a8cf976ce6c82192bdf2d4b310e9ba0ea75bd0b0

Fixes: QTBUG-115101
Change-Id: I24b34574fdc3060e3a60886620dbe5c1b526f1a7
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit d22a696b6623716e0b922d833997582a5c415a19)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-07 10:55:58 +00:00
Axel Spoerl
c859532b0b Remove references to Application Example
Removing dangling references to the example due to its move to
manual tests.

Change-Id: I13f5fad93763d1ef70ddd8b3dcf430b5df8e28f9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d2db1d511ddbc4d676bcd93881e17e42edd37b84)
2023-07-07 10:55:57 +00:00
Mårten Nordheim
52de4aa86e Update public suffix list
Change-Id: Idebcc00133661263d557750abdb31f2816a4e190
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 68043e2ca92ea0c89c111329061edbe7858e1efa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-07 08:45:14 +00:00
Mårten Nordheim
6334d43fce Android[openssl]: Check existence of OpenSSL .so file before use
VCPKG by default does static builds when building for Android.
This is at odds with the bundling-concept, so it should not be done
unconditionally.

Since we don't necessarily have the WrapOpenSSL target on-hand, let's
just do a file-exists test for the one of the paths we would include.

Change-Id: I3693354308d5168d8a9c3d1659bfa51540114b7f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 20d3827ecca29f46ce147d519274942e5ca33263)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-07 08:45:03 +00:00
Ahmad Samir
05a2a4b450 Moc: port to qsizetype
Change-Id: Ibacc9b4bd6c26b890a09f689c730286c2aa0894c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2271ee6b4b5b89a5f77c4260333921bd9c3e91af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-06 21:48:15 +00:00
Ahmad Samir
9043e95ad9 QStringBuilder: fix typos in API docs
My fault, I had added that bit of the docs a while ago.

Change-Id: I1fa2c10b0f7263e12b5b2a4d18f362c702f9d831
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 5eec5a674baadc435ff879225d9a157d135cfffd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-06 18:01:24 +00:00
Alexey Edelev
92ffc0ac38 Re-enable exceptions when building syncqt
syncqt uses iostream API that 'excepts'. So enable exceptions flags
when building it.

Amends 49ce711796c2f10dfe658cc77b81db1f2d1b25f7

Change-Id: Ib0cd581eaec9ae73edc9de423019098304049463
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
(cherry picked from commit 0f5fbe369b84c422003e24322abc90a1b09520d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-06 10:49:48 +00:00
Kai Köhne
49f8f62b03 QCA docs: Call QSettings() default constructor
Change-Id: I42c68f7386226a1213f635fbcd8835491450d274
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit f5ea7dd88b13594dca886c4396e3b9ac0ca76840)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-06 09:45:56 +00:00
Kai Köhne
3d21cc29e8 Doc: Mention further uses of QCA::applicationName()
Change-Id: I47c72b30d13b8a2b3cfdad262a539a0865a3d635
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit a1b22bc16cdb48f14cbb21b0d5a4662f3692bf62)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-06 09:45:56 +00:00
Kai Köhne
9361271f11 Doc: Improve description of QT_FATAL_ environment vars
Much like QT_FATAL_WARNINGS, QT_FATAL_CRITICALS also is
interpreted as a counter. Revamp both function descriptions
to make scope and purpose clearer.

Also, mention logging rules as a way to surpress output,
in addition to a custom message hander.

Change-Id: I44767abb067a6accd81f13dc549c9787ef9a4729
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 62e3fa28d7610b5b1b5b5b9c3f67423549a3aec6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-06 09:45:55 +00:00
Marc Mutz
0188af38b1 QLogging: add qYieldCpu() to CAS loop
CAS failures should result in PAUSE/YIELD, cf. qYieldCpu() docs.

qYieldCpu() is only available since Qt 6.3, though, so adding it as a
follow-up with limited pick-to.

Task-number: QTBUG-115062
Change-Id: Ibcc73881875a47935940015e30b9a27a282054d4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 06d520dbef21f5debe9f092c63d2aa9b02afb4c3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-06 09:45:55 +00:00
Marc Mutz
c9fe146401 Make sure we don't count down past 0 QT_FATAL_CRITICALS
The old code first checked for == 0, then, if false, executed a
fetchAndAdd(-1), both with relaxed memory ordering. This can lead to
executions that, counter to what the code comment states, can count
down past 0:

    // T1                   T2
    loadRelaxed()                                  // true
                            loadRelaxed()          // true
    fetchAndAddRelaxed(-1)                         // e.g. 1 → 0
                            fetchAndAddRelaxed(-1) // 0 → -1

while fatality is detected exactly once, this execution doesn't stop
at 0 and causes further calls to isFatal() to count down further, with
the (very) remote spectre of underflow past INT_MIN.

Fix by using a CAS loop instead, so each count-down uses only one
step, not two, which therefore can no longer interleave.

Fixes: QTBUG-115062
Change-Id: If77b906c94cb4b9fa91bfad84fe63bc8d9103b0a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit b933a5668cc5647d26378f8a9a52901d0497585d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-06 09:45:55 +00:00
Axel Spoerl
63428b1f1f QDialogButtonBox - Update focus chain when buttons show or hide
Hiding a button in a QDialogButtonBox doesn't remove its default and
focus behavior. Hiding the button shown in the first position, breaks
the focus chain. Tabbing between the button is no longer possible.

This patch implements listening to the buttons' HideToParent and
ShowToParent events. Hidden buttons are removed from the button box
and kept in a separate hash. That ensures focus chain consistency.
When they are shown again, they are added to the button logic and
their default/focus behavior is restored.

An autotest is added in tst_QDialogButtonBox.

Fixes: QTBUG-114377
Change-Id: Id10c4675f43d6007206e41c694688c4f0a34ee52
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit bbb71e7e80f292c2e69faef81b1624832981147e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-06 09:45:55 +00:00
Thiago Macieira
2e70ca4847 qC{Debug,Info,Warning,Critical}: move the function call to the macro
The change in commit 04ee5795cc31ee81fb0c27bf55d9e8f662995753 was
source-incompatible if the function in question was a non-static member.
I could add a new, template constructor to catch those, but this is
simpler.

Fixes: QTBUG-115043
Change-Id: I53335f845a1345299031fffd176f1071afbae7a9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ef9fe7a99a9a6779e7133167fe84426bfe9cc371)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-06 09:45:55 +00:00
Ahmad Samir
bccb6c13f0 QXmlStream: fix generating ERROR enum value
It was changed from ERROR to XML_ERROR to disambiguate static variables
in d3f8d7fd4140b269532e2daca8eb5cbfe28ed465. Make the change in
qxmlstream.g, so that generating the C++ code doesn't revert it.

Change-Id: Ie51955a2b013ce8d9580ce64f708598f9a103754
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit a982b67538155500269418b9fec81f19ff019510)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-06 03:28:41 +00:00
Ahmad Samir
eea8c04e6f QXmlStreamReader: use std::optional
The optional-like FastScanNameResult was used to make some previous
changes backport-able to Qt 5.15 (std::optional is C++17 whereas Qt 5.15
requires C++14).

Amends commit 6326bec46a618c72feba4a2bb994c4d475050aed.

Change-Id: I409e1da83f82927c1eb24c47c1414c0c7ab1bf5b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit effb3bddf63eb6c53d81ce6b0a30be6e3e80e189)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-06 03:28:36 +00:00
Marc Mutz
a3a5d805c9 QOpenGLFunctions: fix -Wunused-private-field (Clang 15)
I see this with -unity-build -unity-build-batch-size 32, but I don't
know whether it's unity-build or just Clang 15, so also pick to
6.2. The issue exists in 5.15, too, presumably, but I have no desire
to find a non-C++17 fix.

It appears the generator (glgen) is out-of-sync with the state of its
supposed output as of at least 18aae36a90c0753f1b1e615ba8437d8ebd1bd2fb,
so don't try to update the generator (I failed to find where these
fields originate from, anyway).

Task-number: QTBUG-115031
Change-Id: Ia27620b8f8034c3e8eff383abb849e6ce93dce8a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4443d392e4f234a5315cfd773559af936cb62ddb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-06 00:10:56 +00:00
Axel Spoerl
2461783ae9 QIbaseResult: null parameter follow up fix
a7deddba519fc1f6fd637496e92ca5daccf6d453 implemented a warning for
disallowed null parameters. A check, was missing, if the argument is
actually null.

This patch adds the missing check.

Fixes: QTBUG-114683
Change-Id: Iecbd636599a28284a0a9afe2987e48552f3658ff
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit 634ef449bffad3e97a7141ca6c2df0795407b9fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-05 21:37:23 +00:00
Marc Mutz
90d96766af QEventLoopLocker: defend against nullptr arguments
The class would previosuly produce a crash when the QEventLoop* or the
QThread* were nullptr or if no QCoreApplication existed. We want,
however, the out-of-line constructors of the class to be noexcept, and
for that, they should neither allocation nor have preconditions. The
former is for another patch; this patch deals with the latter.

[ChangeLog][QtCore][QEventLoopLocker] Is now a no-op on nullptr
QEventLoop*, QThread*, QCoreApplication::instance() (was: crash).

Task-number: QTBUG-114793
Change-Id: I4246f74008df6ad7fcbfde56403397b065fbe861
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 3748b194d4de790540aa74db8d65b602e097f415)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-05 23:37:23 +02:00
Marc Mutz
acaf9b0d2c QEventLoopLocker: use visit() to DRY ctors
Collapse all three Private ctors into one (void*, Type) one.

Task-number: QTBUG-114793
Change-Id: Ia5c67c0ffdcddfdecb38fe3e095d60f6761f1160
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit d18a9dd977a59bf735ed3b6a19e101d4b26a1cef)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-05 23:37:23 +02:00
Marc Mutz
74571f3455 QEventLoopLocker: add a visit() member
Still suffers from a bit of an impedance mismatch, because it's the
first step in making QEventLoopLocker shed its Private, but will be
used in a subsequent commit to DRY more code.

Task-number: QTBUG-114793
Change-Id: Ia14effb6255961edae68eaf941fece9dca0cb844
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8c2c4f178a1722fc8c749ca6ee894df151808138)
2023-07-05 23:37:22 +02:00
Amanda Hamblin-Trué
9c7b9f9f58 QtTest: fix documention wording and typo
Change-Id: I71c38e40db9ff222016ed24a43f646ceef749180
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 9de8e7532b52a0a98bfb319d045ee03874dc09c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-05 16:55:27 +00:00
Alexandru Croitor
6f5132cf83 CMake: Add missing check for tool target promotion
We shouldn't try to promote tool targets if they were not created
when Qt6FooTools_FOUND is FALSE due to missing dependencies and
Qt6FooToolsTargets.cmake is not included.

Add a check for Qt6FooTools_FOUND to prevent errors like:

 CMake Error at lib/cmake/Qt6/QtPublicTargetHelpers.cmake:257
 (get_property):
  get_property could not find TARGET Qt6::qtprotobufgen.  Perhaps it
  has not yet been created.

Change-Id: Ie26db637d4d8ef682a0ada5ea36ef0e8ceced008
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 3f6041a24fe9b663e6a00481a30e84b2cd15763c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-05 15:08:18 +00:00
Safiyyah Moosa
f50d13389d Doc: State that Qt5.15 is compatible with OpenSSL3
Task-number: QTBUG-114138
Change-Id: Ida224255d4aac323cb4bebeb7825a07bb55fc041
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit d2a73883ae110c423dce126d15c2b1c0df1b51a3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-05 15:08:18 +00:00
Marc Mutz
4ea9f75b11 QLogging: DRY isFatal(QtMsgType)
Extract Method on the count-down algorithm of fatalCriticals and
fatalWarnings, so we don't have the repeat the calculation and the
comment.

Task-number: QTBUG-115062
Change-Id: I4bcbc2f5a21b999e7f301085581677b437a889e9
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 3ffc1f9775cde1369ebdfcfa91ec18c393c24260)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-05 11:03:56 +00:00
Laszlo Agocs
747ceb8515 rhi: metal: Fix external MTLDevice import
Fixes: QTBUG-115002
Change-Id: I57c12685f8451420c30c65a1a25064607b52e31c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit e090853ad598aa4f39304d69ec29b80fc3fceb62)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-05 09:25:56 +00:00
Mårten Nordheim
32f93394ef CMake: Don't use VCPKG_DEFAULT_TRIPLET for triplet deduction
This environment variable is used by vcpkg to avoid having to pass
the --triplet argument on the command line on every vcpkg invocation
and shouldn't influence the triplet used during build. In fact,
the vcpkg.cmake toolchain will automatically attempt to deduce the
target triplet if we don't define this beforehand.

As a replacement, read from the QT_VCPKG_TARGET_TRIPLET environment
variable. It has the QT_ prefix to make it clear this is not a
standard vcpkg environment variable.

[ChangeLog][Build System] Qt no longer uses the VCPKG_DEFAULT_TRIPLET
environment variable to deduce target triplet. By default we let
vcpkg's toolchain file automatically deduce the triplet to use.
The new QT_VCPKG_TARGET_TRIPLET environment variable can be used
instead, or pass -DVCPKG_TARGET_TRIPLET=<triplet> to CMake.

Change-Id: Idc6cbd52a68578d1762ca175c4973355409688ac
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit ee736717d35d10d15e05a8b93255088889f3a9ce)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-05 08:43:05 +00:00
Volker Hilsheimer
f00f557ee6 QVariant: always compare floating point with double precision
When Qt is configured with `-qreal float`, then we should still compare
QVariants containing floating point values with the full precision of
the stored type, and not cast to qreal (ie. float).

Cast all floating point types up to double, which is the highest-
precision floating point type we support in Qt. This might have a small
performance impact when compiling with `-qreal float`, if the FPU does
not perform well with double-precision floating point values.

We don't test any `-qreal float` configurations in CI, so not adding
a unit test for this.

Fixes: QTBUG-114991
Change-Id: I198ec2c39913b501ef2fe99ae3048b160baa1fd8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 1fe60cbcc3c476f5f4bc4bce49d4e73d99c49d3d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-05 06:53:15 +00:00
Marc Mutz
4ba4723d57 QTabBar: share verticalTabs(Shape) with QStyleSheetStyle
... unbreaking -unity-build-batch-size 103.

As a drive-by, make the shared function constexpr and noexcept.

Task-number: QTBUG-115031
Change-Id: I2bf30a280eccd896a5aa7de92c72aab30e797640
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 19bfe3e0b111827d6afc9e3602839f3dd0ad37dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 23:26:17 +00:00
Marc Mutz
9cded930f0 QWidgetTextControl: share setActionIcon() with QLineEdit
... unbreaking -unity-build-batch-size 103.

Task-number: QTBUG-115031
Change-Id: I004163000a422b05ee0c882f065286c043d58206
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5f9ab113e32fb6ba81eab58acd9f99186af80534)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 23:26:16 +00:00
Marc Mutz
d0a9b93324 QFusionStyle: rename dock_widget_close_xpm to avoid clash with qcommonstylepixmaps_p.h
They're different XPMs, so we can't share them.

Detected by -unity-build-batch-size 103.

Task-number: QTBUG-115031
Change-Id: Ifa5ce59df10883f95582aefe37e413db2e5a13f1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 199a339f38ca2feda6cd1a52e895fabfc56097ed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 23:26:10 +00:00
Allan Sandfeld Jensen
78a45e4a65 Make while iterations over height safer
Changing the repeating pattern to one that can survive negative numbers,
even if most places it isn't possible.

Fixes: QTBUG-115003
Change-Id: I636e246b00a9dda65c147dff3e1f1d1a748d1879
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 7c6be5e884db0be343fe767683c6b0a8c194ce45)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 23:26:06 +00:00
Axel Spoerl
dcef040b9d QIbaseResult: qWarning, when disallowed null parameter becomes zero
QIbaseResult turns null into zero when database field doesn't
accept a null argument.

This patch adds a warning in that case. It would be better to return
with an error, but that breaks existing behavior with code relying on
it.

Fixes: QTBUG-114683
Change-Id: Ib50b7b6b4dd6c51489ba8b355f7baa8b1b14dc15
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit a7deddba519fc1f6fd637496e92ca5daccf6d453)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 22:58:44 +00:00
Axel Spoerl
c1f6fbdd4e QHeaderView: Don't add new sections on no-op
When a table view adds its first row, QHeaderView::initializeSections()
is called. It initializes the vertical header view with the number of
added sections. Subsequently QHeaderView::sectionsInserted() is called
with the same amount of newly added rows/sections.
That leads to the initial amount of sections being 2x the number of
rows added in the first go. In other words, the table view will display
at least one row more than the underlying table model has.

This patch adds an OR condition to the early return check at the
beginning of QHeaderView::sectionsInserted(). The method returns early
if the number of sections equals the number of respective sections
(rows in this case) in the model.

An autotest is added in tst_QTableView::rowsInVerticalHeader().

Fixes: QTBUG-114225
Change-Id: I895444f025591981965562e54e2335391db52357
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 2a1772a6499d440b9ee2435a5f0c22d93b9d8897)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 20:52:16 +00:00
Axel Spoerl
0a981bd9db Implement QWidgetPrivate::focusObject()
QWidgetPrivate::focusObject() always returns nullptr. That has lead to
mismatches between QGuiApplication::focusObject() and
QApplication::focusWidget(), when a widget got focus by the window
system (e.g. mouse click).

This patch implements QWidgetPrivate::focusObject.
It returns the current widget, if it doesn't have a focus proxy.
If it has a focus proxy, it resolves the proxy chain and returns the
deepest focus proxy.
(Note: It does not return QWidget::focusWidget(), because the focus
widget might not yet have been set, when the method is called).

Fixes: QTBUG-92464
Fixes: QTBUG-108522
Done-With: Liang Qi <liang.qi@qt.io>
Change-Id: Icf01e8ac4fc5f722fbf8e0ca5a562617ae9ae8f2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit f83ea896227dfb37281ca18cdebbd072df3b1da7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 20:52:16 +00:00
Marc Mutz
ce7725cf85 QtNetwork: replace clashing statics with lambdas II: isSeparator
Detected with -unity-build-batch-size 103.

Here, we just replace one of the static functions with a lambda,
because the transformed function was far away from the use site while
the unchanged instances (in qhsts.cpp) had several brethren isFoo()
functions and the use was close to the definition.

Task-number: QTBUG-115031
Change-Id: Ib84a64cd8b9f20cad7806659990df76552c0c5e4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 586e07785ce276547d30502a8a44b212d37b95c7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 18:30:52 +00:00
Marc Mutz
95c8d2914a QtNetwork: replace clashing statics with lambdas I: downloadBufferDeleter
Detected with -unity-build-batch-size 103.

Task-number: QTBUG-115031
Change-Id: Ia67082efbdb3f403a8c8010ec15f9f796f97feb6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 5b7c8eb9849855fac16d91c47803d0ef16a8e9a8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 18:30:52 +00:00
Volker Hilsheimer
26623b9d09 Android: Downgrade OpenSSL configure error to warning
Amend 9d5a8162a5a168972c7aaf39b130da6a72dc13e2, after which building Qt
for Android locally required an OPENSSL_ROOT_DIR variable to be set.
Instead of making it harder for everyone to build Qt for Android (even
if no intention to work on or test network code locally), downgrade the
fatal error to a warning.

Change-Id: I6f2176a40663cc9f55aa3066af78499af1f20894
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit b3608700f92fb0f4362371a401ec7f3a774fde37)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 18:30:51 +00:00
Marc Mutz
3d70617c71 QEventLoopLockerPrivate: store the tag in the pointer variable
There's enough space in the LSB of the three pointers to encode the
type.

Saves sizeof(void*) in the Private class, but, more importantly, paves
the way for the next patch to get rid of the Private class and its
memory allocation altogether, turning QEventLoopLocker::d_ptr into
what this patch still calls QEventLoopLockerPrivate::p.

Neither QTaggedPointer nor QML's QBiPointer apply here. QTaggedPointer
only supports a single T, plus flags; QBiPointer supports only two Ts,
and one flag; we need three Ts and no flags. This could be a

    QVariantPointer<QEventLoopPrivate, QCoreApplicationPriivate*, QThreadPrivate*>

I'm thinking about it; just would want to find a second use-case for it.

Task-number: QTBUG-114793
Change-Id: I0e21bd8745cc75a9c04b71343c398ad953283857
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit c70257e9b22226f52caade22b085fb6508fb1ec1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 18:30:51 +00:00
Marc Mutz
8b1f858f65 Unity-build: exclude qrandom.cpp (#undef's Q_ASSERT/_X())
qrandom.cpp #undef's Q_ASSERT/_X(), breaking TUs that happen to use it
after qrandom.cpp has processed.

Exclude it.

Fixes: QTBUG-115031
Change-Id: Ie419f4ed2323f9c9e91f4dceaf8fecc097673d0e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 093a0b4f6ee8f31b059ae83e5526d0da037dbd8e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 18:30:51 +00:00
Alexey Edelev
8527913a0c Fix handling of QT_PATH_ANDROID_ABI_xxxx in android multi-abi tests
Fix 'IN_LISTS' typo, should be IN LISTS.

Change-Id: Ia0bd1bf45922b2c9c1779e03b40dad6eab97eef1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f0ae4b07ebb3c86a6bc6ca0e375c06cd51f45324)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 18:30:51 +00:00
Marc Mutz
fd1be66d16 Unity-build: exclude qdebug.cpp (#undef's qDebug())
Like qlogging.cpp, qdebug.cpp also #undef's qDebug, breaking TUs that
happen to use it after qdebug.cpp has processed.

Exclude it.

In CMakeLists.txt, also mention qlogging.cpp undef's qInfo() and
qDebug(), too.

Task-number: QTBUG-115031
Change-Id: I4c910f051f1578f27cac8e5e6b358e7ee2eeb97e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b8dd99a1b2bc02abd2f0c48c38b336b58d3e0721)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 18:30:51 +00:00
Alexey Edelev
583065c533 Install the missing deprecated header files
Deprecated Qt header files generated by syncqt were missing in
installation package of Qt, after migration to cpp based syncqt.
Restore them.

Note: we didn't receive bugs since 6.5 release so far. I would check
the existing files and remove them completely in 6.7. See QTBUG-115029.

Fixes: QTBUG-112956
Change-Id: I2e5375ee0dbd87a76135594cd489bb67f6d3456d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 97268742e4869875cb98a1a9fc7884d16d7e7e69)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 18:30:50 +00:00
Marc Mutz
eb1cec404e QEventLoopLocker: unexport
Non-polymorphic classes should not be exported wholesale. Luckily, in
this case, all SMFs are either out-of-line or (implicitly or
explicitly) deleted, so we don't need to wait for Qt 7 to do the
change.

This is a prerequisite of adding move semantics to the class, as well
as some other optimizations that require non-exported functions.

As a drive-by, collapse ctor declarations into single lines, because a
follow-up patch will need to touch the original lines, anyway, to add
noexcept, so there's no point in keeping separate lines to optimize
the API review diffs.

Task-number: QTBUG-114793
Change-Id: Iccfcc11d37aa9274e48345a1e01e0f827e465644
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 97adda8675dcc9ca380a43d49b6c59fcea734090)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 18:30:50 +00:00
Ievgenii Meshcheriakov
3bbdd022a7 Fix invalid closing XML tag
Change-Id: I1785fe855f69d7dc7d043b235ed4f3b99a6057fc
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 77a4ff4036330ea445b0dab8132cf143533106a7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 18:30:50 +00:00
Morten Sørvig
8cf16c6f50 wasm: add "preload" qtloader config property
Add support for downloading files from the web server
to the in-memory file system at application load time.

See included documentation for usage.

This preload functionality is different from Emscripten's
--preload-file and --embed-file in that the files are
not packed to a single data file or embedded in the
JavaScript runtime. Instead, the files are downloaded
individually from the web server, which means that they
can be cached individually, and also updated individually
without rebuilding the application.

Any file type can be preloaded. The primary use case
(at the moment) is preloading Qt plugins and QML imports.

Task-number: QTBUG-63925
Change-Id: I2b71b0d6a2c12ecd3ec58e319c679cd3f6b16631
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 64007c749703090ebf7f9b1b49b4267bb9993b99)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 18:30:50 +00:00
Morten Sørvig
a825cd1a3f wasm: add preload config for shared libraries build
Preload Qt plugins and QML imports by default. The json
files contain file listings generated by scripts in
qtbase/util/wasm/preload.

Task-number: QTBUG-63925
Change-Id: I123b7a46fa19fa75ef214e8edb92e15ef635e5ba
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 7620c7b26ec19e902592baf7f7c4185392c2b15d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 18:30:50 +00:00
Inho Lee
11456b4d56 QXkbCommon::isLatin1 : Add a lower bound of Latin1
The range of the Latin1 key is from 0x20 to 0xff
in both xkb_keysym and Qt::Key.

Task-number: QTBUG-113387
Task-number: QTBUG-74479
Change-Id: I2eaba3129bead9526910f716c211f637804ab592
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 1652687d34d8e663c53c456b45cf0040570d870d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 18:30:49 +00:00
Morten Sørvig
cd16e289f6 wasm: add "qtdir" qtloader config property
This points to the location where qtloader should find
the Qt installation when loading Qt shared libraries
and plugins.

The path is relative to the path of the html file which
contains the application, and is set to "qt" by default.

Deployment of the Qt installation to the web server is
left to the app developer, since this depends on the
exact use case. One possible way to deploy is to create
a "qt" symlink to the Qt installation, for instance:

  html/myapp/myapp.html
  html/myapp/myapp.wasm
  html/myapp/qt -> /path/to/qt

Task-number: QTBUG-63925
Change-Id: I76b129dffc75c06ff6bc67d8c20ce12557b32f31
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit d659c93068120474fb433ad55c619c5d52ab7d8d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 18:30:49 +00:00
Eirik Aavitsland
cb3416696f Update bundled libpng to version 1.6.40
[ChangeLog][Third-Party Code] libpng was updated to version 1.6.40

Change-Id: Id10d61fc4c3b8cccdcca9042097d4dc470aa0067
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 8aa0d71d06fc1673d90bddecc15c8c7917a39c32)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 18:30:49 +00:00
Morten Sørvig
f9b5440292 wasm: introduce virtual processPostedEvents()
Don't re-use processEvents() for the case where we
get a callback from the native event loop and want
to send events. This makes it clearer that these are
two different cases.

Align with the Core Foundation event dispatcher where
processPostedEvents() is virtual and is overridden
by the Gui event dispatcher to send window system events.

Change-Id: I3ea9c55c1d9c03195c1937c4dcc0e5b689e15448
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 3f8f79ddafc68e2a3e1bdf59355e9a4958f46d12)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 18:30:49 +00:00
Amir Masoud Abdol
f4cc885f8c CMake: Avoid creating empty directories when installing Find*.cmake
Surprisingly, CMake copy/install empty directories when `file` or
`install` are used with `FILES_MATCHING PATTERN` argument.
In order to avoid this, we can exclude the empty directories using a
PATTERN EXCLUDE argument.

Change-Id: I17a22f9b9e317bc4a66cee3df39815659ddb4c04
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 86e0c111fd0b9a2c2becb4e37199e9091e883fde)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 13:40:00 +00:00
Mårten Nordheim
7bdef9c75a QMetaType[docs]: fix 'constructor' typo
Change-Id: I7dedf635b9a5e85f6af49bf0a5e0348dde32e80d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit af9c02234b946c70c35af7fa9dc864323a108fb1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 13:17:48 +00:00
Liang Qi
77a1c96be9 tests: blacklist tst_QAbstractItemView::selectionAutoScrolling() on Wayland
because it's flaky in current CI setup.

Task-number: QTBUG-109776
Change-Id: I3e432e632622f47b8125344187daf238a03a7372
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 8b98c0a4c21e16da2da1499bfc67396cb6924e56)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-04 06:00:52 +00:00
Alexey Edelev
05a2de3ce9 Remove redundant qt_no_master_include from deprecated headers
qt_no_master_include is not used  in the deprecated headers since
are generated by syncqt, are never scanned and master include logic
is controlled by syncqt.

Change-Id: If6f737938abe67349c8f88387ccb5efdb95afabd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit afc8260359191b5e5b2f2c0a124e2094c01f7e1a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-03 23:59:42 +00:00
Marc Mutz
433e5223d6 QCoreApplication: mark instance() as noexcept
QEventLoopLocker's own noexcept depends on this.

Task-number: QTBUG-114793
Change-Id: If1ba3aaa2f0bbb6334d52dd44db84d138890f4bb
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit bd40a67aab5f843295c043ac164bd931cf107d15)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-03 23:59:42 +00:00
Volker Hilsheimer
d117cd5f3a QPixmapCache: ignore insertion or searches with empty key
When a key for a pixmap cannot be generated, then the only meaningful
way to indicate that failure is to return an empty string. Instead of
plastering checks for the generated key being empty all over our styling
code, reject attempts to insert a pixmap with an empty key string in the
QPixmapCache, and fail to find immediately. Such a key makes no sense
either way.

[ChangeLog][Gui][QPixmapCache] Trying to insert or find a pixmap with
an empty key string now always fails immediately.

Task-number: QTBUG-114473
Change-Id: I15bf8064ac7a4fe715722d98f2df2b8608809c7f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 79abdd3cd496b472f0a6140fcf94e68ff79fda2b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-03 20:54:58 +00:00
Amir Masoud Abdol
5cf68eb150 Unity Build: Resolve a variable redefinition error
The `qvk_sampleCounts` variable is defined in `qrhivulkan.cpp` as well.
This causes an issue when building with unity build. To resolve the
problem, I renamed the variable in `qvulkanwindow.cpp`.

Fixes: QTBUG-114918
Change-Id: I0b38c6b3e30792dd6f770d4dea8cb4c7789961d1
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit c90cc8c900b81eb75ba443e2be7a01d4a946fe70)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-03 20:24:02 +00:00
Marc Mutz
95fa5e33d0 QEvent: add strategic [[maybe_unused]] to Q_IMPL_EVENT_COMMON
Apparently, in unity-builds Q_ASSERT does not always compile its
argument, so I'm getting -Werror,-Wunused-variable on Clang 15.

Fix by adding [[maybe_unused]].

Amends da0f72ebb817bb9c92c7a183b281d8a4bf31a135.

Change-Id: I2de810aded1226ce4e5651de8c2e9464de3f274f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f71f0312d66c4e937c7ce13972617c393e96cabb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-03 20:24:00 +00:00
Morten Sørvig
0b1fdf1185 wasm: add shared library preload scripts
Add scripts which generates Qt plugins and QML imports
preload lists, for use with the "preload" functionality
form qtloader.js.

The preload lists downlad plugins and imports from $QTDIR/
to /qt/ at application load time, where $QTDIR is configurable
using the qt.qtdir qtloader configuration property (set
to "qt" by default).

Sample directory structure:
  app.html
  app.js
  qtloader.js
  qt_plugins.json     [generated]
  qt_qml_imports.json [generated]
  qt -> /path/to/qt   [symlink]

The json files are generated by the scripts in this commit.
app.html configures qtloader.js to use the json files
as preload lists, which instructs it to preload from
"qt", which again is a symlink to or a copy of the Qt
installation.

Task-number: QTBUG-63925
Change-Id: I53bd197f22057dbb70e9a9bee43b9d9b969aa072
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit be7b748b7e049a4e42611f3e5f920a568348ff15)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-03 19:30:37 +00:00
BogDan Vatra
6a2956172b 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
Change-Id: I574bf325300c0aedef68b1b183fa837144ad63c6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 76619eae4c4e857721529c87eb3c9d519fa2f0b7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-03 16:19:18 +00:00
Morten Sørvig
ee72e23897 wasm: don't use on qGlobalPostedEventsCount()
There is no guarantee that it will return 0 after one call
to sendPostedEvents(), since more events may have been
posted during that call. This can in turn cause infinite
looping since the wait() isn't called.

Move sendPostedEvents to the top of processEvents()
to make sure we send events before waiting, in line
with the implementation for the other event dispatchers.

Fixes: QTBUG-112893
Change-Id: Iba7d87cf1c08cd302884782cb135d758afeb9e4b
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 9c9aca3b4393a1f1c8169c7b811e46ec5de25df9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-03 08:19:01 +00:00
Safiyyah Moosa
390b2b773e Docs: Add link to OPenGL examples to OpenGL index
Task-number: QTBUG-112824
Change-Id: Ib507e8c32518442fd211f3486c4317b4907ea414
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit efc6b9946bdedda0618bc6f4c8efbe2f8fdb9193)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-03 08:19:01 +00:00
Tor Arne Vestbø
4fa8095ad4 macOS: Respect QDir::Hidden for native file dialogs
The default for showsHiddenFiles is NO, so we were not showing hidden
files unless the user toggled them via the keyboard shortcut.

Change-Id: I796144452cf8f5a6cc46f1ba6747affcd0a35879
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit bc648641209ff598687ae9bcf88cd40d8aaf8847)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-03 08:19:01 +00:00
Tor Arne Vestbø
dd4a42e86f macOS: Avoid triggering TCC permission dialogs in file dialogs
In our NSOpenSavePanelDelegate we respond to panel:shouldEnableURL: by
checking the file dialog's filter options. As part of this, we pulled
out the file's attributes using [NSFileManager attributesOfItemAtPath:],
but this API triggers the TCC (Transparency, Consent, and Control)
machinery to ask the user for permission to access the path in question.

We could replace the directory check with fileExistsAtPath:isDirectory:,
but this would still leave the checks for writable/readable/executable.

Luckily for us, the plumbing for QFileInfo uses lower level CoreFoundation
APIs that don't have these issues (except for isBundle, which we should
fix separately).

This also means we can remove the custom isHiddenFileAtURL helper, as
it was based on the same kCFURLIsHiddenKey as the QFileInfo plumbing.

Fixes: QTBUG-114919
Change-Id: I9ebefaeb1ef7bcc5bb9a1c5cd4b993ce230cf506
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 90345459fce8ae9ca58ca2279ea50129ad14e287)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-03 08:19:00 +00:00
Tor Arne Vestbø
83172f759a macOS: Enable dirs in file dialogs, also when treating bundles as dirs
In our NSOpenSavePanelDelegate we respond to panel:shouldEnableURL:
with YES if it's a directory or symlink to a directory, which matches
the native behavior.

But the panel has a special flag to treat bundles as directories instead
of files. We were checking this flag, but ignoring the case where it
was actually set (which it normally is not), and as a result would
go on to filter directory names as well.

We now handle both cases, and only call [NSWorkspace isFilePackageAtPath:]
if needed (when the treatsFilePackagesAsDirectories flag is not set).

Change-Id: I2b9a16ff99b4b643389acc042c032813f432ac59
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8fbce6b4a04ba9712e45340afc9b52fe2966f125)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-03 08:19:00 +00:00
Volker Hilsheimer
4df0132adc Silence compiler warning about unreachable code
The warning has been reported by users, but never observed in CI, even
though the only path that can lead to the last return statement becoming
unreachable is very common in Qt: if a QDebug stream operator exists,
then we always return early.

Nevertheless, rewrite the code to have a single return statement.

Task-number: QTBUG-112371
Fixes: QTBUG-114944
Change-Id: Iaf9ec683ceceedb00771fb0743a09dcc8f50ba3f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Pavel Dubsky <pavel.dubsky@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
(cherry picked from commit cf5da333672516921eddb4b3ba020d39b0a169d6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-03 08:19:00 +00:00
Shawn Rutledge
bc2ba337dc xcb: Use QWSI::handleTabletEnterLeaveProximityEvent(.. QPointingDev* ..)
We want to pass the QPointingDevice* because we've already identified
it by its "system ID" (xinput device number). The other versions of
handleTabletEnterProximityEvent and handleTabletLeaveProximityEvent
try to identify the stylus by only its deviceType, pointerType and
unique ID, which can go wrong if there are multiple tablet devices and
the unique ID is not provided (as with N-trig and Wacom tablets being
used at the same time). Anyway this fixes a TODO comment from
6589f2ed0cf78c9b8a5bdffcdc458dc40a974c60

Leave a "deprecated" comment by the QWSI functions that should not
be used.

Task-number: QTBUG-104878
Change-Id: Id9f19c60b54b7900b02d5f87b5d12f9a9189721d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1a49eae776f1c40b5e22f668e30107ccbde0238b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-03 06:00:14 +00:00
Shawn Rutledge
745e7583d0 Show decimal device IDs in QInputDevice qDebug output
The lack of 0x adornment made hex confusing. `xinput list` shows device
IDs as decimal, and device IDs appear in decimal in some categorized
qt.qpa.input.devices log messages, so let's be consistent here too.
Also fixed one more that was inconsistent in that category:
"scroll event from unregistered device <x>"

Change-Id: I98a39b30b1bc030611d3cfe9dd5e95886faf48ff
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit a6059cebe85c4ba8dd43df8aae146799c8bb6cb0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-03 06:00:00 +00:00
Shawn Rutledge
e938a4a100 xcb: Don't clear touch or tablet devices due to device hierarchy event
When QXcbConnection::xi2SetupDevices() reacts to a device hierarchy
event and re-discovers an already-known slave device, it doesn't call
xi2SetupSlavePointerDevice() again. I.e. it won't attempt to add it to
m_touchDevices or m_tabletData because it was already known. So it
should not clear m_touchDevices or m_tabletData either, but only remove
the touch devices that are known to have disappeared. Tablet styli
normally come and go from proximity, so it's ok to avoid deleting the
corresponding device data.

Also fix some other failure cases after testing hotplugging more with
tests/manual/inputdevices: there should be no crashes, no duplicated
devices after plugging (although the QAIM might have a bug that makes
it look that way), no leftover instances after unplugging.

Amends 2a9d93efc68324ce5e41831ea46a3945f1c4531d

Fixes: QTBUG-114334
Change-Id: I30f5e532f7dd3a465d56ecdd34d893cbadbf0453
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a8a75d2c4b0f50f4029aac76d09657d8bbab1295)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-03 05:59:50 +00:00
Jøger Hansegård
3af876d53b Fix crash in QVariant::convert and QVariant::view
`QVariant::convert` may lead to crash or produce garbage data when
attempting to convert a gadget between a pointer type and a value type,
for example from a variant holding a QLocale gadget to a QLocale*
pointer and vice versa. Similarly, `QVariant::view` may crash under the
same conditions.

The reason is that conversion is implemented through copy construction
assuming that both source and target types are either both pointers or
both values. If converting from pointer to value type, the result is
crash during destruction of the QVariant. If converting from value to
pointer type, the result is a QVariant holding a pointer to garbage
data (and possibly crash if pointer is dereferenced).

Similarly, if attempting to convert a pointer to a QObject derived type
to its value type, the system crashes, with a slightly different failure
mode. During `QVariant::convert`, a temporary `QVariant` of the target
type is created. Since objects that can not be copy constructed are
invalid for `QVariant`, the temporary is left empty without constructing
the target value. Then, when attempting to convert from a pointer type
to a value type, the temporary's destructor is incorrectly called on the
owned object. Since the owned object is never constructed, this leads to
a crash.

The proposed fix is to return false from `QMetaType::view`,
`QMetaType::canView`, `QMetaType::convert`, and `QMetaType::canConvert`
if the target type is of different 'pointedness' than the source type.

After this fix, converting and viewing gadgets and QObjects behaves the
same way as primitive types and core types, which already returned false
when converting between value type and pointer type.

Fixes: QTBUG-114797
Change-Id: If5ad764a60f2f3c912070198073b28999d995f17
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a8792feaaaeefbaba6c7a35468d6d5a166abf8f9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-07-03 05:59:29 +00:00
Tor Arne Vestbø
13beed1569 Move simple dom model example to manual test
Change-Id: I33120e3f6217ea52bdfdebea8b5faa79d9d3fd68
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8937169c190246ebc85df242f85b3bda911bc5c6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-30 14:07:56 +00:00
Tor Arne Vestbø
05def66af0 Move pixelator example to manual test
Change-Id: I3ce2bc269a9f77bce3dd41f0127d01091c1408f6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 921337f98c54d3c4a252569acd2152a1dea8c4bb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-30 14:07:56 +00:00
Tor Arne Vestbø
3cfaab940f Move plug and paint example to manual test
Change-Id: Ibfd870f2f879d6ae68cd6806b0c1ab02da0a3441
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9c71b924304c2d1bd3ac3e13263b47131478562c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-30 14:07:55 +00:00
Alexey Edelev
a869f448e9 Evaluate the QT_ANDROID_DEPLOYMENT_SETTINGS_FILE property
Make sure that QT_ANDROID_DEPLOYMENT_SETTINGS_FILE is expanded
correctly and completely when using it in custom commands.

Task-number: QTBUG-114888
Change-Id: I87c9cb052ea6afedd129fec0a1c415ad38e8eeb5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 0be35f3a7bb97bacf7ddd47729f2f97dcf750b80)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-30 14:07:55 +00:00
Alexey Edelev
8bd5865f76 Fix syncqt compiler and linker flags handling
We want syncqt to be built optimized by default. The current approach
set the default build type for the external projects and optimized
flags for the non-configure-time syncqt build. The problem is that
syncqt still have compiler flags littered by either the Qt configuration
type or the system defaults that are applicable for RelWithDebugInfo
configuration(the default one we chose for syncqt).

This patch makes sure that we cleanup all compiler flags from any
optimizations and apply optimized flags for all configurations. Also
we discard '/RTC1' flag if it's set. Configure time executables now
respect the language related flags that are set in the project and
adjust the flags passed to try_compile.

For linker flags we should use those that are applicable for the
preferred build type. Since syncqt is built in RelWithDebugInfo
by default we should replace linker flags in all configs with
those are used for RelWithDebugInfo configuration.

Fixes: QTBUG-114925
Change-Id: I782f81a36f5ef7ee4d342ce8ac6c217cb2552f3b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 49ce711796c2f10dfe658cc77b81db1f2d1b25f7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-30 14:07:55 +00:00
Alexandru Croitor
b851d89e8a CMake: Don't use check_language for Objective-C/C++
The check_language macro spawns a new cmake subprocess to detect
availability of a language. We use that to detect availability of
the Objective-C/C++ languages when targeting Apple platforms.

That's problematic because the parent process CFLAGS / LDFLAGS env
vars influences the result of the subprocess compiler detection,
and in some cases that can fail the detection.
An example of that is passing iOS specific flags which then get
mixed with the default macOS flags added by CMake, resulting in
a linker failure.

Instead of using check_language, explicitly enable the Objective-C
and C++ languages when targeting Apple platforms because we know
that we need them for compiling Qt.

This avoids the issue because enable_language is not spawning a
separate cmake sub-process and thus passes more information to the
underlying try_compile project to ensure a successful check.

The change also means that CMake will error out earlier in case if the
Objective-C compiler is not found, which was not the case before.

Fixes: QTBUG-114470
Change-Id: I1a16c1e5828dfe10b2d7da27cc9a8c787517ab8e
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 961ff0cc8a7408f59b2d0f9adfa980fd89bd3274)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-30 14:07:55 +00:00
Amir Masoud Abdol
7cdf9eca5c Look for MoltenVK headers if there are installed separately using Brew
Homebrew offers a formula for `vulkan-headers`, which does not include
the MoltenVK headers. MoltenVK does include the vulkan headers, but if
someone passes the vulkan-headers path to CMAKE_PREFIX_PATH, then our
module cannot pick up the MoltenVK headers. Brew's MoltenVK
installation is a bit odd as well, as in, one needs to point the
CMAKE_PREFIX_PATH to `HOMEBREW_PREFIX/molten-vk/libexec/` instead of
the directory head.

Change-Id: I933faeb16b3f54597e3a0af0af584d79b3c0a344
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f1db0ca2518bc4e3e4740f46a41c37715db14b4f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-30 10:55:11 +00:00
Amir Masoud Abdol
86c4d60fde Update the implementation of -unity-build
I added the ability to use `-no-unity-build`, and included the
batch size in the config.summary as well. In addition, qt_feature is not
being used for `-unity-build` anymore.

Change-Id: I4a10e03d3505336d2256280ed2854ec0425df47f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit f607e22d59e970f5016141ee4e70c834e64658dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-30 10:54:48 +00:00
Friedemann Kleint
70f48ca973 Fix typo in QXmlStreamReader error message
Amends 6326bec46a618c72feba4a2bb994c4d475050aed.

Task-number: QTBUG-109781
Task-number: QTBUG-114829
Change-Id: Ib5189dc908cd61c6c6fa23024776a4a5baa75ca5
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
(cherry picked from commit bdc8dc51380d2ce4580e6b84e3286ec6f1866156)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-30 09:55:23 +00:00
Eskil Abrahamsen Blomfeldt
4ffd435333 API update: Don't expose QHash storage in API
To maintain flexibility in how we store the features, we
introduce accessors through indirection rather than accessing
the property directly.

Made as response to API review.

Change-Id: I3e5d4ddabe93f67796af4626fddefe028ded9888
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit 17f8e2c441f2302f1df19053208f77f7fb60e1f1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-30 07:11:13 +00:00
Santhosh Kumar
865bfc531c Fix button state validation in windows platform during drag and drop
The button state from windows when we use GetAsynckeyState() provides
both MK_LBUTTON and MK_RIGHTBUTTON at the same time. This creates an
issue when we validate only with single state to determine
DRAGDROP_S_DROP operation.

Normally, The MK_RBUTTON will be delivered when we have long press
during drag. But sometimes (no definitive reason identified) the key
state from windows contains both the key state (MK_LBUTTON | Mk_RBUTTON)
during drag and drop operation with touch.

This patch set fixes the issue by validating all key state instead of
a particular state.

Fixes: QTBUG-112995
Change-Id: I67bf5f4956b68279ecc5fbeca8e8e7aef46d0482
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 3902fb0438d946a466b67f2b82ba8779c731e55d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 23:38:06 +00:00
Tor Arne Vestbø
8bd70959f8 QMessageBox: Set clicked button for native dialogs in clicked callback
For non-native dialogs we set the clicked button before calling finalize,
which emits finished(). We did the same for custom buttons in native
dialogs, but for standard buttons in native dialogs we deferred it
until QMessageBoxPrivate::helperDone, which meant that during the
finished() signal the button was not set.

We now set the button as early as possible for all three cases.

Change-Id: Ifdbaa9a25105fef0bb56dd28caee9af55cd74e67
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit cd9ae49962bbadf20c4b6599187b5a1bb0d8dc8a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 23:38:06 +00:00
Marc Mutz
0714ab7db5 tst_QXmlStream: remove unneeded _ba UDLs
... and collapse adjacent C string literals.

Both QStringBuilder and non-QStringBuilder builds have no problem
resolving an operator+ for char[] and QByteArray, so there's no need
to turn the char[] into a QByteArray using the _ba UDL first.

It just causes pain because not all active branches support this UDL,
so remove, to bring this code in line with what the cherry-picks to
6.2 and 5.15 must needs had to use.

Amends 6326bec46a618c72feba4a2bb994c4d475050aed.

Change-Id: Id3d61483729c51c82f58b826efcc8fc7960c3ccd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
(cherry picked from commit 3bc3b8d69a291aa513d2d120c8ef46f968f1efdf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 21:15:55 +00:00
Marc Mutz
f0feeb8486 QCFString: unexport
This class doesn't exist on MSVC, so the inline functions didn't
become part of the ABI, so it suffices to only export the two
out-of-line functions.

Task-number: QTBUG-104164
Change-Id: Iedf8b0b1882802db53406942d7ac2a27e7ddfa23
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit b249a8ab3ab68ee4e823f5cf32d9d742bebe1cd1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 21:15:55 +00:00
Ville Voutilainen
92805d19bb Make android_content_uri directly openable in Creator
Task-number: QTBUG-93020
Change-Id: I008c8b3a39b5f347828e387a19be8823653f69c9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 779e4cc0b0ed5c3f6958dc4a856277e6c908f8f9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 21:15:55 +00:00
Tor Arne Vestbø
1c9fe0173c Move interview example to manual test
Change-Id: I06c77672c3ca08dfd3e50af25ed3e1669462259a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 645e011d7ddaf8660951d28577010d83eb9ede05)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 21:15:55 +00:00
Tor Arne Vestbø
a47eccc32c Move validators example to manual test
Change-Id: Ic91bc89422fb23e3782db69bab2953e7cf8ddf69
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e00d8aa6a83d52b71e3ab2abdb45eafadf65e5f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 21:15:55 +00:00
Tor Arne Vestbø
3b4c6da046 Move pinch zoom example to manual test
Change-Id: I0632a839ef069e13a8b859a22f47be2e7423ffb0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c7702638f33b78c39981504574db5021e1d7c383)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 21:15:55 +00:00
Tor Arne Vestbø
1dc356cf5e Move movie example to manual test
Change-Id: Ie185a3c88eced7b8b0fe324b9ef62ab86d38d521
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ec01f6ae8b28f6b5cdb125e8e42e18b96f2a97a6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 21:15:54 +00:00
Tor Arne Vestbø
f61c424919 Move image viewer example to manual test
Change-Id: I4b64033f1a075681ce5b918fdf2e018ad05a7869
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b8f588bea74aae0a890e1af18b936b0bfbf8c237)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 21:15:54 +00:00
Tor Arne Vestbø
d6bf951b76 Fix missing references to 'Qt Widgets - Application Example'
Amends eda71105ff9a516059c6dd6643ff446a82edac81

Change-Id: I44fa9acef37667d635d5770ce5d50fc52d92aa88
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 35063254fdba9704fd1411e9bd5ba7984c303e93)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 21:15:54 +00:00
Tor Arne Vestbø
9845bda23f Move dynamic layouts example to manual test
Change-Id: I34288b2b22cbbfb3b77870f0c71778bcf3d552fb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 76ba4a04223670afdfe9dc17eee3dc0ec3659f66)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-06-29 17:59:19 +00:00
Tor Arne Vestbø
25b995a575 Move digital clock example to manual test
Change-Id: I043c0060a71d9de2f3e74aab0759d07a20880c3a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 65e7303ec906fb64930772a06fed647f41b54391)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-06-29 17:57:23 +00:00
Tor Arne Vestbø
1c682c2432 Move styles example to manual test
Change-Id: I5738932c0c498ce2075a399274e3b80a04ad9211
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 89b463ac2facc1b4fdcf3dcae612a4d8f9109b2c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 17:53:27 +00:00
Tor Arne Vestbø
9e8c8fc105 Move tetrix example to manual test
Change-Id: Ie73d9e35df8513d05d55ffbad1f02584359e3bd0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 40dbee13ebf8a8d2fdd2fe2fbd82b42ef413a8fd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 17:53:24 +00:00
Tor Arne Vestbø
11aa5f8aca Move stylesheets example to manual test
Change-Id: If0206e63546bf948af4cfb65773e2662c53a5e79
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1e954f9be898a604499c53fe639e89e8c48a4b0e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 17:53:21 +00:00
Tor Arne Vestbø
054510b8aa permissions: Handle unknown permission statuses gracefully
If an application runs on a macOS or iOS version that introduces new
permission statuses that we haven't accounted for, we don't want to
crash.

Replace Q_UNREACHABLE with a warning and Qt::PermissionStatus::Denied.

Change-Id: I063042f510caaa8936742f6195bd455d09c4d9ee
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 993cbef7f41446b550c28fcbb30c5c4a5b40d19f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 17:52:58 +00:00
Alexey Edelev
eb6784eb87 Introduce openssl-hash feature
The feature allows to not use OpenSSL in QCryptographicHash
implementation and removes OpenSSL from dependencies of QtCore if
disabled.

Fixes: QTBUG-114783
Change-Id: I2a49fa9ddfa5acedcfc95a3330fd7863a8052a5c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit bacb04d77b064d1f348d310b5b57aeebe93f590c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 14:39:56 +00:00
Tor Arne Vestbø
2a1ba918da macOS: Propagate mouse enter/exit for windows embedded into foreign windows
Similar to the isEmbedded() case, when the parent of a QWindow is a
foreign window, created via QWindow::fromWinId(), we don't have a
QNSView parent that will handle mouse enter/exit on our behalf.

Longer term we probably want to fold this case into the isEmbedded()
case, but as that function is used other places too this requires
some more research, so for now let's fix hover events.

Fixes: QTBUG-114605
Change-Id: Ib61aefc84ed080417a6820a4a365555424b208be
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 21f3a6d8c5dc737c82cdc02c5debb6cf86894d98)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 14:39:44 +00:00
Tor Arne Vestbø
1e2aa97a11 Move qpa examples to manual tests
Change-Id: I7b25b1c8100f04eec3d9a571f59a1babef55b1d5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6c96218b43667ae47364f303b566be6e0e5779fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 14:39:43 +00:00
Tor Arne Vestbø
08f2757fe0 Move chart example to manual test
Change-Id: I95a40834853a0157d8fa6137431bfd86ce855b2f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e46fb69a87c46e812cc09b3f131462c99aae85d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 14:39:41 +00:00
Tor Arne Vestbø
a9b924dca6 Move character map example to manual test
Change-Id: Ie27fe436fc7ae7774beaa78f8a27f6009027753a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3a8265a4290e3405c08811e815edb8432d873a81)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 14:39:40 +00:00
Tor Arne Vestbø
de85c3a3d0 Move dock widgets example to manual test
Change-Id: I23ca3f2450df8f6c71509235ccec655d88d0d6d7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2a65849e10e5288d0aa61d293f3fb80d4056bc37)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 14:39:39 +00:00
Tor Arne Vestbø
d3cef8f3f4 Move dirview example to manual test
Change-Id: I9057d5efb1cdf3e425e879f8cc96a544c1892e77
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit fc0e82f58a8fbd879fb0867334b664bd83863d8d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 14:39:37 +00:00
Tor Arne Vestbø
366bf02129 Move calendar example to manual test
Change-Id: Ie2215ae0feeb322888619aed632e20db9b69e20b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 288c7ef5570f2badf5781a744ab2ba2d6f18b183)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 14:39:37 +00:00
Tor Arne Vestbø
fcf1dc1633 permissions: Handle EKAuthorizationStatusWriteOnly on macOS 14/iOS 17
For now we do not have a QCalendarPermission::AccessMode::WriteOnly,
so we have to report Qt::PermissionStatus::Denied.

Fixes: QTBUG-114864
Change-Id: I94e92912ef4c24adb524ccf2cf28553115d6781b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit 2736e908e9da05ed8a03a8f163237ec68606e1a3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 14:39:32 +00:00
Tor Arne Vestbø
7eb7da8e52 CoreText: Handle failure to find matching theme font descriptors
CTFontDescriptorCreateMatchingFontDescriptors has been observed to
return nullptr, so we need to handle that explicitly.

Fixes: QTBUG-113698
Change-Id: Ic9fa574c14068fcae98fe8e6ceddd8a4f7008210
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9526a7693604c5513a08a4ab08c0c691c3003f39)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 14:39:30 +00:00
Tor Arne Vestbø
77573a04aa Move windowcontainer example to manual test
Change-Id: I68b866bcc2659b90aad2c10dc06240674bf4a826
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit cd7995de57321854b1da01e07ba49e82520abfe3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 14:39:29 +00:00
Tor Arne Vestbø
8b8b7467bf Move border layout example to manual test
Change-Id: I3f45043a64275f8678288e1d9839271eafa1fd2b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 42b58f8cb41790169eb2ebcd215cf2696dcecbe7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 08:40:23 +00:00
Tor Arne Vestbø
cd54a5e837 Fix qdoc link warnings after moving a few examples to manual tests
Change-Id: I81a6e9d52e858c3f733d4c527c70408772813b56
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 71f156fff07f6c876941096134f6ee4ac90a9309)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 08:40:23 +00:00
Tor Arne Vestbø
2d83c9d026 Move item views puzzle example to manual test
Change-Id: Idbb4222861be86275a86f731e75127b8496a08a7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a18c55e7380d123484d3cae11755337fb8b74a39)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 08:40:23 +00:00
Marc Mutz
212ff817ca Make qt_noop() constexpr and noexcept (for C++)
Since qt_noop() is supposed to be a no-op, it should not affect
constexpr'ness and noexcept'ness of functions and expressions it's
(indirectly) used in.

That requires that it be constexpr and noexcept itself. Add the
keywords, but guard against use from C. We can't use our Q_ macros
(which would enable noexcept for C, too, on some compilers, because
qcompilerdetection.h depends on qtnoop.h, and we don't want the
circular dependency.

Change-Id: Ie5441c423b7942a6c956345126fc7aec99907d25
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7bad2902f84a44da00a8cbc8e3acbec3b26c6866)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 08:40:23 +00:00
Marc Mutz
13197d7506 Remove all class-level [[nodiscard]] from the code-base
A class-level [[nodiscard]] used to be the only way to get a waring
for code such as

   QMutexLocker(&mutex);

with original C++17 means. This was because a few of our compilers
would warn about the presence of [[nodiscard]] on ctors, which is
really the semantics we want: we don't want to prevent users from
passing QMutexLocker out of functions and users of those functions
from ignoring the return value, if they so choose. That should be the
choice of the author of the function returning such types, not ours.

So QUIP-0019 makes class-level [[nodiscard]] conditional on proper
rationale in the user docs (or the commit message in case of private
API). Since none of the existing uses really strikes this author as
particularly convincing, remove them all.

All these classes have gotten Q_NODISCARD_CTOR on all their ctors, so
we continue to provide the same true positive warnings, minus the
false positives when returning from functions, at least on the
majority of compilers (and it's not as if all compilers interpreted a
class-level [[nodiscard]] as a trigger to warn on the initial example
of this commit message).

Task-number: QTBUG-104164
Change-Id: I163356486e7c80f9d69bf67023010a88233fe662
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 01e1dc273d0fd95e4e4f57ae0af1862196f72bd6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 08:40:22 +00:00
Michael Klein
91132d6b27 QNetworkReply: Propagate proxy errors properly
Map QNetworkError::HostNotFoundError and QNetworkError::ConnectionRefusedError
 to ProxyNotFoundError resp. ProxyConnectionRefusedError when it originated
from the communication with the proxy server.

Fixes: QTBUG-68821
Change-Id: I21b91f2667ba0cd329d4ece1fe543472cdab2d22
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 69de333e1fbb3b866ab77a9d6a4ad26d0796633b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-29 06:08:01 +00:00
Yuhang Zhao
972984521e WASM: don't ignore custom QSurfaceFormat settings
Previously, Qt would always ignore user's custom QSurfaceFormat
settings and this behavior makes user have no way to control
the preferred OpenGL version when running on WASM. And after reading
the wasm platform plugin code, I don't see any reason why we should
limit ourself to the default OpenGL version. And I've tested this
patch locally, Qt still work normally if I set a newer OpenGL version.

Change-Id: I0cfb831d6a722fe61cc85808a6d9e3098c73d82e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 33a9cbef657d598589500d2eecea192b83f79b3c)
2023-06-29 05:53:32 +00:00
Axel Spoerl
51dc94df9c QGtk3Theme: Do not default Active WindowText to button foreground
QGtk3Theme uses the GTK button foreground as a default for the
WindowText color role. When a GTK3 theme has no specific color for the
entry text, this can lead to text on certain assets looking darker
and thus disabled.

This discontinues usage of the button foreground for the window text.

Finding the WindowText color role in QPlatformTheme::SystemPalette now
follows the following logic:
(1) GTK normal entry text is used if specified. This is the preferred
option, copying GTK behavior.
(2) If (1) is not specified, the GTK default text color is used, making
WindowText equal to Text.
(3) If neither (1), nor (2) are specified, the WindowText color role is
taken from qt_fusionPalette, where it is also equal to Text.

The SystemPalette is used as a default template for all other control
or widget speicific palettes. The rules above therefor apply to all
screen assets (unless they use a JSON file to specify a their
individual WindowText).

[ChangeLog][QGtk3Theme][SystemPalette][WindowText] Default to GTK
Entry Text / Normal Text / qt_fusionPalette

Fixes: QTBUG-114600
Change-Id: I4c96ac7d096526faf4c2feee436753990c6c9f92
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 574a47dd5a89e7cecf4fbf592dd0d5b216c3b0a6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 20:48:53 +00:00
Alexey Edelev
32466f5763 Pass CMAKE_OSX_SYSROOT to syncqt CMAKE_FLAGS
Fixes: QTBUG-114803
Change-Id: I2eed5d6a7255eb61eff09d0c9a102e0652e63c0c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit a3ec70a92971342da0caf68e20c14ce16a0b39af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 20:09:32 +00:00
Alexandru Croitor
87ccb0b481 CMake: Require CMake 3.21 when building/using Qt on Apple platforms
Explicitly check that at least CMake 3.21 is used when building Qt or
when using Qt in a project.
This only affects macOS and iOS builds.

We check for 3.21 instead of 3.21.1 as described in the documentation
to avoid an error like:

 Policy VERSION range "3.21.1...3.21" specifies a larger minimum than
  maximum.

Until the technical limitation is addressed, if someone does end up
using 3.21.1, another existing check for "unsuitable" cmake versions
(as opposed to minimum required) will let them know they should use
something newer.

Amends 1cf3295cef321c9a587af2f2de7740c0cd3ca743.

Fixes: QTBUG-114869
Change-Id: I2a479baaa63cfbe23af187cf0796e1c00042692b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 9ef864f56f1a049237f599b65684fa6d5ce06f55)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 20:09:30 +00:00
Marc Mutz
afe4666519 De-inline QGenericRunnable overrides
Pins the vtable to a single TU and therefore prevents duplicate
vtables, -Wweak-vtables warnings and false-positive dynamic_casts.

This requires exporting QGenericRunnable, which hopefully won't
also export the nested class.

Task-number: QTBUG-45582
Change-Id: Ie1f29d25b0dcdee7654c33c497e8e0350d12e311
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit be1b589cb9f147762a5a73d2b3a44778b7ae7502)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 17:58:25 +00:00
Morten Sørvig
07708f6e61 wasm: fix touch -> mouse event synth on Safari
Mobile Safari generates touch pointer events with negative
pointer id's, which causes processTochEvent() to skip
the event instead of synthesizing a mouse event.

Ensure that the id's are always positive by taking the
absolute value of the event.

Change-Id: I1514329dc76ecc4b9103f7deca9642aaf304df8b
Reviewed-by: Piotr Wierciński <piotr.wiercinski@qt.io>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
(cherry picked from commit 7a31911b795a3d07c6cba3af8436c3a38673689e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 17:58:25 +00:00
Michal Klocek
970888356a Fix headers clean for newer msvc
Newer msvc gives C4309 warning for 'initializing':
truncation of constant value

Warning would go away if we had 'enum foo: unsigned'.
Disable the warning for problematic enums is not enough
as it also complains about headers coming from windows sdk
like:

C:\Program Files (x86)\Windows
Kits\10\include\10.0.22621.0\shared\wtypesbase.h(395): warning C4309:
'initializing': truncation of constant value

Note 10.0.22621.0 is the latest sdk already.

Do not disable language extensions for header clean target.

This reverts commit 8bf602518d8440542329d867c1a710b66ae12c36

Task-number: COIN-1059
Fixes: QTBUG-114931
Change-Id: Ifc3883f88a6bd52794a37dc640eca99c158a40e0
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 2dcc30592bccd2e6990b25b89490f3c1fe293d78)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 17:58:25 +00:00
Laszlo Agocs
613a37e7ca rhi: gl: Correct data type for D24 and D24S8
Change-Id: I7aaaba49d0cc427c82e1ee4d0657b2992ffd4905
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 409cd2be188af6ace294f46276c69a7aab87fcb1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 17:58:25 +00:00
Amanda Hamblin-Trué
5ef2440102 Revamp bindable subscription example
Silence a bogus warning.

Task-number: QTBUG-114689
Change-Id: I7267b752e780b0c48cc57a513d12ad504e4c7a30
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 0644f8e63adf9dacc5e6adfac1bdc2dfa4324e2f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 17:58:25 +00:00
Laszlo Agocs
27d2256494 rhi: d3d: Handle the case of passing in a texture array as depthTexture
Behave identically to Vulkan, i.e. create a view that spans all array
elements. (except when the range is set)

This becomes relevant with multiview, where the depth/stencil attachment
the render target must be set up with a texture array as well, similarly
to the color attachment. But applies even to D3D11, even though it is
not common to use a texture array there, but it's possible.

Task-number: QTBUG-114896
Change-Id: Ieda8475500b0553f8c14aa9ecad57001b9714d49
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit e126558b9b4d4bf8f06ed7bf84dcfe3922801663)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 17:58:25 +00:00
Morten Sørvig
34a64c3771 QWizard: Support fractional DPR on Windows
We were storing the DPR as int; change to qreal.

Task-number: QTBUG-114175
Change-Id: I7dc7df82f584cddbbb3f690f1df74e7a30369ab2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c0e48ed645f68e714e982064540d710676a0738b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 15:58:00 +00:00
Amanda Hamblin-Trué
2bc452d8a3 QBindable example: Replace SpinBox connection with QBindable
Made this change because there was no example of the interaction
between QBindable and non-bindable properties.

Task-number: QTBUG-114689
Change-Id: Ief7662f8af5e6fab32491418fa35f0daa937819d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 19b0800555e7850682a6556c0569e1e2ea963c79)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 13:20:34 +00:00
Timothée Keller
fe36efc625 Windows QPA: Move transient children with a window move
When moving a window with keyboard shortcuts, popup menus currently do
not follow along. Allow this to happen by accounting for a window's
transient children, and moving them after the owning window has finished
its move.

Fixes: QTBUG-106483
Change-Id: Id51a7c0163e4fdd2d139565f2bf500a3fc997488
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 530d092eae0579bbb88e95f853715cac214da636)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 08:57:01 +00:00
Assam Boudjelthia
75abc39672 Android: explicitly bundle the OpenSSL libs for tests
Use the new argument to bundle the OpenSSL prebuilt libararies so that
ssl operations are actually tested at runtime.

Task-number: QTBUG-110025
Change-Id: I0d73fed463a1724a9e0ee84ba603aa2ff1bc649b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit f667445006c52f26103540ae18964a0015a297db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 07:57:31 +00:00
Assam Boudjelthia
72821e7ebd Android:CMake: Add argument to bundle OpenSSL libs for internal tests
The new argument would allow bundling the prebuilt OpenSSL libs
into the test apk so that SSL can actually run. It expects the CMake
argument OPENSSL_ROOT_DIR to be set ( we set that in Coin configs).

Task-number: QTBUG-110025
Change-Id: I4c82796635ca89f5511255ae26182f41a504b026
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 9d5a8162a5a168972c7aaf39b130da6a72dc13e2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 07:57:28 +00:00
Tor Arne Vestbø
f1e796193a Move fridge magnets example to manual test
Change-Id: I6e40aff63f24dc98ab6b84450d288159f036142b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 532e1c9bf674f44da2b60fbc81bf3bc921641b7b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 07:57:06 +00:00
Tor Arne Vestbø
58aa9808a4 Move graphis view flow layout example to manual test
Change-Id: I713816114b87def9eab79b893d13554f1c37c6a5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 95595d68bee7ef9e58100e4230f71d7f065eacb7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 07:57:04 +00:00
Tor Arne Vestbø
3852b2f4fd Move icons example to manual test
Change-Id: I08f44448f96a61f780c21d628954879c7b28dce3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c3fd8e911ea361df7f1e6fe971f8835d2093db7c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 07:57:03 +00:00
Tor Arne Vestbø
028c3b6e15 Move font sampler example to manual test
Change-Id: I696d9be26edfaadd40579884930b2f061d308a06
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 917282ea53626e4be45c6bb19682776b250948ba)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 07:56:57 +00:00
Tor Arne Vestbø
c0d9424404 Move finger paint example to manual test
Change-Id: I26eec035eaa78eac2aa96de72ae38093bc08fd23
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0b6f5ae131af140088fbc5e770779f9cf8fdbd7f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 07:56:50 +00:00
Axel Spoerl
28ee92c656 QDialogButtonBox - code cleanup
Replace const char * based connect statements by modern API and remove
'_q_' slot prefixes.
This requires explicit disconnection in the destructor -> add.
Replace bool traps for layouting and removing buttons by enum classes.
Replace if/elseif event handler by switch.
Replace iterator typedef with auto.
Encapsulate logic to ensure defaulting to first accept button in a
member function for better readability.
Remove dead code.
Move private header declaration from cpp to a new _p.h.

Task-number: QTBUG-114377
Change-Id: I8a2bc355e3816c3c826c10cd96194c89bf0ae510
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit df735d794fd2e545c18b9e345e833422bcd64329)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 01:37:54 +00:00
Ahmad Samir
2b0ea48258 Handle a couple of GCC 13 warnings about dangling references
There are two temporaries, reply.arguments() returns a temporary QList
and list.at(0) returns a temporary reference to the first element. The
local reference variable would only extend the lifetime of the temporary
object it's bound to, list.at(0), but not the temporary list itself.
Even though this a false positive in this case because QList is
implicilty shared, the compiler can't tell the difference and the fix is
simple.

tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp:1845:21:
warning: possibly dangling reference to a temporary
[-Wdangling-reference]
 1845 |     const QVariant &retval = reply.arguments().at(0);
      |                     ^~~~~~
tests/auto/dbus/qdbusabstractadaptor/tst_qdbusabstractadaptor.cpp:1845:50:
note: the temporary was destroyed at the end of the full expression
‘QDBusMessage::arguments() const().QList<QVariant>::at(0)’
 1845 |     const QVariant &retval = reply.arguments().at(0);
      |                              ~~~~~~~~~~~~~~~~~~~~^~~

Change-Id: I03d54b56769cbd0f9f1165e4679ec4947267181a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3a9526468c134b68b64b9a3bb6278d47c266e381)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 01:37:53 +00:00
Tor Arne Vestbø
b024426ee9 Move embedded dialogs example to manual test
Change-Id: I86213aa47def7ebacaa9465a0200cef10871706e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7b4b5c839ba7e7a05a339533d37f0d97a26bad18)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 01:37:53 +00:00
Tor Arne Vestbø
16c9ea4194 Move drag and drop puzzle example to manual test
Change-Id: I859cdb2cf74cd6272c29924c77dab26b4f4c0b6c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit cefb1c9ca9af73999247678907c496c1a143d00f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 01:37:53 +00:00
Marc Mutz
3343eeb1fb tst_QFutureSynchronizer: describe how setFutureAliasingExistingMember() works
So no-one 'fixes' the test by pinning synchronizer.futures() into a
named variable or collapsing the two lines into one. Both would break
the premiss of the test.

Amends e8dcbaaaf61ee2164db61e70a5d61d7a5b849371.

Change-Id: I7a98c382a7db0bf3ff369dcaf61af0942796d6a3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 70a7a695fdbaccd042aa4371cbb231ced2d9b499)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-28 01:37:53 +00:00
Amir Masoud Abdol
f03c7e4a2d Introduce -no-vcpkg flag for disabling vcpkg detection/integration
Vcpkg detection is enabled by default, but we did not have a flag to
disable it, and it was not showing up in config.summary either. By
adding a -vcpkg flag, we get to use `-no-vcpkg` when necessary, as well
as adding an entry to config summary indicating whether vcpkg is in use
or not. Besides `-no-vcpkg`, one can pass `-DQT_USE_VCPKG=OFF` to cmake
command in order to disable the automatic vcpkg detection/integration.

[ChangeLog][configure] vcpkg detection, and integration can be disabled
by passing the -no-vcpkg flag to the configure command, or by passing
`-DQT_USE_VCPKG=OFF` to the cmake command.

Change-Id: Ide8da70a7b473ec23995104d162356e75e6d1240
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b3f27f75b638c6eb8494d681cd4df50dd34bcac0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-27 22:00:08 +00:00
Ahmad Samir
a13f78144a QXmlStreamReader: make fastScanName() indicate parsing status to callers
This fixes a crash while parsing an XML file with garbage data, the file
starts with '<' then garbage data:
- The loop in the parse() keeps iterating until it hits "case 262:",
  which calls fastScanName()
- fastScanName() iterates over the text buffer scanning for the
  attribute name (e.g. "xml:lang"), until it finds ':'
- Consider a Value val, fastScanName() is called on it, it would set
  val.prefix to a number > val.len, then it would hit the 4096 condition
  and return (returned 0, now it returns the equivalent of
  std::null_opt), which means that val.len doesn't get modified, making
  it smaller than val.prefix
- The code would try constructing an XmlStringRef with negative length,
  which would hit an assert in one of QStringView's constructors

Add an assert to the XmlStringRef constructor.

Add unittest based on the file from the bug report.

Later on I will replace FastScanNameResult with std::optional<qsizetype>
(std::optional is C++17, which isn't required by Qt 5.15, and we want to
backport this fix).

Credit to OSS-Fuzz.

Fixes: QTBUG-109781
Fixes: QTBUG-114829
Change-Id: I455a5eeb47870c2ac9ffd0cbcdcd99c1ae2dd374
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 6326bec46a618c72feba4a2bb994c4d475050aed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-27 21:11:41 +00:00
Ahmad Samir
47c6473680 QXmlStreamReader: change fastScanName() to take a Value*
For easier debugging, e.g. to print out value.len and value.prefix.

Change-Id: Ib0eed38772f899502962f578775d34ea2744fdde
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 1a423ce4372d18a779f3c0d746d5283d9a425839)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-27 21:11:33 +00:00
Alexey Edelev
c131e159b0 Introduce QT_SYNC_HEADERS_AT_CONFIGURE_TIME flag
The syncqt tool was originally designed to run at build time, as a
part of dependency chain of Qt modules. This works well unless we need
the code model of the Qt project in IDE, since Qt source code actively
uses header aliases, and creating them at build time breaks the code
model until the initial build is done. So we made syncqt the configure
time tool to not break the developer experience.

It's more likely that developers build Qt using command line or don't
need the code model before the first build. So running the tool at
configure time should be optional.

QT_SYNC_HEADERS_AT_CONFIGURE_TIME switches the "mode" of the syncqt
tool from build time tool to the configure time tool. Without the
option enabled build procedure runs all the syncing targets at build
time only. The exception are the developer builds, if the
'-developer-build' option is enabled, QT_SYNC_HEADERS_AT_CONFIGURE_TIME
is set to TRUE by default. This gives better development experience for
the developers that don't use the code model in their IDE or don't
require it before the first build is finished. Also this build time
mode is preferred for the CI or similar build procedures where code
model is not required at all.

By default, the option initialized from the
QT_INTERNAL_CONFIGURE_FROM_IDE CMake variable.

TODO: The option is forced to TRUE for the static Ninja Multi-Config
builds. See QTBUG-113974 for details.

[ChangeLog][Build System] When building Qt from sources, syncqt and Qt
header files are now created at build time, not configure time. This
should speed up the configuration step. You can set the CMake variable
QT_CONFIGURE_TIME_SYNC_HEADERS to ON to use the previous behavior,
though. The old behavior is also preserved if cmake/configure is run
from inside an IDE - Qt Creator, Visual Studio Code, and CLion are
currently detected.

Task-number: QTBUG-111163
Task-number: QTBUG-109792
Change-Id: Ib61bda9546e58492be874a8591c37e100313d02c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit a8cf976ce6c82192bdf2d4b310e9ba0ea75bd0b0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-27 20:03:54 +00:00
Liang Qi
c73372b5fe tests: skip tst_QWindow::enterLeaveOnWindowShowHide() on Wayland
This amends 79ac43053798763828d51c79f6368465b1db1c87.

Change-Id: Id68daff20de11361a1bb20071266e8adafe5e9c4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit d1f3ffc80b0e15a4342fd0e5a334f42e378d401b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-27 20:03:53 +00:00
Ahmad Samir
50dbf86104 QTest: port qSleep() to std::this_thread::sleep_for
As requested in code review. Big improvement, code-wise.

tst_Sleep::wait() was failing on the CI, so be more accurate by using
QElapsedTimer::durationElapsed(), which returns nanoseconds.

Change-Id: I5bed6d6bd768adfdecab2475e6cbe245c20aabd7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8ace5b26aa7d0b0e800655089c6405d67dbaca12)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-27 20:03:51 +00:00
Topi Reinio
50150e3b4e Doc: Add \relates command to two global swap() functions
And fix incorrect copy-paste error in QBasicTimer's swap()
description, 'string' -> 'timer'.

Change-Id: I28f5e4d6c8e3b8698ab9b4587d503b06c5628b78
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
(cherry picked from commit 2f283489ef6a2f77c6a5ecc85a4f2c109969d393)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-27 13:02:27 +00:00
Giuseppe D'Angelo
abd60e9592 SSL: upgrade the default DH parameters
We have been using as default DH parameters the 1024-bit MODP group.
This is now considered insecure, and applications should use the
2048-bit at a minimum [1]. This commit therefore replaces the parameters
with the 2048-bit MODP group from [2].

To double check the data, use openssl asn1parse to verify that the prime
matches. For instance:

1) put the encoded string in a `encoded.txt` file (c&p from the source,
   removing the double quotes)
2) put the hexadecimal value of the 2048-bit group in a `reference.txt`
   file (c&p from [2])
3) compare the output of openssl asn1parse with the reference. For
   instance like this:

    $ diff <(openssl asn1parse < encoded.txt | grep -m 1 INTEGER | perl -pe 's/.*://; s/\n//') <(perl -0777 -pe 's/\s//g' reference.txt) && echo OK
    OK

[1] https://datatracker.ietf.org/doc/html/rfc8247#section-2.4
[2] https://datatracker.ietf.org/doc/html/rfc3526#section-3

[ChangeLog][QtNetwork][QSslDiffieHellmanParameters] The default
Diffie-Hellman parameters are now using the 2048-bit MODP group from
RFC 3526.

Change-Id: I47133cd78ba0e954b8f93a3da09fa2c760c9f7a8
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 3ec24e329c9ef6802786a37f30ddd8982e903480)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-27 11:16:03 +00:00
Laszlo Agocs
0445c77429 rhi: gl: Make resolve on par with other backends
Just handling attachments with a render buffer set and only one
attachment is not what other backends do. They support all attachments
and also the cases of multisample (2D) textures and multisample texture
arrays.

By extension this allows multisample 2D texture arrays. (GL 3.2+/GLES
3.1+) This was previously not working probably since the correct texture
target was never used.

Change-Id: Ibe929faaf86824a596f9794240d1becc51f68e43
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 07d900dd57648aeabf4c95250581c1a04dce88a7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-27 07:40:39 +00:00
Thiago Macieira
59a826e9a6 tst_QFile: remove the timer in unixPipe and socketPair
We were basically timing the qSleep, which is pointless. We don't need
to verify that qSleep(X) spends at least X time. Because it also
doesn't. Somehow, QNX can execute 1000 ms sleeps in 996 ms.

Amends commit 30e5ff3ff223d665fbed3baf2d08ad3fcf2b8455.

Change-Id: I46b5dede27114be29724fffd176a66c1799075b7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7d0431bb8bb32606e416fbdb67fe7d3d20fc9d8b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-27 02:17:18 +00:00
Thiago Macieira
9529e3e13e QMetaContainer: add missing #include <iterator>
For std::iterator_traits, tags, std::advance, std::distance, etc.

Fixes: QTBUG-114583
Change-Id: I443cf0c8a76243eead33fffd1768e904ae823f75
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 003c29511de5979fba526acd62f2a4c7c356b982)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-27 02:17:05 +00:00
Timothée Keller
04bc5fa4be Windows QPA: Fix dpi change when changing screens with keyboard
If moving a window from a screen to another using keyboard shortcuts,
the screen change detection happens after the handleDpiChange() call
which essentially makes Qt think the window stayed on the old monitor.
Instead of checking against currentScreen DPI, check against savedDpi
which should not have this problem.

Task-number: QTBUG-106483
Change-Id: Ic30dc1b16bbaf9306a086c8d3042f5341d3848c1
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 1d3b06a1abb715efc38f88ecd369f96d6e8cadd6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 18:42:51 +00:00
Tor Arne Vestbø
03b1ade31c Add XDG theme file for example icons
Allows easy use from the examples.

Change-Id: I731ea5641e247db2937aa1b12d1e91dd7dcb2848
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e27841c2fb6b953ec9fda95bfc34d873801e51d8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 18:42:51 +00:00
Tor Arne Vestbø
e63c51c7de Fix build with -sanitize undefined
Fixes: QTBUG-114865
Change-Id: If21f0faa8aacc84745c972438c2e30940716fb66
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 2ffa125c2d38b3ec058b3189bf53815a68fd0897)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 18:42:50 +00:00
Ahmad Samir
188fdf7ceb QFactoryLoader: add assert and explicitly cast to int
Other parts of the code are expecting int.

Change-Id: Iea73412c874adb2e6589e9b11607f313e1747d19
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 60f34fc9e368010a5eaae920e5e306e59abf8e73)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 18:42:50 +00:00
Santhosh Kumar
c8c3c44064 Fix disabled and inactive group palettes for windows native style
The dark mode related changes for windows didn't update disabled and
inactive group palettes, and this makes text in certain context
(such as menu bar) appear with enabled color. The windows theme API
populateLightSystemPalette() is responsible for this and it updates
palettes for color roles and certain inactive scenarios but not for
disabled.

This patch set makes existing systemPalette(Qt::ColorScheme) to be
available in QWindowsTheme and it updates palette depending on color
scheme. From now on, this API updates palettes for windows native
style. Its to be noted that window native style use light palette
irrespective of color scheme.

Fixes: QTBUG-114821
Change-Id: Iff4f35900293b8e7030ec121ca21856daa094dc0
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 491534006ec0b648e70269d33ccd7b79faddef7f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 18:42:50 +00:00
Laszlo Agocs
92f155cc29 rhi: d3d12: Fix more than one window with the same QRhi
This is what maps to the Vulkan and Metal backend. Taking the
frame slot from the other swapchain was a mistake. It should use
the frame slot from the current swapchain.

Fixes: QTBUG-114826
Change-Id: I1585088ce9a963f1710168d3ebc0d2e5f1e9ab21
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 1c4dbd14ae2f335f6148b1355f88d75c1a79cc35)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 18:42:50 +00:00
Tor Arne Vestbø
94aef47539 iOS: Propagate UIColor.tintColor as QPalette::AccentColor
Change-Id: Ib7418782f22abd8b60747d9df65810ff288a8246
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit 69cc7f946a66527c3f2b7a28510dcb37459dc33a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 18:42:50 +00:00
Tor Arne Vestbø
a77605f3ad Move permissions example to manual test
Change-Id: If7482ff20079d91ddba26a1abcb06b3054cc72ad
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit f4a80552c2784eaa0659acd12df7a865aeb7ebec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 18:42:50 +00:00
Mike Chen
5c64b63a47 Fix QTextEdit/QPlanTextEdit palette not updated on ActivationChange
When a QTextEdit/QPlanTextEdit window loses focus and receives
PaletteChange event, the ColorGroup that controls the palette for
the QWidgetTextControl will be set to 'Inactive'. However, the
QTextEdit does not update the palette when the window is activated again.
This can become more noticeable in applications where different colors
are used for the 'Inactive' and 'Active' ColorGroups.

Change-Id: Idd4dcc55b2bf8e671e7dd9cbd040782e1c3bf1a3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 4afcdc488f4e77f599406efe990e8534d38daf31)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 16:33:49 +00:00
Volker Hilsheimer
d924253c91 QSqlResult: remove bad API returning non-const reference
QSqlResult::boundValues is a const member function, but returned a non-
const reference to a QList<QVariant>. This is a bad and potentially
dangerous API, as callers can modify the list stored in QSqlResult.

Move that API into the removed_api translation unit, remove it from
Qt 6.6 on and replace it with two suitable overloads where the const
version returns a QVariantList by value, and the non-const overload
returns a mutable reference.

Driver implementations that used to call the const overload to get a
mutable reference are now calling the non-const overload instead
(those calls are all made in the non-const exec() or equivalent driver
implementations).

As a drive-by, replace "vector" with "list" in the documentation.

Change-Id: I6e4fd8f5749b939cdb609bf5876735e9b30b2b5a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 3f72b0d5fc70d3cf7daa4badccd5a40fc8b0726a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 16:33:49 +00:00
Volker Hilsheimer
1b5b090a5a QLineEdit: ignore key release events
Amends 55fe46fd58c73a7a22374694a1b45ec2a0e6fdc5. Before that change,
key release events were ignored as the QLineEdit::event reimplementation
continued to call QWidget::event, and as QLineEdit didn't override
keyReleaseEvent, the default implementation in QWidget got called to
ignore the event.

Restore that behavior by explicitly calling the QWidget implementation
after updating QLineEdit-specific states, and add a test case.

Fixes: QTBUG-114654
Change-Id: Ic8aa35a1c915b446aece47aaf03ef5cf1884b936
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 8afe4faf298798783278f992d14fb78cecee9588)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 16:33:49 +00:00
Mårten Nordheim
f10448ffaf tst_QNetworkReply: split extremely long line
Gerrit says it refuses to color lines that exceed 500 characters, so
let's split this line to get colors back.

Change-Id: Iab6d37332e27ecdeaf1420da6fa242ca65f0aab5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 02ca59c4c89199ae6bd68d117507f01b984e60a4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 16:33:49 +00:00
Volker Hilsheimer
343fa701ed Pacify MSVC compiler incorrectly warning about unused variable
Under some circumstances, MSVC seems to complain about SlotArgumentCount
being unused

  qobject.h(210): warning C4189: 'SlotArgumentCount': local variable is
  initialized but not referenced
  note: see reference to function template instantiation
  'QMetaObject::Connection QObject::connect<void(__cdecl QAction::* )(bool),
  main::<lambda_1>>(const QAction *,Func1,
    const QtPrivate::ContextTypeForFunctor<main::<lambda_1>,void>::ContextType *,
    Func2 &&,Qt::ConnectionType)' being compiled

This is nonsense, as SlotArgumentCount is used in the next line, to
construct the list of signal arguments, but the workaround to declare
the variable as [[maybe_unused]] is trivial.

Add a connect statement to the test case that creates such a connection.
This does not produce any warning with or without the attribute (and if
it did, the build would fail for CI configuratinos setting -Werror).

Fixes: QTBUG-114781
Change-Id: I4ee6f7d57c2836ef3dd9741d037d48181af2cdec
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 2b9ef2eb44c084d39ef8324cfe1ae42a98b3038f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 13:59:01 +00:00
Amanda Hamblin-Trué
6e395ef151 Revamp Bindable Properties Example
The use of Q_ASSERT(false) is bogus as we don't need to test here, but
want to signal unreachability.
Q_UNREACHABLE_RETURN allows us to tell the compiler that the point
can't be reached while also getting rid of the no return error.

Task-number: QTBUG-114689
Change-Id: I007cd243055237bcc21772a4130a6c1a44fd882d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit ce39beea0cd49bb93b0e345194265dd8081094cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 10:29:49 +00:00
Tor Arne Vestbø
c85aa4947a QIconLoader: Invalidate cache even if system theme hasn't changed name
The platform theme's icon loading logic may still have changed, even
if the theme name has not, so we still need to invalidate the theme
cache.

Change-Id: Id3635c235fadb007df86d93ce3beb5622d26b8bf
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit e9276d7497afeba3e116cb1044d37c341294780f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 10:29:49 +00:00
Tor Arne Vestbø
a557b5af56 Use systemFallbackThemeName in QIconLoader::updateSystemTheme()
The fallback logic in QIconLoader::updateSystemTheme() has been
updated to match QIconLoader::ensureInitialized(), by using the
systemFallbackThemeName() directly, rather than the possibly
user set QIconLoader::fallbackThemeName().

Change-Id: Ib5aab62bbfb22683d3bddf87c4e798eca4a5af62
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 89fe1085903cab969ed65f05c7004e18a47d935a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 10:29:48 +00:00
Tor Arne Vestbø
6c69eb4021 Update QIconLoader system theme unconditionally on ThemeChange
We cache the system theme name in QIconLoader, so when a theme change
comes in we need to update the system icon theme name regardless of
whether a user theme has been set.

The updated system theme name will not be reflected through the
QiconLoader::themeNamed() unless the user theme is cleared/unset.

Change-Id: Id949e55e2fa12e40818ba54cf2a10ce48fe10815
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 883c3dc8c8c014528e77ecbc4b4ed7d7504afa42)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 10:29:48 +00:00
Tor Arne Vestbø
dc7a2d20f8 Consult QIcon::fallbackThemeName() even when theme name is empty
We still need to consult fallbackThemeName() when computing the
parent list for an individual theme, as the Freedesktop Theme Icon
spec mandates that the "hicolor" theme comes last, but we no longer
need to do explicit fallback to fallbackThemeName() if a theme is
not found.

Change-Id: I6c0b5a45d8258c5b6eaa761402944a735b1606ba
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit addde7843f0bcbf7da8171e5146d8f1822ee0428)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 10:29:48 +00:00
Tor Arne Vestbø
c00d99d96e Consult QIcon::fallbackSearchPaths() even when theme name is empty
The use of fallback icons should not depend on a theme being set.

[ChangeLog][QtGui][QIcon] QIcon::fallbackSearchPaths() will now be consulted
for fallback icons even if the current theme name is empty.

Change-Id: Ia8d14062de7c53601fd9dac30f87a9e672aa2207
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit dde45bcefb1626c26de310a95321bb5e8e4c0014)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 10:29:48 +00:00
Tor Arne Vestbø
a9c29029d3 Consult QIcon::fallbackThemeName() even for themes with explicit parents
We would previously only use the fallback theme for themes that did
not exist, or for themes that did not declare any parent theme.

We now unconditionally use the fallback theme, even for themes that
declare their own parent themes, so that a QIcon::fromTheme("foo")
that doesn't exist in the current theme, nor any of its parents,
nor in "hicolor", will still be looked up in the fallback theme.

The reason this seemed to work in the existing tests was because
our test themes inherit system themes such as crystalsvg and gnome,
and we didn't provide a hicolor theme. Any of these themes missing
would lead us into the code path where we use the fallback theme
for a missing theme, masking that fact that we had not added the
fallback theme to the list of fallbacks for the theme that had
explicit parents declared.

The logic has been moved out of the theme parsing and into an
accessor in QIconTheme, so that we're not caching the fallback
theme lookup.

[ChangeLog][QtGui][QIcon] QIcon::fallbackThemeName() will now be
used as fallback even for themes that declare a parent theme.

Change-Id: Ib0ce1dfe97030f23893460ed624073a719a3ebd1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit f4dca7c512ab3f8860f711de971af1fea76a1665)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 10:29:48 +00:00
Tor Arne Vestbø
848932fbd8 Invalidate QIconLoader cache when setting fallback theme
Setting a fallback theme will affect the lookup strategy, so we need
to invalidate earlier lookups.

Change-Id: I962245ddb3a20b7798d5ce831ed8a369b0ab76b4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit ae36c1dc9c395e010334532319faaf4e3a911365)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 10:29:48 +00:00
Tor Arne Vestbø
7ab0bcbf8e Skip clearing the QIcon cache on QIconLoader theme key change
QThemeIconEngine takes care of creating a new icon engine when
the icon theme key changes, so we don't need to invalidate the
entire QIcon cache.

Change-Id: Ie3bca00a9146d1f429b2a6f8ab0b39e15834d158
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 4dacaaf15a51860f3a7a2d72ca033ccc38165de1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 10:29:48 +00:00
Tor Arne Vestbø
33402cdf69 iOS: Don't eat touch event when detecting edit menu tap gesture
Our logic in the edit menu tap recognizer for determining whether the
tap should trigger the edit menu only looks at the bounds of the input
area, and as long as the tap is within these bounds we trigger the edit
menu.

This doesn't take into account that there might be controls laid on top
of the input area, for example a button, where we don't want to trigger
the gesture.

The only related logic we have is a heuristic that checks whether the
cursor ends up moving as a result of the initial press, in which case
we treat it as the edit area "accepting" the touch press.

The proper fix to this is to handle the gesture recognizer delegate
callback gestureRecognizer:shouldReceiveTouch:, and do hit testing
there, but we don't have any machinery for that in our IM protocol,
nor in QWSI.

As a workaround, we treat the gesture recognizer as having failed,
even when we do detect a tap that should open the menu, so that the
recognizer doesn't eat the touch event. We then open the menu manually
instead of relying on the gesture recognizer changing state. This
should be safe, as sending a touch/mouse event down to the input
area should normally be a noop.

The workaround does result in a slight visual wart when clicking
buttons that live inside input areas, as the edit menu temporarily
opens, but the menu is quickly hidden again as the focus object is
transferred to the button. Compared to the current situation, where
the button is visually pressed, but doesn't do anything, and we
bring up the edit menu fully, this is an improvement, even with
the wart.

Note that the original problem outlined in this changed is not an
issue in practice for Qt Widgets, as we synthesize mouse events
from touch events, and (wrongly) synthesize a mouse release in
response to the touch cancel triggered by the gesture recognizer,
so the button is still activated.

Fixes: QTBUG-113975
Change-Id: I41e850f20d69ad8e3247949644a389e1c61c4dcf
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 843ce2759ea1698171cc4c5fad64d8cc0690cea8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 10:29:48 +00:00
Tor Arne Vestbø
ec39297898 iOS: Tear down all text interaction recognizers on focus object change
Prior to 30276cec3d47f4f4fa847fea90214ec5c28d54ed all the recognizers
were managed together, so we could safely condition teardown of them
all by checking for the presence of one of them.

Now that we selectively enable only some of the recognizers, we need
to have more granular teardown logic. For extra safety, we tear down
each one individually now, even if some of them are still managed
together.

Fixes: QTBUG-114416
Change-Id: Ie99388cd8abb7543c17df5b6b5a88e86ff86df7e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit 46d69b6ca45ad9218a27f7db8fccba8a8f655ecc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 10:29:48 +00:00
Jøger Hansegård
f4ca871977 Add CMakeUserPresets.json to .gitignore
The CMakeUserPresets.json file can be used to simplify configuring Qt,
particularly with tools such as Visual Studio and Visual Studio Code.

As opposed to the CMakePresets.json, the CMakeUserPresets.json should
only contain user specific configurations, and should never be checked
into source code management system.

This file is already ignored in the top level Qt super-project, but to
facilitate working with each individual submodule, we should also have
this .gitignore in each submodule.

Change-Id: I383417c7fe9d803aeb0385ba83e8c9cee6181602
Reviewed-by: Miguel Costa <miguel.costa@qt.io>
(cherry picked from commit 5546f2df538c06f5e7cc3e218f03a9a0ef2d830e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 10:29:48 +00:00
Laszlo Agocs
efd63925d7 rhi: d3d: Skip MakeWindowAssoc. when using dcomp
It has no purpose (like Alt+Enter is not functional anyway when we
created the swapchain for composition), and with D3D12 there is a
warning printed (with the debug layer enabled?) about this. So move
the call to the appropriate branch.

Change-Id: I266ae6835bcc49b3ba8d84e5d08ab9115c6401e0
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 300da03e3a0b80797e8cb9ddae90233244704691)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 10:29:48 +00:00
Laszlo Agocs
c12fa6b6fa rhi: vulkan: Shuffle post-1.0 phys.dev.feature queries
Make it so that what we query with regards to 1.1, 1.2, and 1.3 features
are stored for later use. This will be relevant for e.g. multiview where
the multiview field will need to be checked when deciding if the feature
is supported at run time.

All this is only really compatible with Vulkan 1.2 and newer. Vulkan 1.1
does not have the 1.2 approach, i.e. there is no
VkPhysicalDeviceVulkan11Features
in Vulkan 1.1 (!). That is a struct added in Vulkan 1.2. In 1.1 one had
the feature (extension) specific structs, such as
VkPhysicalDeviceMultiviewFeatures
in case of multiview. That we do not bother with at the moment.

Then again that's nothing new. The existing code to enable all features
with a few exceptions, that's already tied to the 1.2+ way of working
with physical device features, and not quite compatible with a pure
1.1 (not 1.0, not 1.2+) implementation (which should be hopefully rare
out there).

Change-Id: I661f2634651d28edd9b5feec66a423220920f894
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit fc3ee08737ab53b8ad033e50b3b14fc8bba4bca1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 10:29:47 +00:00
Laszlo Agocs
3ae6c1a307 rhi: d3d: Load DirectComposition library dynamically
Only for dev and 6.6, includes D3D12.
6.5 has its own dedicated version of the patch.

Fixes: QTBUG-114775
Task-number: QTBUG-114115
Change-Id: I36c96e046ba611b228fd5c320e5780ca4d180165
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit e7405dc14acc4f35d60e58f4f76b745dfd86f131)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 10:29:47 +00:00
Dennis Oberst
69fa86f81d QFuture: mention the work-stealing algorithm in the docs
A number of users have explored the behavior and complained about it.
Lets add a \note explaining this. The function in charge is
QThreadPool::stealAndRunRunnable(QRunnable *), which is a private
function, exclusively used by:

  QFutureInterfaceBase::waitForResult()
  QFutureInterfaceBase::waitForFinished()

also update the documentation to reflect these changes accordingly.

Fixes: QTBUG-112351
Change-Id: I839858cb449063d8af9bef64d2f35a6816a419b0
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 0235de994be7e04aca3456f1260b18313dd45b74)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 07:59:15 +00:00
Piotr Wierciński
604d25e238 wasm: update emscripten to 3.1.37
Qt 6.6 will require emscripten 3.1.37

Change-Id: Id036d799d5730ac8d8a5f7914d56a1ed421f9222
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
(cherry picked from commit 9f11a038b5294b27a98fc106183053535d6061dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-26 07:48:34 +00:00
Venugopal Shivashankar
2a0ba7258a 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.

Task-number: QTBUG-35605
Change-Id: I24201406114feaf8af21403b09375a2ee9a4709e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 4af07d6e54091e7a9e413b92b943eee41cb67bb8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-23 08:55:31 +00:00
Morten Sørvig
db46249c44 wasm: add "FS" to EXPORTED_METHODS
This is required when using the preload functionality
from qtloader.

Change-Id: Ib1bf8788b87834ba0ff80d563897040e093a16b9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit c2988de88d54ddd63d270964e4561a9fce10d11e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-23 08:44:31 +00:00
Morten Sørvig
6d4b9aadcf wasm: Document (and rename) config.qt.module
This property can take a either a WebAssembly.Module
or a promise to a module, and we don't have to specify
the exact type in the property name.

Change-Id: Iebaf52178253afe8c93cf78bbe0853461bf48b67
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
(cherry picked from commit bc340abe877199af640d16f1fbeaf4b96c36fe14)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-23 08:44:21 +00:00
Paul Olav Tvete
f2fc341c54 Fix for QQuaternion normalize when length > 1
If the length of the quaternion was slightly larger than 1,
the resulting quaternion would be invalid, causing
getAxisAndAngle() to fail.

Fixes: QTBUG-114313
Change-Id: I8f0616e74590dd6cfee0ce913d214c8e280c4df4
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit de9e978532ef5a3c212426f0e46de9059377968d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-23 08:20:03 +00:00
Doris Verria
7c32220284 iOS plugin: Make sure window is of type QUIWindow when determining the color scheme
In the iOS theme, we determine the color scheme based on the the last
UIWindow of the application, but listen to trait changes in the
QUIWindow class. However, the last window of the application is not
always a QUIWindow. Sometimes it can be a temporary UIWindow created
by the system for transitioning or other effects. These kind of windows
do not always follow the appearance of the app and the main window
(QUIWindow), so we were sometimes ending up with the wrong color scheme being reported.

This was happening when the app was put into background for example,
which causes the traitCollectionDidChange method to be called and query
the userInterfaceStyle of the last window to determine if the color scheme was changed. The queried window would sometimes end up being of type UITextEffectsWindow, etc. and report the wrong appearance.
To fix, always make sure to get the appearance from a QUIWindow.

Fixes: QTBUG-114571
Fixes: QTBUG-113169
Fixes: QTBUG-114191
Change-Id: Ic0b29c02c8e8100996d5cd31b37e6a5b839f5fb1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 551cbc5b15b46ca4b298a9dfe946f834e0cd2fed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-23 07:58:00 +00:00
Amir Masoud Abdol
18f8aae1f5 Set QT_COMMAND_LINE_PARSER_NO_GUI_MESSAGE_BOXES before TRY_RUN
Set `QT_COMMAND_LINE_PARSER_NO_GUI_MESSAGE_BOXES` before trying to run
qt tools for correctness. This is to suppress QCommandLinerParser from
showing a message box when console is not available.

Task-number: QTBUG-114530
Change-Id: Ib3d264a799a5da1f620d2bebe55539bafc43da0f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 45e17162ba9f030c067553c5c5e7fe8ec56c10aa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-23 07:53:42 +00:00
Amir Masoud Abdol
41670375f8 Resolve an issue with detecting GSSAPI on macOS
Spack, like VcPkg, sets the `CMAKE_FIND_FRAMEWORK` to `LAST`, as a
result, similar to VcPkg, when Spack is used, FindGSSAPI opts for
`gssapi_krb5` which is not what we want. By dropping the `gssapi_krb5`
from the list of alternative names we can resolve this without much
tinkering with internals of these package managers.

Fixes: QTBUG-114537
Change-Id: If517c409511f58e3bed78316a2030393dc249a40
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 1bf144ba78ff10d712b4de55d2797b9256948a1d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-23 07:53:40 +00:00
Amir Masoud Abdol
c9207ef38f Introduce QT_COMMAND_LINE_PARSER_NO_GUI_MESSAGE_BOXES environment var
Add an environment variable to be able to stop QCommandLinerParser
from showing GUI message boxes when console is not available.

Task-number: QTBUG-114530
Change-Id: I52500a2177894bc0bf2d20f9723ce3e8fe87420f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit cdcead0ab2a83b268e6cf1109b9af5f0abc31728)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-23 07:53:39 +00:00
Amir Masoud Abdol
d0262b4f95 Disable TEST_separate_debug_info when building with MSVC or on Apple
As mentioned, separate debug info will always be generated when building
with `-release -force-debug-info`.

Fixes: QTBUG-108015
Change-Id: I49e79177ca833007b932b58a76261c07acd52ca6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 059f4dc6f85525a07d0985ee90f845bd6208693b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-23 07:53:30 +00:00
Marc Mutz
6db8d06778 Q(Shared|Weak|)Pointer: mark ctors [[nodiscard]]
They're smart pointer classes, and QUIP-0019 says smart pointer class'
constructors should be marked [[nodiscard]].

Task-number: QTBUG-104164
Change-Id: I86b62571e64c2579b4151ffcb03d5bb32e0ac274
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 45ffb1790c25e4fbbbaafd9ddd936ef2dd819258)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-23 07:48:45 +00:00
Marc Mutz
38787f9507 Mark all remaining RAII/smart pointer class ctors [[nodiscard]]
... like QUIP-0019 suggests.

The main problem here is finding these classes. We don't have markup
for RAII classes, so I had to find them by name. This patch is based
on the output of

    git grep -we Q[A-Z0-9a-z_]+er

extracting the matches and piping them through sort -u, then removing
a lot of suffixes like Manager and Handler, then visually inspecting
the remaining list.

Task-number: QTBUG-104164
Change-Id: I59b18d8d0a0237fcc11047857adc39b984ad7fcb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 31d834a1c0d83d22fcf74624577013a558ad1974)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-23 07:48:40 +00:00
Marc Mutz
76a051047e QSharedPointer: mark create() [[nodiscard]]
It's a named constructor of a smart pointer class. QUIP-0019 says
constructors of such classes should be marked as [[noexcept]]. It
doesn't (yet) say anything about _named_ constructors, but it makes
sense to include them, too.

Task-number: QTBUG-104164
Change-Id: Ia4b43e4f819ce45d71274019c919fd98cc97878b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 51b97626857f13e785aae61c1beb16dc39601cd2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-22 04:30:25 +00:00
Marc Mutz
1a6e1660b1 QWeakPointer: mark lock() [[nodiscard]]
The lock() function, added for std::weak_ptr compatibility, sounds
like QMutex::lock(), but is, in fact, a const function. QUIP-0019 says
such functions must be marked [[nodiscard]]. For symmetry, also mark
toStrongRef() and toWeakRef() as [[nodiscard]].

Change-Id: Ifb6e447d2cd96fedd9a78decdfac6bc57c1d282a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 81d357ff8a7af8704ba5657caef04f28e7099625)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-22 04:30:19 +00:00
Axel Spoerl
850e926841 QDockWidget: Don't insert gap item if QDockWidgetGroupWindow has one
When a dock widget is hovered over a QDockWidgetGroupWindow, a gap item
is inserted at its potential docking position. Since only one item at a
time can be moved with the mouse, only one such gap item can exist.
QDockAreaLayoutInfo::insertGap() therefore contains an assertion, that
kicks in if a second gap item is inserted.

QDockWidgetGroupWindow::hover() checks if the dock widget is hovered
over a gap item. If that is the case, no additional gap item is
inserted. The check fails if a gap item exists in the group window, but
the dock widget is hovered over another part of that group window.
This can be the case if the group window already contains more than
one dock widget: By inserting the gap, the group window's size changes,
one of the existing dock widgets receives another hover event and a
second gap insertion is attempted.

This patch adds QDockAreaLayoutInfo::hasGapItem() to check if a gap
already exists. The method is queried in addition to prevent a second
gap insertion.

An autotest has not been added, because gap items appear and disappear
during hovering. The improved functionality can be tested manually with
the mainwindow example.

Fixes: QTBUG-112491
Fixes: QTBUG-114542
Change-Id: I9ea64e729873a86eb98ea950fbb066817fc25a07
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b26cdbd8777bf1348c7967138e59836990233121)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-22 04:18:20 +00:00
Axel Spoerl
bede24ee04 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.

Fixes: QTBUG-48161
Change-Id: I43aa16c2ecb4877abd8effb7da8e07576438d6d2
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 7993321e7620941f3106acb977243c51aa27ceec)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-22 04:18:01 +00:00
Axel Spoerl
a84d0b6bab 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
Change-Id: I7b194dfc71abea6f2bbaaae18270c80eb15afb4d
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 787b4c1506aba7e83d861e178329a18c6ec34322)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-22 04:17:17 +00:00
Axel Spoerl
596c9a71fa Don't double draw ItemViewItems' icons in QStyleSheetStyle::drawControl
To draw a CE_ItemViewItem QStyleSheetStyle::drawControl lets parts
of the element being drawn by QWindowsStyle, others by baseStyle().
If the ItemViewItem has an icon, it can lead to the icon being drawn
twice: Once by QWindowsStyle, respecting options set in the stylesheet.
Once by the baseStyle(), not respecting stylesheet options.

When the style sheet modifies the icon's position, the icon will be
drawn at this position as well as on the default position.

This patch prevents an icon to be drawn by baseStyle() when it has
already been drawn by the QWindowsStyle.

Fixes: QTBUG-110942
Change-Id: I8622dfe95bef13b196a3e38025fac1cc92f097c9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 30cf6ed32f3e38c8623cbafbb25b4ce558d370f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-22 04:16:01 +00:00
Yuhang Zhao
0af9bb58e1 rhi: fix compilation error when using rhi headers
Without this patch, the compiler will complain about can't find
"qshaderdescription.h" when using "qrhigles2_p.h" from outside of
Qt, which breaks user project compilation.

Change-Id: I9e201d82890c92ddd2f6aad48eef0edc9a7c46ef
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 055bc81bd14aacde68c6404c0ec5f8346a22d105)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-22 01:13:47 +00:00
Martin Jansa
d173d73f26 tinycbor: fix build with gcc-13
* fixes:
  http://errors.yoctoproject.org/Errors/Details/701753/

qtbase/6.5.0-r0/git/tests/auto/corelib/serialization/qcborstreamwriter/../../../../../src/3rdparty/tinycbor/tests/encoder/data.cpp:242:90: error: invalid user-defined conversion from 'float' to 'const qfloat16&' [-fpermissive]
  242 |     QTest::newRow("nan_f16") << raw("\xf9\x7e\0") << QVariant::fromValue<qfloat16>(myNaNf());
      |                                                                                    ~~~~~~^~
n file included from TOPDIR/tmp-glibc/work/core2-64-oe-linux/qtbase/6.5.0-r0/image/usr/include/QtCore/qmetatype.h:14,
                 from TOPDIR/tmp-glibc/work/core2-64-oe-linux/qtbase/6.5.0-r0/image/usr/include/QtTest/qtestcase.h:11,
                 from TOPDIR/tmp-glibc/work/core2-64-oe-linux/qtbase/6.5.0-r0/image/usr/include/QtTest/qtest.h:13,
                 from TOPDIR/tmp-glibc/work/core2-64-oe-linux/qtbase/6.5.0-r0/image/usr/include/QtTest/QTest:1,
                 from TOPDIR/tmp-glibc/work/core2-64-oe-linux/qtbase/6.5.0-r0/git/tests/auto/corelib/serialization/qcborstreamwriter/tst_qcborstreamwriter.cpp:4:
TOPDIR/tmp-glibc/work/core2-64-oe-linux/qtbase/6.5.0-r0/image/usr/include/QtCore/qfloat16.h:81:22: note: candidate is: 'constexpr qfloat16::qfloat16(NativeType)' (near match)
   81 |     constexpr inline qfloat16(NativeType f) : f(f) {}
      |                      ^~~~~~~~
TOPDIR/tmp-glibc/work/core2-64-oe-linux/qtbase/6.5.0-r0/image/usr/include/QtCore/qfloat16.h:81:22: note:   conversion of argument 1 would be ill-formed:
TOPDIR/tmp-glibc/work/core2-64-oe-linux/qtbase/6.5.0-r0/git/tests/auto/corelib/serialization/qcborstreamwriter/../../../../../src/3rdparty/tinycbor/tests/encoder/data.cpp:242:90: warning: converting to 'qfloat16::NativeType' {aka '_Float16'} from 'float' with greater conversion rank
  242 |     QTest::newRow("nan_f16") << raw("\xf9\x7e\0") << QVariant::fromValue<qfloat16>(myNaNf());
      |                                                                                    ~~~~~~^~
TOPDIR/tmp-glibc/work/core2-64-oe-linux/qtbase/6.5.0-r0/git/tests/auto/corelib/serialization/qcborstreamwriter/../../../../../src/3rdparty/tinycbor/tests/encoder/data.cpp:242:90: warning: converting to 'qfloat16::NativeType' {aka '_Float16'} from 'float' with greater conversion rank
TOPDIR/tmp-glibc/work/core2-64-oe-linux/qtbase/6.5.0-r0/image/usr/include/QtCore/qfloat16.h:81:42: note:   initializing argument 1 of 'constexpr qfloat16::qfloat16(NativeType)'
   81 |     constexpr inline qfloat16(NativeType f) : f(f) {}
      |                               ~~~~~~~~~~~^
In file included from TOPDIR/tmp-glibc/work/core2-64-oe-linux/qtbase/6.5.0-r0/image/usr/include/QtCore/qmetaobject.h:9,
                 from TOPDIR/tmp-glibc/work/core2-64-oe-linux/qtbase/6.5.0-r0/image/usr/include/QtTest/qtestcase.h:12:
TOPDIR/tmp-glibc/work/core2-64-oe-linux/qtbase/6.5.0-r0/image/usr/include/QtCore/qvariant.h:435:43: note:   initializing argument 1 of 'static std::enable_if_t<(is_copy_constructible_v<T> && is_destructible_v<T>), QVariant> QVariant::fromValue(const T&) [with T = qfloat16; std::enable_if_t<(is_copy_constructible_v<T> && is_destructible_v<T>), QVariant> = QVariant]'
  435 |     static inline auto fromValue(const T &value)
      |                                  ~~~~~~~~~^~~~~

Fixes: QTBUG-114785
Change-Id: I4876ebd8890eee883a0d1a2bef8cb7aec4fd0f2f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3e801b5477a7abfe4b87f20639e345bf3dc7eca8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 23:20:43 +00:00
Marc Mutz
69daaaea46 qcompilerdetection.h: move Q_NODISCARD_CTOR def near Q_REQUIRED_RESULT
They both check __has_cpp_attribute(nodiscard), so keep them together.

Move the fall-back (empty) definition to the block that does the same
for all other such macros.

Mention that both P1771 ([[nodiscard]] for ctors) and P1301
([[nodiscard("reason")]]) use the same numerical value.

Amends 959800f6de137f6a77c7d5a2741a5bae0638cbd9.

Change-Id: I0ef913b6076ffa4058220b542303591de6fefde7
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 58352e7f9aece796b4d95fddc027e817ef640785)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 20:13:45 +00:00
Marc Mutz
15b9a1e6d5 Div. private RAII/smart ptr classes: mark ctors [[nodiscard]]
The following private APIs are either RAII or smart pointer classes:

- QAutoPointer
- QBoolBlocker
- QFdContainer

QUIP-0019 says to mark RAII and smart pointer class ctors
[[nodiscard]], so do that.

Task-number: QTBUG-104164
Change-Id: Ibc77e6603fadf18ea28428a49635f46a5680b777
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 25e20d5537b2a7682c34a9837076530ad220b3b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 20:13:45 +00:00
Marc Mutz
53f88aa737 QPixmapCache: don't leak QString keys of evicted pixmap
It's not a real leak in that the string data is being freed on program
exit (or, more recently, QPixmapCache::clear()), but it can lead to
lots of memory being bound for much longer than expected when users
put in new QString keys without attempting to retrive them again. It
can also lead to problems with QStringLiterals lingering around until
after their underlying data has been freed. A bug in the Fusion style,
generating new string keys for identical state, exposed this
misbehavior, and one way to fix the resulting issue for the user is to
make sure that QPixmapCache doesn't leak QString keys.

The Fusion style issue with generating non-repeating keys for use with
QPixmapCache should also be fixed, eventually, but this patch
relegates that to an optimization issue (the caching is effectively
non-existent), the resource exhaustion is gone now.

The issue exists because the QString keys are internally mapped to
QPixmapCache::Key's by way of a QHash<QString, Key> cacheKeys data
structure. When the QCache, indexed by Key, not QString, decides to
evict an entry, the Key is invalidated, but no-one was removing the
corresponding entry from cacheKeys. So make the existing releaseKey(),
used to invalidate copies of Keys referring to evicted pixmaps, do
that, now. So as not to have to scan the whole cacheKeys QHash for the
right Key, store the QString key, if any, inside the Key, so
releaseKey() can retrieve it and use it for O(1) erasure from
cacheKey.

This allows removing the previous work-around in clear()
(6ab0d25a09f5aeb7a5a062f7fd44e95ca761e21e), greatly simplify
object(QString), and requires to rewrite all code that holds iterators
or references into cacheKeys over an insertion into or removal from
the QCache. Two (insert() and remove()) have already been done in
prequel commits, so only flushDetachedPixmaps() was left.

Fixes: QTBUG-112200
Change-Id: Ic93b0ed388ae963267fe242b491c6c941d146b99
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 56644240851443b1259bff2098d221068dd3e8b5)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-06-21 22:13:45 +02:00
Thiago Macieira
4f8b0c7e3e QProcess/Unix: disable vfork() under ASan
Change-Id: I443cf0c8a76243eead33fffd1768ee771eca2d56
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit 94ec17436cbdab52ed85e15ea197b538541b14ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 20:13:45 +00:00
Thiago Macieira
12b43d3902 QProcess/Unix: fix setting SIGPIPE to SIG_IGN where SIG_DFL was intended
And take the opportunity to clarify what the QtVforkSafe namespace is
doing. Amends commit e71c226d6f188abd811b28d3cb7529343f52d61f.

Change-Id: I443cf0c8a76243eead33fffd1767f3fa390a7cdd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
(cherry picked from commit c4a0a76deca0bc5082fb561004bc0d29a8de9978)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 20:13:44 +00:00
Morten Sørvig
081dd8d7f0 wasm: enable asyncify for batched tests only
It should be possible to build a test in any configuration
by building Qt in that configuration, and then building
the test with qt-standalone-test.

Not all Qt configurations will be able to run all tests,
(due to exec() calls and similar) but that's OK - some
tests don't have exec() calls, and we want to be able
to run tests for a given configuration to figure out
how well it works.

On CI we want to use batching and asyncify, so it makes
sense to tie usage of asyncify to batching.

Change-Id: I05553d250a45c1831f43dc71a43ef02d01d70535
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
(cherry picked from commit 70f5d396be1c7d20784ef93a59a73099a02e0f5b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 20:13:44 +00:00
Marc Mutz
7f987d8bd5 Document Q_NODISCARD_CTOR
Found in API review.

Amends 959800f6de137f6a77c7d5a2741a5bae0638cbd9.

Change-Id: I00877ce7030c638765b495089899c022deb31a27
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 4968f8418f65dca54078c3565de8db3b777686c4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 20:13:35 +00:00
Marc Mutz
f897f722e3 QFutureSynchronizer: mark ctors [[nodiscard]]
QFutureSynchronizer is a RAII class. QUIP-0019 says that RAII class
ctors should be marked as [[nodiscard]].

Task-number: QTBUG-104164
Change-Id: I0b6710f2b9a14d67f64150f240f819b8336e0929
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit f403ef428efab5af857e85d9d28c5f7b64603ec0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 20:13:35 +00:00
Marc Mutz
f1adc51ca4 QFutureSynchronizer: fix aliasing problem in setFuture()
When setFuture() was handed an element of m_futures, it would hold the
reference to past the clear(), which invalidates said reference.

Fix by taking the future by value instead of by cref.

While append() is not affected, as QList::append() already guards
against aliasing, do the same change there, both for consistency as
well as to optimize the common case of passing rvalues. It also means
we can use the rvalue overload of QList::append(), skipping the alias
analysis in the lvalue QList::append().

[ChangeLog][QtConcurrent][QFutureSynchronizer] Fixed a crash in
setFuture() if the argument was already a member of
QFutureSynchronizer::futures().

Change-Id: Ic0b212b9f265a746df9a6beb6272a5415d131442
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit e8dcbaaaf61ee2164db61e70a5d61d7a5b849371)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 20:13:35 +00:00
Laszlo Agocs
5feaf7ffaa rhi: D3D-related doc cleanups
Change-Id: I46f1b10c49841719bf54e52b58ee565b963ca21c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit b2bfd757f7c537753b95140c3fe89bd2b60a1cb8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 20:13:35 +00:00
Laszlo Agocs
45e2533ebf rhi: Follow gles2_p private header fix for d3d11/12
Just in case someone includes the private headers outside of Qt.

Change-Id: I79232d2bab7604c71c31226a67ec3ef40210d161
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 952f6f2e915a90d55ff38b532a3692e87f151e33)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 20:13:35 +00:00
Laszlo Agocs
de01c5ecb8 Do away with qrhivulkanext_p.h
This is not scalable. Instead of putting parts of post-1.0 vulkan_core.h
into this header, apply the appropriate ifdefs instead.

Change-Id: I21a9d6f7c51169efa7b66705545bae192ed30c14
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit 497c0f1b0d920a934147f1bd3abcd40daa67828f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 20:13:34 +00:00
Mårten Nordheim
0ca64287f8 tst_QSslSocket: ignore order of sslErrors list
In Schannel it is not guaranteed CertificateBlacklisted will be the
first error emitted. And it really does not make a difference anyway.

Change-Id: If041f913db9e78ac54e6f8bb2ba1bda110e7d64a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit e09b1373c2b761f20cd930f95119306d59068c80)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 20:13:34 +00:00
Mårten Nordheim
afee9d90b8 Update public suffix list
Task-number: QTBUG-114548
Change-Id: I5857438aeb1902cd68ceffe4e5179e7bbdf9b44b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 8da8126bae030c7ab33ca02b7ef816b667a6cdb0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 20:13:34 +00:00
Mårten Nordheim
3f3f46d615 FontEngine: Skip 0-width glyphs when finding first left bearing
Since they don't contribute to the width of a string then we may
accidentally end up ignoring the potential left-bearing that the first
non-zero-width glyph has.

Task-number: QTBUG-113679
Change-Id: I8e89a428acf5d0a3da0255c50778ccc773ff20e1
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 8469b369287609ed7b179ff846d64c8b408498ca)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 20:13:34 +00:00
Mårten Nordheim
e799b3de67 FontEngine[directwrite]: include leftBearing for boundingBox for glyphs
It was always 0

Task-number: QTBUG-113679
Change-Id: I090036296ad2df99b986400863b1e57a5d6101fb
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 1fcbe0f6c24eff66add23bcc6212451a87d64c05)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 20:13:34 +00:00
Mårten Nordheim
49f488c855 QStringView: size is encoded with code units not code points
Code points is what you get when surrogate pairs have been joined

Change-Id: I86c4131de5782ce1e6342217947a603ca16bb521
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 054a64ce67421b213df73a9bcfda3fa6e9c6e64f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 20:13:34 +00:00
Marc Mutz
211ff8ac53 QPixmapCache: Move qHash(Key) from _p.h to public header
... and make it a hidden friend.

This avoids ODR violations when, because they can't use ours (private,
and not exported), users try to produce their own version of
qHash(Key).

[ChangeLog][QtGui][QPixmapCache] Made the qHash() overload for
QPixmapCache::Key public (was: private) API.

Change-Id: I324ed001c0ae0a251ac2e1d04713013452ffff9c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7fa3267fda6cff720cca44e829f9a39789031a54)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 14:20:01 +00:00
Marc Mutz
2df17d56b9 QMessageBox: cut out the _q_requireVersion() middle-man
Just de-inline the original function instead of merely moving its
implementation into an out-of-line function.

Amends 408fbd3f2d7a6b87521f5b3c27ecf6341dc06e13.

Change-Id: I6860a10e0a7d876ce1837f196b1fb4165779540a
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 91efd6116665bd71f7932adcf7a589204c239276)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 14:19:51 +00:00
Marc Mutz
11e0a4fc5e QMessageBox: use optional<> instead of unique_ptr
... to hold the optional QApplication.

Saves a memory allocation, and is more readable.

Amends 408fbd3f2d7a6b87521f5b3c27ecf6341dc06e13.

Change-Id: I390b9cfa367d01feb59bb5deadc5383c8e678749
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 2389b93b7991e96dc189e44cf5ea7ca894224d30)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 14:19:46 +00:00
Marc Mutz
1c79aab50d QMessageBox: use %ls and qUtf6Printable()
... instead of %s and qPrintable()

Less operations, less code expansion.

Amends 408fbd3f2d7a6b87521f5b3c27ecf6341dc06e13.

Change-Id: I5a3d2e79623bd32c348a2d655e3a2c8d98eca1e3
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 1e626c135b7376bdbc6b2a27124afe66a802dfb0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 14:19:37 +00:00
Topi Reinio
9772069ade Doc: Mark QThemeIconEngine, QIconLoaderEngine classes as \internal
Fixes QDoc warning: 'Documentation for class has no \inmodule command'
for both classes.

Change-Id: I59eb5f5b935ea30f756d655158a06f390d2ebc54
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 77f7c3a45d83ed14dbe92ed7ae2f8ccc95d2eed1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 13:20:11 +00:00
Topi Reinio
fa2940fa33 Doc: Remove \target commands from the qmake manual
A \target defines a global doc linking target across all Qt modules,
and they may interfere with link targets local to module documentation.

As we no longer link as heavily to qmake manual after moving to CMake,
remove the \target commands. The section titles remain as valid link
targets; arguably, duplicating a \section1 title with an identical
\target name was unnecessary in any case.

Replace all \l command arguments that used the \target for linking
with the actual section title.

Fixes: QTBUG-114073
Change-Id: I6e595a77268cbd6ddb5d004501bc6df178c3883d
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 4aac1ca91fa74c4539d79388a324c3f8ce12aa51)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 13:20:05 +00:00
Jan Arve Sæther
5ec1f39f4c Move imagine/musicplayer to tests/manual/imagine/musicplayer
imagine/automotive already demonstrate the imagine style

Task-number: QTBUG-108751
Change-Id: I8ed52242e3a522f934cef7bcb299ce8fbcbdb601
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit 2c9732250b25ff126bbcfd17110ca2e797de46a5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 13:19:15 +00:00
Laszlo Agocs
266be57eed rhi: Adjust some HDR-related docs and notes
Change-Id: I3b5709358fc572ad2214527b19d027c93a0af745
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 5328fdd8baa813c4a170501c2fad740dc2d0b433)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 13:09:15 +00:00
Laszlo Agocs
6f956279f8 rhiwindow example: Make -g option (OpenGL) work on macOS
Of course we managed to rely on a GLSL feature that is only
in GLSL 130 and newer, not 120 which is what the default 2.1 OpenGL
contexts support on macOS.

Change-Id: Ib75e750ea15d59e51b2207669068fba7719a48b1
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 204c91c971dd2432af96e3586a706cdbc530e6f2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 13:09:14 +00:00
Ulf Hermann
8529d537ac QMetaContainer: Allow retrieving the d pointer
This is in line with how QMetaType handles QMetaTypeInterface*. You can
retrieve a const pointer to it.

Task-number: QTBUG-113690
Change-Id: Iaf3c10603dc6049a5553987c90006807867abc0d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 937751f427fd0cfd8d5f9a8722309e4870eb5e7d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 06:44:31 +00:00
Arno Rehn
f0765c556d QPromise: Propagate cancellation through failure handlers
Previously, failure handlers did not propagate cancellation. This would
lead to crashes when a QPromise was cancelled without having generated
any result. Subsequent continuations would be invoked and try to access
the result (which was nonexistent) and then crash.
This patch propagates cancellation through failure handlers to prevent
subsequent continuations from being called in the first place.

Fixes: QTBUG-114606
Change-Id: I23b28a8e70a76e1ba6416be4440360c6dbaef2a3
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 855c4484693015cb6498f2183d95de1377d49898)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 06:43:48 +00:00
Marc Mutz
40b99f7fc6 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 aea500d5d76864bb1a3918e338ca6806e1766e41.

Change-Id: I57ef5c53999869aa3454fbbaad884c1d18591b2a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 8d39b2165596f0aaae0e5841eb4c849cf4ee1bb0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 06:35:13 +00:00
Marc Mutz
c67f69ce29 tst_qmenu: fix -Wsuggest-override
... and fix placement of {.

Amends f0049873d2ce0742a2df7ce265db70ca8baa8442.

Change-Id: I2479087005d350a23e45eda126a89e0be91c0701
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit c41e03008aff89af5e63177970cc0333260f89e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 06:35:08 +00:00
Marc Mutz
55fbb4c372 tst_QPixmapCache: check we leak QString keys of evicted pixmaps
Task-number: QTBUG-112200
Change-Id: Icf0a40b68a4ef3ec930a74b47e6ca88d9d0060ca
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b74ef9ee48127c8cb65a87d7cf943134b8ef6886)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 06:35:02 +00:00
Marc Mutz
9d6543ea40 QPixmapCache: DRY insert()
Implement insert(QString, QPixmap) in terms of insert(QPixmap) to
avoid duplicating code and to separate concerns: insert(QString,
QPixmap) is now only dealing with the cacheKeys, insert(QPixmap) is
only concerned with the Key-based lookup.

Task-number: QTBUG-112200
Change-Id: I30394da43a5e93b7bd41ef9ce9c7aea044523c30
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit aa8e8e94b99dfff8613bcbcc8ac6de5d0d8bcb12)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 06:34:56 +00:00
Marc Mutz
8050a66a8d QPixmapCache: simplify remove(QString)
The previous code used `cacheKey` as the name of an iterator, which
made the code hard to understand.

Instead of renaming that to the more idiomatic `it`, use QHash::take()
to get an actual `cacheKey` back, and then delegate to
QPMCache::remove(QPixmapCache::Key) for the actual removal.

Task-number: QTBUG-112200
Change-Id: I9311c19f12a05cad694702672f17ae19ba339b04
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c2bcba93a67ed980021304c3bbca5556b4cc3add)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 06:34:52 +00:00
Marc Mutz
ae04c6a16f QMac{,RootLevel}AutoReleasePool: mark ctors [[nodiscard]]
They're RAII classes, and QUIP-0019 says RAII class' constructors
should be marked [[nodiscard]].

Task-number: QTBUG-104164
Change-Id: I0080f5b6a3cea346c0860e00958a8c204849040e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit ffed431293cb0fcb85bdda2e1c4db9bda79a00fc)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-06-21 08:34:32 +02:00
Marc Mutz
ae41507317 QDebugStateSaver: mark ctors [[nodiscard]]
It's a RAII class, and RAII classes should have only [[nodiscard]]
constructors.

Task-number: QTBUG-104164
Change-Id: Ia83fa003677a839734208b12bde2c6287c1b79a3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 8cad4c2903d014bb755bd2349f9c4d127a87cc7a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 06:34:26 +00:00
Marc Mutz
b04a8a90f8 QMacAutoReleasePool: unexport
We should not export non-polymorphic 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.

Task-number: QTBUG-104164
Change-Id: I2e98782160cccb9c0f59a68e67ffd29fec42b728
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 2a76cf81811c9406c75726d7743a28ec79fadb37)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 06:34:21 +00:00
Marc Mutz
c6f7b8aa46 QAppleRefCounted hierarchy: mark ctors [[nodiscard]]
They're RAII/smart pointer-like classes. QUIP-0019 says such classes'
ctors should be marked [[nodiscard]].

Task-number: QTBUG-104164
Change-Id: I830badfa56fbdfb5819866f67b84cd4fa93acbde
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 83a156cd1139950dd333b3151d16a86ce19b06d2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 06:34:15 +00:00
Marc Mutz
82005725c2 QDockAreaLayoutInfo: fix QDebug stream operator
The existing implementation as a member function QDALI::op<<(QDebug)
cannot possibly work, as the implicit `this` argument comes first in
this case, while for streaming operators, the QDebug object must come
first.

Rewrite as a hidden friend and apply QT_NO_DEBUG_STREAM protection as
a drive-by.

Amends faec937756810bbc478da677efb0dca4531a6222.

Task-number: QTBUG-114542
Task-number: QTBUG-112491
Change-Id: Ida400d335491896ec49f2c0f9601a8430eebcd4d
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 46aa713c34c7bc90f3981b3d723591149572203c)
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-06-21 08:34:01 +02:00
Axel Spoerl
22dc39a8d7 Implement debug operator for QDockAreaLayoutItem
QDockAreaLayout items can be widgets, gap or placeholder items.
They appear and disappear during hovering.

This adds a debug operator to make troubleshooting easier.

Task-number: QTBUG-114542
Task-number: QTBUG-112491
Change-Id: I0fa5d3c96ab91838f28ad7cec3c049fd39f47576
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit faec937756810bbc478da677efb0dca4531a6222)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-21 06:33:56 +00:00
Ahmad Samir
8d82e24f95 Moc: fix narrowing conversion warnings with range-for loops
Change-Id: I6dee1a6ae82c33bd6523734ee32ab4c83835f9d8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit db9e206deecab7b78dd2177d4bcaf6415fb84c94)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-20 19:51:03 +03:00
Alexey Edelev
87fc863c27 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.

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>
(cherry picked from commit 28c9625d00d084cfc226c979be52231df7f5d3e3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-20 12:31:51 +00:00
Marc Mutz
308d0b5f96 Q(Explicitly)SharedDataPointer: mark ctors [[nodiscard]]
They're RAII classes, and RAII class' constructors should be marked
[[nodiscard]].

Task-number: QTBUG-104164
Change-Id: If4265a431839a5d3c16dcc855b1ded2d2fc7408c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c823bc2fdba412e867373ef60be8c48feb3c1a48)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-20 12:17:32 +00:00
Marc Mutz
c62e0ed703 QScoped(Array)Pointer: remove the class-level [[nodiscard]]
It was used as a work-around for constructor-level [[nodiscard]]
missing in C++17, but a) compilers are free to implement [[nodiscard]]
for constructors in C++17 (P1771 was not considered a normative
change, just a clarification of the existing wording), and b) prevents
useful code that returns such types from functions.

Task-number: QTBUG-104164
Change-Id: I440b418d58e86118e84689adb06d239ca598afcc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 21c344a221c1d7712a04d990958b211e2dd8a263)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-20 12:17:25 +00:00
Marc Mutz
2c07d59092 Q(Read|Write)Locker: mark ctors [[nodiscard]]
They're RAII classes, and RAII class' constructors should be marked
[[nodiscard]].

Task-number: QTBUG-104164
Change-Id: I9b91c18e67e99bf84abdd12236a18a8c4ec39620
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6dba28419bf6e8ee401708650bb60347bb79d978)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-20 12:16:43 +00:00
Marc Mutz
d082bf07a9 Mark all ctors of [[nodiscard]] classes as Q_NODISCARD_CTOR
This works around around the difference in class-level [[nodiscard]]
behavior between Clang and GCC. While Clang already warns about

    QClass(~~~args~~~);

when QClass is marked as [[nodiscard]] at the class level, GCC does
not, and requires the ctor to be marked as [[nodiscard]] instead.

Fixes: QTBUG-104164
Change-Id: Ifd7076ee422fb9472ae8bbba43d9bfeee1968a78
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 603d6351cc32d07a5e4c349d6dc3db0889c3b120)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-20 12:16:36 +00:00
Fabian Kosmale
295ecd9b87 QBindable: Fix out-of-bound access in non-bindable property support code
QObjectPrivate::getPropertyAdaptorSlotObject called
connectionsForSignal.
Calling this function is only safe after it has been ensured beforehand that the vector has size > signalIndex. As getPropertyAdaptorSlotObject
is not supposed to modify the vector, it does not resize the vector and it could consequently end up with an out-of-bounds read.

To avoid that issue, we instead first check if the vector can
potentially contain an entry for the signal. If not, we simply return
nullptr, and avoid the call to connectionsForSignal.

The issue and its fix can be verified by running the modified
tst_qproperty test with ASAN enabled. The test is modified in the
following way:
- We first create a signal connection to a dummy slot. Otherwise,
  connections.loadRelaxed() would return a nullptr, and the problematic
  code would never be reached.
- We add enough signals to ensure that the fooChanged signal will
  actually be out of reach (which means >= 8 signals, as the initial
  capacity of the vector is 8)
Running the test without ASAN will most likely not result in a failure,
as then the out-of-bounds read will simply read garbage, and the most
likely result is that the cast below will fail.

Change-Id: I18a3c4f52769c2b6491a685abb84f6fcfb44e4d8
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 96e1381a0a61a5b26f7147516f107765dbfc083e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-20 12:08:37 +00:00
Volker Hilsheimer
bdeb45c2e2 QKeySequenceEdit: don't finish when opening a context menu
Right-clicking in a QKeySequenceEdit opens the usual context menu for a
line edit, which generates a focusOut event. QKeySequenceEdit finishes
the recording when it loses focus, which includes deselecting the text.

We should not finish or deselect if the focusOut event has focusReason
FocusReasonPopup, as otherwise users cannot copy the text (keyboard
shortcuts don't work for that, obviously).

Task-number: QTBUG-114624
Change-Id: I0b3c535c189151daa29cf17640493f3353e6394b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit 89566bf7491cd717a6f64a0a8b82306309bb0701)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-20 11:53:57 +00:00
Volker Hilsheimer
848c017165 macOS: work around getting invalid result from NSAlert::runModal
It is possible for an application to trigger the unexpected result of
NSModalResponseContinue from our call to NSAlert::runModal, by showing
and hiding a modal dialog first, and processing events explicitly. This
at best only flashes the native message box, at worst it triggers an
assert from our processResponse function evaluating that response value
as impossible (via Q_UNREACHABLE).

We should never call processResponse with NSModalResponseContinue,
but instead keep the modal loop running and the dialog visible.
So introduce a wrapper to NSAlert::runModal that keeps calling that
method until we get a result other than NSModalResponseContinue.

Writing an auto test for this failed; a simple test didn't reproduce the
assert; trying to place the opening of the native message box into a
lambda that would be called by the event loop (simulating the button
press from the bug report's reproducer) resulted in the native message
box never closing and the test blocking (and still not triggering the
assert).

Fixes: QTBUG-114546
Change-Id: Iab25eff55c48b103287d1881ac355e6cdd190f7a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 2c458a82213ae568ad708e07ee9ed5f4e494a800)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-20 11:53:38 +00:00
Alexey Edelev
15de36f97b Fix typo in qt_internal_add_global_definition
Fix the argument prefix that is used in the cmake_parse_arguments call.

Change-Id: Ie02bdf7d2769ce084b0d173c1e8152ca6fc4fe53
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 4e74fa811907ba981304bed27b093d67106e9986)
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
2023-06-19 15:36:00 +00:00
Liang Qi
b2222ec0d3 Android: use logging category for im debug
Change-Id: I78e84313841f83416dee6b6b2970b402acce5060
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit b992aabd89a150fbb32feb7508cfcaad95fe486a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-19 15:15:17 +00:00
Matthias Rauter
10950d87f7 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
Change-Id: I8a6fb6b7ec77457854a75e20277565d1eb89bab6
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit ef7d809eaf3be2e162a274b48a6ac8051a51e86d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-19 06:26:36 +00:00
Fabian Kosmale
838f66be51 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
Change-Id: Ic94edb69f04b9150aea2c8e6d004a8b9e5cf12ec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 44b5ad01f0da55a351e0855e1173acfbef77221d)
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-06-19 08:14:53 +02:00
Thiago Macieira
c63a3a46be Q*ValueRef: suppress MSVC warning on deriving from non-exported base
Warning C4275 non dll-interface class 'QJsonValueConstRef' used as base for dll-interface class 'QJsonValueRef' UniRemoteAdapter C:\qt\Qt6.5.1\6.5.1\msvc2019_64\include\QtCore\qjsonvalue.h 219

Fixes: QTBUG-114629
Change-Id: I443cf0c8a76243eead33fffd176930f96c43eb47
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 674aa084c2d561d2377d8f8a8de1e3e7e60666f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-19 06:04:08 +00:00
Amir Masoud Abdol
c9630e3afa Disable TRY_RUN when cross compiling
Fixes: QTBUG-114625
Change-Id: Idec5ea438ebf3f88d63da7d956ab52e2a0fa1821
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
(cherry picked from commit 331f316b91c49ee53638053ff8a9bc14517f17d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-17 18:26:23 +00:00
Tor Arne Vestbø
456896aa6b Unify QIcon theme icon loading and cache invalidation
The logic for invalidating a theme QIcon when the platform theme
changed, or when the user set an explicit icon theme, was tied
to QIconLoaderEngine, so any platform theme implementing
QPlatformTheme::createIconEngine() with a custom icon engine
would not take part in this cache invalidation.

As we want users of QIcon::fromTheme to be agnostic to where the
icon is actually coming from, and have a consistent behavior for
the various QIcon APIs for setting explicit themes, the logic
for invalidating the themed icon has now been moved up one
layer, to a new QThemeIconEngine, that is responsible for
lazily creating the actual engine based on the name. The
engine proxies the actual icon loading through to the
real engine via a new QProxyIconEngine helper class.

Change-Id: I474589981f751d7467e3073533cba542182f2d36
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit a452e2254644ffbed289fdf051eaf41d7e6a3b0d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-17 18:02:37 +00:00
Tor Arne Vestbø
bb08b96b29 Add missing QApplication include in streambookmarks example
Amends 3ccf2f8308ba33cab575c22ad2e246b987a3dc0c.

Change-Id: Ib51777ef9af44aff7fbb813b58eb0fbb74761373
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 14f31bf16e9eb5c31a944711225af90f23123a5c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-17 15:41:49 +00:00
Friedemann Kleint
7de02e230c QMessageBox: Remove include of qdebug.h
Move the implementation qRequireVersion() to prevent having
to include qdebug.h which pulls in many other headers.

Amends b5d874e36fd39fa6e57ff27db27ae0b029949749.

Fix missing include introduced by
3a553507a134bee1562d34ebbf786a053d36fc05.

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>
(cherry picked from commit 408fbd3f2d7a6b87521f5b3c27ecf6341dc06e13)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-17 13:28:27 +00:00
Thiago Macieira
0b8d30efec 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 ccf74b592809e0c5a613eff27d6431a4c659e368
(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

Change-Id: I63b988479db546dabffcfffd17661c839014771a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 166e7922695e9b145e0ce33e3674a1716021a1e3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-17 02:50:54 +00:00
Amir Masoud Abdol
4feb6662dc Use QT_64BIT instead of checking CMAKE_SIZEOF_VOID_P
Change-Id: I7db7b8f6c354df264a467538fffffab726ea1b61
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit c5b0fa6082b69d3e5d78b35225daf516adb843e7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-17 00:08:49 +00:00
Amir Masoud Abdol
f5bad37873 Silence a warning in EGL check
There is a chance that an unused variable warning will be treated as an
error, and in that case, this check will fail, and as a result FindEGL
will fail.

Fixes: QTBUG-114431
Change-Id: Iaac49589144dbe4172ec58c6705a9f899c25f01f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 14b01b0aadfac07e2a87cea4af0b09b874ffa100)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-17 00:08:49 +00:00
Laszlo Agocs
d0973a46e6 rhi doc: Fix a repeating typo
Change-Id: I2025d559be357a6825cdcae4cb0f0931a89864ab
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 684070bc342ac8e041c7156f0aa594b89b2265db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-16 21:59:16 +00:00
Morten Sørvig
97c40bf5bf wasm: expose windows before delivering updates
Don't show a blank frame on app startup.

The wasm update request system supports two types of update
requests: Expose and UpdateRequest. It can happen that both
types of request are made for a single window, in which case
the current code prefers UpdateRequest, since those must be
delivered in order to keep QWindow in a consistent state.

However, if the window is visible but not yet exposed then
delivering the update request will not make the window paint
anything, and we end up with a blank frame.

Ideally this should be handled elsewhere and QWindow::requestUpdate()
should not be called for non-exposed windows, but in the
case does happen then sending an expose here allows us to
recover.

Change-Id: Ib53050c33ad1769ea9b9ad678896af15f87a7ecb
(cherry picked from commit 4c18ebbc1c0bddca4b19a585d2d3a5dafdefc4a3)
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-06-16 22:59:06 +02:00
Morten Sørvig
66414b36fd wasm: log stack traces for exceptions
This is very useful for debugging.

Change-Id: I4861afb9bd2b4e757a962d81583a8b12958f9f1c
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 9e0cb768cd3098e6de253913621887351f719d72)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-16 20:59:05 +00:00
Edward Welbourne
8b693cd135 There is no frank.xbel so don't tell qmake to find it
Both the DOM and XML stream versions of the XBEL bookmarks example had
a frank.xbel in their EXAMPLE_FILES, but there is no such file. So
asking qmake to include it is spurious.

Task-number: QTBUG-111228
Change-Id: Iec08042d181fc09c2c428685ce841a13161ab273
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 8e1b60b33126a48acb0af14d938ceeb3b79f8891)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-16 22:59:05 +02:00
Edward Welbourne
f2995dc15a XBEL example - modernize strings: use "..."_L1 for literals
The XML stream reader and writer accept QAnyStringView arguments these
days, so passing a QLatin1StringView is entirely sufficient. This
makes static functions to provide access to unique QString instances
redundant. Linkers are allowed to uniquify the literals the "..."_L1
reference.

Task-number: QTBUG-111228
Change-Id: I7f37e97631e11683b9ddd3842fc6233547bed5ff
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 202b1dca5d96f225d9e576d5f9e83696c3e02b5a)
2023-06-16 22:59:05 +02:00
Edward Welbourne
33d7e170e6 XBEL example: minor simplifications
Pass one function's return as a parameter to another directly.
Use a ternary expression rather than conditional initialization.

Use initializer-list construction instead of appending to an empty
QStringList; and inline the result where it's used.

Task-number: QTBUG-111228
Change-Id: I781aedba8dcc4251193b55d82fe684c9b5da241a
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
(cherry picked from commit 5fd4a65d95ac1f23af9583da752b1a0fb2646afe)
2023-06-16 22:59:05 +02:00
Edward Welbourne
cd1ef4db4f XBEL example: Fix null dereference bug
As readXBEL() does call readSeparator(nullptr), the latter should cope
with being passed nullptr as item.

Task-number: QTBUG-111228
Change-Id: I786e4438b566438448b5d54ff6442c27f1255aa8
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
(cherry picked from commit 705e4e63c6ce26507d930428b8cf0d0f137bf3e5)
2023-06-16 22:59:05 +02:00
Amir Masoud Abdol
14a7096bda 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 41b32cd2c4706fa280fc779d5dec132ee9edf0f6

Fixes: QTBUG-114530
Change-Id: I78e3344d2553c0050c285ae86f2310bd373c6c57
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 69d74afd43adac796efb3ebb1f7e73da64010cb5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-16 20:59:05 +00:00
Topi Reinio
2e55a34c1c Doc: Fix documentation issues
The Qt Widgets Application example was moved to manual tests,
and no longer contains the snippet identifiers. Fix \snippet
and \quotefile commands to quote similar code snippets from
other examples or snippet files.

Fix also the following documentation warnings:

* No such parameter 'parsingMode' in QUrl::fromEncoded()
* Missing image: rsslisting.cpp

Change-Id: Ibc989e83abc49837db08628facaf8e5f72b2f123
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 17ddf2a6a52bab5d406bea560591961a7527929b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-16 07:14:49 +00:00
Tor Arne Vestbø
4f9b22fd00 De-inline QIconLoader::themeName()
The method is more than a plain getter, so keep it with the other
logic of the class.

Change-Id: I34aa185a51f04e3db3c1918f9723e53f33e5e9e1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit f3c2cf47fc35262dee0c4732ada6f334009cabf3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-15 23:56:00 +00:00
Ilya Fedin
5783a384f9 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.

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>
(cherry picked from commit 3025dc597fd1026b7c1aae55fd576fda154ff1c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-15 19:21:04 +00:00
Colin Snover
02f5f21fbf Fix typo in QCocoaWindow comment
Change-Id: Idea292bc2927ff9a534f06b054c26b4ab3ef1bea
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 03bbad68ce45a8c7c199364157b91addfba8fb2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-15 17:30:43 +00:00
Topi Reinio
c75c987a64 Doc: Global configuration: Remove obsolete content
Configuration aliases are no longer supported.

Change-Id: I5bb4e1fe6a861f3824d9832f88d2b89c3f1498fd
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 727b6256c1921bedb7c3f23d49abe866e262ba97)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-15 16:58:47 +00:00
Topi Reinio
8c71212bbd Doc: Require Qt module documentation to define qhp configuration
By setting 'qhp' to true, QDoc will warn if qhp configuration is not
provided.

Task-number: QTBUG-114181
Change-Id: I26bce80e888d0b0bd270ecdcc6c0774298076a4b
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 4729e1e720f1e25eff2793c28e1643a220f66c2b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-15 16:58:36 +00:00
Topi Reinio
60c9347253 Doc: Fix documentation for QProcess::UnixProcessFlag
Change-Id: I6001b8c4e73d9785df8338d4d14fcf15f09eae15
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1797f7946d27b873b34fa30b0856414e27e2daeb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-15 16:58:12 +00:00
Alexey Edelev
da317be412 Fix external header support in qtsync
We should sync external headers for 3rdpary projects
like freetype and harfbuzz-ng and keep the directory
structure.

Fixes: QTBUG-113416
Change-Id: Ie66edb9a21cff37ca6c8c68b6d225de6d8bbad81
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
(cherry picked from commit 65b0bc0eed10307cb2ab0a0c45eb6787bed96614)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-14 10:03:23 +00:00
Marc Mutz
8b67e2381a 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.

Change-Id: I204d703498bf42465ea122d1f31c443ea439bd6e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit ba501285b5156c0562282a950008c6aa45b9ce9f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-14 08:01:17 +00:00
Marc Mutz
4454081240 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 686c02224c03735356bdab987bf62644eb34cc34.

Change-Id: Ie1364bb2fd148bf995a8ffd321f77a6021176928
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2bd8e63690569711452e9c56274ffe2bf91f8f5c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-14 08:01:08 +00:00
Kai Köhne
bffe07264c Fix indentation of generated cmake code snippet
Change-Id: I41a1998bd45fbbf2ec81fe7e3ce042bcb3aae308
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 7626736a5f068ba7bf835266d6b4c48299def97f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-14 05:43:37 +00:00
Kai Köhne
dc0e17fa64 Examples: Remove unnecessary Q_INIT_RESOURCE calls
Explicit calls to Q_INIT_RESOURCE are only needed for
resources embedded in static libraries. See also

  https://doc.qt.io/qt-6/resources.html#explicit-loading-and-unloading-of-embedded-resources

Change-Id: I06a24d1c04369eedc78ca60a6ca02ce33907d9e7
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit eed17b3634a99b6f6f751830c6443094dd6b600b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-14 05:43:25 +00:00
Kai Köhne
e684a7a159 CMake: Remove local __PPS target
Remove the local __PPS target and make PPS::PPS itself the
imported target. This is not only simpler, but also hopefully resolves
an issue with static builds, where PPS::PPS was not properly promoted
to a global target, leading to linker errors.

Fixes: QTBUG-108794
Change-Id: Ia9334a27312ba9bfeec964f6bd6a82652e5f9d37
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b63bf9832959fbb9fb9b6f1546366e582d5c1f36)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-14 05:43:12 +00:00
Lorn Potter
cbf5a4050c wasm: fix networkreply with empty data
Fixes: QTBUG-114078
Change-Id: I78e6844ab1aa5d385d8c558c696299e7fa845f50
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
(cherry picked from commit 103ffe1b584befe863fe040ce6268ebd5e4ab13b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-14 05:36:11 +00:00
Yuhang Zhao
c41547247b Re-fix QtLibraryInfo compilation issues
After the "CMake: make compile options consistent for Qt created libraries"
revert, this part of the code also get reverted, however, it's not
related to the revert reason: the user project's deprecation behavior
is changed. So restore this code. We need this code to make sure
we use the same parameters when compiling QtLibraryInfo, otherwise
some compilers may complain about it, such as clang-cl.

Change-Id: Ie50d4f820be3a2e950dd87902d794f1d2681b7a5
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 71c9b9f05b9e3d0d655db33e75207a90509849e1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-14 03:49:57 +00:00
Marc Mutz
ecdd82ac34 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.

Task-number: QTBUG-104164
Change-Id: Ie88023ba7c57dad7c2116c1c19a80b908b3a9f4d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 123118f82958bb48cb9cf5f46b72c0298fe8c7f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-13 22:04:24 +00:00
Timur Pocheptsov
281e067a62 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.

Fixes: QTBUG-114199
Change-Id: I7178e7687066b3fe082454c512ec9c7eab3bded4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit c8473c090367496885410ce70c0305b6d2b56ce7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-13 21:40:04 +00:00
Mårten Nordheim
49283c156d 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
Change-Id: I723fee468e58786f66d1bba50bc4086beb50adb1
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 230c53ad9d7046e61b37ce63a6bc68449393bb7b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-13 21:40:04 +00:00
Axel Spoerl
0fa6b3dcf4 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
Change-Id: I24a8da62908af9b153245f53026af60e63a600d7
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 8d1304f4f2cbc8e7e0f1b9c48236dde548b2bc8d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-13 21:40:04 +00:00
Marc Mutz
75544c0af6 tst_QProperty: fix -Wsign-compare
Amends cb30e45b9a800c6ad9cdfb446a20b6a6e8efbe71.

Change-Id: I53c32a44c642a931038c7c95de903eafc0d0f6b9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 0ffb5c79db977c8dc892be6f4651d57ad5a5ed0e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-13 19:03:22 +00:00
Marc Mutz
c325766423 QSignalBlocker: plaster with [[nodiscard]]
It's a RAII class, and RAII classes should be marked [[nodiscard]] at
the class as well as the ctor level.

Task-number: QTBUG-104164
Change-Id: I77260dc00d51d62ed1064e13f566d04e88d28ef9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 16a19a4f4ab207eba4ba6da987b31628b51903b0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-13 19:03:14 +00:00
Marc Mutz
df759d34eb QSemaphoreReleaser: plaster with [[nodiscard]]
It's a RAII class, and RAII classes should be marked [[nodiscard]] at
the class as well as the ctor level.

Task-number: QTBUG-104164
Change-Id: Ie877e261cfe602410d9d9bb3acc658d0bb7c4e72
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 6fc908c001a274360d3ff431ba16a1df9d8af089)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-13 19:03:06 +00:00
Friedemann Kleint
7c6883d5db XBEL stream reader: Brush up
- Use mime types in the file dialog handling
- Use per class includes
- Use the configure system instead of QT_NO... defines

Task-number: QTBUG-111228
Change-Id: Iea915604e89d3005270f0eb83eca882855589a44
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 723e331f0a811294e43207db162698c3ff8fde51)
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-06-13 21:02:55 +02:00
Marc Mutz
e75305dd42 Replace {add,sub,mul}_overload with q{Add,Sub,Mul}Overload
These APIs started out as private APIs in qnumeric_p.h, but have since
been made pseudo-public in qnumeric.h. The qnumeric_p.h versions just
forward to the qnumeric.h ones, so just use the latter.

This is in preparation of removing the {add,sub,mul}_overflow
versions, which, despite being defined in the unnamed namespace, don't
sport the q prefix, so potentially clash with global symbols.

The change is a simple textual search and replace, manually excluding
qnumeric_p.h.

Picking to 6.5 to avoid cherry-pick conflicts going forward.

Change-Id: Ic0f7c92f7c47923317109e8a9dc06fa66bdff2c2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit b209f943d2611fa4ac2dd9c64b1a014182b59a3d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-13 14:03:14 +00:00
Alexey Edelev
9b6d4f542f Wrap the GNU/Clang compiler-dependent flags with genex conditions
If flags use CMake scopes that propagate them to user libraries, it may
lead to an issue, if user projects are built using different compiler.
We need to guard these flags to make sure that they only will apply to
respective compilers.

Change-Id: I0fd5847447bd8373e8e07f64dae11f27f48c915d
Reviewed-by: Alexandru Croitor (OOO) <alexandru.croitor@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
(cherry picked from commit a2b6c2f3437bf1779da787e719bea08bc6f28622)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-13 12:48:30 +00:00
Laszlo Agocs
6f4f36333b rhi: Add missing enum to QShader docs
Task-number: QTBUG-113331
Change-Id: Ibc792c1d30518efbae5f946360e7470aecc00d9f
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 67f1c360b6094a2c3daeb1a5e9bbd63136297ffd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-13 12:48:26 +00:00
Laszlo Agocs
2ef4694c0a rhi: metal: Fix a leftover version check
Change-Id: I907d4d312f03658d6f04a626a7df96f7e2b4955a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit dbaa4fd082cdf37a8fccee047113ed65a67c6c4c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-13 12:48:26 +00:00
Alexey Edelev
0997715cf8 Replace list(FIND with simplified IN_LIST check
Change-Id: I2ed1803adabc36e646edae3b2bb07e5ff2194d9b
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 59a740e9973b77bf3bb86f4e96efd46277455782)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-13 12:48:22 +00:00
Eskil Abrahamsen Blomfeldt
119a23d2cf doc: Remove bogus step in font resolution algorithm
This is a left-over from when setFamilies() and setFamily() were
setting two different properties, for compatibility reasons.
There is no longer a special step for the singular family, and the
sentence is also a bit obfuscated, so we just remove it.

Change-Id: Ia3c244d41f550a5062de8de63053770258dcacba
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 0ed324314bf151894be9bdd8272adbbc63c2b0ee)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-13 11:48:33 +00:00
Axel Spoerl
56598b65fa Fix no-op emission of QComboBox::currentTextChanged
currentTextChanged is emitted when the current index changes
and the current text doesn't.
This can be the case, if
- old and new index have identical text values
- an item is removed below the current index

[ChangeLog][Widgets][QComboBox] emit currentTextChanged only,
if currentText changes.

Add a corresponding test in tst_QComboBox::currentText().

Fixes: QTBUG-113717
Change-Id: I847874f0792b29a2841e50bb82d06ad496fb02c3
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 9195438a5fd88c676b0fc4abd429bcffa6f97e24)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-13 11:48:32 +00:00
Bartlomiej Moskal
b49593c0c8 Android: Restore the default QSettings path to the .config directory
After 140ca89a3c2b8d78889d27217f977cd4de10041b commit, the path of the
QSettings default file location changed. That caused the problem with
updating the app (old settings file is not used anymore). That is why we
should still use old (.config) directory for QSettings file if the file
exists.

Fixes: QTBUG-109405
Fixes: QTBUG-109369
Change-Id: I8ce53e0a80e4c2d16802b27b000ab3fbed198628
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit beaaa0bf02fee696b03f2839bea8e0e6bc685a62)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-13 11:48:30 +00:00
Friedemann Kleint
03b23f66d5 Brush up the DOM bookmarks example
- Use modern string literals (use QStringLiteral instead of
  QLatin1StringView for strings that go into the DOM API).
- Use mime types in the file dialog handling
- Streamline code
- Remove mentions of SAX
- Use per class includes
- Do not use QObject::tr()
- Use the configure system instead of QT_NO... defines
- Fix some doc text typos

Complements 3dd3268ded4dd74c64d7ec726fd534375ab9f018.

Task-number: QTBUG-111974
Change-Id: If0dc7b61e729d0a71f37743efc9b82e285d3f451
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 3a553507a134bee1562d34ebbf786a053d36fc05)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-13 00:32:52 +00:00
Tor Arne Vestbø
3653256b7f Deprecate some older Apple platform defines
Clang's macro deprecation pragma was introduced in Clang 14,
shipped with Xcode 14.0.

We can't version check Q_CC_CLANG here, as qcompilerdetection.h
hasn't been included at this point. Nor would it have helped much,
as we would have had to do so for each individual define we wanted
to deprecate, since mentioning an undefined define in the deprecation
pragma is an error. And we can't wrap the pragma in another macro
that conditionally expands to _Pragma either, as the input argument
is a define that needs to be passed on as is, without expanding it.

So the simplest way to support < Xcode 14 is just to silence
the unknown pragma warning.

Change-Id: Icf95042e6186deb212cd1793eb12ba32206ce34b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3c12c3d58c5e27a5792eb85de994539c17ef2c38)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-13 00:32:52 +00:00
Tor Arne Vestbø
ec58e20d7e rhi: Don't check m_format in QRhiSwapChain::hdrInfo()
The HDR info is independent of the current format anyways.
Removing the format check allows code to use hdrInfo() as
a signal for whether to set a HDR format, instead of having
to set the format, then query hdrInfo(), and then setting
SDR again if needed.

Change-Id: I99b57335003d06af227f2a7078560c2a483b049b
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 5ea0256b07495977a1f2740f6b2d99984cf927dc)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-06-12 22:22:22 +02:00
Tor Arne Vestbø
67f18f282a rhi: Only report HDR as supported if maxPotentialColorComponentValue > 1
Change-Id: I4c951e8c651b2bee41aba8ff69f481a08d6a3561
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 5302fb64af2f3f1eb4351a6f775663b74b8e53da)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-06-12 22:22:16 +02:00
Volker Hilsheimer
feadcc6869 Move storageview example into tests/manual
The code is mostly an implementation of a model based on QStorageInfo,
shown in an otherwise uninteresting tree view.

Change-Id: Id6ce70d71ddc9bcd6e82a9ee12f5e1af159eac7a
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit a89f575be3a410a06165dc19961b1a260a67464d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-12 19:22:58 +00:00
Volker Hilsheimer
904d3d628b Move scroller/graphicsview example into tests/manual
The example seems incomplete, is undocumented (and unused in shippets,
in spite of tags being present), and generally full of comments that
give the impression that this is for manual testing rather than showing
best practices.

Change-Id: Ie615420e493cc6bb461c5d9ff8d4ae82bb3591db
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit b908c5cf28923a3ae2d9262361a9810bc57cc9c7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-12 19:22:55 +00:00
Volker Hilsheimer
ae0191d3b7 Remove flattreeview example
The relevant bits are a two-line snippet.

Change-Id: Id1731e5bc6585b1d1fd684817b39d19ad0a8a9cc
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit ce13dc8c2f73408ce2897f4bd044560955e38145)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-12 19:22:48 +00:00
Amir Masoud Abdol
87b485b9bd Fix the issue with setting the QT_BUILDING_QT
`TYPE` argument is not a thing, and if it is there, QT_BUILDING_QT is
set to `TRUE;CACHE;TYPE;STRING;When this is present and set to true, it
signals that we are building Qt from source.` instead of `TRUE`.

Change-Id: I24784e9aead4929d408d06bce72d3f33ee21eb63
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 5d12d9846a9436b4ef4e1f8ac42d081d60568ecf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-12 09:15:26 +00:00
Marc Mutz
2948ab16ea QPixmapCache: deprecate replace()
The replace() implementation overwrites the passed Key key with a new
version, const_cast'ing away the const from the key passed by
reference-to-const. This is UB if the Key was originally declared
const.

Deprecate the function.

Also inline the const_cast, so compilers can readily detect the UB
even if users don't enable deprecation warnings. Due to the severity
of the issue (UB), immediate deprecation is warranted. There appear to
be no in-tree user of the API outside of tst_qpixmapcache.cpp.

[ChangeLog][Deprecation Notice][QtGui][QPixmapCache] The `replace(key,
pixmap)` function has been deprecated, because passing a `const Key`
to it results in undefined behavior. Use `remove(key, pixmap)`
followed by `key = insert(pixmap)` instead.

Change-Id: Ic5060ce3271f2a1b6dc561da8716b452a2355d4c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 78cdd9a64dc0cd666e5c8daafa7477c29641420d)
2023-06-12 10:27:38 +02:00
Marc Mutz
fea706df68 tst_QPixmapCache: QVERIFY a failed replace()
Between the find() == 0 obfuscation (since fixed) and this unchecked
replace(), it took me way too much time to figure out what was going
on: the key passed has been invalidated by the setCacheLimit(0).

Now that we QVERIFY that the replace() _fails_, it's much easier to
backtrack and figure out why it does so and why, consequently, the
following find() is also expected to fail.

As a drive-by, reorder two lines so the grouping becomes clearer
(blocks now both headed by setCacheLimit()).

Change-Id: I434b65fc13c3fed6512036efeb98d738eeb2a13d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0e96dd3464bc2e03d66ebb574a7a5352942ffdb2)
2023-06-12 08:27:34 +00:00
Marc Mutz
04b062ba71 tst_QPixmapCache: check insert() reports failure
None of the existing tests failed when I started to return a valid key
from a failed insert(QPixmap), so add a test that would fail.

Change-Id: I74f23d2ec4c04151f8f1266c0c503713d4642f3a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e409d771d922b9772a0ecb4da575c6fd6f95676f)
2023-06-12 08:27:29 +00:00
Marc Mutz
a5a5ff0dab QPixmapCache: add a comment on how failed insert() invalidates cacheKey
It wasn't obvious to me, at least, and I only found out about it when
I failed to construct a test failure based on this.

Change-Id: I339132d7bb2cb8a76f0f1feec37891d6131c4d7b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 588ca25e4a31642bf8d18cd1948c50fa514ac0a7)
2023-06-12 08:27:25 +00:00
Volker Hilsheimer
c34af8f514 QMenu: don't crash when nested tear-off menus are closed
QMenu's causedStack maintains a list of menus on the way to the menu,
and might contain nullptr if one of the entries was a tear-off menu
that got closed (and thus destroyed, due to DeleteOnClose).

If the entry we get from the stack is nullptr, fall back to the passed-
in parent widget pointer, and test for nullptr before accessing.

Add a test case that crashes without the fix.

Fixes: QTBUG-112217
Change-Id: I958182db47c3cc8733e1780f7efef43881ffae11
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
(cherry picked from commit f0049873d2ce0742a2df7ce265db70ca8baa8442)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 17:22:24 +00:00
Volker Hilsheimer
e20ebd5a26 Stabilize QFile::unixPipe/socketPair tests
We observe failures in CI on QNX because the measured timeout is ~995ms
rather than the expected 1000ms. Start the timer before the thread
starts to guarantee that at least as much time elapses as the thread
waits before writing the second byte to the pipe.

Otherwise, the thread might be sleeping already when the timer starts,
and then we can't rely on any measurements.

Change-Id: I6072569a987f5e952b0953e0e394a223f891fd25
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
(cherry picked from commit 30e5ff3ff223d665fbed3baf2d08ad3fcf2b8455)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 17:22:24 +00:00
Volker Hilsheimer
7f807cdd42 QMetaCallEvent::create: pass arguments by const ref
Amends 4d7ae8a74e70896a757f483865fe7095120fedc1.

Change-Id: Id4379324c2399f2360b3553d297f38dd793af21c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 38a00d2c978eba90e9006418de5ebaf89092b079)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 17:22:24 +00:00
Tor Arne Vestbø
dcffd0035c Remove conanfile.py
The conan experiment has ended, and the file is only bitrotting
nowadays.

Change-Id: I8408265f7db7e52803b1f532d08a11387ea978cb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 9decda9063790ad1782d4a623a6a2857e857ebf9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:42 +00:00
Tor Arne Vestbø
f7b243c721 Add missing line continuations for memory_resource opt-out on Apple systems
And add some additional parenthesis for extra safety.

Amends f7c8ff511c30dc4310a72b3da4b4a345efe1fba0.

Change-Id: I4ca8b70f6adb876a10f82685ba9800021218d418
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
(cherry picked from commit e84c0df50f51c61aa49b47823582b0f8de406e3d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:38 +00:00
Tor Arne Vestbø
2741cf4f8a Remove compatibility defines for Apple OS versions
These are already defined in AvailabilityVersions.h in the SDK,
and we expect people to build Qt against the latest SDK available.

The corner case of requiring defines for upcoming/beta SDKs can
easily be handled by using the version number directly, which is
the recommended practice anyways.

Change-Id: Ica296118ee17608b8c43f9338c3083189083474c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 569c78162a739afcb2605dd253fde60a75014c86)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:30 +00:00
Tor Arne Vestbø
10819985db macOS: Remove fallback defines for MAC_OS_X_VERSION_MIN_REQUIRED
Availability.h from the platform SDK should take care of this these
days.

Change-Id: I23dd821682db66a1f22b1240d485f4a9cc877cd8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 329db8b64f17c8ef013c586cea1f1c5b49c4a4b7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:26 +00:00
Tor Arne Vestbø
18fead0d4f macOS: Don't assume DnD is handled via internal drag loop
If we have only one item, we're not using beginDraggingSessionWithItems
which requires us to manage our own drag loop, and instead use good old
dragImage, which takes care of the drag loop on our behalf.

In both cases we end up in draggingSession:endedAtPoint, so we need
to explicitly check for the existence of a manually managed drag session.

Amends 8a359343621fa83941946cb4e661b54ca7a1c4cc.

Fixes: QTBUG-114236
Change-Id: Ifa9110945e191c4ffebe099e3e4edf9c571ab376
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f1011bd2ed3747880e08791fddbb63f73b0faffe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:24 +00:00
Tor Arne Vestbø
aae0cc0702 Detect when Xcode is presenting os_log as structured log messages
In that case, just like when os_log mirrors to stderr by itself, we
want to disable Qt's fallback stderr handler.

Change-Id: Ia373b19788edbce616d4f0d3d9f0b217ddc1e5c0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 366923b597a56d9a5fa4ac04876ac65c1e0a4d59)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:22 +00:00
Tor Arne Vestbø
54208c3a80 Add QOperatingSystemVersion::MacOSSonoma for macOS 14
Change-Id: I22d4a2443e10ef40f498aa48aabad9aaa7aa8d1a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0237709e2cde08ce792081615250377295722e19)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:20 +00:00
Tor Arne Vestbø
0e125ba4f9 Update mapping between Apple Clang versions and upstream Clang
For Xcode 14.0 and 14.3

Change-Id: Idd533e2d1f7b0feffa618ddf633165ce29043d5e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 18f966aed15ace0c958d0e391813e9ab80fb92c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:18 +00:00
Tor Arne Vestbø
8213f639cd iOS: Don't invalidate a11y whenever UI elements are added or removed
The UIAccessibilityScreenChangedNotification will result in iOS resetting
its state, focusing the first a11y element on the screen. We shouldn't
tie clearing the a11y cache to this notification, as those are two
separate actions.

In the case of adding or removing individual elements, we still likely
need to clear the cache, but can inform the system of the more granular
UIAccessibilityLayoutChangedNotification to have it re-read the a11y
tree.

We still handle additions and removal of a11y elements with Window
or Dialog roles as UIAccessibilityScreenChangedNotification, as these
likely involve major UI changes.

The implicit UIAccessibilityScreenChangedNotification on QIOSWindow
destruction has been removed, as it's assumed iOS will automatically
refresh its a11y tree when a UIWindow is destroyed, and in any case
it's up to the individual clients of QAccessible to send the relevant
QAccessibleEvent to inform about the situation.

Fixes: QTBUG-100094
Change-Id: If7d5cb961743e5ca97d45553b05ae5e92f82d275
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit b006d6d9dea11ac788a54ee3ffd13a9463003a32)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:16 +00:00
Tor Arne Vestbø
2e487a246b macOS: Remove legacy SDK and deployment target check macros
These are no longer in use in Qt.

Change-Id: Id07bc0e09a414754493562d3a48df55cc28c5049
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit af47a197a59675149db208088b4fe072215901dd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:12 +00:00
Tor Arne Vestbø
9d8d9f3258 rhi: Add QRhiSwapChainHdrInfo::maxPotentialColorComponentValue
Knowing the maximum potential component value can be useful
to potentially (sic) opt out of an HDR code path if the maximum
color component value will be too low to make the additional
processing overhead worth it.

Change-Id: Ib1e1b7a745b236e1d137a1e7daf1248f1572e184
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 183629e3ef9286332fdefa15dbce1b1495ef079d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:07 +00:00
Tor Arne Vestbø
8133a6e2af rhi: Pick up HDR maxColorComponentValue from UIScreen if available
Although QRhiSwapChainHdrInfo uses 'max' for this value, it's used
by Qt Multimedia's QVideoWindowPrivate::render() as the current
maximum, so we need to reflect UIScreen's currentEDRHeadroom
rather than potentialEDRHeadroom (the absolute max), the same
way we reflect maximumExtendedDynamicRangeColorComponentValue
and not maximumPotentialExtendedDynamicRangeColorComponentValue
from NSScreen.

As we don't support HDRExtendedSrgbLinear on < iOS 16 there
is no point in providing a heuristic fallback based on the
iPhone 12 spec.

Change-Id: If071bb64f269ce16886206df05eb9f27d260bf15
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 74319d05b1e8e2b5dcf226ef11bc66776460fa3f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:05 +00:00
Tor Arne Vestbø
0c6c9ec6a2 macOS: Remove old friend declaration for qt_mac_is_metal
The function was part of the Cocoa style for checking the metal
look (not Metal the graphics API), but has long been removed.

Change-Id: I366b952db4ae82b8ecc442f1ce61e7f53cacfe80
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 716df4965e75ff9e87278ea6753a4a311ce2c3bd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:03 +00:00
Tor Arne Vestbø
61d7831405 rhi: Enable HDRExtendedSrgbLinear for iOS
Change-Id: Iaff3c0d18c07cc0cd4ed57a8e6fa7fb07b130a58
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 95d10ae682f1e6e67927166c3b04adc39f6aee23)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 15:06:01 +00:00
Assam Boudjelthia
b36eaa3989 Android: improve screen size and physical size calculation
Use new api calls for calculating pixel size and physical size
of multi-display setups after some existing apis have been deprecated
in Android API 30 and 31. Also, do the physical size calculation outside
of the supported modes loop.

As for the physical size, this patch still uses xdpi/ydpi for the
calculation instead of densityDpi as suggested in [1] because from
testing few scenarios, the results returned from xdpi/ydpi are more
consistent with physical device specs.

[1] https://issuetracker.google.com/issues/194120500

Task-number: QTBUG-112742
Change-Id: I0c8ef5185c8b6463830b528374954c324a32d657
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit c0e0b56055e2ed0155d4e2402319dd8f8f134e10)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 02:49:29 +00:00
Thiago Macieira
d75414372d QProcess/Unix: reset the signal block if ResetSignalHandlers requested
This amends commit f9c87cfd44bcf4b90cb45354252ef19f647b0469 to reset the
signal block mask too, not just the signal handlers. For this, SIGPIPE
is not treated specially.

Change-Id: Ib5ce7a497e034ebabb2cfffd17627289614bf315
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 062b2ac71bac1e0449eff7f8f02cb0020ad39991)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 00:57:15 +00:00
Thiago Macieira
0dc6ccbc5c QProcess/Unix: call the internal version of sigaction()
I've investigated the functions we call in the child side of a vfork()
for implementations that do more than simply place the system
call. Where wrappers exist, they are usually related to handling of Unix
signals or PThread cancellation. The implementations investigated are:
- Bionic (Android)
- FreeBSD
- glibc (Linux)
- MUSL (Linux)
- NetBSD
- OpenBSD

Relating to thread cancellation, NetBSD implements it with an internal
API that does not include Unix signals and Bionic doesn't implement
thread cancellation at all. Their wrapper functions are harmless.

The rest do use Unix signals to implement thread cancellations (called
SIGCANCEL everywhere except OpenBSD, where it's SIGTHR). Therefore, they
all block the application attempts to mask this signal or change its
handler (if they're not buggy). FreeBSD's and MUSL's do some locking in
their implementations[1][2] we really want to bypass, therefore we must
bypass their sigaction() wrappers.

The investigation also showed that the glibc[3] and NetBSD[4] abort()
implementations to be slightly unsafe, but we don't use them
ourselves. We're also adding QProcess::failChildProcessModifier() so
users won't have to resort to abort().

[1] https://github.com/bminor/musl/blob/master/src/signal/sigaction.c
[2] https://github.com/freebsd/freebsd-src/blob/main/lib/libthr/thread/thr_sig.c
[3] https://codebrowser.dev/glibc/glibc/stdlib/abort.c.html
[4] https://github.com/NetBSD/src/blob/trunk/lib/libc/stdlib/abort.c

Task-number: QTBUG-113822
Change-Id: I9201d9ecf52f4146bb04fffd17651123800e15a4
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e71c226d6f188abd811b28d3cb7529343f52d61f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 00:56:50 +00:00
Thiago Macieira
bfd07607b2 tst_QFile: replicate the unixPipe test using FIFOs
Pipes are unnamed FIFOs, so they're basically the same.

The difference here is that open() blocks on opening a FIFO until both
ends of the FIFO are opened. This helps us in synchronizing the two
threads and thus ensuring that that the read() system call deep inside
QFile does, indeed, block.

We see this with strace -T on Linux:

[pid 662956] openat(AT_FDCWD, "/run/user/1000/tst_qfile_fifo.2575572361", O_RDONLY|O_CLOEXEC <unfinished ...>
... aux starts up ...
[pid 662957] prctl(PR_SET_NAME, "QThread") = 0 <0.000004>
[pid 662957] openat(AT_FDCWD, "/run/user/1000/tst_qfile_fifo.2575572361", O_WRONLY|O_CLOEXEC <unfinished ...>
[pid 662956] <... openat resumed>)      = 4 <0.000133>
[pid 662957] <... openat resumed>)      = 6 <0.000011>
[pid 662957] clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=500000000},  <unfinished ...>
[pid 662956] read(4,  <unfinished ...>
[pid 662957] <... clock_nanosleep resumed>NULL) = 0 <0.500183>
[pid 662957] write(6, "\2", 1)          = 1 <0.000033>
[pid 662956] <... read resumed>"\2", 1) = 1 <0.500311>

Change-Id: I63b988479db546dabffcfffd1766d7a48819b149
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 01872d06d9a09c83f28b3ecebcb06f0ed81c5622)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 00:56:32 +00:00
Thiago Macieira
9432a7136f tst_QFile: fix unixPipe() and socketPair() closing already-closed fd
Change-Id: I63b988479db546dabffcfffd1766d75c11e46fda
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 65097e7667c96177c322ebd45f7ac5c74fee7a26)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-11 00:56:30 +00:00
Ahmed Essam
4672843ae0 Fix segfault when using qfuture continuations with move only types
When using move-only types, continuations args are set using takeResult
function, which has the side effect of invalidating the QFutureInterface
associated with the promise/futures by:

1. setting isValid to false
2. setting the state to NoState

And when the promise is destroyed, it tries to run the continuations if
`finished()` is not called, which is done by checking the Finished bit
in the state. But since the continuation has been run before, and the
state has been set to NoState it tries to run the continuation again
causing a segfault. Multiple solutions come in mind:

1. don't run the continuation if the state is NoState, but this would
   break the case when an empty promise is destroyed
2. check inside the continuation if it has been run before, and if so
   don't run it again, but this seems hacky since we don't want the
   continuation to be run twice, and it should break if it did.
3. when invalidating the promise leave the state as is, and change
   isValid only to false, which changes the current behavior, but is
   still compatible with the documentation which states only that
   isValid will return false if takeResult is called

I chose option 3

I also extended some tests to test for move only types, and added a test
that continuations run when a promise is finished. This simple case
would segfault before with move only types.

Fixes: QTBUG-112513
Change-Id: Ie225ac4fdf618e4edfb0efd663d6c7fd6b916dbd
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 1f22fc995a36193cd67e8190858bb33614d149f4)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-10 19:34:52 +00:00
Axel Spoerl
fbf948568d QStyleSheetStyle: Default to foreground for unset brushes only
If a foreground style has been defined in the style sheet,
QStyleSheetStyle populates its brushes for the color roles ButtonText,
WindowText, Text, and the widget's foregroundRole with the foreground
brush. PlaceholderText is set to the same brush with a modified color.

That sets their resolve bits in QStyleSheeetStyle's palette and
prevents these color roles from being inherited by the widget's
palette - in contrast to all other brushes.

This patch makes the brushes mentioned default to the widget's palette
if they are set there. It adds a test in tst_QStyleSheetStyle.

Fixes: QTBUG-93009
Change-Id: Ie3df9dbd17b96fa72beee90792fc7eca1933cdbe
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c4635c0d5822d0e95ceca867fffb9ba86a2b7bfe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-10 17:47:15 +00:00
Marc Mutz
879912619a QString: add STL-style assign() [3/4]: (it,it) overload for char32_t
This no longer is range-length preserving now, so adapt the
documentation.

For the non-contiguous iterator case, it's actually ok to always
resize(0) and then append(), because, unlike for QList and QVLA, the
resize(0) doesn't actually iterate the container to destroy
elements. It just sets some members and conveniently detach()es for
us.

The char8_t case is even more complicated, since we can, atm, not
include qstringconverter.h into qstring.h, yet qstringconverter is
required for stateful UTF-8 decoding in the input_iterator case. So
that's postponed to yet another patch, and maybe won't make it into
6.6. But I feel it's important to have at least one
non-length-preserving version of assign(it, it) in before release lest
users come to rely on this documented (and de-facto) feature of the
the step-2 assign().

Fixes: QTBUG-106198
Change-Id: Id458776e91b16fb2c80196e339cb817adee5d6d9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 05e388013098887eb66090b8f145ef92d60657db)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-10 07:19:50 +00:00
Marc Mutz
9d3c8bc058 tst_QPixmapCache: rewrite QVERIFY(x != 0) to QVERIFY(x)
This is just confusing. QPixmapCache::find() already returns bool,
comparing it to a literal zero just makes it hard to read.

Change-Id: I43c000890377cca2111daa48799f10cc99aad8cf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6032845ca2fc69fb67971ea9f7e06588ffcbe9f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-10 07:19:45 +00:00
Amir Masoud Abdol
a5a64671c7 Remove debug symbols from Android's release build
Android's toolchain file, ie., android-legacy.toolchain.cmake assumes
that the default build is a Debug build, and it adds the `-g` flag to
CMAKE_<LANG>_FLAGS, as a result, our release Android build always
contains debug symbols. In this patch, I basically move the `-g` flag
from CMAKE_<LANG>_FLAGS to CMAKE_<LANG>_FLAGS_DEBUG, and
CMAKE_<LANG>_FLAGS_RELWITHDEBINFO.

Fixes: QTBUG-111901
Change-Id: I31eadb07d9172c923e8beaf0ac6c6e34fe1ebefb
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 9d8a04cd1fd0a0c4ec891a9497512e4bbbaead9d)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-09 08:16:03 +00:00
Kai Köhne
ccc30c7e0d Doc: Fix links to QLayout[Item]::expandingDirections()
The method has been named expandingDirections() since the very
initial git commit for Qt 4.8 ... So high time to fix the
documentation.

Change-Id: If5d7189ebbe439bd0b0e95d51e77c08ee52c3471
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit ef7e65e19a0ddf74a0cd72e59a83b9543426322b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-09 08:05:18 +00:00
Kai Köhne
5c3203d38d Doc: Allow qdoc to link to functions mentioned
\c prevents qdoc from linking to the relevant function documentation.

Change-Id: Ieaa38b1feba816e911b17445a9436f64c234522a
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 53fa325f4c4ae5721a4858eeec33ef79d19d1acf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-09 08:05:13 +00:00
Amir Masoud Abdol
fd91d1a668 Move QT_ALLOW_SYMLINK_IN_PATHS warning to config.summary
I think this needs to be more prominent, as I noticed during the testing
that it could cause issues if it gets lost in between the config
messages, as we knew of course.

Task-number: QTBUG-113463
Change-Id: I2ece498a8d3604362a49cc10499b92b0d2764fb9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 9a5de496f1ff37b345010dd70304b2408f273322)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-09 07:35:54 +00:00
Assam Boudjelthia
60dd3b71bb Android: Fix reporting of QScreen's size() and physicalSize()
The screen's DPI need to be accounted for when calculating
the size in mm from pixels. This was missing after multi-displays
support was added for Android.

Amends fbf586db2c587e7ba83cf1bfe8e5b912310d6bdb.

Fixes: QTBUG-112742
Change-Id: I31814faa8de68e5193757d52e264b8ed90ae56b6
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
(cherry picked from commit 436923a76c4c60ad7271a66821768b06573310ce)
2023-06-09 07:21:54 +00:00
Michael Weghorn
1cdc197664 a11y atspi: Report correct char code point when it's > 65535
QString uses UTF-16 encoding and thus "unicode characters with
code values above 65535 are stored using surrogate pairs,
i.e., two consecutive QChars.". [1]

When the character inside of text is retrieved using the
GetCharacterAtOffset method of the AT-SPI Text interface,
use QStringIterator to retrieve the character's actual
codepoint instead of returning an invalid/incorrect one.

[1] https://doc.qt.io/qt-6/qstring.html

Fixes: QTBUG-113438
Change-Id: I07108481716329fd23a92c88892eaedd3f9defc6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit c7b925757f9b55924b788a2f08d777baa0e63250)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-09 06:12:30 +00:00
Marc Mutz
fadc5f7274 qnetworkreplyfileimpl_p.h: fix header guard name
It was missing the _P.

Change-Id: Ic07b4145f06ba3b1bea52349cf9b3f8215f30313
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit b2244a252ca36da3b566112464655a70e887f178)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-09 06:09:27 +00:00
Laszlo Agocs
a0e949637d rhi: d3d11: Fix swapchain format check
...to only return true for HDR formats that are sensible for
Direct 3D. There are currently no other formats, but new ones
may get added in the future.

Change-Id: I4fc6d605da8f6bf2644a4e5c355ab8f1c62ad68d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 8a1915e04e2969a358aa5004bbd511cd92ce7372)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 11:34:59 +00:00
Tor Arne Vestbø
c3c5a6bd95 Opt out of standard library memory_resource on macOS < 14 and iOS < 17
Although the header is available, and the compiler reports that the
standard library supports memory_resource, the feature is only
available on macOS 14 and iOS 17, as reported by

  https://developer.apple.com/xcode/cpp/

As long as our deployment target is lower we can't unconditionally
use this feature. It's not clear whether the expectation is that
consumers of the standard library on these platforms will have to
runtime check their uses of these APIs.

Task-number: QTBUG-114316
Change-Id: I50c1425334b9b9842b253442e2b3aade637783ea
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f7c8ff511c30dc4310a72b3da4b4a345efe1fba0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 11:34:43 +00:00
Alexandru Croitor
5776c58950 Revert "CMake: make compile options consistent for Qt created libraries"
This reverts commit 389507a047e0ec0721535052df6ddf957fbb95b3.

Reason for revert: The original patch unintentionally changes
the deprecation warning behavior for user projects. Merging
the current change will resurface the original static qt build
bug until a new fix is developed.

Change-Id: I29b41b43fdd76b19bc46439470e04443dc2b8ddb
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Yuhang Zhao <yuhangzhao@deepin.org>
(cherry picked from commit e3c6754760b23a9d6e7879c037f72bf768674572)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 11:05:19 +00:00
Axel Spoerl
af152ff825 QPalette Fix documentation typo
compliments -> complements

Change-Id: I5457582299d9cd7d39c8f17ad445cdb796bc8e59
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit 203550cf76ef00b5c2c003be335cb61cb88beda4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 11:04:56 +00:00
Amir Masoud Abdol
4d2dfbaf3e Add Unity Build to config.summary
Unity Build was missing from the `config.summary`. This fixes that.

Task-number: QTBUG-109394
Change-Id: Icd9898956ec1a5332297272130bce27d4d2675ca
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 958c12273af07b04f087c322efdc57fc5f84a091)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-08 08:13:41 +00:00
Amir Masoud Abdol
f638a6d98e Remove an unused variable
Task-number: QTBUG-109394
Change-Id: Ib1099e3d4091b0b222e405ce25b5e680f0514476
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 48014f99dcda836e86c962455ceda99e3d79702d)
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-06-08 08:13:41 +00:00
Amir Masoud Abdol
dc72617cf2 Remove the manual undef of the min/max macros, or def NOMINMAX
We now add NOMINMAX to PlatformCommonInternal target which will be
linked to everything else, so min/max will not be defined upon the
inclusion of `windows.h`, or other headers.

Change-Id: I10016720dac7ce015e929885b7368ee86d8b6918
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 1dfa922606e497918e57a6a06f96ee63b7fb163e)
2023-06-08 08:13:41 +00:00
Amir Masoud Abdol
2713444900 Fix an issue with processing -prefix paths ending with \ on Windows
In cases like `C:\` or `C:\D\E F G\`, we had the issue were Windows'
path separator was acting as an escape and was corrupting configure
arguments', so, we were ending up with `-DCMAKE_INSTALL_PREFIX=C`, or
were cutting the argument list short, and ended up ignoring some of the
arguments.

Change-Id: I433af61d5c143cc37a64dcf8ac82a1a78ce543a5
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b738ad7e3afd41c6d43d8b434fe221ab9b27bff1)
2023-06-08 08:13:41 +00:00
Eskil Abrahamsen Blomfeldt
659bb338fe Avoid infinite loop when loading huge files
QTextDocumentLayout could get into an infinite loop when the
contents exceeded QFIXED_MAX.

Specifically, QFIXED_MAX is used as meaning "one infinite page"
which means that newPage() will just return when it sees this
page height. If the page actually grew larger than this, though,
we would treat it as a page break and enter a loop where we try
to call newPage() to create new pages and never return.

The layout engine cannot support documents this large, so we detect
the case and then just finish the layout loop early when it is
encountered.

Fixes: QTBUG-112968
Change-Id: I485303d714d112119a971c43e0086bf6d3d23e9f
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 1dc88a1b5f826219a58cefc03b4118917be2da96)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 08:13:41 +00:00
Eskil Abrahamsen Blomfeldt
7a42679a98 Freetype: Don't do image transform for translations
In 6ba003f73295b896aa6dc1fba099daadb4760209, we added support
for transforming bitmap fonts in Freetype by rotating the rendered
glyphs as images rather than using FT_Set_Transform(). However,
we enabled this for all transforms, even the ones that were only
doing translations, which is unnecessary and also caused some
issues. We restrict the condition to only cover rotations, scales
and shears and let translations be handled as before.

[ChangeLog][Text][Freetype] Fixed an issue where setting a
translation matrix on text using a bitmap font would cause
rendering artifacts.

Fixes: QTBUG-114229
Change-Id: Ib3f2870e57c881364c85432a7937f15f3664eda7
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit 90e3f0bd73e5fea6e0ed3fec65e3a5864d5e132f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 08:13:41 +00:00
Laszlo Agocs
a9870df180 rhi widget compositor: Use Nearest filtering
To stay compatible what the OpenGL-based code did before Qt 6.4.

Fixes: QTBUG-113811
Change-Id: I80d89b21dcace9b5c361b964d56f29e996940c24
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit ec27b99c2a16994127f77d76eb1fb466c390aee9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 08:13:41 +00:00
Laszlo Agocs
03ad083057 rhi: gl: Switch back to Nearest filtering when resolving
...for Qt 5 compatibility. It seems both Qt Gui and Quick calls
the QOpenGLFramebufferObject helper for blitFramebuffer with
the default GL_NEAREST argument for the filtering. In Qt 6 we
must use the same if we want to ensure pixel-perfect compatibility.

Task-number: QTBUG-113811
Change-Id: I03c69448265e7b0d73f021d71135a1725e96fcbc
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 6ec01168d1c517bedf8039ba27f8059ca29478f4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 08:13:41 +00:00
Laszlo Agocs
aa0266b90b rhi: vulkan: Fix swapchain format check
Fix the treatment of the sRGB flag. That is independent from the value
of format(), and should be checked regardless of wanting a HDR swapchain
or not. On Android for instance Display P3 with RGBA8 or RGBA8_SRGB is
one of the formats offered. While we do not support this right now,
it is an example of a "HDR" format that still uses a color buffer
format where a dedicated sRGB format is available and must be
chosen according to the specified swapchain flags.

Change-Id: I2d97689fa5af7c08486702ae690f2230d06db469
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 526744ba6536175f9a19ffdf6ff1ee068f9522a4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 08:13:40 +00:00
Laszlo Agocs
91f9cce4ce rhi: d3d12: Fix swapchain format check
Change-Id: Ie2c19ce0aa2c30997a682ed25bc69b2b8e9f7ee0
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit dc341ea284bf533967a1e70d60df92184cc112ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 08:13:40 +00:00
Laszlo Agocs
9479b55672 rhi: metal: Fix a swapchain debug print crash
When enabling the logs, printing hdrInfo() to qDebug
in Qt Quick is something that is done before calling
createOrResize() on the swapchain. (logically since
this is still at the point of configuring the swapchain
settings)

Thus the correct thing to do is to only access m_window,
not the backend data's window.

Change-Id: I3004b0c4a4fdb09cb07a9c0e3c503f79c699c562
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit bee7d2c61026089371249ab03e1a788604abf99b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 08:13:40 +00:00
Amir Masoud Abdol
b61d67ff61 Add TRY_RUN to host tools
On Windows, we will try to run our host tools after a successful build.
If the build fails because of a missing DLL, we will be able to throw an
error with some direction on what might be the cause, and how to resolve
it.

Fixes: QTBUG-113273
Change-Id: Iba548829bc41fbee95cef288faaf7edca118ee33
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 41b32cd2c4706fa280fc779d5dec132ee9edf0f6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 08:13:40 +00:00
Marc Mutz
ff469d570b Add tst_QString::prependEventuallyProducesFreeSpaceAtBegin()
This seems to work with prepend(char), but not with prepend("data"),
cf. QTBUG-114167.

Task-number: QTBUG-114167
Change-Id: I7aa4dca7c2b5938c2e5ad416231945c23140d659
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit e4682408b036b95d4edfb7e324c8e6835230d263)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 06:26:19 +00:00
Thiago Macieira
428821b675 tst_QProcess: move the crasher code to a header
So I can use it in tst_QProcess itself.

This also modernizes it a bit by using __builtin_trap() where available.
On x86-64, this expands to the ud2 instruction.

Change-Id: Ib5ce7a497e034ebabb2cfffd176288433378731b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f992402f15fd117bb5ccf9a484bf31fd4f4967e2)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-08 02:23:54 +00:00
Thiago Macieira
17537273f0 QElfParser: use ELFOSABI_LINUX instead of ELFOSABI_GNU
It seems to be the preferred constant in other OSes. In particular,
OpenBSD does not appear to have ELFOSABI_GNU[1]. Found while researching
if commit 9caac0f176040b4da48d3ea289683b0b082cf729 was still necessary
for OpenBSD.

This reverts commit ded2fd9ff4fea06af881229bacaeff5d0ecfa6de, which
implied NetBSD 9 doesn't have ELFOSABI_GNU either.

[1] https://github.com/openbsd/ports/blob/master/x11/qt6/qtbase/patches/patch-src_corelib_plugin_qelfparser_p_cpp

Change-Id: I63b988479db546dabffcfffd17662020d722af20
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 4e2f8bad0a4e83ac6890bf6f38f26d9857c0d79b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 02:23:53 +00:00
Thiago Macieira
459ae9334d QElfParser: fix build if EM_S390 is not defined
Found in the OpenBSD ports patch collection[1] while researching if
commit 9caac0f176040b4da48d3ea289683b0b082cf729 was still necessary for
OpenBSD. They should upstream their changes instead of working around...

[1] https://github.com/openbsd/ports/blob/master/x11/qt6/qtbase/patches/patch-src_corelib_plugin_qelfparser_p_cpp

Change-Id: I63b988479db546dabffcfffd17662042c7130f7c
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
(cherry picked from commit b1816c2718acf9743d842e4b02dd314d8252cb78)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-08 02:23:51 +00:00
Marc Mutz
a08ca88b24 QString: add STL-style assign() [2/4]: (it,it) overload for QChar-convertible *it
Restrict the permissible value_types to those QStringView can take,
plus QLatin1Char. All of these implicitly convert to QChar and give
the correct result, even when converted char-by-char.

Task-number: QTBUG-106198
Change-Id: Icb44244cb08af391161c4309467d4e0d2d3d3d62
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
(cherry picked from commit f5ed163c19c4a165a61e6fbfdaf5ee39b5587a0c)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-08 02:23:48 +00:00
Thiago Macieira
e5d222867c CMake: apply OpenBSD patch to enable $ORIGIN
Found at https://github.com/openbsd/ports/blob/master/x11/qt6/qtbase/patches/patch-cmake_QtRpathHelpers_cmake

There are a lot more patches there whose purpose I can't tell. This is
the only CMake one that I do understand. They should upstream those
changes to us with an explanation, instead of carrying patches...

Found while researching if 9caac0f176040b4da48d3ea289683b0b082cf729 was
still necessary for OpenBSD.

Change-Id: I63b988479db546dabffcfffd17661fdd376bf8c8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 604eb6f4cdf61bf02a2e6e2ec2bbb58d0567364c)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-06-08 02:23:31 +00:00
Szabolcs David
54eebc4918 Fix some syntax errors in snippets
- The following error occurs when trying to use these example codes:
"error: expected primary-expression before ‘!=’ token"
- Rename "map" to "hash" in the QHash snippet

Amends 7d542e1daf09caadf6d3e36c4b09bdf94952c5a1.

Change-Id: I1ad5b799f444bf074dbfb44223c00770ecf456c7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 4e367fa17bca5ec9cc7456f9ce2a81466b34027f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 01:50:19 +00:00
Friedemann Kleint
f3d0f70949 Mimer SQL driver plugin: Reduce repetitive error messages
Introduce message helper functions for get/set, sparing the translators
having to translate the data types.

As a drive-by, use UUID/CLOB/BLOB consistently.

Amends 0efd8854c4b32ec0b011efbf6b3a1990fe684e32.

Task-number: QTBUG-111219
Change-Id: I7a137c3797947523af5478b3add6ee0a26b295d7
Reviewed-by: Fredrik Ålund <fredrik.alund@mimer.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit de3795c2a67a60691b1bb6b58908a16860dfc77a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 01:50:17 +00:00
Tor Arne Vestbø
463a3d1f6a Add Q_OS_APPLE define on Apple operating systems
It's quite common that macOS and iOS share backends, for example due to
the functionality being part of one of the Apple core frameworks. In
this case the support isn't directly tied to the Darwin kernel per se,
so let's use a more general define to refer to the union of Apple
based features.

Change-Id: I71cac5ec1d74cd86eba67a64b20846e48c9f05c5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit f34c5215f45a242962835c1174d79912a56e5410)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-08 01:50:16 +00:00
Amir Masoud Abdol
760c9d6a6a Resolve an issue when running /qt-configure-module .
Accounting for the case where `MODULE_ROOT` is set to `.` which then
makes the `get_filename_component` command to return an empty string;
consequently, we cannot find the `config_file.txt`, and cannot process
the features correctly.

Amend f4bf7982a679312146546fabfb086e801c2bbc37

Fixes: QTBUG-114085
Change-Id: I55c7529be6caba4691adec80efca8021bd03c500
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 076b4bed9f418f97f9fb29fce4f948f0d98854c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-07 23:32:34 +00:00
Timothée Keller
e14fe5f848 Windows QPA: Change monitor index detection
Monitor index detection changed from comparing deviceNames to comparing
serialNumbers, to prevent the case where two monitors with identical
names might overwrite one another.

Fixes: QTBUG-112829
Change-Id: Ibfad08e178774396c4b347acfcfbdb83ed4fe332
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit f4d6d04898bcc239f4b271330ba778de69bbd893)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-07 23:32:34 +00:00
Timothée Keller
4139b6d029 Windows QPA: Fix restore geometry after dragging from maximised - Fix
Small adjustment made to previous patch to fix the following issues:
- restoreGeometry not being updated after moving the window from one
screen to the other with keyboard shortcuts.
- restoreGeometry's size not being changed when moving screens if
WM_GETDPISCALEDSIZE isn't sent.

Task-number: QTBUG-112814
Change-Id: I9dd2340137ce57a731f8881d476e902323887e62
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 245c2b621f5942861b7f827bfc8a859b9efb9b72)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-07 23:32:34 +00:00
Axel Spoerl
78760fd3d8 QDockWidget: Propagate window title when re-docking
When a floating dockwidget's title changes, it is rendered as a
window title. When the title changes while floating, the change will be
reverted to the pre-change title when the dockwidget is docked again.

This patch explicitly propagates the window title, if it has been
programmatically changed while the dock widget is floating.

It adds test functionality in tst_QDockWidget::floatingTabs().

Fixes: QTBUG-113591
Change-Id: I96fa69fb27ad1a85f4ea9ce44c0a22290259fca6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c153066baaa88718ed45b68230d81285eb436d3d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-07 21:24:24 +00:00
Edward Welbourne
d1bef7ea9a Fix deprecation warnings agains u"..."_qs in dnslookup.cpp
Change-Id: I29a177c7d46304c5b494218f5862195eb92c7684
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 3ab7b7e23023a223392ae67514ff7ec73126ac42)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-07 13:23:30 +00:00
Edward Welbourne
8984ea7b4d QCoreApplicationPrivate::initLocale(): report correct encoding
We override the old encoding because it wasn't UTF-8, then we use a
fresh call to nl_langinfo(CODESET) when reporting the encoding that
"is not UTF-8", except that we've just fixed that so it is now.

Store the old encoding in a std::string before we change it, so that
we can report what it was rather than what we changed it to.
Amends commit 3690c202f959a505e0f0bcd4a7b19f235b04d015

Task-number: QTBUG-113371
Change-Id: I5f7c3648890cb0abf1d4769af24715686762c176
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit a7c87be8883458d151e3fe7fa1a8511212af41d4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-07 13:23:30 +00:00
Edward Welbourne
025ef096f7 Fix what we can of macOS's divergence for pre-1900 dates
The system locale backend on macOS uses system APIs to format dates
and times in localized ways. Those system APIs appear to know more
about time zones than the time_t functions (which artificially cut off
before 1900) are willing to tell us. As a result, QDateTime is left to
guess the offsets in use before 1900 but the locale-formatting takes a
correct offset into account, which can lead to QDateTime and the
locale-aware APIs using different offsets. This is further compounded
by the system APIs taking into account the calendar transition from
Julian to Gregorian. We can't do much about the latter.

Previously we were formatting dates by passing the start of the day to
the system APIs (which take a date-time, albeit using a "Date" name
for the type), along with a date-format that ignores the time of day.
For dates before 1900, if the system APIs know the offset in use was
less than that in use in the early 1900s, QDateTime (using the latter)
gets the start of the day slightly earlier than where the system APIs
know it is, so the day before is the date at that time. Use noon on
the day in question to avoid this problem, at least for zones that
didn't do whole day offset-shifts (crossing the date line) before
1900. Document the problem and the limited extent to which we can
solve it.

Task-number: QTBUG-54955
Change-Id: I5be1bfdb3013433ee248846533ef73af39f173f5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 9155a07667a3e3e7ac59382a59ba615d7211a322)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-07 13:23:30 +00:00
Marc Mutz
010b9adb95 QFusionStyle: optimize cache-key generation for qt_fusion_draw_button():
Instead of passing a QLatin1StringView to QStyleHelper::uniqueName(),
which takes a QString, allocating, and then using QStringBuilder to
append something to the result of uniqueHelper(), allocating again,
pull the appends to before the call to uniqueName(), folding these two
allocations into one.

Task-number: QTBUG-112200
Change-Id: I501dd4a3df4b9f5267ca931b550d521f4dafe493
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 362b5b84281ac4f31237166763f565e331876887)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-07 13:23:29 +00:00
Marc Mutz
a95930282e QFusionStyle: de-pessimize arrow painting
Instead of holding three QPointF's in a QPolygonF, which will allocate
them on the heap, use QVarLengthArray<>, which will allocate them on
the stack instead.

Task-numbber: QTBUG-112200
Change-Id: If078e5a9a5cb82fd03b511e28cceb88bd42996f8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d6ce0bad67c6961dc87469db7ac81144a52e875f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-07 13:23:29 +00:00
Marc Mutz
e6fb3b4ea0 QPixmapCache: fix leaking of QStrings and Keys on clear()
QPixmapCache maintains a mapping from QString to QPixmapCache::Key, in
the form of the cacheKeys QHash, but QPixmapCache::clear() didn't
touch it, leading to the string data (as well as the Keys) being
retained after any possible use. This can lead to memory slowly being
eaten up, as reported in QTBUG-112200, and prevents a periodic calling
of QPixmapCache::clear() from being a work-around for the issue in the
bug report.

Fix by clearing cacheKeys in QPixmapCache::clear().

This is designed as a low-risk enabler of a work-around, not a fix for
the issue. The work-around enabled by this is periodic calling of
QPixmapCache::clear().

[ChangeLog][QtGui][QPixmapCache] Fixed QString key data not being
freed on clear().

Task-number: QTBUG-112200
Change-Id: Ica6fa0e27e1b47b8df58d5e996378a2ececa5f9c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 6ab0d25a09f5aeb7a5a062f7fd44e95ca761e21e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-07 13:23:29 +00:00
Mikolaj Boc
f5e52d209e Modernize the qtloader
This is a minimal version of qtloader. The load function accepts
the same arguments as emscripten runtime with a few additions:
- qt.environment
- qt.onExit
- qt.containerElements
- qt.fontDpi
- qt.onLoaded
- qt.entryFunction

State handling has been removed in favor of making the load async
(assume loading when the promise is live).

Public APIs getting crashed status, exit text and code have been
refactored into the new qt.onExit event fed to load. No need for
keeping the state in the loader.

The loader is integration-tested. A test module with test APIs
has been created as a test harness.

The runtime APIs exposed by Qt (font dpi and screen API) are handled
by the qtloader seamlessly.

Change-Id: Iaee65702667da0349a475feae6b83244d966d98d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit b9491daad0ed1c4b9c74e0c3b23f87eb7ad4f37d)
2023-06-07 13:10:01 +02:00
Amir Masoud Abdol
f1fa472c9f Use parentheses for Xcode specific variables
If I'm not mistaken we would like to leave this to Xcode, if so, we can
use `$()` to make our intention more clear in the code.

Change-Id: I3867f68f371a1cf1a5db5e639ec740f2546ccd75
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit a471324a03a0b83e657325ee22f032b273e84102)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-07 08:41:31 +00:00
Eskil Abrahamsen Blomfeldt
ad4a011ebd Upgrade Harfbuzz to 7.3.0
Fixes: QTBUG-114098
Change-Id: I7bc766e6edada6f964c2dc40f18ff710249fb159
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit d390ac99f2c2a0f70319df5f6ed3068cc5cbd6fe)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-06-07 08:41:31 +00:00
Friedemann Kleint
d0962ccebe uic: Generate QFont::Weight
Check for the new "fontweight" attribute before "bold".

Task-number: QTBUG-113670
Change-Id: Ib34ab5a19872adb3c063861ffbe6b2d3374afcaa
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
(cherry picked from commit 79436bd34ddf2dc39d42ed9b80a54f4d581c44d9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-07 06:24:21 +00:00
Volker Hilsheimer
38c0d60047 QTabBar: recalculate scroll offset when showing
If an application sets the current index and resizes the tab widget
before showing it, then the scroll offset might be calculated based on
an old size. Since after ca15f650a1a914bb9a41131109c46c4e52c5ebb1,
resizing explicitly avoids scrolling, this could result in tabs ending
up scrolled outside of the tab bar when showing the tab widget.

Fix that by explicitly making the current tab visible in the tab bar's
showEvent handler, which recalculates the scroll offset based on the
actual size.

This is only reproducible with a tab widget, which lays out the tab bar
for each change and resets the tab bar's layoutDirty flag. Add a test
case there.

Fixes: QTBUG-114204
Change-Id: I1e9506b9dde1dd892291d108dd2c7b675ef99509
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Jonas Kvinge <jonas@jkvinge.net>
(cherry picked from commit 2a7da1b3c8c4096d7c2b09f3fcc58e9cf47867cd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-07 02:12:27 +00:00
Andy Nichols
2c12c9b010 Revert "QStringBuilder: remove unneeded specializations"
This reverts commit 3c6c3eccd1f91bd1ae0a518318ef264f8eff63f5.

Reason for revert: They do appear to be needed, and removing them
changes behavior: QTBUG-114206

Fixes: QTBUG-114206
Task-number: QTBUG-114238
Change-Id: Iac75bbc1ef14fe89f4282bd58fe996f9a09b8506
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4d261c1b544330c5481b2ac2e42fbab764255ab5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-06 09:26:10 +00:00
Kai Köhne
d6d16aa17f Doc: Small fixes to QCommandLineParser overview
Change-Id: I535944b747ed511cfe5e6efe8ca2c13b52c2cfbb
Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io>
(cherry picked from commit 1352dba3b05a5d9e8a59ccd86037d41bfcee6fb0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-06 08:44:01 +00:00
Ahmad Samir
7126a58f6f Moc: streamline how diagnostic messages are printed
If we don't have a valid Symbol to get a line number from, or if the
symbol.lineNum is -1, print a shorter message containing only the file
path. Printing: '/path/to/file👎1' isn't useful (and looks wrong).

Change error/defaultErrorMsg/warning/note() to delegate to one central
method, so that they all behave the same; e.g. previously warning() and
note(), guarded against printing "-1" for the line number, whereas
error() didn't.

This also makes it possible to use error() for reporting other issues
(e.g. the size of generator.strings list exceeding INT_MAX, which will
happen in a later commit).

Change-Id: Iddc96e08315fae415be6a84928f845d7bceb4c5f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 9cb08c4c0de1685551c18e3b7958a00afa2a4c6a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-05 22:23:20 +00:00
Ahmad Samir
059acac8f9 Moc/Generator: fix 64-to-32 narrowing conversion warnigns
Change-Id: Id1094aaba284c51c3a840a8e107abd837a825593
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e22f766bda7c405ab4daa27b553d4100dcfa811f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-05 22:23:14 +00:00
Ahmad Samir
f22bedf5af Misc.: fix narrowing conversion warnings with explicit cast to int
And using qsizetype in some places.

::pathconf() returns long.

Found by using -Wshorten-64-to-32 clang compiler flag, or adding that
flag to the flags clangd uses.

Change-Id: I9f9abd3d4d6fe73f525eec869ceabc799317f3d6
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 8d77ee0f2b042af7aec43e1e83eb26d92c2f8234)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-05 20:35:41 +00:00
Ahmad Samir
e71dfbb7db Misc.: fix narrowing conversion warnings
Using:
- range-for and iterator-based loops
- QList constructor that takes a pair of iterators

Found by using -Wshorten-64-to-32 clang compiler flag, or adding that
flag to the flags clangd uses, e.g. adding this to clangd's config file
(see https://clangd.llvm.org/config):
CompileFlags:
    Add: [-Wshorten-64-to-32]

Change-Id: I13ae65e09ab59a59f9e5c189ea27e4e16527df2d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 3ee289e40d1a7d3582cb1a3a304e681d2085bb82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-06-05 20:35:35 +00:00
2943 changed files with 119183 additions and 64394 deletions

View File

@ -7,7 +7,7 @@ if (NOT DEFINED QT_SUPERBUILD OR DEFINED QT_REPO_MODULE_VERSION)
set(QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_LEAN_HEADERS=1")
endif()
set(QT_REPO_MODULE_VERSION "6.6.0")
set(QT_REPO_MODULE_VERSION "6.6.2")
set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1")
set(QT_COPYRIGHT_YEAR "2023")
@ -16,12 +16,14 @@ set(QT_COPYRIGHT "Copyright (C) ${QT_COPYRIGHT_YEAR} The Qt Company Ltd and othe
# Minimum requirement for building Qt
set(QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_QT_SHARED "3.16")
set(QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_QT_STATIC "3.21")
set(QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_QT_APPLE "3.21")
# Minimum requirement for consuming Qt in a user project.
# This might be different in the future, e.g. be lower than the requirement for
# building Qt.
set(QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_SHARED "3.16")
set(QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_STATIC "3.21")
set(QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_APPLE "3.21")
# Policy settings for commands defined by qtbase. These will also be injected
# into the top level policy scope of each Qt module when building Qt so that
@ -34,3 +36,13 @@ set(QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_STATIC "3.21")
# in sync.
set(QT_MIN_NEW_POLICY_CMAKE_VERSION "3.16")
set(QT_MAX_NEW_POLICY_CMAKE_VERSION "3.21")
# These should be updated together with the documentation in
# qtdoc/doc/src/platforms/supported-platforms.qdocinc
set(QT_SUPPORTED_MIN_MACOS_SDK_VERSION "12")
set(QT_SUPPORTED_MAX_MACOS_SDK_VERSION "14")
set(QT_SUPPORTED_MIN_MACOS_XCODE_VERSION "13")
set(QT_SUPPORTED_MIN_IOS_SDK_VERSION "16")
set(QT_SUPPORTED_MAX_IOS_SDK_VERSION "17")
set(QT_SUPPORTED_MIN_IOS_XCODE_VERSION "14")

2
.gitignore vendored
View File

@ -253,6 +253,7 @@ tags
*_resource.rc
*.*#
*.debug
.cache
# xemacs temporary files
*.flc
@ -333,3 +334,4 @@ CTestTestfile.cmake
cmake_install.cmake
*_autogen
tst_*.xml
CMakeUserPresets.json

View File

@ -177,13 +177,6 @@ if(NOT QT_BUILD_STANDALONE_TESTS)
add_subdirectory(src)
endif()
if(QT_BUILD_TESTS)
add_subdirectory(tests)
if(NOT QT_BUILD_TESTS_BY_DEFAULT)
set_property(DIRECTORY tests PROPERTY EXCLUDE_FROM_ALL TRUE)
endif()
endif()
if(NOT QT_BUILD_STANDALONE_TESTS)
if(QT_WILL_BUILD_TOOLS AND QT_FEATURE_settings)
add_subdirectory(qmake)
@ -208,6 +201,15 @@ if(NOT QT_BUILD_STANDALONE_TESTS)
endforeach()
endif()
qt_build_repo_post_process()
if(QT_BUILD_TESTS)
add_subdirectory(tests)
if(NOT QT_BUILD_TESTS_BY_DEFAULT)
set_property(DIRECTORY tests PROPERTY EXCLUDE_FROM_ALL TRUE)
endif()
endif()
qt_build_repo_end()
if(NOT QT_BUILD_STANDALONE_TESTS AND QT_BUILD_EXAMPLES)

View File

@ -5,13 +5,18 @@
# https://gitlab.kitware.com/cmake/cmake/-/issues/20713
# https://gitlab.kitware.com/cmake/cmake/-/issues/21475
set(configs "@__qt_configured_configs@")
set(should_skip_strip "@__qt_skip_strip_installed_artifacts@")
if(NOT QT_BUILD_DIR)
message(FATAL_ERROR "No QT_BUILD_DIR value provided to qt-cmake-private-install.")
endif()
if(should_skip_strip)
unset(strip_arg)
if ("x@MSVC@" STREQUAL "x")
else()
set(strip_arg --strip)
endif()
foreach(config ${configs})
message(STATUS "Installing configuration: '${config}'")
set(args "${CMAKE_COMMAND}" --install ${QT_BUILD_DIR} --config "${config}" ${strip_arg})

View File

@ -128,7 +128,8 @@ check_cxx_source_compiles("
#include <EGL/egl.h>
int main(int, char **) {
EGLint x = 0; EGLDisplay dpy = 0; EGLContext ctx = 0;
[[maybe_unused]] EGLint x = 0;
EGLDisplay dpy = 0; EGLContext ctx = 0;
eglDestroyContext(dpy, ctx);
}" HAVE_EGL)

View File

@ -137,6 +137,9 @@ foreach(_comp ${XCB_known_components})
set(XCB_${_comp}_pkg_config "xcb-${_lc_comp}")
set(XCB_${_comp}_lib "xcb-${_lc_comp}")
set(XCB_${_comp}_header "xcb/${_lc_comp}.h")
if(USE_XCB_${_comp}_STATIC)
set(XCB_${_comp}_lib "lib${XCB_${_comp}_lib}.a")
endif()
endforeach()
# exceptions
set(XCB_XCB_component_deps)

View File

@ -23,7 +23,7 @@ set(gssapi_library_names
gssapi # FreeBSD
gssapi_krb5
)
if(VCPKG_TARGET_TRIPLET AND APPLE)
if(APPLE)
list(REMOVE_ITEM gssapi_library_names "gssapi_krb5")
endif()

View File

@ -5,18 +5,62 @@
# FindMimer
# ---------
# Try to locate the Mimer SQL client library
if(NOT DEFINED MimerSQL_ROOT)
if(DEFINED ENV{MIMERSQL_DEV_ROOT})
set(MimerSQL_ROOT "$ENV{MIMERSQL_DEV_ROOT}")
endif()
endif()
if(NOT DEFINED MimerSQL_ROOT)
find_package(PkgConfig QUIET)
pkg_check_modules(PC_Mimer QUIET mimctrl)
endif()
if(PkgConfig_FOUND AND NOT DEFINED MimerSQL_ROOT)
pkg_check_modules(PC_Mimer QUIET mimcontrol)
set(MimerSQL_include_dir_hints "${PC_MimerSQL_INCLUDEDIR}")
set(MimerSQL_library_hints "${PC_MimerSQL_LIBDIR}")
else()
if(DEFINED MimerSQL_ROOT)
if(WIN32)
set(MimerSQL_include_dir_hints "${MimerSQL_ROOT}\\include")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86|X86)$")
set(MimerSQL_library_hints "${MimerSQL_ROOT}\\lib\\x86")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(amd64|AMD64)$")
set(MimerSQL_library_hints "${MimerSQL_ROOT}\\lib\\amd64")
else()
set(MimerSQL_library_hints "")
endif()
else()
set(MimerSQL_include_dir_hints "${MimerSQL_ROOT}/include")
set(MimerSQL_library_hints "${MimerSQL_ROOT}/lib")
endif()
else()
if(WIN32)
set(MimerSQL_include_dir_hints "C:\\MimerSQLDev\\include")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86|X86)$")
set(MimerSQL_library_hints "C:\\MimerSQLDev\\lib\\x86")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(amd64|AMD64)$")
set(MimerSQL_library_hints "C:\\MimerSQLDev\\lib\\amd64")
else()
set(MimerSQL_library_hints "")
endif()
elseif(APPLE AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(MimerSQL_library_hints "/usr/local/lib")
set(MimerSQL_include_dir_hints "/usr/local/include")
else()
set(MimerSQL_include_dir_hints "")
set(MimerSQL_library_hints "")
endif()
endif()
endif()
find_path(Mimer_INCLUDE_DIR
NAMES mimerapi.h
HINTS ${PC_Mimer_INCLUDEDIR})
HINTS ${MimerSQL_include_dir_hints})
if(WIN32)
if("$ENV{PROCESSOR_ARCHITECTURE}" STREQUAL "x86")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86|X86)$")
set(MIMER_LIBS_NAMES mimapi32)
else()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(amd64|AMD64)$")
set(MIMER_LIBS_NAMES mimapi64)
endif()
else()
@ -25,7 +69,7 @@ endif()
find_library(Mimer_LIBRARIES
NAMES ${MIMER_LIBS_NAMES}
HINTS ${PC_Mimer_LIBDIR})
HINTS ${MimerSQL_library_hints})
include(FindPackageHandleStandardArgs)

View File

@ -18,9 +18,7 @@ find_package_handle_standard_args(PPS DEFAULT_MSG PPS_INCLUDE_DIR PPS_LIBRARY)
mark_as_advanced(PPS_INCLUDE_DIR PPS_LIBRARY)
if(PPS_FOUND)
add_library(__PPS INTERFACE IMPORTED)
target_link_libraries(__PPS INTERFACE "${PPS_LIBRARY}")
target_include_directories(__PPS INTERFACE "${PPS_INCLUDE_DIR}")
add_library(PPS::PPS ALIAS __PPS)
add_library(PPS::PPS INTERFACE IMPORTED)
target_link_libraries(PPS::PPS INTERFACE "${PPS_LIBRARY}")
target_include_directories(PPS::PPS INTERFACE "${PPS_INCLUDE_DIR}")
endif()

View File

@ -17,14 +17,18 @@ if (OpenGL_FOUND)
add_library(WrapOpenGL::WrapOpenGL INTERFACE IMPORTED)
if(APPLE)
# CMake 3.27 and older:
# On Darwin platforms FindOpenGL sets IMPORTED_LOCATION to the absolute path of the library
# within the framework. This ends up as an absolute path link flag, which we don't want,
# because that makes our .prl files un-relocatable.
# Extract the framework path instead, and use that in INTERFACE_LINK_LIBRARIES,
# which CMake ends up transforming into a reloctable -framework flag.
# which CMake ends up transforming into a relocatable -framework flag.
# See https://gitlab.kitware.com/cmake/cmake/-/issues/20871 for details.
#
# CMake 3.28 and above:
# IMPORTED_LOCATION is the absolute path the the OpenGL.framework folder.
get_target_property(__opengl_fw_lib_path OpenGL::GL IMPORTED_LOCATION)
if(__opengl_fw_lib_path)
if(__opengl_fw_lib_path AND NOT __opengl_fw_lib_path MATCHES "/([^/]+)\\.framework$")
get_filename_component(__opengl_fw_path "${__opengl_fw_lib_path}" DIRECTORY)
endif()

View File

@ -31,7 +31,7 @@ check_cxx_source_compiles("
int main(int, char **argv)
{
res_state statep;
res_state statep = 0;
int n = res_nmkquery(statep, 0, argv[1], 0, 0, NULL, 0, NULL, NULL, 0);
n = res_nsend(statep, NULL, 0, NULL, 0);
n = dn_expand(NULL, NULL, NULL, NULL, 0);

View File

@ -48,6 +48,26 @@ if(Vulkan_INCLUDE_DIR)
target_include_directories(WrapVulkanHeaders::WrapVulkanHeaders INTERFACE
${__qt_molten_vk_homebrew_include_path})
endif()
# Check for homebrew vulkan-headers folder structure
# If instead of molten-vk folder, CMAKE_PREFIX_PATH points to Homebrew's
# vulkan-headers installation, then we will not be able to find molten-vk
# headers. If we assume that user has installed the molten-vk formula as
# well, then we might have a chance to pick it up like this.
if(Vulkan_INCLUDE_DIR MATCHES "/homebrew/Cellar/")
set(__qt_standalone_molten_vk_homebrew_include_path
"${Vulkan_INCLUDE_DIR}/../../../../opt/molten-vk/include")
else()
set(__qt_standalone_molten_vk_homebrew_include_path
"${Vulkan_INCLUDE_DIR}/../../molten-vk/include")
endif()
get_filename_component(
__qt_standalone_molten_vk_homebrew_include_path
"${__qt_standalone_molten_vk_homebrew_include_path}" ABSOLUTE)
if(EXISTS "${__qt_standalone_molten_vk_homebrew_include_path}")
target_include_directories(WrapVulkanHeaders::WrapVulkanHeaders INTERFACE
${__qt_standalone_molten_vk_homebrew_include_path})
endif()
endif()
endif()

View File

@ -5,6 +5,7 @@
# Android specific functions/macros/properties required for building Qt Modules
#
macro(qt_internal_setup_android_target_properties)
define_property(TARGET
PROPERTY
QT_ANDROID_MODULE_INSTALL_DIR
@ -14,7 +15,6 @@ define_property(TARGET
"Recorded install location for a Qt Module. Used by qt_internal_android_dependencies()."
)
define_property(TARGET
PROPERTY
QT_ANDROID_JAR_DEPENDENCIES
@ -86,6 +86,7 @@ define_property(TARGET
FULL_DOCS
"List of ABIs that the target packages are built with."
)
endmacro()
function(qt_internal_android_dependencies_content target file_content_out)
get_target_property(arg_JAR_DEPENDENCIES ${target} QT_ANDROID_JAR_DEPENDENCIES)

View File

@ -53,6 +53,7 @@ function(qt_internal_add_app target)
${arg_NO_UNITY_BUILD}
${forward_install_dir}
SOURCES ${arg_SOURCES}
NO_PCH_SOURCES ${arg_NO_PCH_SOURCES}
NO_UNITY_BUILD_SOURCES ${arg_NO_UNITY_BUILD_SOURCES}
INCLUDE_DIRECTORIES
${arg_INCLUDE_DIRECTORIES}

View File

@ -1,499 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#
# Collection of auto detection routines to improve the user experience when
# building Qt from source.
#
# Make sure to not run detection when building standalone tests, because the detection was already
# done when initially configuring qtbase.
function(qt_internal_ensure_static_qt_config)
if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build Qt statically or dynamically" FORCE)
endif()
if(BUILD_SHARED_LIBS)
message(FATAL_ERROR
"Building Qt for ${CMAKE_SYSTEM_NAME} as shared libraries is not supported.")
endif()
endfunction()
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicWasmToolchainHelpers.cmake")
function(qt_auto_detect_wasm)
if("${QT_QMAKE_TARGET_MKSPEC}" STREQUAL "wasm-emscripten" OR "${QT_QMAKE_TARGET_MKSPEC}" STREQUAL "wasm-emscripten-64")
if (NOT DEFINED ENV{EMSDK})
message(FATAL_ERROR
"Can't find an Emscripten SDK! Make sure the EMSDK environment variable is "
"available by activating and sourcing the emscripten sdk. Also ensure emcc is in "
"your path.")
endif()
if(NOT DEFINED QT_AUTODETECT_WASM_IS_DONE)
message(STATUS "Extracting Emscripten SDK info from EMSDK env var: $ENV{EMSDK}")
__qt_internal_get_emroot_path_suffix_from_emsdk_env(EMROOT_PATH)
__qt_internal_query_emsdk_version("${EMROOT_PATH}" TRUE CMAKE_EMSDK_REGEX_VERSION)
set(EMCC_VERSION "${CMAKE_EMSDK_REGEX_VERSION}" CACHE STRING INTERNAL FORCE)
if(NOT DEFINED BUILD_SHARED_LIBS)
qt_internal_ensure_static_qt_config()
endif()
# Find toolchain file
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
__qt_internal_get_emscripten_cmake_toolchain_file_path_from_emsdk_env(
"${EMROOT_PATH}" wasm_toolchain_file)
set(CMAKE_TOOLCHAIN_FILE "${wasm_toolchain_file}" CACHE STRING "" FORCE)
endif()
if(EXISTS "${CMAKE_TOOLCHAIN_FILE}")
message(STATUS
"Emscripten ${EMCC_VERSION} toolchain file detected at ${CMAKE_TOOLCHAIN_FILE}")
else()
__qt_internal_show_error_no_emscripten_toolchain_file_found_when_building_qt()
endif()
__qt_internal_get_emcc_recommended_version(recommended_version)
set(QT_EMCC_RECOMMENDED_VERSION "${recommended_version}" CACHE STRING INTERNAL FORCE)
set(QT_AUTODETECT_WASM_IS_DONE TRUE CACHE BOOL "")
else()
message(STATUS
"Reusing cached Emscripten ${EMCC_VERSION} toolchain file detected at "
"${CMAKE_TOOLCHAIN_FILE}")
endif()
endif()
endfunction()
function(qt_auto_detect_cmake_generator)
if(NOT CMAKE_GENERATOR MATCHES "Ninja" AND NOT QT_SILENCE_CMAKE_GENERATOR_WARNING)
message(WARNING
"The officially supported CMake generator for building Qt is Ninja. "
"You are using: '${CMAKE_GENERATOR}' instead. "
"Thus, you might encounter issues. Use at your own risk.")
endif()
endfunction()
function(qt_auto_detect_android)
# We assume an Android build if any of the ANDROID_* cache variables are set.
if(DEFINED ANDROID_SDK_ROOT
OR DEFINED ANDROID_NDK_ROOT
OR DEFINED ANDROID_ABI
OR DEFINED ANDROID_NATIVE_ABI_LEVEL
OR DEFINED ANDROID_STL)
set(android_detected TRUE)
else()
set(android_detected FALSE)
endif()
# Auto-detect NDK root
if(NOT DEFINED ANDROID_NDK_ROOT AND DEFINED ANDROID_SDK_ROOT)
file(GLOB ndk_versions LIST_DIRECTORIES true RELATIVE "${ANDROID_SDK_ROOT}/ndk"
"${ANDROID_SDK_ROOT}/ndk/*")
unset(ndk_root)
if(NOT ndk_versions STREQUAL "")
# Use the NDK with the highest version number.
if(CMAKE_VERSION VERSION_LESS 3.18)
list(SORT ndk_versions)
list(REVERSE ndk_versions)
else()
list(SORT ndk_versions COMPARE NATURAL ORDER DESCENDING)
endif()
list(GET ndk_versions 0 ndk_root)
string(PREPEND ndk_root "${ANDROID_SDK_ROOT}/ndk/")
else()
# Fallback: use the deprecated "ndk-bundle" directory within the SDK root.
set(ndk_root "${ANDROID_SDK_ROOT}/ndk-bundle")
if(NOT IS_DIRECTORY "${ndk_root}")
unset(ndk_root)
endif()
endif()
if(DEFINED ndk_root)
message(STATUS "Android NDK detected: ${ndk_root}")
set(ANDROID_NDK_ROOT "${ndk_root}" CACHE STRING "")
endif()
endif()
# Auto-detect toolchain file
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ANDROID_NDK_ROOT)
set(toolchain_file "${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake")
if(EXISTS "${toolchain_file}")
message(STATUS "Android toolchain file within NDK detected: ${toolchain_file}")
set(CMAKE_TOOLCHAIN_FILE "${toolchain_file}" CACHE STRING "")
else()
message(FATAL_ERROR "Cannot find the toolchain file '${toolchain_file}'. "
"Please specify the toolchain file with -DCMAKE_TOOLCHAIN_FILE=<file>.")
endif()
endif()
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND android_detected)
message(FATAL_ERROR "An Android build was requested, but no Android toolchain file was "
"specified nor detected.")
endif()
if(DEFINED CMAKE_TOOLCHAIN_FILE AND NOT DEFINED QT_AUTODETECT_ANDROID)
# Peek into the toolchain file and check if it looks like an Android one.
if(NOT android_detected)
file(READ ${CMAKE_TOOLCHAIN_FILE} toolchain_file_content OFFSET 0 LIMIT 80)
string(FIND "${toolchain_file_content}" "The Android Open Source Project"
find_result REVERSE)
if(NOT ${find_result} EQUAL -1)
set(android_detected TRUE)
endif()
endif()
if(android_detected)
message(STATUS "Android build detected, checking configuration defaults...")
# ANDROID_NATIVE_API_LEVEL is an just an alias to ANDROID_PLATFORM, check for both
if(NOT DEFINED ANDROID_PLATFORM AND NOT DEFINED ANDROID_NATIVE_API_LEVEL)
message(STATUS "Neither ANDROID_PLATFORM nor ANDROID_NATIVE_API_LEVEL were specified, using API level 23 as default")
set(ANDROID_PLATFORM "android-23" CACHE STRING "")
set(ANDROID_NATIVE_API_LEVEL 23 CACHE STRING "")
endif()
if(NOT DEFINED ANDROID_STL)
set(ANDROID_STL "c++_shared" CACHE STRING "")
endif()
endif()
set(QT_AUTODETECT_ANDROID ${android_detected} CACHE STRING "")
elseif (QT_AUTODETECT_ANDROID)
message(STATUS "Android build detected")
endif()
endfunction()
function(qt_auto_detect_vcpkg)
if(DEFINED ENV{VCPKG_ROOT})
set(vcpkg_toolchain_file "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")
get_filename_component(vcpkg_toolchain_file "${vcpkg_toolchain_file}" ABSOLUTE)
if(DEFINED CMAKE_TOOLCHAIN_FILE)
get_filename_component(supplied_toolchain_file "${CMAKE_TOOLCHAIN_FILE}" ABSOLUTE)
if(NOT supplied_toolchain_file STREQUAL vcpkg_toolchain_file)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${CMAKE_TOOLCHAIN_FILE}" CACHE STRING "")
endif()
unset(supplied_toolchain_file)
endif()
set(CMAKE_TOOLCHAIN_FILE "${vcpkg_toolchain_file}" CACHE STRING "" FORCE)
message(STATUS "Using vcpkg from $ENV{VCPKG_ROOT}")
if(DEFINED ENV{VCPKG_DEFAULT_TRIPLET} AND NOT DEFINED VCPKG_TARGET_TRIPLET)
set(VCPKG_TARGET_TRIPLET "$ENV{VCPKG_DEFAULT_TRIPLET}" CACHE STRING "")
message(STATUS "Using vcpkg triplet ${VCPKG_TARGET_TRIPLET}")
endif()
unset(vcpkg_toolchain_file)
message(STATUS "CMAKE_TOOLCHAIN_FILE is: ${CMAKE_TOOLCHAIN_FILE}")
if(DEFINED VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
message(STATUS "VCPKG_CHAINLOAD_TOOLCHAIN_FILE is: ${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
endif()
endif()
endfunction()
function(qt_auto_detect_ios)
if(CMAKE_SYSTEM_NAME STREQUAL iOS)
message(STATUS "Using internal CMake ${CMAKE_SYSTEM_NAME} toolchain file.")
# The QT_UIKIT_SDK check simulates the input.sdk condition for simulator_and_device in
# configure.json.
# If the variable is explicitly provided, assume simulator_and_device to be off.
if(QT_UIKIT_SDK)
set(simulator_and_device OFF)
else()
# Default to simulator_and_device when an explicit sdk is not requested.
# Requires CMake 3.17.0+.
set(simulator_and_device ON)
endif()
message(STATUS "simulator_and_device set to: \"${simulator_and_device}\".")
# Choose relevant architectures.
# Using a non Xcode generator requires explicit setting of the
# architectures, otherwise compilation fails with unknown defines.
if(simulator_and_device)
set(osx_architectures "arm64;x86_64")
elseif(QT_UIKIT_SDK STREQUAL "iphoneos")
set(osx_architectures "arm64")
elseif(QT_UIKIT_SDK STREQUAL "iphonesimulator")
set(osx_architectures "x86_64")
else()
if(NOT DEFINED QT_UIKIT_SDK)
message(FATAL_ERROR "Please provide a value for -DQT_UIKIT_SDK."
" Possible values: iphoneos, iphonesimulator.")
else()
message(FATAL_ERROR
"Unknown SDK argument given to QT_UIKIT_SDK: ${QT_UIKIT_SDK}.")
endif()
endif()
# For non simulator_and_device builds, we need to explicitly set the SYSROOT aka the sdk
# value.
if(QT_UIKIT_SDK)
set(CMAKE_OSX_SYSROOT "${QT_UIKIT_SDK}" CACHE STRING "")
endif()
set(CMAKE_OSX_ARCHITECTURES "${osx_architectures}" CACHE STRING "")
if(NOT DEFINED BUILD_SHARED_LIBS)
qt_internal_ensure_static_qt_config()
endif()
# Disable qt rpaths for iOS, just like mkspecs/common/uikit.conf does, due to those
# bundles not being able to use paths outside the app bundle. Not sure this is strictly
# needed though.
set(QT_DISABLE_RPATH "OFF" CACHE BOOL "Disable automatic Qt rpath handling." FORCE)
endif()
endfunction()
function(qt_auto_detect_cmake_config)
if(CMAKE_CONFIGURATION_TYPES)
# Allow users to specify this option.
if(NOT QT_MULTI_CONFIG_FIRST_CONFIG)
list(GET CMAKE_CONFIGURATION_TYPES 0 first_config_type)
set(QT_MULTI_CONFIG_FIRST_CONFIG "${first_config_type}")
set(QT_MULTI_CONFIG_FIRST_CONFIG "${first_config_type}" PARENT_SCOPE)
endif()
set(CMAKE_TRY_COMPILE_CONFIGURATION "${QT_MULTI_CONFIG_FIRST_CONFIG}" PARENT_SCOPE)
if(CMAKE_GENERATOR STREQUAL "Ninja Multi-Config")
# Create build-<config>.ninja files for all specified configurations.
set(CMAKE_CROSS_CONFIGS "all" CACHE STRING "")
# The configuration that will be considered the main one (for example when
# configuring standalone tests with a single-config generator like Ninja).
set(CMAKE_DEFAULT_BUILD_TYPE "${QT_MULTI_CONFIG_FIRST_CONFIG}" CACHE STRING "")
# By default when ninja is called without parameters, it will build all configurations.
set(CMAKE_DEFAULT_CONFIGS "all" CACHE STRING "")
endif()
endif()
endfunction()
function(qt_auto_detect_cyclic_toolchain)
if(CMAKE_TOOLCHAIN_FILE AND CMAKE_TOOLCHAIN_FILE MATCHES "/qt.toolchain.cmake$")
message(FATAL_ERROR
"Woah there! You can't use the Qt generated qt.toolchain.cmake file to configure "
"qtbase, because that will create a toolchain file that includes itself!\n"
"Did you accidentally use qt-cmake to configure qtbase? Make sure to remove the "
"CMakeCache.txt file, and configure qtbase with 'cmake' instead of 'qt-cmake'.")
endif()
endfunction()
function(qt_internal_get_darwin_sdk_version out_var)
if(APPLE)
if(CMAKE_SYSTEM_NAME STREQUAL iOS)
set(sdk_name "iphoneos")
else()
# Default to macOS
set(sdk_name "macosx")
endif()
set(xcrun_version_arg "--show-sdk-version")
execute_process(COMMAND /usr/bin/xcrun --sdk ${sdk_name} ${xcrun_version_arg}
OUTPUT_VARIABLE sdk_version
ERROR_VARIABLE xcrun_error)
if(NOT sdk_version)
message(FATAL_ERROR
"Can't determine darwin ${sdk_name} SDK version. Error: ${xcrun_error}")
endif()
string(STRIP "${sdk_version}" sdk_version)
set(${out_var} "${sdk_version}" PARENT_SCOPE)
endif()
endfunction()
function(qt_internal_get_xcode_version out_var)
if(APPLE)
execute_process(COMMAND /usr/bin/xcrun xcodebuild -version
OUTPUT_VARIABLE xcode_version
ERROR_VARIABLE xcrun_error)
string(REPLACE "\n" " " xcode_version "${xcode_version}")
string(STRIP "${xcode_version}" xcode_version)
set(${out_var} "${xcode_version}" PARENT_SCOPE)
endif()
endfunction()
function(qt_auto_detect_darwin)
if(APPLE)
# If no CMAKE_OSX_DEPLOYMENT_TARGET is provided, default to a value that Qt defines.
# This replicates the behavior in mkspecs/common/macx.conf where
# QMAKE_MACOSX_DEPLOYMENT_TARGET is set.
set(description
"Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value.")
if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
if(NOT CMAKE_SYSTEM_NAME)
# macOS
set(version "11.0")
elseif(CMAKE_SYSTEM_NAME STREQUAL iOS)
set(version "14.0")
endif()
if(version)
set(CMAKE_OSX_DEPLOYMENT_TARGET "${version}" CACHE STRING "${description}")
endif()
endif()
qt_internal_get_darwin_sdk_version(darwin_sdk_version)
set(QT_MAC_SDK_VERSION "${darwin_sdk_version}" CACHE STRING "Darwin SDK version.")
qt_internal_get_xcode_version(xcode_version)
set(QT_MAC_XCODE_VERSION "${xcode_version}" CACHE STRING "Xcode version.")
list(LENGTH CMAKE_OSX_ARCHITECTURES arch_count)
if(NOT CMAKE_SYSTEM_NAME STREQUAL iOS AND arch_count GREATER 0)
foreach(arch ${CMAKE_OSX_ARCHITECTURES})
if(arch STREQUAL "arm64e")
message(WARNING "Applications built against an arm64e Qt architecture will "
"likely fail to run on Apple Silicon. Consider targeting "
"'arm64' instead.")
endif()
endforeach()
endif()
endif()
endfunction()
function(qt_auto_detect_macos_universal)
if(APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL iOS)
list(LENGTH CMAKE_OSX_ARCHITECTURES arch_count)
set(is_universal "OFF")
if(arch_count GREATER 1)
set(is_universal "ON")
endif()
set(QT_IS_MACOS_UNIVERSAL "${is_universal}" CACHE INTERNAL "Build universal Qt for macOS")
endif()
endfunction()
function(qt_auto_detect_pch)
set(default_value "ON")
if(CMAKE_OSX_ARCHITECTURES AND CMAKE_VERSION VERSION_LESS 3.18.0 AND NOT QT_FORCE_PCH)
list(LENGTH CMAKE_OSX_ARCHITECTURES arch_count)
# CMake versions lower than 3.18 don't support PCH when multiple architectures are set.
# This is the case for simulator_and_device builds.
if(arch_count GREATER 1)
set(default_value "OFF")
message(WARNING "PCH support disabled due to usage of multiple architectures.")
endif()
endif()
option(BUILD_WITH_PCH "Build Qt using precompiled headers?" "${default_value}")
endfunction()
function(qt_auto_detect_win32_arm)
if("${QT_QMAKE_TARGET_MKSPEC}" STREQUAL "win32-arm64-msvc")
set(CMAKE_SYSTEM_NAME "Windows" CACHE STRING "")
set(CMAKE_SYSTEM_VERSION "10" CACHE STRING "")
set(CMAKE_SYSTEM_PROCESSOR "arm64" CACHE STRING "")
endif()
endfunction()
function(qt_auto_detect_linux_x86)
if("${QT_QMAKE_TARGET_MKSPEC}" STREQUAL "linux-g++-32" AND NOT QT_NO_AUTO_DETECT_LINUX_X86)
# Add flag to ensure code is compiled for 32bit x86 ABI aka i386 or its flavors.
set(__qt_toolchain_common_flags_init "-m32")
if(NOT QT_NO_OVERRIDE_LANG_FLAGS_INIT)
set(CMAKE_C_FLAGS_INIT "${__qt_toolchain_common_flags_init}" PARENT_SCOPE)
set(CMAKE_CXX_FLAGS_INIT "${__qt_toolchain_common_flags_init}" PARENT_SCOPE)
set(CMAKE_ASM_FLAGS_INIT "${__qt_toolchain_common_flags_init}" PARENT_SCOPE)
endif()
# Each distro places arch-specific libraries according to its own file system layout.
#
# https://wiki.debian.org/Multiarch/TheCaseForMultiarch
# https://wiki.ubuntu.com/MultiarchSpec
# https://wiki.gentoo.org/wiki/Project:AMD64/Multilib_layout
# https://wiki.archlinux.org/title/official_repositories#multilib
# https://documentation.suse.com/sles/15-SP3/html/SLES-all/cha-64bit.html
# https://pilotlogic.com/sitejoom/index.php/wiki?id=398
# https://unix.stackexchange.com/questions/458069/multilib-and-multiarch
#
# CMake can usually find 32 bit libraries just fine on its own.
# find_library will use prefixes from CMAKE_PREFIX_PATH / CMAKE_SYSTEM_PREFIX_PATH
# and add arch-specific lib folders like 'lib/i386-linux-gnu' on debian based systems
# or lib32/lib64 on other distros.
# The problem is that if no 32 bit library is found, a 64 bit one might get picked up.
# That's why we need to specify additional ignore paths.
#
# The paths used in the code below are Ubuntu specific.
# You can opt out of using them if you are using a different distro, but then you need to
# specify appropriate paths yourself in your own CMake toolchain file.
#
# Note that to absolutely ensure no x86_64 library is picked up on a multiarch /
# multilib-enabled system, you might need to specify extra directories in
# CMAKE_INGORE_PATH for each sub-directory containing a library.
#
# For example to exclude /usr/lib/x86_64-linux-gnu/mit-krb5/libgssapi_krb5.so
# you need to add /usr/lib/x86_64-linux-gnu/mit-krb5 explicitly to CMAKE_IGNORE_PATH.
# Adding just /usr/lib/x86_64-linux-gnu to either CMAKE_IGNORE_PATH or
# CMAKE_IGNORE_PREFIX_PATH is not enough.
#
# Another consideration are results returned by CMake's pkg_check_modules which uses
# pkg-config.
# CMAKE_IGNORE_PATH is not read by pkg_check_modules, but CMAKE_PREFIX_PATH
# values are passed as additional prefixes to look for .pc files, IN ADDITION to the default
# prefixes searched by pkg-config of each specific distro.
# For example on Ubuntu, the default searched paths on an x86_64 host are:
# /usr/local/lib/x86_64-linux-gnu/pkgconfig
# /usr/local/lib/pkgconfig
# /usr/local/share/pkgconfig
# /usr/lib/x86_64-linux-gnu/pkgconfig
# /usr/lib/pkgconfig
# /usr/share/pkgconfig
# To ensure the x86_64 packages are not picked up, the PKG_CONFIG_LIBDIR environment
# variable can be overridden with an explicit list of prefixes.
# Again, the paths below are Ubuntu specific.
if(NOT QT_NO_OVERRIDE_CMAKE_IGNORE_PATH)
set(linux_x86_ignore_path "/usr/lib/x86_64-linux-gnu;/lib/x86_64-linux-gnu")
set(CMAKE_IGNORE_PATH "${linux_x86_ignore_path}" PARENT_SCOPE)
set_property(GLOBAL PROPERTY
_qt_internal_linux_x86_ignore_path "${linux_x86_ignore_path}")
endif()
if(NOT QT_NO_OVERRIDE_PKG_CONFIG_LIBDIR)
set(pc_config_libdir "")
list(APPEND pc_config_libdir "/usr/local/lib/i386-linux-gnu/pkgconfig")
list(APPEND pc_config_libdir "/usr/local/lib/pkgconfig")
list(APPEND pc_config_libdir "/usr/local/share/pkgconfig")
list(APPEND pc_config_libdir "/usr/lib/i386-linux-gnu/pkgconfig")
list(APPEND pc_config_libdir "/usr/lib/pkgconfig")
list(APPEND pc_config_libdir "/usr/share/pkgconfig")
list(JOIN pc_config_libdir ":" pc_config_libdir)
set_property(GLOBAL PROPERTY
_qt_internal_linux_x86_pc_config_libdir "${pc_config_libdir}")
# Overrides the default prefix list.
set(ENV{PKG_CONFIG_LIBDIR} "${pc_config_libdir}")
# Overrides the additional prefixes list.
set(ENV{PKG_CONFIG_DIR} "")
endif()
endif()
endfunction()
function(qt_auto_detect_integrity)
if(
# Qt's custom CMake toolchain file sets this value.
CMAKE_SYSTEM_NAME STREQUAL "Integrity" OR
# Upstream CMake expects this name, but we don't currently use it in Qt.
CMAKE_SYSTEM_NAME STREQUAL "GHS-MULTI"
)
qt_internal_ensure_static_qt_config()
endif()
endfunction()
# Let CMake load our custom platform modules.
# CMake-provided platform modules take precedence.
if(NOT QT_AVOID_CUSTOM_PLATFORM_MODULES)
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/platforms")
endif()
qt_auto_detect_cmake_generator()
qt_auto_detect_cyclic_toolchain()
qt_auto_detect_cmake_config()
qt_auto_detect_darwin()
qt_auto_detect_macos_universal()
qt_auto_detect_ios()
qt_auto_detect_android()
qt_auto_detect_vcpkg()
qt_auto_detect_pch()
qt_auto_detect_wasm()
qt_auto_detect_win32_arm()
qt_auto_detect_linux_x86()
qt_auto_detect_integrity()
include("${CMAKE_CURRENT_LIST_DIR}/QtAutoDetectHelpers.cmake")
qt_internal_setup_autodetect()

View File

@ -0,0 +1,491 @@
# Copyright (C) 2023 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Collection of auto detection routines to improve the user experience when
# building Qt from source.
#
# Make sure to not run detection when building standalone tests, because the detection was already
# done when initially configuring qtbase.
function(qt_internal_ensure_static_qt_config)
if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build Qt statically or dynamically" FORCE)
endif()
if(BUILD_SHARED_LIBS)
message(FATAL_ERROR
"Building Qt for ${CMAKE_SYSTEM_NAME} as shared libraries is not supported.")
endif()
endfunction()
function(qt_auto_detect_wasm)
if("${QT_QMAKE_TARGET_MKSPEC}" STREQUAL "wasm-emscripten"
OR "${QT_QMAKE_TARGET_MKSPEC}" STREQUAL "wasm-emscripten-64")
if (NOT DEFINED ENV{EMSDK})
message(FATAL_ERROR
"Can't find an Emscripten SDK! Make sure the EMSDK environment variable is "
"available by activating and sourcing the emscripten sdk. Also ensure emcc is in "
"your path.")
endif()
if(NOT DEFINED QT_AUTODETECT_WASM_IS_DONE)
message(STATUS "Extracting Emscripten SDK info from EMSDK env var: $ENV{EMSDK}")
__qt_internal_get_emroot_path_suffix_from_emsdk_env(EMROOT_PATH)
__qt_internal_query_emsdk_version("${EMROOT_PATH}" TRUE CMAKE_EMSDK_REGEX_VERSION)
set(EMCC_VERSION "${CMAKE_EMSDK_REGEX_VERSION}" CACHE STRING INTERNAL FORCE)
if(NOT DEFINED BUILD_SHARED_LIBS)
qt_internal_ensure_static_qt_config()
endif()
# Find toolchain file
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
__qt_internal_get_emscripten_cmake_toolchain_file_path_from_emsdk_env(
"${EMROOT_PATH}" wasm_toolchain_file)
set(CMAKE_TOOLCHAIN_FILE "${wasm_toolchain_file}" CACHE STRING "" FORCE)
endif()
if(EXISTS "${CMAKE_TOOLCHAIN_FILE}")
message(STATUS
"Emscripten ${EMCC_VERSION} toolchain file detected at ${CMAKE_TOOLCHAIN_FILE}")
else()
__qt_internal_show_error_no_emscripten_toolchain_file_found_when_building_qt()
endif()
__qt_internal_get_emcc_recommended_version(recommended_version)
set(QT_EMCC_RECOMMENDED_VERSION "${recommended_version}" CACHE STRING INTERNAL FORCE)
set(QT_AUTODETECT_WASM_IS_DONE TRUE CACHE BOOL "")
else()
message(STATUS
"Reusing cached Emscripten ${EMCC_VERSION} toolchain file detected at "
"${CMAKE_TOOLCHAIN_FILE}")
endif()
endif()
endfunction()
function(qt_auto_detect_cmake_generator)
if(NOT CMAKE_GENERATOR MATCHES "Ninja" AND NOT QT_SILENCE_CMAKE_GENERATOR_WARNING)
message(WARNING
"The officially supported CMake generator for building Qt is Ninja. "
"You are using: '${CMAKE_GENERATOR}' instead. "
"Thus, you might encounter issues. Use at your own risk.")
endif()
endfunction()
function(qt_auto_detect_android)
# We assume an Android build if any of the ANDROID_* cache variables are set.
if(DEFINED ANDROID_SDK_ROOT
OR DEFINED ANDROID_NDK_ROOT
OR DEFINED ANDROID_ABI
OR DEFINED ANDROID_NATIVE_ABI_LEVEL
OR DEFINED ANDROID_STL)
set(android_detected TRUE)
else()
set(android_detected FALSE)
endif()
# Auto-detect NDK root
if(NOT DEFINED ANDROID_NDK_ROOT AND DEFINED ANDROID_SDK_ROOT)
file(GLOB ndk_versions LIST_DIRECTORIES true RELATIVE "${ANDROID_SDK_ROOT}/ndk"
"${ANDROID_SDK_ROOT}/ndk/*")
unset(ndk_root)
if(NOT ndk_versions STREQUAL "")
# Use the NDK with the highest version number.
if(CMAKE_VERSION VERSION_LESS 3.18)
list(SORT ndk_versions)
list(REVERSE ndk_versions)
else()
list(SORT ndk_versions COMPARE NATURAL ORDER DESCENDING)
endif()
list(GET ndk_versions 0 ndk_root)
string(PREPEND ndk_root "${ANDROID_SDK_ROOT}/ndk/")
else()
# Fallback: use the deprecated "ndk-bundle" directory within the SDK root.
set(ndk_root "${ANDROID_SDK_ROOT}/ndk-bundle")
if(NOT IS_DIRECTORY "${ndk_root}")
unset(ndk_root)
endif()
endif()
if(DEFINED ndk_root)
message(STATUS "Android NDK detected: ${ndk_root}")
set(ANDROID_NDK_ROOT "${ndk_root}" CACHE STRING "")
endif()
endif()
# Auto-detect toolchain file
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ANDROID_NDK_ROOT)
set(toolchain_file "${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake")
if(EXISTS "${toolchain_file}")
message(STATUS "Android toolchain file within NDK detected: ${toolchain_file}")
set(CMAKE_TOOLCHAIN_FILE "${toolchain_file}" CACHE STRING "")
else()
message(FATAL_ERROR "Cannot find the toolchain file '${toolchain_file}'. "
"Please specify the toolchain file with -DCMAKE_TOOLCHAIN_FILE=<file>.")
endif()
endif()
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND android_detected)
message(FATAL_ERROR "An Android build was requested, but no Android toolchain file was "
"specified nor detected.")
endif()
if(DEFINED CMAKE_TOOLCHAIN_FILE AND NOT DEFINED QT_AUTODETECT_ANDROID)
# Peek into the toolchain file and check if it looks like an Android one.
if(NOT android_detected)
file(READ ${CMAKE_TOOLCHAIN_FILE} toolchain_file_content OFFSET 0 LIMIT 80)
string(FIND "${toolchain_file_content}" "The Android Open Source Project"
find_result REVERSE)
if(NOT ${find_result} EQUAL -1)
set(android_detected TRUE)
endif()
endif()
if(android_detected)
message(STATUS "Android build detected, checking configuration defaults...")
# ANDROID_NATIVE_API_LEVEL is an just an alias to ANDROID_PLATFORM, check for both
if(NOT DEFINED ANDROID_PLATFORM AND NOT DEFINED ANDROID_NATIVE_API_LEVEL)
message(STATUS "Neither ANDROID_PLATFORM nor ANDROID_NATIVE_API_LEVEL"
" were specified, using API level 23 as default")
set(ANDROID_PLATFORM "android-23" CACHE STRING "")
set(ANDROID_NATIVE_API_LEVEL 23 CACHE STRING "")
endif()
if(NOT DEFINED ANDROID_STL)
set(ANDROID_STL "c++_shared" CACHE STRING "")
endif()
endif()
set(QT_AUTODETECT_ANDROID ${android_detected} CACHE STRING "")
elseif (QT_AUTODETECT_ANDROID)
message(STATUS "Android build detected")
endif()
endfunction()
function(qt_auto_detect_vcpkg)
if(QT_USE_VCPKG AND DEFINED ENV{VCPKG_ROOT})
set(vcpkg_toolchain_file "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")
get_filename_component(vcpkg_toolchain_file "${vcpkg_toolchain_file}" ABSOLUTE)
if(DEFINED CMAKE_TOOLCHAIN_FILE)
get_filename_component(supplied_toolchain_file "${CMAKE_TOOLCHAIN_FILE}" ABSOLUTE)
if(NOT supplied_toolchain_file STREQUAL vcpkg_toolchain_file)
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${supplied_toolchain_file}" CACHE STRING "")
endif()
unset(supplied_toolchain_file)
endif()
set(CMAKE_TOOLCHAIN_FILE "${vcpkg_toolchain_file}" CACHE STRING "" FORCE)
message(STATUS "Using vcpkg from $ENV{VCPKG_ROOT}")
if(DEFINED ENV{QT_VCPKG_TARGET_TRIPLET} AND NOT DEFINED VCPKG_TARGET_TRIPLET)
set(VCPKG_TARGET_TRIPLET "$ENV{QT_VCPKG_TARGET_TRIPLET}" CACHE STRING "")
message(STATUS "Using vcpkg triplet ${VCPKG_TARGET_TRIPLET}")
endif()
unset(vcpkg_toolchain_file)
message(STATUS "CMAKE_TOOLCHAIN_FILE is: ${CMAKE_TOOLCHAIN_FILE}")
if(DEFINED VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
message(STATUS "VCPKG_CHAINLOAD_TOOLCHAIN_FILE is: ${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
endif()
endif()
endfunction()
function(qt_auto_detect_ios)
if(CMAKE_SYSTEM_NAME STREQUAL iOS)
message(STATUS "Using internal CMake ${CMAKE_SYSTEM_NAME} toolchain file.")
# The QT_UIKIT_SDK check simulates the input.sdk condition for simulator_and_device in
# configure.json.
# If the variable is explicitly provided, assume simulator_and_device to be off.
if(QT_UIKIT_SDK)
set(simulator_and_device OFF)
else()
# Default to simulator_and_device when an explicit sdk is not requested.
# Requires CMake 3.17.0+.
set(simulator_and_device ON)
endif()
message(STATUS "simulator_and_device set to: \"${simulator_and_device}\".")
# Choose relevant architectures.
# Using a non Xcode generator requires explicit setting of the
# architectures, otherwise compilation fails with unknown defines.
if(simulator_and_device)
set(osx_architectures "arm64;x86_64")
elseif(QT_UIKIT_SDK STREQUAL "iphoneos")
set(osx_architectures "arm64")
elseif(QT_UIKIT_SDK STREQUAL "iphonesimulator")
set(osx_architectures "x86_64")
else()
if(NOT DEFINED QT_UIKIT_SDK)
message(FATAL_ERROR "Please provide a value for -DQT_UIKIT_SDK."
" Possible values: iphoneos, iphonesimulator.")
else()
message(FATAL_ERROR
"Unknown SDK argument given to QT_UIKIT_SDK: ${QT_UIKIT_SDK}.")
endif()
endif()
# For non simulator_and_device builds, we need to explicitly set the SYSROOT aka the sdk
# value.
if(QT_UIKIT_SDK)
set(CMAKE_OSX_SYSROOT "${QT_UIKIT_SDK}" CACHE STRING "")
endif()
set(CMAKE_OSX_ARCHITECTURES "${osx_architectures}" CACHE STRING "")
if(NOT DEFINED BUILD_SHARED_LIBS)
qt_internal_ensure_static_qt_config()
endif()
# Disable qt rpaths for iOS, just like mkspecs/common/uikit.conf does, due to those
# bundles not being able to use paths outside the app bundle. Not sure this is strictly
# needed though.
set(QT_DISABLE_RPATH "OFF" CACHE BOOL "Disable automatic Qt rpath handling." FORCE)
endif()
endfunction()
function(qt_auto_detect_cmake_config)
# If CMAKE_CONFIGURATION_TYPES are not set for the multi-config generator use Release and
# Debug configurations by default, instead of those are proposed by the CMake internal logic.
get_property(is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(is_multi)
if(NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES Release Debug)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" PARENT_SCOPE)
endif()
# Allow users to specify this option.
if(NOT QT_MULTI_CONFIG_FIRST_CONFIG)
list(GET CMAKE_CONFIGURATION_TYPES 0 first_config_type)
set(QT_MULTI_CONFIG_FIRST_CONFIG "${first_config_type}")
set(QT_MULTI_CONFIG_FIRST_CONFIG "${first_config_type}" PARENT_SCOPE)
endif()
set(CMAKE_TRY_COMPILE_CONFIGURATION "${QT_MULTI_CONFIG_FIRST_CONFIG}" PARENT_SCOPE)
if(CMAKE_GENERATOR STREQUAL "Ninja Multi-Config")
# Create build-<config>.ninja files for all specified configurations.
set(CMAKE_CROSS_CONFIGS "all" CACHE STRING "")
# The configuration that will be considered the main one (for example when
# configuring standalone tests with a single-config generator like Ninja).
set(CMAKE_DEFAULT_BUILD_TYPE "${QT_MULTI_CONFIG_FIRST_CONFIG}" CACHE STRING "")
# By default when ninja is called without parameters, it will build all configurations.
set(CMAKE_DEFAULT_CONFIGS "all" CACHE STRING "")
endif()
endif()
endfunction()
function(qt_auto_detect_cyclic_toolchain)
if(CMAKE_TOOLCHAIN_FILE AND CMAKE_TOOLCHAIN_FILE MATCHES "/qt\\.toolchain\\.cmake$")
message(FATAL_ERROR
"Woah there! You can't use the Qt generated qt.toolchain.cmake file to configure "
"qtbase, because that will create a toolchain file that includes itself!\n"
"Did you accidentally use qt-cmake to configure qtbase? Make sure to remove the "
"CMakeCache.txt file, and configure qtbase with 'cmake' instead of 'qt-cmake'.")
endif()
endfunction()
function(qt_auto_detect_darwin)
if(APPLE)
# If no CMAKE_OSX_DEPLOYMENT_TARGET is provided, default to a value that Qt defines.
# This replicates the behavior in mkspecs/common/macx.conf where
# QMAKE_MACOSX_DEPLOYMENT_TARGET is set.
set(description
"Minimum OS X version to target for deployment (at runtime); newer APIs weak linked."
" Set to empty string for default value.")
if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
if(NOT CMAKE_SYSTEM_NAME)
# macOS
set(version "11.0")
elseif(CMAKE_SYSTEM_NAME STREQUAL iOS)
set(version "14.0")
endif()
if(version)
set(CMAKE_OSX_DEPLOYMENT_TARGET "${version}" CACHE STRING "${description}")
endif()
endif()
_qt_internal_get_apple_sdk_version(apple_sdk_version)
set(QT_MAC_SDK_VERSION "${apple_sdk_version}" CACHE STRING "Darwin SDK version.")
_qt_internal_get_xcode_version_raw(xcode_version_raw)
set(QT_MAC_XCODE_VERSION "${xcode_version_raw}" CACHE STRING "Xcode version.")
list(LENGTH CMAKE_OSX_ARCHITECTURES arch_count)
if(NOT CMAKE_SYSTEM_NAME STREQUAL iOS AND arch_count GREATER 0)
foreach(arch ${CMAKE_OSX_ARCHITECTURES})
if(arch STREQUAL "arm64e")
message(WARNING "Applications built against an arm64e Qt architecture will "
"likely fail to run on Apple Silicon. Consider targeting "
"'arm64' instead.")
endif()
endforeach()
endif()
endif()
endfunction()
function(qt_auto_detect_macos_universal)
if(APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL iOS)
list(LENGTH CMAKE_OSX_ARCHITECTURES arch_count)
set(is_universal "OFF")
if(arch_count GREATER 1)
set(is_universal "ON")
endif()
set(QT_IS_MACOS_UNIVERSAL "${is_universal}" CACHE INTERNAL "Build universal Qt for macOS")
endif()
endfunction()
function(qt_auto_detect_pch)
set(default_value "ON")
if(CMAKE_OSX_ARCHITECTURES AND CMAKE_VERSION VERSION_LESS 3.18.0 AND NOT QT_FORCE_PCH)
list(LENGTH CMAKE_OSX_ARCHITECTURES arch_count)
# CMake versions lower than 3.18 don't support PCH when multiple architectures are set.
# This is the case for simulator_and_device builds.
if(arch_count GREATER 1)
set(default_value "OFF")
message(WARNING "PCH support disabled due to usage of multiple architectures.")
endif()
endif()
option(BUILD_WITH_PCH "Build Qt using precompiled headers?" "${default_value}")
endfunction()
function(qt_auto_detect_win32_arm)
if("${QT_QMAKE_TARGET_MKSPEC}" STREQUAL "win32-arm64-msvc")
set(CMAKE_SYSTEM_NAME "Windows" CACHE STRING "")
set(CMAKE_SYSTEM_VERSION "10" CACHE STRING "")
set(CMAKE_SYSTEM_PROCESSOR "arm64" CACHE STRING "")
endif()
endfunction()
function(qt_auto_detect_linux_x86)
if("${QT_QMAKE_TARGET_MKSPEC}" STREQUAL "linux-g++-32" AND NOT QT_NO_AUTO_DETECT_LINUX_X86)
# Add flag to ensure code is compiled for 32bit x86 ABI aka i386 or its flavors.
set(__qt_toolchain_common_flags_init "-m32")
if(NOT QT_NO_OVERRIDE_LANG_FLAGS_INIT)
set(CMAKE_C_FLAGS_INIT "${__qt_toolchain_common_flags_init}" PARENT_SCOPE)
set(CMAKE_CXX_FLAGS_INIT "${__qt_toolchain_common_flags_init}" PARENT_SCOPE)
set(CMAKE_ASM_FLAGS_INIT "${__qt_toolchain_common_flags_init}" PARENT_SCOPE)
endif()
# Each distro places arch-specific libraries according to its own file system layout.
#
# https://wiki.debian.org/Multiarch/TheCaseForMultiarch
# https://wiki.ubuntu.com/MultiarchSpec
# https://wiki.gentoo.org/wiki/Project:AMD64/Multilib_layout
# https://wiki.archlinux.org/title/official_repositories#multilib
# https://documentation.suse.com/sles/15-SP3/html/SLES-all/cha-64bit.html
# https://pilotlogic.com/sitejoom/index.php/wiki?id=398
# https://unix.stackexchange.com/questions/458069/multilib-and-multiarch
#
# CMake can usually find 32 bit libraries just fine on its own.
# find_library will use prefixes from CMAKE_PREFIX_PATH / CMAKE_SYSTEM_PREFIX_PATH
# and add arch-specific lib folders like 'lib/i386-linux-gnu' on debian based systems
# or lib32/lib64 on other distros.
# The problem is that if no 32 bit library is found, a 64 bit one might get picked up.
# That's why we need to specify additional ignore paths.
#
# The paths used in the code below are Ubuntu specific.
# You can opt out of using them if you are using a different distro, but then you need to
# specify appropriate paths yourself in your own CMake toolchain file.
#
# Note that to absolutely ensure no x86_64 library is picked up on a multiarch /
# multilib-enabled system, you might need to specify extra directories in
# CMAKE_INGORE_PATH for each sub-directory containing a library.
#
# For example to exclude /usr/lib/x86_64-linux-gnu/mit-krb5/libgssapi_krb5.so
# you need to add /usr/lib/x86_64-linux-gnu/mit-krb5 explicitly to CMAKE_IGNORE_PATH.
# Adding just /usr/lib/x86_64-linux-gnu to either CMAKE_IGNORE_PATH or
# CMAKE_IGNORE_PREFIX_PATH is not enough.
#
# Another consideration are results returned by CMake's pkg_check_modules which uses
# pkg-config.
# CMAKE_IGNORE_PATH is not read by pkg_check_modules, but CMAKE_PREFIX_PATH
# values are passed as additional prefixes to look for .pc files, IN ADDITION to the default
# prefixes searched by pkg-config of each specific distro.
# For example on Ubuntu, the default searched paths on an x86_64 host are:
# /usr/local/lib/x86_64-linux-gnu/pkgconfig
# /usr/local/lib/pkgconfig
# /usr/local/share/pkgconfig
# /usr/lib/x86_64-linux-gnu/pkgconfig
# /usr/lib/pkgconfig
# /usr/share/pkgconfig
# To ensure the x86_64 packages are not picked up, the PKG_CONFIG_LIBDIR environment
# variable can be overridden with an explicit list of prefixes.
# Again, the paths below are Ubuntu specific.
if(NOT QT_NO_OVERRIDE_CMAKE_IGNORE_PATH)
set(linux_x86_ignore_path "/usr/lib/x86_64-linux-gnu;/lib/x86_64-linux-gnu")
set(CMAKE_IGNORE_PATH "${linux_x86_ignore_path}" PARENT_SCOPE)
set_property(GLOBAL PROPERTY
_qt_internal_linux_x86_ignore_path "${linux_x86_ignore_path}")
endif()
if(NOT QT_NO_OVERRIDE_PKG_CONFIG_LIBDIR)
set(pc_config_libdir "")
list(APPEND pc_config_libdir "/usr/local/lib/i386-linux-gnu/pkgconfig")
list(APPEND pc_config_libdir "/usr/local/lib/pkgconfig")
list(APPEND pc_config_libdir "/usr/local/share/pkgconfig")
list(APPEND pc_config_libdir "/usr/lib/i386-linux-gnu/pkgconfig")
list(APPEND pc_config_libdir "/usr/lib/pkgconfig")
list(APPEND pc_config_libdir "/usr/share/pkgconfig")
list(JOIN pc_config_libdir ":" pc_config_libdir)
set_property(GLOBAL PROPERTY
_qt_internal_linux_x86_pc_config_libdir "${pc_config_libdir}")
# Overrides the default prefix list.
set(ENV{PKG_CONFIG_LIBDIR} "${pc_config_libdir}")
# Overrides the additional prefixes list.
set(ENV{PKG_CONFIG_DIR} "")
endif()
endif()
endfunction()
function(qt_auto_detect_integrity)
if(
# Qt's custom CMake toolchain file sets this value.
CMAKE_SYSTEM_NAME STREQUAL "Integrity" OR
# Upstream CMake expects this name, but we don't currently use it in Qt.
CMAKE_SYSTEM_NAME STREQUAL "GHS-MULTI"
)
qt_internal_ensure_static_qt_config()
endif()
endfunction()
# Save the build type before project() might set one.
# This allows us to determine if the user has set an explicit build type that we should use.
function(qt_auto_detect_cmake_build_type)
set(__qt_auto_detect_cmake_build_type_before_project_call "${CMAKE_BUILD_TYPE}" PARENT_SCOPE)
endfunction()
macro(qt_internal_setup_autodetect)
# This needs to be here because QtAutoDetect loads before any other modules
option(QT_USE_VCPKG "Enable the use of vcpkg" ON)
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicAppleHelpers.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicWasmToolchainHelpers.cmake")
# Let CMake load our custom platform modules.
# CMake-provided platform modules take precedence.
if(NOT QT_AVOID_CUSTOM_PLATFORM_MODULES)
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/platforms")
endif()
qt_auto_detect_cmake_generator()
qt_auto_detect_cyclic_toolchain()
qt_auto_detect_cmake_config()
qt_auto_detect_darwin()
qt_auto_detect_macos_universal()
qt_auto_detect_ios()
qt_auto_detect_android()
qt_auto_detect_pch()
qt_auto_detect_wasm()
qt_auto_detect_win32_arm()
qt_auto_detect_linux_x86()
qt_auto_detect_integrity()
qt_auto_detect_cmake_build_type()
qt_auto_detect_vcpkg()
endmacro()

View File

@ -73,7 +73,7 @@ function(qt_run_config_test_architecture)
string(SUBSTRING "${_line}" ${_pos} -1 _architecture)
endif()
string(FIND "${_line}" "==Qt=magic=Qt== Sub-architecture:" _pos)
if (_pos GREATER -1 AND ${lineLength} GREATER 33)
if (_pos GREATER -1 AND NOT _line MATCHES "Sub-architecture:$")
math(EXPR _pos "${_pos}+34")
string(SUBSTRING "${_line}" ${_pos} -1 _sub_architecture)
string(REPLACE " " ";" _sub_architecture "${_sub_architecture}")

View File

@ -63,12 +63,8 @@ qt_copy_or_install(
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/QtBuildInternals/${__build_internals_standalone_test_template_dir}/CMakeLists.txt")
include(QtToolchainHelpers)
qt_internal_create_toolchain_file()
include(QtWrapperScriptHelpers)
qt_internal_create_wrapper_scripts()
## Library to hold global features:
## These features are stored and accessed via Qt::GlobalConfig, but the
## files always lived in Qt::Core, so we keep it that way
@ -122,6 +118,9 @@ qt_generate_global_module_pri_file()
qt_generate_global_device_pri_file()
qt_generate_qmake_and_qtpaths_wrapper_for_target()
# Depends on the global features being evaluated.
qt_internal_create_wrapper_scripts()
add_library(Qt::GlobalConfig ALIAS GlobalConfig)
add_library(GlobalConfigPrivate INTERFACE)
@ -134,7 +133,6 @@ target_include_directories(GlobalConfigPrivate INTERFACE
)
add_library(Qt::GlobalConfigPrivate ALIAS GlobalConfigPrivate)
include(QtPlatformTargetHelpers)
qt_internal_setup_public_platform_target()
# defines PlatformCommonInternal PlatformModuleInternal PlatformPluginInternal PlatformToolInternal
@ -172,6 +170,11 @@ qt_internal_get_computed_min_cmake_version_for_using_qt(computed_min_version_for
qt_internal_get_min_new_policy_cmake_version(min_new_policy_version)
qt_internal_get_max_new_policy_cmake_version(max_new_policy_version)
# Get the list of public helper files that should be automatically included in Qt6Config.cmake.
# Used in QtConfig.cmake.in template and further down for installation purposes.
qt_internal_get_qt_build_public_helpers(__qt_cmake_public_helpers)
list(JOIN __qt_cmake_public_helpers "\n " QT_PUBLIC_FILES_TO_INCLUDE)
# Generate and install Qt6 config file. Make sure it happens after the global feature evaluation so
# they can be accessed in the Config file if needed.
configure_package_config_file(
@ -180,6 +183,8 @@ configure_package_config_file(
INSTALL_DESTINATION "${__GlobalConfig_install_dir}"
)
_qt_internal_export_apple_sdk_and_xcode_version_requirements(QT_CONFIG_EXTRAS_CODE)
configure_file(
"${PROJECT_SOURCE_DIR}/cmake/QtConfigExtras.cmake.in"
"${__GlobalConfig_build_dir}/${INSTALL_CMAKE_NAMESPACE}ConfigExtras.cmake"
@ -205,92 +210,22 @@ qt_install(FILES
COMPONENT Devel
)
qt_internal_get_qt_build_private_helpers(__qt_cmake_private_helpers)
list(TRANSFORM __qt_cmake_private_helpers PREPEND "cmake/")
list(TRANSFORM __qt_cmake_private_helpers APPEND ".cmake")
qt_internal_get_qt_build_private_files_to_install(__qt_private_files_to_install)
list(TRANSFORM __qt_private_files_to_install PREPEND "cmake/")
# Install internal CMake files.
# The functions defined inside can not be used in public projects.
# They can only be used while building Qt itself.
set(__private_files
${__qt_cmake_private_helpers}
${__qt_private_files_to_install}
)
qt_copy_or_install(FILES
cmake/ModuleDescription.json.in
cmake/PkgConfigLibrary.pc.in
cmake/Qt3rdPartyLibraryConfig.cmake.in
cmake/Qt3rdPartyLibraryHelpers.cmake
cmake/QtAndroidHelpers.cmake
cmake/QtAppHelpers.cmake
cmake/QtAutogenHelpers.cmake
cmake/QtBuild.cmake
cmake/QtBuildInformation.cmake
cmake/QtCMakeHelpers.cmake
cmake/QtCMakeVersionHelpers.cmake
cmake/QtCMakePackageVersionFile.cmake.in
cmake/QtCompilerFlags.cmake
cmake/QtCompilerOptimization.cmake
cmake/QtConfigDependencies.cmake.in
cmake/QtConfigureTimeExecutableCMakeLists.txt.in
cmake/QtDeferredDependenciesHelpers.cmake
cmake/QtDbusHelpers.cmake
cmake/QtDocsHelpers.cmake
cmake/QtExecutableHelpers.cmake
cmake/QtFileConfigure.txt.in
cmake/QtFindPackageHelpers.cmake
cmake/QtFindWrapConfigExtra.cmake.in
cmake/QtFindWrapHelper.cmake
cmake/QtFinishPkgConfigFile.cmake
cmake/QtFinishPrlFile.cmake
cmake/QtFlagHandlingHelpers.cmake
cmake/QtFrameworkHelpers.cmake
cmake/QtGenerateExtPri.cmake
cmake/QtGenerateLibHelpers.cmake
cmake/QtGenerateLibPri.cmake
cmake/QtGenerateVersionScript.cmake
cmake/QtGlobalStateHelpers.cmake
cmake/QtHeadersClean.cmake
cmake/QtInstallHelpers.cmake
cmake/QtJavaHelpers.cmake
cmake/QtLalrHelpers.cmake
cmake/QtModuleConfig.cmake.in
cmake/QtModuleDependencies.cmake.in
cmake/QtModuleHeadersCheck.cmake
cmake/QtModuleHelpers.cmake
cmake/QtModuleToolsConfig.cmake.in
cmake/QtModuleToolsDependencies.cmake.in
cmake/QtModuleToolsVersionlessTargets.cmake.in
cmake/QtNoLinkTargetHelpers.cmake
cmake/QtPkgConfigHelpers.cmake
cmake/QtPlatformAndroid.cmake
cmake/QtPlatformSupport.cmake
cmake/QtPluginConfig.cmake.in
cmake/QtPluginDependencies.cmake.in
cmake/QtPluginHelpers.cmake
cmake/QtPlugins.cmake.in
cmake/QtPostProcess.cmake
cmake/QtPostProcessHelpers.cmake
cmake/QtPrecompiledHeadersHelpers.cmake
cmake/QtUnityBuildHelpers.cmake
cmake/QtPriHelpers.cmake
cmake/QtPrlHelpers.cmake
cmake/QtPlatformTargetHelpers.cmake
cmake/QtProcessConfigureArgs.cmake
cmake/QtQmakeHelpers.cmake
cmake/QtResourceHelpers.cmake
cmake/QtRpathHelpers.cmake
cmake/QtSanitizerHelpers.cmake
cmake/QtScopeFinalizerHelpers.cmake
cmake/QtSeparateDebugInfo.Info.plist.in
cmake/QtSeparateDebugInfo.cmake
cmake/QtSetup.cmake
cmake/QtSimdHelpers.cmake
cmake/QtSingleRepoTargetSetBuildHelpers.cmake
cmake/QtStandaloneTestsConfig.cmake.in
cmake/QtSyncQtHelpers.cmake
cmake/QtTargetHelpers.cmake
cmake/QtTestHelpers.cmake
cmake/QtToolchainHelpers.cmake
cmake/QtToolHelpers.cmake
cmake/QtWasmHelpers.cmake
cmake/QtWrapperScriptHelpers.cmake
cmake/QtWriteArgsFile.cmake
cmake/modulecppexports.h.in
cmake/modulecppexports_p.h.in
cmake/qbatchedtestrunner.in.cpp
${__private_files}
DESTINATION "${__GlobalConfig_install_dir}"
)
@ -324,39 +259,29 @@ if(QT_WILL_INSTALL)
endforeach()
endif()
# Wrap previously queried helpers file.
list(TRANSFORM __qt_cmake_public_helpers PREPEND "cmake/")
list(TRANSFORM __qt_cmake_public_helpers APPEND ".cmake")
qt_internal_get_qt_build_public_files_to_install(__qt_public_files_to_install)
list(TRANSFORM __qt_public_files_to_install PREPEND "cmake/")
# Install public CMake files.
# The functions defined inside can be used in both public projects and while building Qt.
# Usually we put such functions into Qt6CoreMacros.cmake, but that's getting bloated.
# These files will be included by Qt6Config.cmake.
set(__public_cmake_helpers
cmake/QtCopyFileIfDifferent.cmake
cmake/QtFeature.cmake
cmake/QtFeatureCommon.cmake
cmake/QtInitProject.cmake
cmake/QtPublicAppleHelpers.cmake
cmake/QtPublicCMakeHelpers.cmake
cmake/QtPublicCMakeVersionHelpers.cmake
cmake/QtPublicFinalizerHelpers.cmake
cmake/QtPublicPluginHelpers.cmake
cmake/QtPublicTargetHelpers.cmake
cmake/QtPublicTestHelpers.cmake
cmake/QtPublicToolHelpers.cmake
cmake/QtPublicWalkLibsHelpers.cmake
cmake/QtPublicFindPackageHelpers.cmake
cmake/QtPublicDependencyHelpers.cmake
# Public CMake files that are installed next Qt6Config.cmake, but are NOT included by it.
# Instead they are included by the generated CMake toolchain file.
cmake/QtPublicWasmToolchainHelpers.cmake
set(__public_files
${__qt_cmake_public_helpers}
${__qt_public_files_to_install}
)
qt_copy_or_install(FILES ${__public_cmake_helpers} DESTINATION "${__GlobalConfig_install_dir}")
qt_copy_or_install(FILES ${__public_files} DESTINATION "${__GlobalConfig_install_dir}")
# In prefix builds we also need to copy the files into the build config directory, so that the
# build-dir Qt6Config.cmake finds the files when building examples in-tree.
if(QT_WILL_INSTALL)
foreach(_public_cmake_helper ${__public_cmake_helpers})
file(COPY "${_public_cmake_helper}" DESTINATION "${__GlobalConfig_build_dir}")
foreach(_public_file ${__public_files})
file(COPY "${_public_file}" DESTINATION "${__GlobalConfig_build_dir}")
endforeach()
endif()
@ -375,6 +300,10 @@ qt_copy_or_install(DIRECTORY cmake/
FILES_MATCHING PATTERN "Find*.cmake"
PATTERN "tests" EXCLUDE
PATTERN "3rdparty" EXCLUDE
PATTERN "macos" EXCLUDE
PATTERN "ios" EXCLUDE
PATTERN "platforms" EXCLUDE
PATTERN "QtBuildInternals" EXCLUDE
)
# In prefix builds we also need to copy the files into the build config directory, so that the
@ -385,6 +314,10 @@ if(QT_WILL_INSTALL)
FILES_MATCHING PATTERN "Find*.cmake"
PATTERN "tests" EXCLUDE
PATTERN "3rdparty" EXCLUDE
PATTERN "macos" EXCLUDE
PATTERN "ios" EXCLUDE
PATTERN "platforms" EXCLUDE
PATTERN "QtBuildInternals" EXCLUDE
)
endif()

View File

@ -0,0 +1,81 @@
# Copyright (C) 2023 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Depends on __qt6_qtbase_src_path being set in the top-level dir.
macro(qt_internal_top_level_setup_autodetect)
# Run platform auto-detection /before/ the first project() call and thus
# before the toolchain file is loaded.
# Don't run auto-detection when doing standalone tests. In that case, the detection
# results are taken from either QtBuildInternals or the qt.toolchain.cmake file.
if(NOT QT_BUILD_STANDALONE_TESTS)
set(__qt6_auto_detect_path "${__qt6_qtbase_src_path}/cmake/QtAutoDetect.cmake")
if(NOT EXISTS "${__qt6_auto_detect_path}")
message(FATAL_ERROR "Required file does not exist: '${__qt6_auto_detect_path}'")
endif()
include("${__qt6_auto_detect_path}")
endif()
endmacro()
macro(qt_internal_top_level_setup_after_project)
qt_internal_top_level_setup_testing()
endmacro()
macro(qt_internal_top_level_setup_testing)
# Required so we can call ctest from the root build directory
enable_testing()
endmacro()
# Depends on __qt6_qtbase_src_path being set in the top-level dir.
macro(qt_internal_top_level_setup_cmake_module_path)
if (NOT QT_BUILD_STANDALONE_TESTS)
set(__qt6_cmake_module_path "${__qt6_qtbase_src_path}/cmake")
if(NOT EXISTS "${__qt6_cmake_module_path}")
message(FATAL_ERROR "Required directory does not exist: '${__qt6_cmake_module_path}'")
endif()
list(APPEND CMAKE_MODULE_PATH "${__qt6_cmake_module_path}")
list(APPEND CMAKE_MODULE_PATH
"${__qt6_cmake_module_path}/3rdparty/extra-cmake-modules/find-modules")
list(APPEND CMAKE_MODULE_PATH "${__qt6_cmake_module_path}/3rdparty/kwin")
endif()
endmacro()
macro(qt_internal_top_level_before_build_submodules)
qt_internal_top_level_setup_no_create_targets()
endmacro()
macro(qt_internal_top_level_setup_no_create_targets)
# Also make sure the CMake config files do not recreate the already-existing targets
if (NOT QT_BUILD_STANDALONE_TESTS)
set(QT_NO_CREATE_TARGETS TRUE)
endif()
endmacro()
macro(qt_internal_top_level_end)
qt_internal_print_top_level_info()
# Depends on QtBuildInternalsConfig being included, which is the case whenver any repo is
# configured.
qt_internal_qt_configure_end()
endmacro()
function(qt_internal_print_top_level_info)
if(NOT QT_BUILD_STANDALONE_TESTS)
# Display a summary of everything
include(QtBuildInformation)
include(QtPlatformSupport)
qt_print_feature_summary()
qt_print_build_instructions()
endif()
endfunction()
macro(qt_internal_top_level_after_add_subdirectory)
if(module STREQUAL "qtbase")
if (NOT QT_BUILD_STANDALONE_TESTS)
list(APPEND CMAKE_PREFIX_PATH "${QtBase_BINARY_DIR}/${INSTALL_LIBDIR}/cmake")
list(APPEND CMAKE_FIND_ROOT_PATH "${QtBase_BINARY_DIR}")
endif()
endif()
endmacro()

View File

@ -1,583 +1,4 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
include(CMakePackageConfigHelpers)
include(QtSeparateDebugInfo)
function(qt_configure_process_path name default docstring)
# Values are computed once for qtbase, and then exported and reused for other projects.
if(NOT PROJECT_NAME STREQUAL "QtBase")
return()
endif()
# No value provided, set the default.
if(NOT DEFINED "${name}")
set("${name}" "${default}" CACHE STRING "${docstring}")
else()
get_filename_component(given_path_as_abs "${${name}}" ABSOLUTE BASE_DIR
"${CMAKE_INSTALL_PREFIX}")
file(RELATIVE_PATH rel_path "${CMAKE_INSTALL_PREFIX}"
"${given_path_as_abs}")
# If absolute path given, check that it's inside the prefix (error out if not).
# TODO: Figure out if we need to support paths that are outside the prefix.
#
# If relative path given, it's relative to the install prefix (rather than the binary dir,
# which is what qmake does for some reason).
# In both cases, store the value as a relative path.
if("${rel_path}" STREQUAL "")
# file(RELATIVE_PATH) returns an empty string if the given absolute paths are equal
set(rel_path ".")
elseif(rel_path MATCHES "^\.\./")
# INSTALL_SYSCONFDIR is allowed to be outside the prefix.
if(NOT name STREQUAL "INSTALL_SYSCONFDIR")
message(FATAL_ERROR
"Path component '${name}' is outside computed install prefix: ${rel_path} ")
return()
endif()
set("${name}" "${${name}}" CACHE STRING "${docstring}" FORCE)
else()
set("${name}" "${rel_path}" CACHE STRING "${docstring}" FORCE)
endif()
endif()
endfunction()
# Install locations:
qt_configure_process_path(INSTALL_BINDIR "bin" "Executables [PREFIX/bin]")
qt_configure_process_path(INSTALL_INCLUDEDIR "include" "Header files [PREFIX/include]")
qt_configure_process_path(INSTALL_LIBDIR "lib" "Libraries [PREFIX/lib]")
qt_configure_process_path(INSTALL_MKSPECSDIR "mkspecs" "Mkspecs files [PREFIX/mkspecs]")
qt_configure_process_path(INSTALL_ARCHDATADIR "." "Arch-dependent data [PREFIX]")
qt_configure_process_path(INSTALL_PLUGINSDIR
"${INSTALL_ARCHDATADIR}/plugins"
"Plugins [ARCHDATADIR/plugins]")
if(NOT INSTALL_MKSPECSDIR MATCHES "(^|/)mkspecs")
message(FATAL_ERROR "INSTALL_MKSPECSDIR must end with '/mkspecs'")
endif()
# Given CMAKE_CONFIG and ALL_CMAKE_CONFIGS, determines if a directory suffix needs to be appended
# to each destination, and sets the computed install target destination arguments in OUT_VAR.
# Defaults used for each of the destination types, and can be configured per destination type.
function(qt_get_install_target_default_args)
cmake_parse_arguments(PARSE_ARGV 0 arg
""
"OUT_VAR;CMAKE_CONFIG;RUNTIME;LIBRARY;ARCHIVE;INCLUDES;BUNDLE"
"ALL_CMAKE_CONFIGS")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_CMAKE_CONFIG)
message(FATAL_ERROR "No value given for CMAKE_CONFIG.")
endif()
if(NOT arg_ALL_CMAKE_CONFIGS)
message(FATAL_ERROR "No value given for ALL_CMAKE_CONFIGS.")
endif()
list(LENGTH arg_ALL_CMAKE_CONFIGS all_configs_count)
list(GET arg_ALL_CMAKE_CONFIGS 0 first_config)
set(suffix "")
if(all_configs_count GREATER 1 AND NOT arg_CMAKE_CONFIG STREQUAL first_config)
set(suffix "/${arg_CMAKE_CONFIG}")
endif()
set(runtime "${INSTALL_BINDIR}")
if(arg_RUNTIME)
set(runtime "${arg_RUNTIME}")
endif()
set(library "${INSTALL_LIBDIR}")
if(arg_LIBRARY)
set(library "${arg_LIBRARY}")
endif()
set(archive "${INSTALL_LIBDIR}")
if(arg_ARCHIVE)
set(archive "${arg_ARCHIVE}")
endif()
set(includes "${INSTALL_INCLUDEDIR}")
if(arg_INCLUDES)
set(includes "${arg_INCLUDES}")
endif()
set(bundle "${INSTALL_BINDIR}")
if(arg_BUNDLE)
set(bundle "${arg_BUNDLE}")
endif()
set(args
RUNTIME DESTINATION "${runtime}${suffix}"
LIBRARY DESTINATION "${library}${suffix}"
ARCHIVE DESTINATION "${archive}${suffix}" COMPONENT Devel
BUNDLE DESTINATION "${bundle}${suffix}"
INCLUDES DESTINATION "${includes}${suffix}")
set(${arg_OUT_VAR} "${args}" PARENT_SCOPE)
endfunction()
if (WIN32)
set(_default_libexec "${INSTALL_ARCHDATADIR}/bin")
else()
set(_default_libexec "${INSTALL_ARCHDATADIR}/libexec")
endif()
qt_configure_process_path(
INSTALL_LIBEXECDIR
"${_default_libexec}"
"Helper programs [ARCHDATADIR/bin on Windows, ARCHDATADIR/libexec otherwise]")
qt_configure_process_path(INSTALL_QMLDIR
"${INSTALL_ARCHDATADIR}/qml"
"QML imports [ARCHDATADIR/qml]")
qt_configure_process_path(INSTALL_DATADIR "." "Arch-independent data [PREFIX]")
qt_configure_process_path(INSTALL_DOCDIR "${INSTALL_DATADIR}/doc" "Documentation [DATADIR/doc]")
qt_configure_process_path(INSTALL_TRANSLATIONSDIR "${INSTALL_DATADIR}/translations"
"Translations [DATADIR/translations]")
if(APPLE)
set(QT_DEFAULT_SYS_CONF_DIR "/Library/Preferences/Qt")
else()
set(QT_DEFAULT_SYS_CONF_DIR "etc/xdg")
endif()
qt_configure_process_path(INSTALL_SYSCONFDIR
"${QT_DEFAULT_SYS_CONF_DIR}"
"Settings used by Qt programs [PREFIX/etc/xdg]/[/Library/Preferences/Qt]")
qt_configure_process_path(INSTALL_EXAMPLESDIR "examples" "Examples [PREFIX/examples]")
qt_configure_process_path(INSTALL_TESTSDIR "tests" "Tests [PREFIX/tests]")
qt_configure_process_path(INSTALL_DESCRIPTIONSDIR
"${INSTALL_ARCHDATADIR}/modules"
"Module description files directory")
if(NOT "${CMAKE_STAGING_PREFIX}" STREQUAL "")
set(QT_STAGING_PREFIX "${CMAKE_STAGING_PREFIX}")
else()
set(QT_STAGING_PREFIX "${CMAKE_INSTALL_PREFIX}")
endif()
if(PROJECT_NAME STREQUAL "QtBase")
set(QT_COORD_TYPE double CACHE STRING "Type of qreal")
endif()
function(qt_internal_set_up_global_paths)
# Compute the values of QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR, QT_CONFIG_INSTALL_DIR
# taking into account whether the current build is a prefix build or a non-prefix build,
# and whether it is a superbuild or non-superbuild.
# A third case is when another module or standalone tests are built against a super-built Qt.
# The layout for the third case is the same as for non-superbuilds.
#
# These values should be prepended to file paths in commands or properties,
# in order to correctly place generated Config files, generated Targets files,
# executables / libraries, when copying / installing files, etc.
#
# The build dir variables will always be absolute paths.
# The QT_INSTALL_DIR variable will have a relative path in a prefix build,
# which means that it can be empty, so use qt_join_path to prevent accidental absolute paths.
if(QT_SUPERBUILD)
# In this case, we always copy all the build products in qtbase/{bin,lib,...}
if(QT_WILL_INSTALL)
set(QT_BUILD_DIR "${QtBase_BINARY_DIR}")
set(QT_INSTALL_DIR "")
else()
if("${CMAKE_STAGING_PREFIX}" STREQUAL "")
set(QT_BUILD_DIR "${QtBase_BINARY_DIR}")
set(QT_INSTALL_DIR "${QtBase_BINARY_DIR}")
else()
set(QT_BUILD_DIR "${CMAKE_STAGING_PREFIX}")
set(QT_INSTALL_DIR "${CMAKE_STAGING_PREFIX}")
endif()
endif()
else()
if(QT_WILL_INSTALL)
# In the usual prefix build case, the build dir is the current module build dir,
# and the install dir is the prefix, so we don't set it.
set(QT_BUILD_DIR "${CMAKE_BINARY_DIR}")
set(QT_INSTALL_DIR "")
else()
# When doing a non-prefix build, both the build dir and install dir are the same,
# pointing to the qtbase build dir.
set(QT_BUILD_DIR "${QT_STAGING_PREFIX}")
set(QT_INSTALL_DIR "${QT_BUILD_DIR}")
endif()
endif()
set(__config_path_part "${INSTALL_LIBDIR}/cmake")
set(QT_CONFIG_BUILD_DIR "${QT_BUILD_DIR}/${__config_path_part}")
set(QT_CONFIG_INSTALL_DIR "${QT_INSTALL_DIR}")
if(QT_CONFIG_INSTALL_DIR)
string(APPEND QT_CONFIG_INSTALL_DIR "/")
endif()
string(APPEND QT_CONFIG_INSTALL_DIR ${__config_path_part})
set(QT_BUILD_DIR "${QT_BUILD_DIR}" PARENT_SCOPE)
set(QT_INSTALL_DIR "${QT_INSTALL_DIR}" PARENT_SCOPE)
set(QT_CONFIG_BUILD_DIR "${QT_CONFIG_BUILD_DIR}" PARENT_SCOPE)
set(QT_CONFIG_INSTALL_DIR "${QT_CONFIG_INSTALL_DIR}" PARENT_SCOPE)
endfunction()
qt_internal_set_up_global_paths()
qt_get_relocatable_install_prefix(QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX)
set(QT_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}")
# Find the path to mkspecs/, depending on whether we are building as part of a standard qtbuild,
# or a module against an already installed version of qt.
if(NOT QT_MKSPECS_DIR)
if("${QT_BUILD_INTERNALS_PATH}" STREQUAL "")
get_filename_component(QT_MKSPECS_DIR "${CMAKE_CURRENT_LIST_DIR}/../mkspecs" ABSOLUTE)
else()
# We can rely on QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX being set by
# QtBuildInternalsExtra.cmake.
get_filename_component(
QT_MKSPECS_DIR
"${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_MKSPECSDIR}" ABSOLUTE)
endif()
set(QT_MKSPECS_DIR "${QT_MKSPECS_DIR}" CACHE INTERNAL "")
endif()
# macOS versions 10.14 and less don't have the implementation of std::filesystem API.
if(CMAKE_HOST_APPLE AND CMAKE_HOST_SYSTEM_VERSION VERSION_LESS "19.0.0")
message(FATAL_ERROR "macOS versions less than 10.15 are not supported for building Qt.")
endif()
# the default RPATH to be used when installing, but only if it's not a system directory
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBDIR}" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(_default_install_rpath "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBDIR}")
endif("${isSystemDir}" STREQUAL "-1")
# The default rpath settings for installed targets is empty.
# The rpaths will instead be computed for each target separately using qt_apply_rpaths().
# Additional rpaths can be passed via QT_EXTRA_RPATHS.
# By default this will include $ORIGIN / @loader_path, so the installation is relocatable.
# Bottom line: No need to pass anything to CMAKE_INSTALL_RPATH.
set(CMAKE_INSTALL_RPATH "" CACHE STRING "RPATH for installed binaries")
# By default, don't embed auto-determined RPATHs pointing to directories
# outside of the build tree, into the installed binaries.
# This ended up adding rpaths like ${CMAKE_INSTALL_PREFIX}/lib (or /Users/qt/work/install/lib into
# the official libraries created by the CI) into the non-qtbase libraries, plugins, etc.
#
# It should not be necessary, given that qt_apply_rpaths() already adds the necessary rpaths, either
# relocatable ones or absolute ones, depending on what the platform supports.
if(NOT QT_NO_DISABLE_CMAKE_INSTALL_RPATH_USE_LINK_PATH)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
endif()
# Ensure that GNUInstallDirs's CMAKE_INSTALL_LIBDIR points to the same lib dir that Qt was
# configured with. Currently this is important for QML plugins, which embed an rpath based
# on that value.
set(CMAKE_INSTALL_LIBDIR "${INSTALL_LIBDIR}")
function(qt_setup_tool_path_command)
if(NOT CMAKE_HOST_WIN32)
return()
endif()
set(bindir "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_BINDIR}")
file(TO_NATIVE_PATH "${bindir}" bindir)
list(APPEND command COMMAND)
list(APPEND command set PATH=${bindir}$<SEMICOLON>%PATH%)
set(QT_TOOL_PATH_SETUP_COMMAND "${command}" CACHE INTERNAL "internal command prefix for tool invocations" FORCE)
# QT_TOOL_PATH_SETUP_COMMAND is deprecated. Please use _qt_internal_get_wrap_tool_script_path
# instead.
endfunction()
qt_setup_tool_path_command()
# Platform define path, etc.
if(WIN32)
set(QT_DEFAULT_PLATFORM_DEFINITIONS WIN32 _ENABLE_EXTENDED_ALIGNED_STORAGE)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
list(APPEND QT_DEFAULT_PLATFORM_DEFINITIONS WIN64 _WIN64)
endif()
if(CLANG)
if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC" OR MSVC)
set(QT_DEFAULT_MKSPEC win32-clang-msvc)
elseif(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU" OR MINGW)
set(QT_DEFAULT_MKSPEC win32-clang-g++)
endif()
elseif(MSVC)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
set(QT_DEFAULT_MKSPEC win32-arm64-msvc)
else()
set(QT_DEFAULT_MKSPEC win32-msvc)
endif()
elseif(MINGW)
set(QT_DEFAULT_MKSPEC win32-g++)
list(APPEND QT_DEFAULT_PLATFORM_DEFINITIONS MINGW_HAS_SECURE_API=1)
endif()
elseif(LINUX)
if(GCC)
set(QT_DEFAULT_MKSPEC linux-g++)
elseif(CLANG)
set(QT_DEFAULT_MKSPEC linux-clang)
endif()
elseif(ANDROID)
if(GCC)
set(QT_DEFAULT_MKSPEC android-g++)
elseif(CLANG)
set(QT_DEFAULT_MKSPEC android-clang)
endif()
elseif(IOS)
set(QT_DEFAULT_MKSPEC macx-ios-clang)
elseif(APPLE)
set(QT_DEFAULT_MKSPEC macx-clang)
elseif(WASM)
if(WASM64)
set(QT_DEFAULT_MKSPEC wasm-emscripten-64)
else()
set(QT_DEFAULT_MKSPEC wasm-emscripten)
endif()
elseif(QNX)
# Certain POSIX defines are not set if we don't compile with -std=gnuXX
set(QT_ENABLE_CXX_EXTENSIONS ON)
list(APPEND QT_DEFAULT_PLATFORM_DEFINITIONS _FORTIFY_SOURCE=2 _REENTRANT)
set(compiler_aarch64le aarch64le)
set(compiler_armle-v7 armv7le)
set(compiler_x86-64 x86_64)
set(compiler_x86 x86)
foreach(arch aarch64le armle-v7 x86-64 x86)
if (CMAKE_CXX_COMPILER_TARGET MATCHES "${compiler_${arch}}$")
set(QT_DEFAULT_MKSPEC qnx-${arch}-qcc)
endif()
endforeach()
elseif(FREEBSD)
if(CLANG)
set(QT_DEFAULT_MKSPEC freebsd-clang)
elseif(GCC)
set(QT_DEFAULT_MKSPEC freebsd-g++)
endif()
elseif(NETBSD)
set(QT_DEFAULT_MKSPEC netbsd-g++)
elseif(OPENBSD)
set(QT_DEFAULT_MKSPEC openbsd-g++)
elseif(SOLARIS)
if(GCC)
if(QT_64BIT)
set(QT_DEFAULT_MKSPEC solaris-g++-64)
else()
set(QT_DEFAULT_MKSPEC solaris-g++)
endif()
else()
if(QT_64BIT)
set(QT_DEFAULT_MKSPEC solaris-cc-64)
else()
set(QT_DEFAULT_MKSPEC solaris-cc)
endif()
endif()
elseif(HURD)
set(QT_DEFAULT_MKSPEC hurd-g++)
endif()
if(NOT QT_QMAKE_TARGET_MKSPEC)
set(QT_QMAKE_TARGET_MKSPEC "${QT_DEFAULT_MKSPEC}" CACHE STRING "QMake target mkspec")
endif()
if(CMAKE_CROSSCOMPILING)
set(QT_QMAKE_HOST_MKSPEC "${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_QMAKE_MKSPEC}")
else()
set(QT_QMAKE_HOST_MKSPEC "${QT_QMAKE_TARGET_MKSPEC}")
endif()
if(NOT QT_QMAKE_TARGET_MKSPEC OR NOT EXISTS "${QT_MKSPECS_DIR}/${QT_QMAKE_TARGET_MKSPEC}")
if(NOT QT_QMAKE_TARGET_MKSPEC)
set(reason "Platform is not detected. Please make sure your build environment is configured"
" properly or specify it manually using QT_QMAKE_TARGET_MKSPEC variable and one of the"
" known platforms.")
else()
set(reason "Unknown platform ${QT_QMAKE_TARGET_MKSPEC}")
endif()
file(GLOB known_platforms
LIST_DIRECTORIES true
RELATIVE "${QT_MKSPECS_DIR}"
"${QT_MKSPECS_DIR}/*"
)
list(JOIN known_platforms "\n " known_platforms)
message(FATAL_ERROR "${reason}\n"
"Known platforms:\n ${known_platforms}")
endif()
if(NOT DEFINED QT_DEFAULT_PLATFORM_DEFINITIONS)
set(QT_DEFAULT_PLATFORM_DEFINITIONS "")
endif()
set(QT_PLATFORM_DEFINITIONS ${QT_DEFAULT_PLATFORM_DEFINITIONS}
CACHE STRING "Qt platform specific pre-processor defines")
set(QT_NAMESPACE "" CACHE STRING "Qt Namespace")
include(QtGlobalStateHelpers)
# Reset global state:
qt_internal_clear_qt_repo_known_modules()
qt_internal_clear_qt_repo_known_plugin_types()
qt_internal_set_qt_known_plugins("")
set(QT_KNOWN_MODULES_WITH_TOOLS "" CACHE INTERNAL "Known Qt modules with tools" FORCE)
# For adjusting variables when running tests, we need to know what
# the correct variable is for separating entries in PATH-alike
# variables.
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(QT_PATH_SEPARATOR "\\;")
else()
set(QT_PATH_SEPARATOR ":")
endif()
# This is used to hold extra cmake code that should be put into QtBuildInternalsExtra.cmake file
# at the QtPostProcess stage.
set(QT_BUILD_INTERNALS_EXTRA_CMAKE_CODE "")
# Save the value of the current first project source dir.
# This will be /path/to/qtbase for qtbase both in a super-build and a non super-build.
# This will be /path/to/qtbase/tests when building standalone tests.
set(QT_TOP_LEVEL_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
# Prevent warnings about object files without any symbols. This is a common
# thing in Qt as we tend to build files unconditionally, and then use ifdefs
# to compile out parts that are not relevant.
if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
foreach(lang ASM C CXX)
# We have to tell 'ar' to not run ranlib by itself, by passing the 'S' option
set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> qcS <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> qS <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols <TARGET>")
endforeach()
endif()
# Functions and macros:
# Needed for qt_internal_add_link_flags_no_undefined.
include(CheckCXXSourceCompiles)
set(__default_private_args
SOURCES
LIBRARIES
INCLUDE_DIRECTORIES
SYSTEM_INCLUDE_DIRECTORIES
DEFINES
DBUS_ADAPTOR_BASENAME
DBUS_ADAPTOR_FLAGS
DBUS_ADAPTOR_SOURCES
DBUS_INTERFACE_BASENAME
DBUS_INTERFACE_FLAGS
DBUS_INTERFACE_SOURCES
FEATURE_DEPENDENCIES
COMPILE_OPTIONS
LINK_OPTIONS
MOC_OPTIONS
DISABLE_AUTOGEN_TOOLS
ENABLE_AUTOGEN_TOOLS
PLUGIN_TYPES
NO_UNITY_BUILD_SOURCES
)
set(__default_public_args
PUBLIC_LIBRARIES
PUBLIC_INCLUDE_DIRECTORIES
PUBLIC_DEFINES
PUBLIC_COMPILE_OPTIONS
PUBLIC_LINK_OPTIONS
)
set(__default_private_module_args
PRIVATE_MODULE_INTERFACE
)
set(__default_target_info_args
TARGET_VERSION
TARGET_PRODUCT
TARGET_DESCRIPTION
TARGET_COMPANY
TARGET_COPYRIGHT
)
# Collection of arguments so they can be shared across qt_internal_add_executable
# and qt_internal_add_test_helper.
set(__qt_internal_add_executable_optional_args
GUI
NO_INSTALL
EXCEPTIONS
DELAY_RC
DELAY_TARGET_INFO
QT_APP
NO_UNITY_BUILD
)
set(__qt_internal_add_executable_single_args
CORE_LIBRARY
OUTPUT_DIRECTORY
INSTALL_DIRECTORY
VERSION
${__default_target_info_args}
)
set(__qt_internal_add_executable_multi_args
${__default_private_args}
${__default_public_args}
)
option(QT_CMAKE_DEBUG_EXTEND_TARGET "Debug extend_target calls in Qt's build system" OFF)
# Internal helpers available only while building Qt itself.
include(Qt3rdPartyLibraryHelpers)
include(QtAppHelpers)
include(QtAutogenHelpers)
include(QtCMakeHelpers)
include(QtDeferredDependenciesHelpers)
include(QtDbusHelpers)
include(QtDocsHelpers)
include(QtExecutableHelpers)
include(QtFindPackageHelpers)
include(QtFlagHandlingHelpers)
include(QtFrameworkHelpers)
include(QtInstallHelpers)
include(QtLalrHelpers)
include(QtModuleHelpers)
include(QtNoLinkTargetHelpers)
include(QtPluginHelpers)
include(QtPrecompiledHeadersHelpers)
include(QtUnityBuildHelpers)
include(QtPkgConfigHelpers)
include(QtPriHelpers)
include(QtPrlHelpers)
include(QtQmakeHelpers)
include(QtResourceHelpers)
include(QtRpathHelpers)
include(QtSanitizerHelpers)
include(QtScopeFinalizerHelpers)
include(QtSimdHelpers)
include(QtSingleRepoTargetSetBuildHelpers)
include(QtSyncQtHelpers)
include(QtTargetHelpers)
include(QtTestHelpers)
include(QtToolHelpers)
include(QtHeadersClean)
include(QtJavaHelpers)
if(ANDROID)
include(QtAndroidHelpers)
endif()
if(WASM)
include(QtWasmHelpers)
endif()
# Helpers that are available in public projects and while building Qt itself.
include(QtPublicAppleHelpers)
include(QtPublicCMakeHelpers)
include(QtPublicPluginHelpers)
include(QtPublicTargetHelpers)
include(QtPublicWalkLibsHelpers)
include(QtPublicFindPackageHelpers)
include(QtPublicDependencyHelpers)
include(QtPublicTestHelpers)
include(QtPublicToolHelpers)
if(CMAKE_CROSSCOMPILING)
if(NOT IS_DIRECTORY "${QT_HOST_PATH}")
message(FATAL_ERROR "You need to set QT_HOST_PATH to cross compile Qt.")
endif()
endif()
_qt_internal_determine_if_host_info_package_needed(__qt_build_requires_host_info_package)
_qt_internal_find_host_info_package("${__qt_build_requires_host_info_package}")
# This sets up the poor man's scope finalizer mechanism.
# For newer CMake versions, we use cmake_language(DEFER CALL) instead.
if(CMAKE_VERSION VERSION_LESS "3.19.0")
variable_watch(CMAKE_CURRENT_LIST_DIR qt_watch_current_list_dir)
endif()
qt_internal_setup_build_and_global_variables()

447
cmake/QtBuildHelpers.cmake Normal file
View File

@ -0,0 +1,447 @@
# Copyright (C) 2023 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
macro(qt_internal_set_qt_building_qt)
# Set the QT_BUILDING_QT variable so we can verify whether we are building
# Qt from source.
# Make sure not to set it when building a standalone test, otherwise
# upon reconfiguration we get an error about qt_internal_add_test
# not being found due the if(NOT QT_BUILDING_QT) check we have
# in each standalone test.
if(NOT QT_INTERNAL_IS_STANDALONE_TEST)
set(QT_BUILDING_QT TRUE CACHE BOOL
"When this is present and set to true, it signals that we are building Qt from source.")
endif()
endmacro()
macro(qt_internal_unset_extra_build_internals_vars)
# Reset content of extra build internal vars for each inclusion of QtSetup.
unset(QT_EXTRA_BUILD_INTERNALS_VARS)
endmacro()
macro(qt_internal_get_generator_is_multi_config)
# Save the global property in a variable to make it available to feature conditions.
get_property(QT_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
endmacro()
macro(qt_internal_setup_position_independent_code)
## Position independent code:
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Does the linker support position independent code?
include(CheckPIESupported)
check_pie_supported()
endmacro()
macro(qt_internal_set_link_depends_no_shared)
# Do not relink dependent libraries when no header has changed:
set(CMAKE_LINK_DEPENDS_NO_SHARED ON)
endmacro()
macro(qt_internal_set_qt_source_tree_var)
# Specify the QT_SOURCE_TREE only when building qtbase. Needed by some tests when the tests are
# built as part of the project, and not standalone. For standalone tests, the value is set in
# QtBuildInternalsExtra.cmake.
if(PROJECT_NAME STREQUAL "QtBase")
set(QT_SOURCE_TREE "${QtBase_SOURCE_DIR}" CACHE PATH
"A path to the source tree of the previously configured QtBase project." FORCE)
endif()
endmacro()
macro(qt_internal_include_qt_platform_android)
## Android platform settings
if(ANDROID)
include(QtPlatformAndroid)
endif()
endmacro()
macro(qt_internal_set_compiler_optimization_flags)
include(QtCompilerOptimization)
endmacro()
macro(qt_internal_set_compiler_warning_flags)
include(QtCompilerFlags)
endmacro()
macro(qt_internal_set_skip_setup_deployment)
if(NOT QT_BUILD_EXAMPLES)
# Disable deployment setup to avoid warnings about missing patchelf with CMake < 3.21.
set(QT_SKIP_SETUP_DEPLOYMENT ON)
endif()
endmacro()
macro(qt_internal_reset_global_state)
qt_internal_clear_qt_repo_known_modules()
qt_internal_clear_qt_repo_known_plugin_types()
qt_internal_set_qt_known_plugins("")
set(QT_KNOWN_MODULES_WITH_TOOLS "" CACHE INTERNAL "Known Qt modules with tools" FORCE)
endmacro()
macro(qt_internal_set_qt_path_separator)
# For adjusting variables when running tests, we need to know what
# the correct variable is for separating entries in PATH-alike
# variables.
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(QT_PATH_SEPARATOR "\\;")
else()
set(QT_PATH_SEPARATOR ":")
endif()
endmacro()
macro(qt_internal_set_internals_extra_cmake_code)
# This is used to hold extra cmake code that should be put into QtBuildInternalsExtra.cmake file
# at the QtPostProcess stage.
set(QT_BUILD_INTERNALS_EXTRA_CMAKE_CODE "")
endmacro()
macro(qt_internal_set_top_level_source_dir)
# Save the value of the current first project source dir.
# This will be /path/to/qtbase for qtbase both in a super-build and a non super-build.
# This will be /path/to/qtbase/tests when building standalone tests.
set(QT_TOP_LEVEL_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
endmacro()
macro(qt_internal_set_apple_archiver_flags)
# Prevent warnings about object files without any symbols. This is a common
# thing in Qt as we tend to build files unconditionally, and then use ifdefs
# to compile out parts that are not relevant.
if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
foreach(lang ASM C CXX)
# We have to tell 'ar' to not run ranlib by itself, by passing the 'S' option
set(CMAKE_${lang}_ARCHIVE_CREATE "<CMAKE_AR> qcS <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_APPEND "<CMAKE_AR> qS <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_${lang}_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols <TARGET>")
endforeach()
endif()
endmacro()
macro(qt_internal_set_debug_extend_target)
option(QT_CMAKE_DEBUG_EXTEND_TARGET "Debug extend_target calls in Qt's build system" OFF)
endmacro()
# These upstream CMake modules will be automatically include()'d when doing
# find_package(Qt6 COMPONENTS BuildInternals).
function(qt_internal_get_qt_build_upstream_cmake_modules out_var)
set(${out_var}
CMakeFindBinUtils
CMakePackageConfigHelpers
CheckCXXSourceCompiles
FeatureSummary
PARENT_SCOPE
)
endfunction()
# These helpers will be installed when building qtbase, and they will be automatically include()'d
# when doing find_package(Qt6 COMPONENTS BuildInternals).
# The helpers are expected to exist under the qtbase/cmake sub-directory and their file name
# extension should be '.cmake'.
function(qt_internal_get_qt_build_private_helpers out_var)
set(${out_var}
Qt3rdPartyLibraryHelpers
QtAndroidHelpers
QtAppHelpers
QtAutoDetectHelpers
QtAutogenHelpers
QtBuildInformation
QtBuildOptionsHelpers
QtBuildPathsHelpers
QtBuildRepoExamplesHelpers
QtBuildRepoHelpers
QtCMakeHelpers
QtCMakeVersionHelpers
QtDbusHelpers
QtDeferredDependenciesHelpers
QtDocsHelpers
QtExecutableHelpers
QtFindPackageHelpers
QtFlagHandlingHelpers
QtFrameworkHelpers
QtGlobalStateHelpers
QtHeadersClean
QtInstallHelpers
QtJavaHelpers
QtLalrHelpers
QtMkspecHelpers
QtModuleHelpers
QtNoLinkTargetHelpers
QtPkgConfigHelpers
QtPlatformTargetHelpers
QtPluginHelpers
QtPostProcessHelpers
QtPrecompiledHeadersHelpers
QtPriHelpers
QtPrlHelpers
QtQmakeHelpers
QtResourceHelpers
QtRpathHelpers
QtSanitizerHelpers
QtScopeFinalizerHelpers
QtSeparateDebugInfo
QtSimdHelpers
QtSingleRepoTargetSetBuildHelpers
QtSyncQtHelpers
QtTargetHelpers
QtTestHelpers
QtToolHelpers
QtToolchainHelpers
QtUnityBuildHelpers
QtWasmHelpers
QtWrapperScriptHelpers
PARENT_SCOPE
)
endfunction()
# These files will be installed when building qtbase, but will NOT be automatically include()d
# when doing find_package(Qt6 COMPONENTS BuildInternals).
# The files are expected to exist under the qtbase/cmake sub-directory.
function(qt_internal_get_qt_build_private_files_to_install out_var)
set(${out_var}
ModuleDescription.json.in
PkgConfigLibrary.pc.in
Qt3rdPartyLibraryConfig.cmake.in
QtBaseTopLevelHelpers.cmake
QtBuild.cmake
QtBuildHelpers.cmake
QtCMakePackageVersionFile.cmake.in
QtCompilerFlags.cmake
QtCompilerOptimization.cmake
QtConfigDependencies.cmake.in
QtConfigureTimeExecutableCMakeLists.txt.in
QtFileConfigure.txt.in
QtFindWrapConfigExtra.cmake.in
QtFindWrapHelper.cmake
QtFinishPkgConfigFile.cmake
QtFinishPrlFile.cmake
QtGenerateExtPri.cmake
QtGenerateLibHelpers.cmake
QtGenerateLibPri.cmake
QtGenerateVersionScript.cmake
QtModuleConfig.cmake.in
QtModuleDependencies.cmake.in
QtModuleHeadersCheck.cmake
QtModuleToolsConfig.cmake.in
QtModuleToolsDependencies.cmake.in
QtModuleToolsVersionlessTargets.cmake.in
QtPlatformAndroid.cmake
QtPlatformSupport.cmake
QtPluginConfig.cmake.in
QtPluginDependencies.cmake.in
QtPlugins.cmake.in
QtPostProcess.cmake
QtProcessConfigureArgs.cmake
QtSeparateDebugInfo.Info.plist.in
QtSetup.cmake
QtStandaloneTestsConfig.cmake.in
QtWriteArgsFile.cmake
modulecppexports.h.in
modulecppexports_p.h.in
qbatchedtestrunner.in.cpp
PARENT_SCOPE
)
endfunction()
# These helpers will be installed when building qtbase, and they will be automatically include()'d
# when doing find_package(Qt6 COMPONENTS BuildInternals).
# The helpers are expected to exist under the qtbase/cmake sub-directory and their file name
# extension should be '.cmake'.
# In addition, they are meant to be included when doing find_package(Qt6) as well.
function(qt_internal_get_qt_build_public_helpers out_var)
set(${out_var}
QtFeature
QtFeatureCommon
QtPublicAppleHelpers
QtPublicCMakeHelpers
QtPublicCMakeVersionHelpers
QtPublicDependencyHelpers
QtPublicExternalProjectHelpers
QtPublicFinalizerHelpers
QtPublicFindPackageHelpers
QtPublicPluginHelpers
QtPublicTargetHelpers
QtPublicTestHelpers
QtPublicToolHelpers
QtPublicWalkLibsHelpers
PARENT_SCOPE
)
endfunction()
# These files will be installed when building qtbase, but will NOT be automatically include()d
# when doing find_package(Qt6) nor find_package(Qt6 COMPONENTS BuildInternals).
# The files are expected to exist under the qtbase/cmake sub-directory.
function(qt_internal_get_qt_build_public_files_to_install out_var)
set(${out_var}
QtCopyFileIfDifferent.cmake
QtInitProject.cmake
# Public CMake files that are installed next Qt6Config.cmake, but are NOT included by it.
# Instead they are included by the generated CMake toolchain file.
QtPublicWasmToolchainHelpers.cmake
PARENT_SCOPE
)
endfunction()
# Includes all Qt CMake helper files that define functions and macros.
macro(qt_internal_include_all_helpers)
# Upstream cmake modules.
qt_internal_get_qt_build_upstream_cmake_modules(__qt_upstream_helpers)
foreach(__qt_file_name IN LISTS __qt_upstream_helpers)
include("${__qt_file_name}")
endforeach()
# Internal helpers available only while building Qt itself.
qt_internal_get_qt_build_private_helpers(__qt_private_helpers)
foreach(__qt_file_name IN LISTS __qt_private_helpers)
include("${__qt_file_name}")
endforeach()
# Helpers that are available in public projects and while building Qt itself.
qt_internal_get_qt_build_public_helpers(__qt_public_helpers)
foreach(__qt_file_name IN LISTS __qt_public_helpers)
include("${__qt_file_name}")
endforeach()
endmacro()
function(qt_internal_check_host_path_set_for_cross_compiling)
if(CMAKE_CROSSCOMPILING)
if(NOT IS_DIRECTORY "${QT_HOST_PATH}")
message(FATAL_ERROR "You need to set QT_HOST_PATH to cross compile Qt.")
endif()
endif()
endfunction()
macro(qt_internal_setup_find_host_info_package)
_qt_internal_determine_if_host_info_package_needed(__qt_build_requires_host_info_package)
_qt_internal_find_host_info_package("${__qt_build_requires_host_info_package}")
endmacro()
macro(qt_internal_setup_poor_mans_scope_finalizer)
# This sets up the poor man's scope finalizer mechanism.
# For newer CMake versions, we use cmake_language(DEFER CALL) instead.
if(CMAKE_VERSION VERSION_LESS "3.19.0")
variable_watch(CMAKE_CURRENT_LIST_DIR qt_watch_current_list_dir)
endif()
endmacro()
macro(qt_internal_set_qt_namespace)
set(QT_NAMESPACE "" CACHE STRING "Qt Namespace")
endmacro()
macro(qt_internal_set_qt_coord_type)
if(PROJECT_NAME STREQUAL "QtBase")
set(QT_COORD_TYPE double CACHE STRING "Type of qreal")
endif()
endmacro()
function(qt_internal_check_macos_host_version)
# macOS versions 10.14 and less don't have the implementation of std::filesystem API.
if(CMAKE_HOST_APPLE AND CMAKE_HOST_SYSTEM_VERSION VERSION_LESS "19.0.0")
message(FATAL_ERROR "macOS versions less than 10.15 are not supported for building Qt.")
endif()
endfunction()
function(qt_internal_setup_tool_path_command)
if(NOT CMAKE_HOST_WIN32)
return()
endif()
set(bindir "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_BINDIR}")
file(TO_NATIVE_PATH "${bindir}" bindir)
list(APPEND command COMMAND)
list(APPEND command set PATH=${bindir}$<SEMICOLON>%PATH%)
set(QT_TOOL_PATH_SETUP_COMMAND "${command}" CACHE INTERNAL
"internal command prefix for tool invocations" FORCE)
# QT_TOOL_PATH_SETUP_COMMAND is deprecated. Please use _qt_internal_get_wrap_tool_script_path
# instead.
endfunction()
macro(qt_internal_setup_android_platform_specifics)
if(ANDROID)
qt_internal_setup_android_target_properties()
endif()
endmacro()
macro(qt_internal_setup_build_and_global_variables)
qt_internal_set_qt_building_qt()
qt_internal_compute_features_from_possible_inputs()
# Depends on qt_internal_compute_features_from_possible_inputs
qt_internal_set_default_build_type()
qt_internal_set_message_log_level(CMAKE_MESSAGE_LOG_LEVEL)
qt_internal_unset_extra_build_internals_vars()
qt_internal_get_generator_is_multi_config()
# Depends on qt_internal_set_default_build_type
qt_internal_setup_cmake_config_postfix()
qt_internal_setup_position_independent_code()
qt_internal_set_link_depends_no_shared()
# Depends on qt_internal_compute_features_from_possible_inputs
qt_internal_setup_default_install_prefix()
qt_internal_set_qt_source_tree_var()
qt_internal_set_export_compile_commands()
qt_internal_set_configure_from_ide()
# Depends on qt_internal_compute_features_from_possible_inputs
# Depends on qt_internal_set_configure_from_ide
qt_internal_set_sync_headers_at_configure_time()
# Depends on qt_internal_compute_features_from_possible_inputs
qt_internal_setup_build_benchmarks()
# Depends on qt_internal_compute_features_from_possible_inputs
# Depends on qt_internal_setup_build_benchmarks
qt_internal_setup_build_tests()
qt_internal_setup_build_tools()
# Depends on qt_internal_setup_default_install_prefix
qt_internal_setup_build_examples()
qt_internal_set_qt_host_path()
qt_internal_include_qt_platform_android()
# Depends on qt_internal_setup_default_install_prefix
qt_internal_setup_paths_and_prefixes()
qt_internal_reset_global_state()
# Depends on qt_internal_setup_paths_and_prefixes
qt_internal_set_mkspecs_dir()
qt_internal_setup_platform_definitions_and_mkspec()
qt_internal_check_macos_host_version()
_qt_internal_check_apple_sdk_and_xcode_versions()
qt_internal_check_host_path_set_for_cross_compiling()
qt_internal_setup_android_platform_specifics()
qt_internal_setup_find_host_info_package()
qt_internal_setup_tool_path_command()
qt_internal_setup_default_target_function_options()
qt_internal_set_default_rpath_settings()
qt_internal_set_qt_namespace()
qt_internal_set_qt_coord_type()
qt_internal_set_qt_path_separator()
qt_internal_set_internals_extra_cmake_code()
qt_internal_set_top_level_source_dir()
qt_internal_set_apple_archiver_flags()
qt_internal_set_debug_extend_target()
qt_internal_setup_poor_mans_scope_finalizer()
qt_internal_set_compiler_optimization_flags()
qt_internal_set_compiler_warning_flags()
qt_set_language_standards()
qt_internal_set_use_ccache()
qt_internal_set_unity_build()
qt_internal_set_allow_symlink_in_paths()
qt_internal_set_skip_setup_deployment()
qt_internal_set_qt_allow_download()
qt_internal_detect_dirty_features()
endmacro()

View File

@ -1,6 +1,22 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
function(qt_internal_set_message_log_level out_var)
# Decide whether output should be verbose or not.
# Default to verbose (--log-level=STATUS) in a developer-build and
# non-verbose (--log-level=NOTICE) otherwise.
# If a custom CMAKE_MESSAGE_LOG_LEVEL was specified, it takes priority.
# Passing an explicit --log-level=Foo has the highest priority.
if(NOT CMAKE_MESSAGE_LOG_LEVEL)
if(FEATURE_developer_build OR QT_FEATURE_developer_build)
set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")
else()
set(CMAKE_MESSAGE_LOG_LEVEL "NOTICE")
endif()
set(${out_var} "${CMAKE_MESSAGE_LOG_LEVEL}" PARENT_SCOPE)
endif()
endfunction()
function(qt_print_feature_summary)
if(QT_SUPERBUILD)
qt_internal_set_message_log_level(message_log_level)
@ -11,7 +27,6 @@ function(qt_print_feature_summary)
endif()
endif()
include(FeatureSummary)
# Show which packages were found.
feature_summary(INCLUDE_QUIET_PACKAGES
WHAT PACKAGES_FOUND

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@
# SPDX-License-Identifier: BSD-3-Clause
# Includes QtSetup and friends for private CMake API.
set(QT_INTERNAL_IS_STANDALONE_TEST TRUE)
qt_internal_project_setup()
qt_build_internals_set_up_private_api()

View File

@ -103,6 +103,9 @@ set(QT_BUILD_EXAMPLES_AS_EXTERNAL "@QT_BUILD_EXAMPLES_AS_EXTERNAL@" CACHE BOOL
# Propagate usage of ccache.
set(QT_USE_CCACHE @QT_USE_CCACHE@ CACHE BOOL "Enable the use of ccache")
# Propagate usage of vcpkg, ON by default.
set(QT_USE_VCPKG @QT_USE_VCPKG@ CACHE BOOL "Enable the use of vcpkg")
# Propagate usage of unity build.
set(QT_UNITY_BUILD @QT_UNITY_BUILD@ CACHE BOOL "Enable unity (jumbo) build")
set(QT_UNITY_BUILD_BATCH_SIZE "@QT_UNITY_BUILD_BATCH_SIZE@" CACHE STRING "Unity build batch size")
@ -163,6 +166,7 @@ function(qt_internal_force_set_cmake_build_type_conditionally value)
AND NOT QT_NO_FORCE_SET_CMAKE_BUILD_TYPE
AND NOT __qt_internal_extras_is_multi_config)
set(CMAKE_BUILD_TYPE "${value}" CACHE STRING "Choose the type of build." FORCE)
set(__qt_build_internals_cmake_build_type "${value}" PARENT_SCOPE)
endif()
endfunction()

View File

@ -0,0 +1,258 @@
# Copyright (C) 2023 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
macro(qt_internal_set_default_build_type)
set(_default_build_type "Release")
if(FEATURE_developer_build)
set(_default_build_type "Debug")
endif()
# Try to detect if an explicit CMAKE_BUILD_TYPE was set by the user.
# CMake sets CMAKE_BUILD_TYPE_INIT to Debug on most Windows platforms and doesn't set
# anything for UNIXes. CMake assigns CMAKE_BUILD_TYPE_INIT to CMAKE_BUILD_TYPE during
# first project() if CMAKE_BUILD_TYPE has no previous value.
# We use extra information about the state of CMAKE_BUILD_TYPE before the first
# project() call that's set in QtAutodetect.
# STREQUAL check needs to have expanded variables because an undefined var is not equal
# to an empty defined var.
# See also qt_internal_force_set_cmake_build_type_conditionally which is used
# to set the build type when building other repos or tests.
if("${CMAKE_BUILD_TYPE}" STREQUAL "${CMAKE_BUILD_TYPE_INIT}"
AND NOT __qt_auto_detect_cmake_build_type_before_project_call
AND NOT __qt_build_internals_cmake_build_type
AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${_default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${_default_build_type}" CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE
PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo") # Set the possible values for cmake-gui.
elseif(CMAKE_CONFIGURATION_TYPES)
message(STATUS "Building for multiple configurations: ${CMAKE_CONFIGURATION_TYPES}.")
message(STATUS "Main configuration is: ${QT_MULTI_CONFIG_FIRST_CONFIG}.")
if(CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE)
message(STATUS
"Default build configuration set to '${CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE}'.")
endif()
if(CMAKE_GENERATOR STREQUAL "Ninja")
message(FATAL_ERROR
"It's not possible to build multiple configurations with the single config Ninja "
"generator. Consider configuring with -G\"Ninja Multi-Config\" instead of -GNinja."
)
endif()
else()
message(STATUS "CMAKE_BUILD_TYPE was set to: '${CMAKE_BUILD_TYPE}'")
endif()
endmacro()
macro(qt_internal_set_configure_from_ide)
# QT_INTERNAL_CONFIGURE_FROM_IDE is set to TRUE for the following known IDE applications:
# - Qt Creator, detected by QTC_RUN environment variable
# - CLion, detected by CLION_IDE environment variable
# - Visual Studio Code, detected by VSCODE_CLI environment variable
if("$ENV{QTC_RUN}" OR "$ENV{CLION_IDE}" OR "$ENV{VSCODE_CLI}")
set(QT_INTERNAL_CONFIGURE_FROM_IDE TRUE CACHE INTERNAL "Configuring Qt Project from IDE")
else()
set(QT_INTERNAL_CONFIGURE_FROM_IDE FALSE CACHE INTERNAL "Configuring Qt Project from IDE")
endif()
endmacro()
macro(qt_internal_set_sync_headers_at_configure_time)
set(_qt_sync_headers_at_configure_time_default ${QT_INTERNAL_CONFIGURE_FROM_IDE})
if(FEATURE_developer_build)
# Sync headers during the initial configuration of a -developer-build to facilitate code
# navigation for code editors that use an LSP-based code model.
set(_qt_sync_headers_at_configure_time_default TRUE)
endif()
# Sync Qt header files at configure time
option(QT_SYNC_HEADERS_AT_CONFIGURE_TIME "Run syncqt at configure time already"
${_qt_sync_headers_at_configure_time_default})
unset(_qt_sync_headers_at_configure_time_default)
# In static Ninja Multi-Config builds the sync_headers dependencies(and other autogen
# dependencies are not added to '_autogen/timestamp' targets. See QTBUG-113974.
if(CMAKE_GENERATOR STREQUAL "Ninja Multi-Config" AND NOT QT_BUILD_SHARED_LIBS)
set(QT_SYNC_HEADERS_AT_CONFIGURE_TIME TRUE CACHE BOOL "" FORCE)
endif()
endmacro()
macro(qt_internal_set_export_compile_commands)
if(FEATURE_developer_build)
if(DEFINED QT_CMAKE_EXPORT_COMPILE_COMMANDS)
set(CMAKE_EXPORT_COMPILE_COMMANDS ${QT_CMAKE_EXPORT_COMPILE_COMMANDS})
else()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
endif()
endif()
endmacro()
macro(qt_internal_setup_build_benchmarks)
if(FEATURE_developer_build)
set(__build_benchmarks ON)
# Disable benchmarks for single configuration generators which do not build
# with release configuration.
if(CMAKE_BUILD_TYPE AND CMAKE_BUILD_TYPE STREQUAL Debug)
set(__build_benchmarks OFF)
endif()
else()
set(__build_benchmarks OFF)
endif()
# Build Benchmarks
option(QT_BUILD_BENCHMARKS "Build Qt Benchmarks" ${__build_benchmarks})
endmacro()
macro(qt_internal_setup_build_tests)
if(FEATURE_developer_build)
set(_qt_build_tests_default ON)
# Tests are not built by default with qmake for iOS and friends, and thus the overall build
# tends to fail. Disable them by default when targeting uikit.
if(UIKIT OR ANDROID)
set(_qt_build_tests_default OFF)
endif()
else()
set(_qt_build_tests_default OFF)
endif()
# If benchmarks are explicitly enabled, force tests to also be built, even if they might
# not work on the platform.
if(QT_BUILD_BENCHMARKS)
set(_qt_build_tests_default ON)
endif()
## Set up testing
option(QT_BUILD_TESTS "Build the testing tree." ${_qt_build_tests_default})
unset(_qt_build_tests_default)
option(QT_BUILD_TESTS_BY_DEFAULT
"Should tests be built as part of the default 'all' target." ON)
if(QT_BUILD_STANDALONE_TESTS)
# BuildInternals might have set it to OFF on initial configuration. So force it to ON when
# building standalone tests.
set(QT_BUILD_TESTS ON CACHE BOOL "Build the testing tree." FORCE)
# Also force the tests to be built as part of the default build target.
set(QT_BUILD_TESTS_BY_DEFAULT ON CACHE BOOL
"Should tests be built as part of the default 'all' target." FORCE)
endif()
set(BUILD_TESTING ${QT_BUILD_TESTS} CACHE INTERNAL "")
if(WASM)
set(_qt_batch_tests ON)
else()
set(_qt_batch_tests OFF)
endif()
if(DEFINED INPUT_batch_tests)
if (${INPUT_batch_tests})
set(_qt_batch_tests ON)
else()
set(_qt_batch_tests OFF)
endif()
endif()
option(QT_BUILD_TESTS_BATCHED "Link all tests into a single binary." ${_qt_batch_tests})
if(QT_BUILD_TESTS AND QT_BUILD_TESTS_BATCHED AND CMAKE_VERSION VERSION_LESS "3.19")
message(FATAL_ERROR
"Test batching requires at least CMake 3.19, due to requiring per-source "
"TARGET_DIRECTORY assignments and DEFER calls.")
endif()
option(QT_BUILD_MANUAL_TESTS "Build Qt manual tests" OFF)
if(WASM)
option(QT_BUILD_MINIMAL_STATIC_TESTS "Build minimal subset of tests for static Qt builds"
ON)
else()
option(QT_BUILD_MINIMAL_STATIC_TESTS "Build minimal subset of tests for static Qt builds"
OFF)
endif()
option(QT_BUILD_MINIMAL_ANDROID_MULTI_ABI_TESTS
"Build minimal subset of tests for Android multi-ABI Qt builds" OFF)
include(CTest)
enable_testing()
endmacro()
macro(qt_internal_setup_build_tools)
# QT_BUILD_TOOLS_WHEN_CROSSCOMPILING -> QT_FORCE_BUILD_TOOLS
# pre-6.4 compatibility flag (remove sometime in the future)
if(CMAKE_CROSSCOMPILING AND QT_BUILD_TOOLS_WHEN_CROSSCOMPILING)
message(WARNING "QT_BUILD_TOOLS_WHEN_CROSSCOMPILING is deprecated. "
"Please use QT_FORCE_BUILD_TOOLS instead.")
set(QT_FORCE_BUILD_TOOLS TRUE CACHE INTERNAL "" FORCE)
endif()
# When cross-building, we don't build tools by default. Sometimes this also covers Qt apps as
# well. Like in qttools/assistant/assistant.pro, load(qt_app), which is guarded by a
# qtNomakeTools() call.
set(_qt_build_tools_by_default_default ON)
if(CMAKE_CROSSCOMPILING AND NOT QT_FORCE_BUILD_TOOLS)
set(_qt_build_tools_by_default_default OFF)
endif()
option(QT_BUILD_TOOLS_BY_DEFAULT "Should tools be built as part of the default 'all' target."
"${_qt_build_tools_by_default_default}")
unset(_qt_build_tools_by_default_default)
endmacro()
macro(qt_internal_setup_build_examples)
option(QT_BUILD_EXAMPLES "Build Qt examples" OFF)
option(QT_BUILD_EXAMPLES_BY_DEFAULT
"Should examples be built as part of the default 'all' target." ON)
option(QT_INSTALL_EXAMPLES_SOURCES "Install example sources" OFF)
option(QT_INSTALL_EXAMPLES_SOURCES_BY_DEFAULT
"Install example sources as part of the default 'install' target" ON)
# FIXME: Support prefix builds as well QTBUG-96232
if(QT_WILL_INSTALL)
set(_qt_build_examples_as_external OFF)
else()
set(_qt_build_examples_as_external ON)
endif()
option(QT_BUILD_EXAMPLES_AS_EXTERNAL "Should examples be built as ExternalProjects."
${_qt_build_examples_as_external})
unset(_qt_build_examples_as_external)
endmacro()
macro(qt_internal_set_qt_host_path)
## Path used to find host tools, either when cross-compiling or just when using the tools from
## a different host build.
set(QT_HOST_PATH "$ENV{QT_HOST_PATH}" CACHE PATH
"Installed Qt host directory path, used for cross compiling.")
endmacro()
macro(qt_internal_set_use_ccache)
option(QT_USE_CCACHE "Enable the use of ccache")
if(QT_USE_CCACHE)
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
set(CMAKE_OBJC_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
set(CMAKE_OBJCXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
else()
message(FATAL_ERROR "Ccache use was requested, but the program was not found.")
endif()
endif()
endmacro()
macro(qt_internal_set_unity_build)
option(QT_UNITY_BUILD "Enable unity (jumbo) build")
set(QT_UNITY_BUILD_BATCH_SIZE "32" CACHE STRING "Unity build batch size")
if(QT_UNITY_BUILD)
set(CMAKE_UNITY_BUILD ON)
set(CMAKE_UNITY_BUILD_BATCH_SIZE "${QT_UNITY_BUILD_BATCH_SIZE}")
endif()
endmacro()
macro(qt_internal_set_allow_symlink_in_paths)
option(QT_ALLOW_SYMLINK_IN_PATHS "Allows symlinks in paths." OFF)
endmacro()
macro(qt_internal_set_qt_allow_download)
option(QT_ALLOW_DOWNLOAD "Allows files to be downloaded when building Qt." OFF)
endmacro()

View File

@ -0,0 +1,230 @@
# Copyright (C) 2023 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
macro(qt_internal_setup_default_install_prefix)
# Detect non-prefix builds: either when the qtbase install prefix is set to the binary dir
# or when a developer build is explicitly enabled and no install prefix (or staging prefix)
# is specified.
# This detection only happens when building qtbase, and later is propagated via the generated
# QtBuildInternalsExtra.cmake file.
if (PROJECT_NAME STREQUAL "QtBase" AND NOT QT_BUILD_STANDALONE_TESTS)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
# Handle both FEATURE_ and QT_FEATURE_ cases when they are specified on the command line
# explicitly. It's possible for one to be set, but not the other, because
# qtbase/configure.cmake is not processed by this point.
if((FEATURE_developer_build
OR QT_FEATURE_developer_build
OR FEATURE_no_prefix
OR QT_FEATURE_no_prefix
)
AND NOT CMAKE_STAGING_PREFIX)
# Handle non-prefix builds by setting the CMake install prefix to point to qtbase's
# build dir. While building another repo (like qtsvg) the CMAKE_PREFIX_PATH should
# be set on the command line to point to the qtbase build dir.
set(__qt_default_prefix "${QtBase_BINARY_DIR}")
else()
if(CMAKE_HOST_WIN32)
set(__qt_default_prefix "C:/Qt/")
else()
set(__qt_default_prefix "/usr/local/")
endif()
string(APPEND __qt_default_prefix
"Qt-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
endif()
set(CMAKE_INSTALL_PREFIX ${__qt_default_prefix} CACHE PATH
"Install path prefix, prepended onto install directories." FORCE)
unset(__qt_default_prefix)
endif()
if(CMAKE_STAGING_PREFIX)
set(__qt_prefix "${CMAKE_STAGING_PREFIX}")
else()
set(__qt_prefix "${CMAKE_INSTALL_PREFIX}")
endif()
if(__qt_prefix STREQUAL QtBase_BINARY_DIR)
set(__qt_will_install_value OFF)
else()
set(__qt_will_install_value ON)
endif()
set(QT_WILL_INSTALL ${__qt_will_install_value} CACHE BOOL
"Boolean indicating if doing a Qt prefix build (vs non-prefix build)." FORCE)
unset(__qt_prefix)
unset(__qt_will_install_value)
endif()
endmacro()
function(qt_internal_setup_build_and_install_paths)
# Compute the values of QT_BUILD_DIR, QT_INSTALL_DIR, QT_CONFIG_BUILD_DIR, QT_CONFIG_INSTALL_DIR
# taking into account whether the current build is a prefix build or a non-prefix build,
# and whether it is a superbuild or non-superbuild.
# A third case is when another module or standalone tests are built against a super-built Qt.
# The layout for the third case is the same as for non-superbuilds.
#
# These values should be prepended to file paths in commands or properties,
# in order to correctly place generated Config files, generated Targets files,
# executables / libraries, when copying / installing files, etc.
#
# The build dir variables will always be absolute paths.
# The QT_INSTALL_DIR variable will have a relative path in a prefix build,
# which means that it can be empty, so use qt_join_path to prevent accidental absolute paths.
if(QT_SUPERBUILD)
# In this case, we always copy all the build products in qtbase/{bin,lib,...}
if(QT_WILL_INSTALL)
set(QT_BUILD_DIR "${QtBase_BINARY_DIR}")
set(QT_INSTALL_DIR "")
else()
if("${CMAKE_STAGING_PREFIX}" STREQUAL "")
set(QT_BUILD_DIR "${QtBase_BINARY_DIR}")
set(QT_INSTALL_DIR "${QtBase_BINARY_DIR}")
else()
set(QT_BUILD_DIR "${CMAKE_STAGING_PREFIX}")
set(QT_INSTALL_DIR "${CMAKE_STAGING_PREFIX}")
endif()
endif()
else()
if(QT_WILL_INSTALL)
# In the usual prefix build case, the build dir is the current module build dir,
# and the install dir is the prefix, so we don't set it.
set(QT_BUILD_DIR "${CMAKE_BINARY_DIR}")
set(QT_INSTALL_DIR "")
else()
# When doing a non-prefix build, both the build dir and install dir are the same,
# pointing to the qtbase build dir.
set(QT_BUILD_DIR "${QT_STAGING_PREFIX}")
set(QT_INSTALL_DIR "${QT_BUILD_DIR}")
endif()
endif()
set(__config_path_part "${INSTALL_LIBDIR}/cmake")
set(QT_CONFIG_BUILD_DIR "${QT_BUILD_DIR}/${__config_path_part}")
set(QT_CONFIG_INSTALL_DIR "${QT_INSTALL_DIR}")
if(QT_CONFIG_INSTALL_DIR)
string(APPEND QT_CONFIG_INSTALL_DIR "/")
endif()
string(APPEND QT_CONFIG_INSTALL_DIR ${__config_path_part})
set(QT_BUILD_DIR "${QT_BUILD_DIR}" PARENT_SCOPE)
set(QT_INSTALL_DIR "${QT_INSTALL_DIR}" PARENT_SCOPE)
set(QT_CONFIG_BUILD_DIR "${QT_CONFIG_BUILD_DIR}" PARENT_SCOPE)
set(QT_CONFIG_INSTALL_DIR "${QT_CONFIG_INSTALL_DIR}" PARENT_SCOPE)
endfunction()
function(qt_configure_process_path name default docstring)
# Values are computed once for qtbase, and then exported and reused for other projects.
if(NOT PROJECT_NAME STREQUAL "QtBase")
return()
endif()
# No value provided, set the default.
if(NOT DEFINED "${name}")
set("${name}" "${default}" CACHE STRING "${docstring}")
else()
get_filename_component(given_path_as_abs "${${name}}" ABSOLUTE BASE_DIR
"${CMAKE_INSTALL_PREFIX}")
file(RELATIVE_PATH rel_path "${CMAKE_INSTALL_PREFIX}"
"${given_path_as_abs}")
# If absolute path given, check that it's inside the prefix (error out if not).
# TODO: Figure out if we need to support paths that are outside the prefix.
#
# If relative path given, it's relative to the install prefix (rather than the binary dir,
# which is what qmake does for some reason).
# In both cases, store the value as a relative path.
if("${rel_path}" STREQUAL "")
# file(RELATIVE_PATH) returns an empty string if the given absolute paths are equal
set(rel_path ".")
elseif(rel_path MATCHES "^\.\./")
# INSTALL_SYSCONFDIR is allowed to be outside the prefix.
if(NOT name STREQUAL "INSTALL_SYSCONFDIR")
message(FATAL_ERROR
"Path component '${name}' is outside computed install prefix: ${rel_path} ")
return()
endif()
set("${name}" "${${name}}" CACHE STRING "${docstring}" FORCE)
else()
set("${name}" "${rel_path}" CACHE STRING "${docstring}" FORCE)
endif()
endif()
endfunction()
macro(qt_internal_setup_configure_install_paths)
# Install locations:
qt_configure_process_path(INSTALL_BINDIR "bin" "Executables [PREFIX/bin]")
qt_configure_process_path(INSTALL_INCLUDEDIR "include" "Header files [PREFIX/include]")
qt_configure_process_path(INSTALL_LIBDIR "lib" "Libraries [PREFIX/lib]")
qt_configure_process_path(INSTALL_MKSPECSDIR "mkspecs" "Mkspecs files [PREFIX/mkspecs]")
qt_configure_process_path(INSTALL_ARCHDATADIR "." "Arch-dependent data [PREFIX]")
qt_configure_process_path(INSTALL_PLUGINSDIR
"${INSTALL_ARCHDATADIR}/plugins"
"Plugins [ARCHDATADIR/plugins]")
if(NOT INSTALL_MKSPECSDIR MATCHES "(^|/)mkspecs")
message(FATAL_ERROR "INSTALL_MKSPECSDIR must end with '/mkspecs'")
endif()
if (WIN32)
set(_default_libexec "${INSTALL_ARCHDATADIR}/bin")
else()
set(_default_libexec "${INSTALL_ARCHDATADIR}/libexec")
endif()
qt_configure_process_path(
INSTALL_LIBEXECDIR
"${_default_libexec}"
"Helper programs [ARCHDATADIR/bin on Windows, ARCHDATADIR/libexec otherwise]")
qt_configure_process_path(INSTALL_QMLDIR
"${INSTALL_ARCHDATADIR}/qml"
"QML imports [ARCHDATADIR/qml]")
qt_configure_process_path(INSTALL_DATADIR "." "Arch-independent data [PREFIX]")
qt_configure_process_path(INSTALL_DOCDIR "${INSTALL_DATADIR}/doc" "Documentation [DATADIR/doc]")
qt_configure_process_path(INSTALL_TRANSLATIONSDIR "${INSTALL_DATADIR}/translations"
"Translations [DATADIR/translations]")
if(APPLE)
set(QT_DEFAULT_SYS_CONF_DIR "/Library/Preferences/Qt")
else()
set(QT_DEFAULT_SYS_CONF_DIR "etc/xdg")
endif()
qt_configure_process_path(
INSTALL_SYSCONFDIR
"${QT_DEFAULT_SYS_CONF_DIR}"
"Settings used by Qt programs [PREFIX/etc/xdg]/[/Library/Preferences/Qt]")
qt_configure_process_path(INSTALL_EXAMPLESDIR "examples" "Examples [PREFIX/examples]")
qt_configure_process_path(INSTALL_TESTSDIR "tests" "Tests [PREFIX/tests]")
qt_configure_process_path(INSTALL_DESCRIPTIONSDIR
"${INSTALL_ARCHDATADIR}/modules"
"Module description files directory")
endmacro()
macro(qt_internal_set_cmake_install_libdir)
# Ensure that GNUInstallDirs's CMAKE_INSTALL_LIBDIR points to the same lib dir that Qt was
# configured with. Currently this is important for QML plugins, which embed an rpath based
# on that value.
set(CMAKE_INSTALL_LIBDIR "${INSTALL_LIBDIR}")
endmacro()
macro(qt_internal_set_qt_cmake_dir)
set(QT_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}")
endmacro()
macro(qt_internal_set_qt_staging_prefix)
if(NOT "${CMAKE_STAGING_PREFIX}" STREQUAL "")
set(QT_STAGING_PREFIX "${CMAKE_STAGING_PREFIX}")
else()
set(QT_STAGING_PREFIX "${CMAKE_INSTALL_PREFIX}")
endif()
endmacro()
macro(qt_internal_setup_paths_and_prefixes)
qt_internal_setup_configure_install_paths()
qt_internal_set_qt_staging_prefix()
# Depends on QT_STAGING_PREFIX being set.
qt_internal_setup_build_and_install_paths()
qt_get_relocatable_install_prefix(QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX)
# Depends on INSTALL_LIBDIR being set.
qt_internal_set_cmake_install_libdir()
qt_internal_set_qt_cmake_dir()
endmacro()

View File

@ -0,0 +1,590 @@
# Copyright (C) 2023 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
macro(qt_examples_build_begin)
set(options EXTERNAL_BUILD)
set(singleOpts "")
set(multiOpts DEPENDS)
cmake_parse_arguments(arg "${options}" "${singleOpts}" "${multiOpts}" ${ARGN})
set(CMAKE_UNITY_BUILD OFF)
# Use by qt_internal_add_example.
set(QT_EXAMPLE_BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
if(arg_EXTERNAL_BUILD AND QT_BUILD_EXAMPLES_AS_EXTERNAL)
# Examples will be built using ExternalProject.
# We depend on all plugins built as part of the current repo as well as current repo's
# dependencies plugins, to prevent opportunities for
# weird errors associated with loading out-of-date plugins from
# unrelated Qt modules.
# We also depend on all targets from this repo's src and tools subdirectories
# to ensure that we've built anything that a find_package() call within
# an example might use. Projects can add further dependencies if needed,
# but that should rarely be necessary.
set(QT_EXAMPLE_DEPENDENCIES ${qt_repo_plugins_recursive} ${arg_DEPENDS})
if(TARGET ${qt_repo_targets_name}_src)
list(APPEND QT_EXAMPLE_DEPENDENCIES ${qt_repo_targets_name}_src_for_examples)
endif()
if(TARGET ${qt_repo_targets_name}_tools)
list(APPEND QT_EXAMPLE_DEPENDENCIES ${qt_repo_targets_name}_tools)
endif()
set(QT_IS_EXTERNAL_EXAMPLES_BUILD TRUE)
string(TOLOWER ${PROJECT_NAME} project_name_lower)
if(NOT TARGET examples)
if(QT_BUILD_EXAMPLES_BY_DEFAULT)
add_custom_target(examples ALL)
else()
add_custom_target(examples)
endif()
endif()
if(NOT TARGET examples_${project_name_lower})
add_custom_target(examples_${project_name_lower})
add_dependencies(examples examples_${project_name_lower})
endif()
include(ExternalProject)
else()
# This repo has not yet been updated to build examples in a separate
# build from this main build, or we can't use that arrangement yet.
# Build them directly as part of the main build instead for backward
# compatibility.
if(NOT BUILD_SHARED_LIBS)
# Ordinarily, it would be an error to call return() from within a
# macro(), but in this case we specifically want to return from the
# caller's scope if we are doing a static build and the project
# isn't building examples in a separate build from the main build.
# Configuring static builds requires tools that are not available
# until build time.
return()
endif()
if(NOT QT_BUILD_EXAMPLES_BY_DEFAULT)
set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL TRUE)
endif()
endif()
# TODO: Change this to TRUE when all examples in all repos are ported to use
# qt_internal_add_example.
# We shouldn't need to call qt_internal_set_up_build_dir_package_paths when
# QT_IS_EXTERNAL_EXAMPLES_BUILD is TRUE.
# Due to not all examples being ported, if we don't
# call qt_internal_set_up_build_dir_package_paths -> set(QT_NO_CREATE_TARGETS TRUE) we'll get
# CMake configuration errors saying we redefine Qt targets because we both build them and find
# them as part of find_package.
set(__qt_all_examples_ported_to_external_projects FALSE)
# Examples that are built as part of the Qt build need to use the CMake config files from the
# build dir, because they are not installed yet in a prefix build.
# Prepending to CMAKE_PREFIX_PATH helps find the initial Qt6Config.cmake.
# Prepending to QT_BUILD_CMAKE_PREFIX_PATH helps find components of Qt6, because those
# find_package calls use NO_DEFAULT_PATH, and thus CMAKE_PREFIX_PATH is ignored.
# Prepending to CMAKE_FIND_ROOT_PATH ensures the components are found while cross-compiling
# without setting CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to BOTH.
if(NOT QT_IS_EXTERNAL_EXAMPLES_BUILD OR NOT __qt_all_examples_ported_to_external_projects)
qt_internal_set_up_build_dir_package_paths()
list(PREPEND CMAKE_FIND_ROOT_PATH "${QT_BUILD_DIR}")
list(PREPEND QT_BUILD_CMAKE_PREFIX_PATH "${QT_BUILD_DIR}/${INSTALL_LIBDIR}/cmake")
endif()
# Because CMAKE_INSTALL_RPATH is empty by default in the repo project, examples need to have
# it set here, so they can run when installed.
# This means that installed examples are not relocatable at the moment. We would need to
# annotate where each example is installed to, to be able to derive a relative rpath, and it
# seems there's no way to query such information from CMake itself.
set(CMAKE_INSTALL_RPATH "${_default_install_rpath}")
install(CODE "
# Backup CMAKE_INSTALL_PREFIX because we're going to change it in each example subdirectory
# and restore it after all examples are processed so that QtFooToolsAdditionalTargetInfo.cmake
# files are installed into the original install prefix.
set(_qt_internal_examples_cmake_install_prefix_backup \"\${CMAKE_INSTALL_PREFIX}\")
")
endmacro()
macro(qt_examples_build_end)
# We use AUTOMOC/UIC/RCC in the examples. When the examples are part of the
# main build rather than being built in their own separate project, make
# sure we do not fail on a fresh Qt build (e.g. the moc binary won't exist
# yet because it is created at build time).
_qt_internal_collect_buildsystem_targets(targets
"${CMAKE_CURRENT_SOURCE_DIR}" EXCLUDE UTILITY ALIAS)
foreach(target ${targets})
qt_autogen_tools(${target} ENABLE_AUTOGEN_TOOLS "moc" "rcc")
if(TARGET Qt::Widgets)
qt_autogen_tools(${target} ENABLE_AUTOGEN_TOOLS "uic")
endif()
set_target_properties(${target} PROPERTIES UNITY_BUILD OFF)
endforeach()
install(CODE "
# Restore backed up CMAKE_INSTALL_PREFIX.
set(CMAKE_INSTALL_PREFIX \"\${_qt_internal_examples_cmake_install_prefix_backup}\")
")
set(CMAKE_UNITY_BUILD ${QT_UNITY_BUILD})
endmacro()
# Allows building an example either as an ExternalProject or in-tree with the Qt build.
# Also allows installing the example sources.
function(qt_internal_add_example subdir)
# Pre-compute unique example name based on the subdir, in case of target name clashes.
qt_internal_get_example_unique_name(unique_example_name "${subdir}")
# QT_INTERNAL_NO_CONFIGURE_EXAMPLES is not meant to be used by Qt builders, it's here for faster
# testing of the source installation code path for build system engineers.
if(NOT QT_INTERNAL_NO_CONFIGURE_EXAMPLES)
if(NOT QT_IS_EXTERNAL_EXAMPLES_BUILD)
qt_internal_add_example_in_tree("${subdir}")
else()
qt_internal_add_example_external_project("${subdir}"
NAME "${unique_example_name}")
endif()
endif()
if(QT_INSTALL_EXAMPLES_SOURCES)
string(TOLOWER ${PROJECT_NAME} project_name_lower)
qt_internal_install_example_sources("${subdir}"
NAME "${unique_example_name}"
REPO_NAME "${project_name_lower}")
endif()
endfunction()
# Gets the install prefix where an example should be installed.
# Used for computing the final installation path.
function(qt_internal_get_example_install_prefix out_var)
# Allow customizing the installation path of the examples. Will be used in CI.
if(QT_INTERNAL_EXAMPLES_INSTALL_PREFIX)
set(qt_example_install_prefix "${QT_INTERNAL_EXAMPLES_INSTALL_PREFIX}")
else()
set(qt_example_install_prefix "${CMAKE_INSTALL_PREFIX}/${INSTALL_EXAMPLESDIR}")
endif()
file(TO_CMAKE_PATH "${qt_example_install_prefix}" qt_example_install_prefix)
set(${out_var} "${qt_example_install_prefix}" PARENT_SCOPE)
endfunction()
# Gets the install prefix where an example's sources should be installed.
# Used for computing the final installation path.
function(qt_internal_get_examples_sources_install_prefix out_var)
# Allow customizing the installation path of the examples source specifically.
if(QT_INTERNAL_EXAMPLES_SOURCES_INSTALL_PREFIX)
set(qt_example_install_prefix "${QT_INTERNAL_EXAMPLES_SOURCES_INSTALL_PREFIX}")
else()
qt_internal_get_example_install_prefix(qt_example_install_prefix)
endif()
file(TO_CMAKE_PATH "${qt_example_install_prefix}" qt_example_install_prefix)
set(${out_var} "${qt_example_install_prefix}" PARENT_SCOPE)
endfunction()
# Gets the relative path of an example, relative to the current repo's examples source dir.
# QT_EXAMPLE_BASE_DIR is meant to be already set in a parent scope.
function(qt_internal_get_example_rel_path out_var subdir)
file(RELATIVE_PATH example_rel_path
"${QT_EXAMPLE_BASE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/${subdir}")
set(${out_var} "${example_rel_path}" PARENT_SCOPE)
endfunction()
# Gets the install path where an example should be installed.
function(qt_internal_get_example_install_path out_var subdir)
qt_internal_get_example_install_prefix(qt_example_install_prefix)
qt_internal_get_example_rel_path(example_rel_path "${subdir}")
set(example_install_path "${qt_example_install_prefix}/${example_rel_path}")
set(${out_var} "${example_install_path}" PARENT_SCOPE)
endfunction()
# Gets the install path where an example's sources should be installed.
function(qt_internal_get_examples_sources_install_path out_var subdir)
qt_internal_get_examples_sources_install_prefix(qt_example_install_prefix)
qt_internal_get_example_rel_path(example_rel_path "${subdir}")
set(example_install_path "${qt_example_install_prefix}/${example_rel_path}")
set(${out_var} "${example_install_path}" PARENT_SCOPE)
endfunction()
# Get the unique name of an example project based on its subdir or explicitly given name.
# Makes the name unique by appending a short sha1 hash of the relative path of the example
# if a target of the same name already exist.
function(qt_internal_get_example_unique_name out_var subdir)
qt_internal_get_example_rel_path(example_rel_path "${subdir}")
set(name "${subdir}")
# qtdeclarative has calls like qt_internal_add_example(imagine/automotive)
# so passing a nested subdirectory. Custom targets (and thus ExternalProjects) can't contain
# slashes, so extract the last part of the path to be used as a name.
if(name MATCHES "/")
string(REPLACE "/" ";" exploded_path "${name}")
list(POP_BACK exploded_path last_dir)
if(NOT last_dir)
message(FATAL_ERROR "Example subdirectory must have a name.")
else()
set(name "${last_dir}")
endif()
endif()
# Likely a clash with an example subdir ExternalProject custom target of the same name in a
# top-level build.
if(TARGET "${name}")
string(SHA1 rel_path_hash "${example_rel_path}")
string(SUBSTRING "${rel_path_hash}" 0 4 short_hash)
set(name "${name}-${short_hash}")
endif()
set(${out_var} "${name}" PARENT_SCOPE)
endfunction()
# Use old non-ExternalProject approach, aka build in-tree with the Qt build.
function(qt_internal_add_example_in_tree subdir)
# Unset the default CMAKE_INSTALL_PREFIX that's generated in
# ${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake
# so we can override it with a different value in
# ${CMAKE_CURRENT_BINARY_DIR}/${subdir}/cmake_install.cmake
#
install(CODE "
# Unset the CMAKE_INSTALL_PREFIX in the current cmake_install.cmake file so that it can be
# overridden in the included add_subdirectory-specific cmake_install.cmake files instead.
unset(CMAKE_INSTALL_PREFIX)
")
# Override the install prefix in the subdir cmake_install.cmake, so that
# relative install(TARGETS DESTINATION) calls in example projects install where we tell them to.
qt_internal_get_example_install_path(example_install_path "${subdir}")
set(CMAKE_INSTALL_PREFIX "${example_install_path}")
# Make sure unclean example projects have their INSTALL_EXAMPLEDIR set to "."
# Won't have any effect on example projects that don't use INSTALL_EXAMPLEDIR.
# This plus the install prefix above takes care of installing examples where we want them to
# be installed, while allowing us to remove INSTALL_EXAMPLEDIR code in each example
# incrementally.
# TODO: Remove once all repositories use qt_internal_add_example instead of add_subdirectory.
set(QT_INTERNAL_SET_EXAMPLE_INSTALL_DIR_TO_DOT ON)
add_subdirectory(${subdir})
endfunction()
function(qt_internal_add_example_external_project subdir)
set(options "")
set(singleOpts NAME)
set(multiOpts "")
cmake_parse_arguments(PARSE_ARGV 1 arg "${options}" "${singleOpts}" "${multiOpts}")
_qt_internal_get_build_vars_for_external_projects(
CMAKE_DIR_VAR qt_cmake_dir
PREFIXES_VAR qt_prefixes
ADDITIONAL_PACKAGES_PREFIXES_VAR qt_additional_packages_prefixes
)
list(APPEND QT_ADDITIONAL_PACKAGES_PREFIX_PATH "${qt_additional_packages_prefixes}")
set(vars_to_pass_if_defined)
set(var_defs)
if(QT_HOST_PATH OR CMAKE_CROSSCOMPILING)
list(APPEND var_defs
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${qt_cmake_dir}/qt.toolchain.cmake
)
else()
list(PREPEND CMAKE_PREFIX_PATH ${qt_prefixes})
# Setting CMAKE_SYSTEM_NAME affects CMAKE_CROSSCOMPILING, even if it is
# set to the same as the host, so it should only be set if it is different.
# See https://gitlab.kitware.com/cmake/cmake/-/issues/21744
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND
NOT CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME)
list(APPEND vars_to_pass_if_defined CMAKE_SYSTEM_NAME:STRING)
endif()
endif()
# In multi-config mode by default we exclude building tools for configs other than the main one.
# Trying to build an example in a non-default config using the non-installed
# QtFooConfig.cmake files would error out saying moc is not found.
# Make sure to build examples only with the main config.
# When users build an example against an installed Qt they won't have this problem because
# the generated non-main QtFooTargets-$<CONFIG>.cmake file is empty and doesn't advertise
# a tool that is not there.
if(QT_GENERATOR_IS_MULTI_CONFIG)
set(CMAKE_CONFIGURATION_TYPES "${QT_MULTI_CONFIG_FIRST_CONFIG}")
endif()
# We need to pass the modified CXX flags of the parent project so that using sccache works
# properly and doesn't error out due to concurrent access to the pdb files.
# See qt_internal_set_up_config_optimizations_like_in_qmake, "/Zi" "/Z7".
if(MSVC AND QT_FEATURE_msvc_obj_debug_info)
qt_internal_get_enabled_languages_for_flag_manipulation(enabled_languages)
set(configs RELWITHDEBINFO DEBUG)
foreach(lang ${enabled_languages})
foreach(config ${configs})
set(flag_var_name "CMAKE_${lang}_FLAGS_${config}")
list(APPEND vars_to_pass_if_defined "${flag_var_name}:STRING")
endforeach()
endforeach()
endif()
# When cross-compiling for a qemu target in our CI, we source an environment script
# that sets environment variables like CC and CXX. These are parsed by CMake on initial
# configuration to populate the cache vars CMAKE_${lang}_COMPILER.
# If the environment variable specified not only the compiler path, but also a list of flags
# to pass to the compiler, CMake parses those out into a separate CMAKE_${lang}_COMPILER_ARG1
# cache variable. In such a case, we want to ensure that the external project also sees those
# flags.
# Unfortunately we can't do that by simply forwarding CMAKE_${lang}_COMPILER_ARG1 to the EP
# because it breaks the compiler identification try_compile call, it simply doesn't consider
# the cache var. From what I could gather, it's a limitation of try_compile and the list
# of variables it considers for forwarding.
# To fix this case, we ensure not to pass either cache variable, and let the external project
# and its compiler identification try_compile project pick up the compiler and the flags
# from the environment variables instead.
foreach(lang_as_env_var CC CXX OBJC OBJCXX)
if(lang_as_env_var STREQUAL "CC")
set(lang_as_cache_var "C")
else()
set(lang_as_cache_var "${lang_as_env_var}")
endif()
set(lang_env_value "$ENV{${lang_as_env_var}}")
if(lang_env_value
AND CMAKE_${lang_as_cache_var}_COMPILER
AND CMAKE_${lang_as_cache_var}_COMPILER_ARG1)
# The compiler environment variable is set and specifies a list of extra flags, don't
# forward the compiler cache vars and rely on the environment variable to be picked up
# instead.
else()
list(APPEND vars_to_pass_if_defined "CMAKE_${lang_as_cache_var}_COMPILER:STRING")
endif()
endforeach()
unset(lang_as_env_var)
unset(lang_as_cache_var)
unset(lang_env_value)
list(APPEND vars_to_pass_if_defined
CMAKE_BUILD_TYPE:STRING
CMAKE_CONFIGURATION_TYPES:STRING
CMAKE_PREFIX_PATH:STRING
QT_BUILD_CMAKE_PREFIX_PATH:STRING
QT_ADDITIONAL_PACKAGES_PREFIX_PATH:STRING
CMAKE_FIND_ROOT_PATH:STRING
BUILD_SHARED_LIBS:BOOL
CMAKE_OSX_ARCHITECTURES:STRING
CMAKE_OSX_DEPLOYMENT_TARGET:STRING
CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED:BOOL
CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH:BOOL
CMAKE_C_COMPILER_LAUNCHER:STRING
CMAKE_CXX_COMPILER_LAUNCHER:STRING
CMAKE_OBJC_COMPILER_LAUNCHER:STRING
CMAKE_OBJCXX_COMPILER_LAUNCHER:STRING
)
foreach(var_with_type IN LISTS vars_to_pass_if_defined)
string(REPLACE ":" ";" key_as_list "${var_with_type}")
list(GET key_as_list 0 var)
if(NOT DEFINED ${var})
continue()
endif()
# Preserve lists
string(REPLACE ";" "$<SEMICOLON>" varForGenex "${${var}}")
list(APPEND var_defs -D${var_with_type}=${varForGenex})
endforeach()
if(QT_INTERNAL_VERBOSE_EXAMPLES)
list(APPEND var_defs -DCMAKE_MESSAGE_LOG_LEVEL:STRING=DEBUG)
list(APPEND var_defs -DCMAKE_AUTOGEN_VERBOSE:BOOL=TRUE)
endif()
set(deps "")
list(REMOVE_DUPLICATES QT_EXAMPLE_DEPENDENCIES)
foreach(dep IN LISTS QT_EXAMPLE_DEPENDENCIES)
if(TARGET ${dep})
list(APPEND deps ${dep})
endif()
endforeach()
set(independent_args)
cmake_policy(PUSH)
if(POLICY CMP0114)
set(independent_args INDEPENDENT TRUE)
cmake_policy(SET CMP0114 NEW)
endif()
# The USES_TERMINAL_BUILD setting forces the build step to the console pool
# when using Ninja. This has two benefits:
#
# - You see build output as it is generated instead of at the end of the
# build step.
# - Only one task can use the console pool at a time, so it effectively
# serializes all example build steps, thereby preventing CPU
# over-commitment.
#
# If the loss of interactivity is not so important, one can allow CPU
# over-commitment for Ninja builds. This may result in better throughput,
# but is not allowed by default because it can make a machine almost
# unusable while a compilation is running.
set(terminal_args USES_TERMINAL_BUILD TRUE)
if(CMAKE_GENERATOR MATCHES "Ninja")
option(QT_BUILD_EXAMPLES_WITH_CPU_OVERCOMMIT
"Allow CPU over-commitment when building examples (Ninja only)"
)
if(QT_BUILD_EXAMPLES_WITH_CPU_OVERCOMMIT)
set(terminal_args)
endif()
endif()
# QT_EXAMPLE_INSTALL_MARKER
# The goal is to install each example project into a directory that keeps the example source dir
# hierarchy, without polluting the example projects with dirty INSTALL_EXAMPLEDIR and
# INSTALL_EXAMPLESDIR usage.
# E.g. ensure qtbase/examples/widgets/widgets/wiggly is installed to
# $qt_example_install_prefix/examples/widgets/widgets/wiggly/wiggly.exe
# $qt_example_install_prefix defaults to ${CMAKE_INSTALL_PREFIX}/${INSTALL_EXAMPLEDIR}
# but can also be set to a custom location.
# This needs to work both:
# - when using ExternalProject to build examples
# - when examples are built in-tree as part of Qt (no ExternalProject).
# The reason we want to support the latter is for nicer IDE integration: a can developer can
# work with a Qt repo and its examples using the same build dir.
#
# In both case we have to ensure examples are not accidentally installed to $qt_prefix/bin or
# similar.
#
# Example projects installation matrix.
# 1) ExternalProject + unclean example install rules (INSTALL_EXAMPLEDIR is set) =>
# use _qt_internal_override_example_install_dir_to_dot + ExternalProject_Add's INSTALL_DIR
# using relative_dir from QT_EXAMPLE_BASE_DIR to example_source_dir
#
# 2) ExternalProject + clean example install rules =>
# use ExternalProject_Add's INSTALL_DIR using relative_dir from QT_EXAMPLE_BASE_DIR to
# example_source_dir, _qt_internal_override_example_install_dir_to_dot would be a no-op
#
# 3) in-tree + unclean example install rules (INSTALL_EXAMPLEDIR is set)
# +
# 4) in-tree + clean example install rules =>
# ensure CMAKE_INSTALL_PREFIX is unset in parent cmake_install.cmake file, set non-cache
# CMAKE_INSTALL_PREFIX using relative_dir from QT_EXAMPLE_BASE_DIR to
# example_source_dir, use _qt_internal_override_example_install_dir_to_dot to ensure
# INSTALL_EXAMPLEDIR does not interfere.
qt_internal_get_example_install_path(example_install_path "${subdir}")
set(ep_binary_dir "${CMAKE_CURRENT_BINARY_DIR}/${subdir}")
set(build_command "")
if(QT_INTERNAL_VERBOSE_EXAMPLES AND CMAKE_GENERATOR MATCHES "Ninja")
set(build_command BUILD_COMMAND "${CMAKE_COMMAND}" --build "." -- -v)
endif()
ExternalProject_Add(${arg_NAME}
EXCLUDE_FROM_ALL TRUE
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${subdir}"
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/${subdir}-ep"
STAMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/${subdir}-ep/stamp"
BINARY_DIR "${ep_binary_dir}"
INSTALL_DIR "${example_install_path}"
INSTALL_COMMAND ""
${build_command}
TEST_COMMAND ""
DEPENDS ${deps}
CMAKE_CACHE_ARGS ${var_defs}
-DCMAKE_INSTALL_PREFIX:STRING=<INSTALL_DIR>
-DQT_INTERNAL_SET_EXAMPLE_INSTALL_DIR_TO_DOT:BOOL=TRUE
${terminal_args}
)
# Install the examples when the the user runs 'make install', and not at build time (which is
# the default for ExternalProjects).
install(CODE "\
# Install example from inside ExternalProject into the main build's install prefix.
execute_process(
COMMAND
\"${CMAKE_COMMAND}\" --build \"${ep_binary_dir}\" --target install
)
")
# Force configure step to re-run after we configure the main project
set(reconfigure_check_file ${CMAKE_CURRENT_BINARY_DIR}/reconfigure_${arg_NAME}.txt)
file(TOUCH ${reconfigure_check_file})
ExternalProject_Add_Step(${arg_NAME} reconfigure-check
DEPENDERS configure
DEPENDS ${reconfigure_check_file}
${independent_args}
)
# Create an apk external project step and custom target that invokes the apk target
# within the external project.
# Make the global apk target depend on that custom target.
if(ANDROID)
ExternalProject_Add_Step(${arg_NAME} apk
COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --target apk
DEPENDEES configure
EXCLUDE_FROM_MAIN YES
${terminal_args}
)
ExternalProject_Add_StepTargets(${arg_NAME} apk)
if(TARGET apk)
add_dependencies(apk ${arg_NAME}-apk)
endif()
endif()
cmake_policy(POP)
string(TOLOWER ${PROJECT_NAME} project_name_lower)
add_dependencies(examples_${project_name_lower} ${arg_NAME})
endfunction()
function(qt_internal_install_example_sources subdir)
set(options "")
set(single_args NAME REPO_NAME)
set(multi_args "")
cmake_parse_arguments(PARSE_ARGV 1 arg "${options}" "${single_args}" "${multi_args}")
qt_internal_get_examples_sources_install_path(example_install_path "${subdir}")
# The trailing slash is important to avoid duplicate nested directory names.
set(example_source_dir "${subdir}/")
# Allow controlling whether sources should be part of the default install target.
if(QT_INSTALL_EXAMPLES_SOURCES_BY_DEFAULT)
set(exclude_from_all "")
else()
set(exclude_from_all "EXCLUDE_FROM_ALL")
endif()
# Create an install component for all example sources. Can also be part of the default
# install target if EXCLUDE_FROM_ALL is not passed.
install(
DIRECTORY "${example_source_dir}"
DESTINATION "${example_install_path}"
COMPONENT "examples_sources"
USE_SOURCE_PERMISSIONS
${exclude_from_all}
)
# Also create a specific install component just for this repo's examples.
install(
DIRECTORY "${example_source_dir}"
DESTINATION "${example_install_path}"
COMPONENT "examples_sources_${arg_REPO_NAME}"
USE_SOURCE_PERMISSIONS
EXCLUDE_FROM_ALL
)
# Also create a specific install component just for the current example's sources.
install(
DIRECTORY "${example_source_dir}"
DESTINATION "${example_install_path}"
COMPONENT "examples_sources_${arg_NAME}"
USE_SOURCE_PERMISSIONS
EXCLUDE_FROM_ALL
)
endfunction()

View File

@ -0,0 +1,933 @@
# Copyright (C) 2023 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Macros and functions for building Qt submodules
# The macro sets all the necessary pre-conditions and setup consistent environment for building
# the Qt repository. It has to be called right after the find_package(Qt6 COMPONENTS BuildInternals)
# call. Otherwise we cannot make sure that all the required policies will be applied to the Qt
# components that are involved in build procedure.
macro(qt_internal_project_setup)
# Check for the minimum CMake version.
qt_internal_require_suitable_cmake_version()
qt_internal_upgrade_cmake_policies()
endmacro()
macro(qt_build_internals_set_up_private_api)
# TODO: this call needs to be removed once all repositories got the qtbase update
qt_internal_project_setup()
# Qt specific setup common for all modules:
include(QtSetup)
# Optionally include a repo specific Setup module.
include(${PROJECT_NAME}Setup OPTIONAL)
include(QtRepoSetup OPTIONAL)
# Find Apple frameworks if needed.
qt_find_apple_system_frameworks()
# Decide whether tools will be built.
qt_check_if_tools_will_be_built()
endmacro()
# add toplevel targets for each subdirectory, e.g. qtbase_src
function(qt_build_internals_add_toplevel_targets qt_repo_targets_name)
set(qt_repo_target_all "")
get_directory_property(directories DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" SUBDIRECTORIES)
foreach(directory IN LISTS directories)
set(qt_repo_targets "")
get_filename_component(qt_repo_target_basename ${directory} NAME)
_qt_internal_collect_buildsystem_targets(qt_repo_targets "${directory}" EXCLUDE UTILITY)
if (qt_repo_targets)
set(qt_repo_target_name "${qt_repo_targets_name}_${qt_repo_target_basename}")
message(DEBUG "${qt_repo_target_name} depends on ${qt_repo_targets}")
add_custom_target("${qt_repo_target_name}"
COMMENT "Building everything in ${qt_repo_targets_name}/${qt_repo_target_basename}")
add_dependencies("${qt_repo_target_name}" ${qt_repo_targets})
list(APPEND qt_repo_target_all "${qt_repo_target_name}")
# Create special dependency target for External Project examples excluding targets
# marked as skipped.
if(qt_repo_target_basename STREQUAL "src")
set(qt_repo_target_name
"${qt_repo_targets_name}_${qt_repo_target_basename}_for_examples")
add_custom_target("${qt_repo_target_name}")
set(unskipped_targets "")
foreach(target IN LISTS qt_repo_targets)
if(TARGET "${target}")
qt_internal_is_target_skipped_for_examples("${target}" is_skipped)
if(NOT is_skipped)
list(APPEND unskipped_targets "${target}")
endif()
endif()
endforeach()
if(unskipped_targets)
add_dependencies("${qt_repo_target_name}" ${unskipped_targets})
endif()
endif()
endif()
endforeach()
if (qt_repo_target_all)
# Note qt_repo_targets_name is different from qt_repo_target_name that is used above.
add_custom_target("${qt_repo_targets_name}"
COMMENT "Building everything in ${qt_repo_targets_name}")
add_dependencies("${qt_repo_targets_name}" ${qt_repo_target_all})
message(DEBUG "${qt_repo_targets_name} depends on ${qt_repo_target_all}")
endif()
endfunction()
macro(qt_enable_cmake_languages)
set(__qt_required_language_list C CXX)
set(__qt_platform_required_language_list )
if(APPLE)
list(APPEND __qt_platform_required_language_list OBJC OBJCXX)
endif()
foreach(__qt_lang ${__qt_required_language_list})
enable_language(${__qt_lang})
endforeach()
foreach(__qt_lang ${__qt_platform_required_language_list})
enable_language(${__qt_lang})
endforeach()
# The qtbase call is handled in qtbase/CMakeLists.txt.
# This call is used for projects other than qtbase, including for other project's standalone
# tests.
# Because the function uses QT_FEATURE_foo values, it's important that find_package(Qt6Core) is
# called before this function. but that's usually the case for Qt repos.
if(NOT PROJECT_NAME STREQUAL "QtBase")
qt_internal_set_up_config_optimizations_like_in_qmake()
endif()
endmacro()
# Minimum setup required to have any CMakeList.txt build as as a standalone
# project after importing BuildInternals
macro(qt_prepare_standalone_project)
qt_set_up_build_internals_paths()
qt_build_internals_set_up_private_api()
qt_enable_cmake_languages()
endmacro()
# Define a repo target set, and store accompanying information.
#
# A repo target set is a subset of targets in a Qt module repository. To build a repo target set,
# set QT_BUILD_SINGLE_REPO_TARGET_SET to the name of the repo target set.
#
# This function is to be called in the top-level project file of a repository,
# before qt_internal_prepare_single_repo_target_set_build()
#
# This function stores information in variables of the parent scope.
#
# Positional Arguments:
# name - The name of this repo target set.
#
# Named Arguments:
# DEPENDS - List of Qt6 COMPONENTS that are build dependencies of this repo target set.
function(qt_internal_define_repo_target_set name)
set(oneValueArgs DEPENDS)
set(prefix QT_REPO_TARGET_SET_)
cmake_parse_arguments(${prefix}${name} "" ${oneValueArgs} "" ${ARGN})
foreach(arg IN LISTS oneValueArgs)
set(${prefix}${name}_${arg} ${${prefix}${name}_${arg}} PARENT_SCOPE)
endforeach()
set(QT_REPO_KNOWN_TARGET_SETS "${QT_REPO_KNOWN_TARGET_SETS};${name}" PARENT_SCOPE)
endfunction()
# Setup a single repo target set build if QT_BUILD_SINGLE_REPO_TARGET_SET is defined.
#
# This macro must be called in the top-level project file of the repository after all repo target
# sets have been defined.
macro(qt_internal_prepare_single_repo_target_set_build)
if(DEFINED QT_BUILD_SINGLE_REPO_TARGET_SET)
if(NOT QT_BUILD_SINGLE_REPO_TARGET_SET IN_LIST QT_REPO_KNOWN_TARGET_SETS)
message(FATAL_ERROR
"Repo target set '${QT_BUILD_SINGLE_REPO_TARGET_SET}' is undefined.")
endif()
message(STATUS
"Preparing single repo target set build of ${QT_BUILD_SINGLE_REPO_TARGET_SET}")
if (NOT "${QT_REPO_TARGET_SET_${QT_BUILD_SINGLE_REPO_TARGET_SET}_DEPENDS}" STREQUAL "")
find_package(${INSTALL_CMAKE_NAMESPACE} ${PROJECT_VERSION} CONFIG REQUIRED
COMPONENTS ${QT_REPO_TARGET_SET_${QT_BUILD_SINGLE_REPO_TARGET_SET}_DEPENDS})
endif()
endif()
endmacro()
macro(qt_build_repo_begin)
set(QT_INTERNAL_REPO_POST_PROCESS_CALLED FALSE)
list(APPEND CMAKE_MESSAGE_CONTEXT "${PROJECT_NAME}")
qt_build_internals_set_up_private_api()
# Prevent installation in non-prefix builds.
# We need to associate targets with export names, and that is only possible to do with the
# install(TARGETS) command. But in a non-prefix build, we don't want to install anything.
# To make sure that developers don't accidentally run make install, add bail out code to
# cmake_install.cmake.
if(NOT QT_WILL_INSTALL)
# In a top-level build, print a message only in qtbase, which is the first repository.
if(NOT QT_SUPERBUILD OR (PROJECT_NAME STREQUAL "QtBase"))
install(CODE [[message(FATAL_ERROR
"Qt was configured as non-prefix build. "
"Installation is not supported for this arrangement.")]])
endif()
install(CODE [[return()]])
endif()
qt_enable_cmake_languages()
qt_internal_generate_binary_strip_wrapper()
# Add global docs targets that will work both for per-repo builds, and super builds.
if(NOT TARGET docs)
add_custom_target(docs)
add_custom_target(prepare_docs)
add_custom_target(generate_docs)
add_custom_target(html_docs)
add_custom_target(qch_docs)
add_custom_target(install_html_docs)
add_custom_target(install_qch_docs)
add_custom_target(install_docs)
add_dependencies(html_docs generate_docs)
add_dependencies(docs html_docs qch_docs)
add_dependencies(install_docs install_html_docs install_qch_docs)
endif()
if(NOT TARGET sync_headers)
add_custom_target(sync_headers)
endif()
# The special target that we use to sync 3rd-party headers before the gn run when building
# qtwebengine in top-level builds.
if(NOT TARGET thirdparty_sync_headers)
add_custom_target(thirdparty_sync_headers)
endif()
# Add global qt_plugins, qpa_plugins and qpa_default_plugins convenience custom targets.
# Internal executables will add a dependency on the qpa_default_plugins target,
# so that building and running a test ensures it won't fail at runtime due to a missing qpa
# plugin.
if(NOT TARGET qt_plugins)
add_custom_target(qt_plugins)
add_custom_target(qpa_plugins)
add_custom_target(qpa_default_plugins)
endif()
string(TOLOWER ${PROJECT_NAME} project_name_lower)
# Target to build all plugins that are part of the current repo.
set(qt_repo_plugins "qt_plugins_${project_name_lower}")
if(NOT TARGET ${qt_repo_plugins})
add_custom_target(${qt_repo_plugins})
endif()
# Target to build all plugins that are part of the current repo and the current repo's
# dependencies plugins. Used for external project example dependencies.
set(qt_repo_plugins_recursive "${qt_repo_plugins}_recursive")
if(NOT TARGET ${qt_repo_plugins_recursive})
add_custom_target(${qt_repo_plugins_recursive})
add_dependencies(${qt_repo_plugins_recursive} "${qt_repo_plugins}")
endif()
qt_internal_read_repo_dependencies(qt_repo_deps "${PROJECT_SOURCE_DIR}")
if(qt_repo_deps)
foreach(qt_repo_dep IN LISTS qt_repo_deps)
if(TARGET qt_plugins_${qt_repo_dep})
message(DEBUG
"${qt_repo_plugins_recursive} depends on qt_plugins_${qt_repo_dep}")
add_dependencies(${qt_repo_plugins_recursive} "qt_plugins_${qt_repo_dep}")
endif()
endforeach()
endif()
set(qt_repo_targets_name ${project_name_lower})
set(qt_docs_target_name docs_${project_name_lower})
set(qt_docs_prepare_target_name prepare_docs_${project_name_lower})
set(qt_docs_generate_target_name generate_docs_${project_name_lower})
set(qt_docs_html_target_name html_docs_${project_name_lower})
set(qt_docs_qch_target_name qch_docs_${project_name_lower})
set(qt_docs_install_html_target_name install_html_docs_${project_name_lower})
set(qt_docs_install_qch_target_name install_qch_docs_${project_name_lower})
set(qt_docs_install_target_name install_docs_${project_name_lower})
add_custom_target(${qt_docs_target_name})
add_custom_target(${qt_docs_prepare_target_name})
add_custom_target(${qt_docs_generate_target_name})
add_custom_target(${qt_docs_qch_target_name})
add_custom_target(${qt_docs_html_target_name})
add_custom_target(${qt_docs_install_html_target_name})
add_custom_target(${qt_docs_install_qch_target_name})
add_custom_target(${qt_docs_install_target_name})
add_dependencies(${qt_docs_generate_target_name} ${qt_docs_prepare_target_name})
add_dependencies(${qt_docs_html_target_name} ${qt_docs_generate_target_name})
add_dependencies(${qt_docs_target_name} ${qt_docs_html_target_name} ${qt_docs_qch_target_name})
add_dependencies(${qt_docs_install_target_name} ${qt_docs_install_html_target_name} ${qt_docs_install_qch_target_name})
# Make top-level prepare_docs target depend on the repository-level prepare_docs_<repo> target.
add_dependencies(prepare_docs ${qt_docs_prepare_target_name})
# Make top-level install_*_docs targets depend on the repository-level install_*_docs targets.
add_dependencies(install_html_docs ${qt_docs_install_html_target_name})
add_dependencies(install_qch_docs ${qt_docs_install_qch_target_name})
# Add host_tools meta target, so that developrs can easily build only tools and their
# dependencies when working in qtbase.
if(NOT TARGET host_tools)
add_custom_target(host_tools)
add_custom_target(bootstrap_tools)
endif()
# Add benchmark meta target. It's collection of all benchmarks added/registered by
# 'qt_internal_add_benchmark' helper.
if(NOT TARGET benchmark)
add_custom_target(benchmark)
endif()
if(QT_INTERNAL_SYNCED_MODULES)
set_property(GLOBAL PROPERTY _qt_synced_modules ${QT_INTERNAL_SYNCED_MODULES})
endif()
endmacro()
# Runs delayed actions on some of the Qt targets.
# Can be called either explicitly or as part of qt_build_repo_end().
macro(qt_build_repo_post_process)
if(NOT QT_INTERNAL_REPO_POST_PROCESS_CALLED)
set(QT_INTERNAL_REPO_POST_PROCESS_CALLED TRUE)
if(NOT QT_BUILD_STANDALONE_TESTS)
include(QtPostProcess)
endif()
endif()
endmacro()
macro(qt_build_repo_end)
if(NOT QT_BUILD_STANDALONE_TESTS)
qt_build_repo_post_process()
# Install the repo-specific cmake find modules.
qt_path_join(__qt_repo_install_dir ${QT_CONFIG_INSTALL_DIR} ${INSTALL_CMAKE_NAMESPACE})
qt_path_join(__qt_repo_build_dir ${QT_CONFIG_BUILD_DIR} ${INSTALL_CMAKE_NAMESPACE})
if(NOT PROJECT_NAME STREQUAL "QtBase")
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
qt_copy_or_install(DIRECTORY cmake/
DESTINATION "${__qt_repo_install_dir}"
FILES_MATCHING PATTERN "Find*.cmake"
)
if(QT_SUPERBUILD AND QT_WILL_INSTALL)
file(COPY cmake/
DESTINATION "${__qt_repo_build_dir}"
FILES_MATCHING PATTERN "Find*.cmake"
)
endif()
endif()
endif()
if(NOT QT_SUPERBUILD)
qt_print_feature_summary()
endif()
endif()
qt_build_internals_add_toplevel_targets(${qt_repo_targets_name})
if(NOT QT_SUPERBUILD)
qt_print_build_instructions()
endif()
get_property(synced_modules GLOBAL PROPERTY _qt_synced_modules)
if(synced_modules)
set(QT_INTERNAL_SYNCED_MODULES ${synced_modules} CACHE INTERNAL
"List of the synced modules. Prevents running syncqt.cpp after the first configuring.")
endif()
if(NOT QT_SUPERBUILD)
qt_internal_save_previously_visited_packages()
endif()
if(QT_INTERNAL_FRESH_REQUESTED)
set(QT_INTERNAL_FRESH_REQUESTED "FALSE" CACHE INTERNAL "")
endif()
if(NOT QT_SUPERBUILD)
qt_internal_qt_configure_end()
endif()
list(POP_BACK CMAKE_MESSAGE_CONTEXT)
endmacro()
# Function called either at the end of per-repo configuration, or at the end of configuration of
# a super build.
# At the moment it is called before examples are configured in a per-repo build. We might want
# to change that at some point if needed.
function(qt_internal_qt_configure_end)
# If Qt is configued via the configure script, remove the marker variable, so that any future
# reconfigurations that are done by calling cmake directly don't trigger configure specific
# logic.
unset(QT_INTERNAL_CALLED_FROM_CONFIGURE CACHE)
endfunction()
macro(qt_build_repo)
qt_build_repo_begin(${ARGN})
qt_build_repo_impl_find_package_tests()
qt_build_repo_impl_src()
qt_build_repo_impl_tools()
qt_build_repo_post_process()
qt_build_repo_impl_tests()
qt_build_repo_end()
qt_build_repo_impl_examples()
endmacro()
macro(qt_build_repo_impl_find_package_tests)
# If testing is enabled, try to find the qtbase Test package.
# Do this before adding src, because there might be test related conditions
# in source.
if (QT_BUILD_TESTS AND NOT QT_BUILD_STANDALONE_TESTS)
# When looking for the Test package, do it using the Qt6 package version, in case if
# PROJECT_VERSION is following a different versioning scheme.
if(Qt6_VERSION)
set(_qt_build_repo_impl_find_package_tests_version "${Qt6_VERSION}")
else()
set(_qt_build_repo_impl_find_package_tests_version "${PROJECT_VERSION}")
endif()
find_package(Qt6
"${_qt_build_repo_impl_find_package_tests_version}"
CONFIG REQUIRED COMPONENTS Test)
unset(_qt_build_repo_impl_find_package_tests_version)
endif()
endmacro()
macro(qt_build_repo_impl_src)
if(NOT QT_BUILD_STANDALONE_TESTS)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/CMakeLists.txt")
add_subdirectory(src)
endif()
endif()
if(QT_FEATURE_lttng AND NOT TARGET LTTng::UST)
qt_find_package(LTTngUST PROVIDED_TARGETS LTTng::UST
MODULE_NAME global QMAKE_LIB lttng-ust)
endif()
endmacro()
macro(qt_build_repo_impl_tools)
if(NOT QT_BUILD_STANDALONE_TESTS)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tools/CMakeLists.txt")
add_subdirectory(tools)
endif()
endif()
endmacro()
macro(qt_build_repo_impl_tests)
if (QT_BUILD_TESTS AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/CMakeLists.txt")
add_subdirectory(tests)
if(NOT QT_BUILD_TESTS_BY_DEFAULT)
set_property(DIRECTORY tests PROPERTY EXCLUDE_FROM_ALL TRUE)
endif()
endif()
endmacro()
macro(qt_build_repo_impl_examples)
if(QT_BUILD_EXAMPLES
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/examples/CMakeLists.txt"
AND NOT QT_BUILD_STANDALONE_TESTS)
message(STATUS "Configuring examples.")
add_subdirectory(examples)
endif()
endmacro()
macro(qt_set_up_standalone_tests_build)
# Remove this macro once all usages of it have been removed.
# Standalone tests are not handled via the main repo project and qt_build_tests.
endmacro()
function(qt_get_standalone_tests_config_files_path out_var)
set(path "${QT_CONFIG_INSTALL_DIR}/${INSTALL_CMAKE_NAMESPACE}BuildInternals/StandaloneTests")
# QT_CONFIG_INSTALL_DIR is relative in prefix builds.
if(QT_WILL_INSTALL)
if(DEFINED CMAKE_STAGING_PREFIX)
qt_path_join(path "${CMAKE_STAGING_PREFIX}" "${path}")
else()
qt_path_join(path "${CMAKE_INSTALL_PREFIX}" "${path}")
endif()
endif()
set("${out_var}" "${path}" PARENT_SCOPE)
endfunction()
function(qt_internal_get_standalone_tests_config_file_name out_var)
# When doing a "single repo target set" build (like in qtscxqml) ensure we use a unique tests
# config file for each repo target set. Using the PROJECT_NAME only is not enough because
# the same file will be overridden with different content on each repo set install.
set(tests_config_file_name "${PROJECT_NAME}")
if(QT_BUILD_SINGLE_REPO_TARGET_SET)
string(APPEND tests_config_file_name "RepoSet${QT_BUILD_SINGLE_REPO_TARGET_SET}")
endif()
string(APPEND tests_config_file_name "TestsConfig.cmake")
set(${out_var} "${tests_config_file_name}" PARENT_SCOPE)
endfunction()
macro(qt_build_tests)
set(CMAKE_UNITY_BUILD OFF)
# Prepending to QT_BUILD_CMAKE_PREFIX_PATH helps find components of Qt6, because those
# find_package calls use NO_DEFAULT_PATH, and thus CMAKE_PREFIX_PATH is ignored.
list(PREPEND CMAKE_FIND_ROOT_PATH "${QT_BUILD_DIR}")
list(PREPEND QT_BUILD_CMAKE_PREFIX_PATH "${QT_BUILD_DIR}/${INSTALL_LIBDIR}/cmake")
if(QT_BUILD_STANDALONE_TESTS)
# Find location of TestsConfig.cmake. These contain the modules that need to be
# find_package'd when testing.
qt_get_standalone_tests_config_files_path(_qt_build_tests_install_prefix)
qt_internal_get_standalone_tests_config_file_name(_qt_tests_config_file_name)
set(_qt_standalone_tests_config_file_path
"${_qt_build_tests_install_prefix}/${_qt_tests_config_file_name}")
include("${_qt_standalone_tests_config_file_path}"
OPTIONAL
RESULT_VARIABLE _qt_standalone_tests_included)
if(NOT _qt_standalone_tests_included)
message(DEBUG
"Standalone tests config file not included because it does not exist: "
"${_qt_standalone_tests_config_file_path}"
)
else()
message(DEBUG
"Standalone tests config file included successfully: "
"${_qt_standalone_tests_config_file_path}"
)
endif()
unset(_qt_standalone_tests_config_file_path)
unset(_qt_standalone_tests_included)
unset(_qt_tests_config_file_name)
# Of course we always need the test module as well.
# When looking for the Test package, do it using the Qt6 package version, in case if
# PROJECT_VERSION is following a different versioning scheme.
if(Qt6_VERSION)
set(_qt_build_tests_package_version "${Qt6_VERSION}")
else()
set(_qt_build_tests_package_version "${PROJECT_VERSION}")
endif()
find_package(Qt6 "${_qt_build_tests_package_version}" CONFIG REQUIRED COMPONENTS Test)
unset(_qt_build_tests_package_version)
# Set language standards after finding Core, because that's when the relevant
# feature variables are available, and the call in QtSetup is too early when building
# standalone tests, because Core was not find_package()'d yet.
qt_set_language_standards()
if(NOT QT_SUPERBUILD)
# Set up fake standalone tests install prefix, so we don't pollute the Qt install
# prefix. For super builds it needs to be done in qt5/CMakeLists.txt.
qt_set_up_fake_standalone_tests_install_prefix()
endif()
else()
if(ANDROID)
# When building in-tree tests we need to specify the QT_ANDROID_ABIS list. Since we
# build Qt for the single ABI, build tests for this ABI only.
set(QT_ANDROID_ABIS "${CMAKE_ANDROID_ARCH_ABI}")
endif()
endif()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/auto/CMakeLists.txt")
add_subdirectory(auto)
endif()
if(NOT QT_BUILD_MINIMAL_STATIC_TESTS AND NOT QT_BUILD_MINIMAL_ANDROID_MULTI_ABI_TESTS)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/baseline/CMakeLists.txt")
add_subdirectory(baseline)
endif()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/CMakeLists.txt" AND QT_BUILD_BENCHMARKS)
add_subdirectory(benchmarks)
endif()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/manual/CMakeLists.txt" AND QT_BUILD_MANUAL_TESTS)
add_subdirectory(manual)
# Adding this logic to all tests impacts the configure time ~3sec in addition. We still
# might want this in the future for other test types since currently we have a moderate
# subset of tests that require manual initialization of autotools.
_qt_internal_collect_buildsystem_targets(targets
"${CMAKE_CURRENT_SOURCE_DIR}/manual" EXCLUDE UTILITY ALIAS)
foreach(target ${targets})
qt_autogen_tools(${target} ENABLE_AUTOGEN_TOOLS "moc" "rcc")
if(TARGET Qt::Widgets)
qt_autogen_tools(${target} ENABLE_AUTOGEN_TOOLS "uic")
endif()
endforeach()
endif()
endif()
set(CMAKE_UNITY_BUILD ${QT_UNITY_BUILD})
endmacro()
function(qt_compute_relative_path_from_cmake_config_dir_to_prefix)
# Compute the reverse relative path from the CMake config dir to the install prefix.
# This is used in QtBuildInternalsExtras to create a relocatable relative install prefix path.
# This path is used for finding syncqt and other things, regardless of initial install prefix
# (e.g installed Qt was archived and unpacked to a different path on a different machine).
#
# This is meant to be called only once when configuring qtbase.
#
# Similar code exists in Qt6CoreConfigExtras.cmake.in and src/corelib/CMakeLists.txt which
# might not be needed anymore.
if(CMAKE_STAGING_PREFIX)
set(__qt_prefix "${CMAKE_STAGING_PREFIX}")
else()
set(__qt_prefix "${CMAKE_INSTALL_PREFIX}")
endif()
if(QT_WILL_INSTALL)
get_filename_component(clean_config_prefix
"${__qt_prefix}/${QT_CONFIG_INSTALL_DIR}" ABSOLUTE)
else()
get_filename_component(clean_config_prefix "${QT_CONFIG_BUILD_DIR}" ABSOLUTE)
endif()
file(RELATIVE_PATH
qt_path_from_cmake_config_dir_to_prefix
"${clean_config_prefix}" "${__qt_prefix}")
set(qt_path_from_cmake_config_dir_to_prefix "${qt_path_from_cmake_config_dir_to_prefix}"
PARENT_SCOPE)
endfunction()
function(qt_get_relocatable_install_prefix out_var)
# We need to compute it only once while building qtbase. Afterwards it's loaded from
# QtBuildInternalsExtras.cmake.
if(QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX)
return()
endif()
# The QtBuildInternalsExtras value is dynamically computed, whereas the initial qtbase
# configuration uses an absolute path.
set(${out_var} "${CMAKE_INSTALL_PREFIX}" PARENT_SCOPE)
endfunction()
function(qt_set_up_fake_standalone_tests_install_prefix)
# Set a fake local (non-cache) CMAKE_INSTALL_PREFIX.
# Needed for standalone tests, we don't want to accidentally install a test into the Qt prefix.
# Allow opt-out, if a user knows what they're doing.
if(QT_NO_FAKE_STANDALONE_TESTS_INSTALL_PREFIX)
return()
endif()
set(new_install_prefix "${CMAKE_BINARY_DIR}/fake_prefix")
# It's IMPORTANT that this is not a cache variable. Otherwise
# qt_get_standalone_tests_confg_files_path() will not work on re-configuration.
message(STATUS
"Setting local standalone test install prefix (non-cached) to '${new_install_prefix}'.")
set(CMAKE_INSTALL_PREFIX "${new_install_prefix}" PARENT_SCOPE)
# We also need to clear the staging prefix if it's set, otherwise CMake will modify any computed
# rpaths containing the staging prefix to point to the new fake prefix, which is not what we
# want. This replacement is done in cmComputeLinkInformation::GetRPath().
#
# By clearing the staging prefix for the standalone tests, any detected link time
# rpaths will be embedded as-is, which will point to the place where Qt was installed (aka
# the staging prefix).
if(DEFINED CMAKE_STAGING_PREFIX)
message(STATUS "Clearing local standalone test staging prefix (non-cached).")
set(CMAKE_STAGING_PREFIX "" PARENT_SCOPE)
endif()
endfunction()
# Mean to be called when configuring examples as part of the main build tree, as well as for CMake
# tests (tests that call CMake to try and build CMake applications).
macro(qt_internal_set_up_build_dir_package_paths)
list(PREPEND CMAKE_PREFIX_PATH "${QT_BUILD_DIR}/${INSTALL_LIBDIR}/cmake")
# Make sure the CMake config files do not recreate the already-existing targets
set(QT_NO_CREATE_TARGETS TRUE)
endmacro()
function(qt_internal_static_link_order_test)
# The CMake versions greater than 3.21 take care about the resource object files order in a
# linker line, it's expected that all object files are located at the beginning of the linker
# line.
# No need to run the test.
if(CMAKE_VERSION VERSION_LESS 3.21)
__qt_internal_check_link_order_matters(link_order_matters)
if(link_order_matters)
set(summary_message "no")
else()
set(summary_message "yes")
endif()
else()
set(summary_message "yes")
endif()
qt_configure_add_summary_entry(TYPE "message"
ARGS "Linker can resolve circular dependencies"
MESSAGE "${summary_message}"
)
endfunction()
function(qt_internal_check_cmp0099_available)
# Don't care about CMP0099 in CMake versions greater than or equal to 3.21
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.21)
return()
endif()
__qt_internal_check_cmp0099_available(result)
if(result)
set(summary_message "yes")
else()
set(summary_message "no")
endif()
qt_configure_add_summary_entry(TYPE "message"
ARGS "CMake policy CMP0099 is supported"
MESSAGE "${summary_message}"
)
endfunction()
function(qt_internal_run_common_config_tests)
qt_configure_add_summary_section(NAME "Common build options")
qt_internal_static_link_order_test()
qt_internal_check_cmp0099_available()
qt_configure_end_summary_section()
endfunction()
# It is used in QtWebEngine to replace the REALPATH with ABSOLUTE path, which is
# useful for building Qt in Homebrew.
function(qt_internal_get_filename_path_mode out_var)
set(mode REALPATH)
if(APPLE AND QT_ALLOW_SYMLINK_IN_PATHS)
set(mode ABSOLUTE)
endif()
set(${out_var} ${mode} PARENT_SCOPE)
endfunction()
macro(qt_internal_setup_platform_support_variables)
# Define some constants to check for certain platforms, etc.
# Needs to be loaded before qt_repo_build() to handle require() clauses before even starting a
# repo build.
include(QtPlatformSupport)
endmacro()
function(qt_build_internals_set_up_system_prefixes)
if(APPLE AND NOT FEATURE_pkg_config)
# Remove /usr/local and other paths like that which CMake considers as system prefixes on
# darwin platforms. CMake considers them as system prefixes, but in qmake / Qt land we only
# consider the SDK path as a system prefix.
# 3rd party libraries in these locations should not be picked up when building Qt,
# unless opted-in via the pkg-config feature, which in turn will disable this behavior.
#
# Note that we can't remove /usr as a system prefix path, because many programs won't be
# found then (e.g. perl).
set(QT_CMAKE_SYSTEM_PREFIX_PATH_BACKUP "${CMAKE_SYSTEM_PREFIX_PATH}" PARENT_SCOPE)
set(QT_CMAKE_SYSTEM_FRAMEWORK_PATH_BACKUP "${CMAKE_SYSTEM_FRAMEWORK_PATH}" PARENT_SCOPE)
list(REMOVE_ITEM CMAKE_SYSTEM_PREFIX_PATH
"/usr/local" # Homebrew
"/opt/homebrew" # Apple Silicon Homebrew
"/usr/X11R6"
"/usr/pkg"
"/opt"
"/sw" # Fink
"/opt/local" # MacPorts
)
if(_CMAKE_INSTALL_DIR)
list(REMOVE_ITEM CMAKE_SYSTEM_PREFIX_PATH "${_CMAKE_INSTALL_DIR}")
endif()
list(REMOVE_ITEM CMAKE_SYSTEM_FRAMEWORK_PATH "~/Library/Frameworks")
set(CMAKE_SYSTEM_PREFIX_PATH "${CMAKE_SYSTEM_PREFIX_PATH}" PARENT_SCOPE)
set(CMAKE_SYSTEM_FRAMEWORK_PATH "${CMAKE_SYSTEM_FRAMEWORK_PATH}" PARENT_SCOPE)
# Also tell qt_find_package() not to use PATH when looking for packages.
# We can't simply set CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH to OFF because that will break
# find_program(), and for instance ccache won't be found.
# That's why we set a different variable which is used by qt_find_package.
set(QT_NO_USE_FIND_PACKAGE_SYSTEM_ENVIRONMENT_PATH "ON" PARENT_SCOPE)
endif()
endfunction()
# Set FEATURE_${feature} if INPUT_${feature} is set in certain circumstances.
# Set FEATURE_${feature}_computed_from_input to TRUE or FALSE depending on whether the
# INPUT_${feature} value has overridden the FEATURE_${feature} variable.
#
# Needs to be in QtBuildInternalsConfig.cmake instead of QtFeature.cmake because it's used in
# qt_build_internals_disable_pkg_config_if_needed.
function(qt_internal_compute_feature_value_from_possible_input feature)
# If FEATURE_ is not defined try to use the INPUT_ variable to enable/disable feature.
# If FEATURE_ is defined and the configure script is being used (so
# QT_INTERNAL_CALLED_FROM_CONFIGURE is TRUE), ignore the FEATURE_ variable, and take into
# account the INPUT_ variable instead, because a command line argument takes priority over
# a pre-cached FEATURE_ variable.
if((NOT DEFINED FEATURE_${feature} OR QT_INTERNAL_CALLED_FROM_CONFIGURE)
AND DEFINED INPUT_${feature}
AND NOT "${INPUT_${feature}}" STREQUAL "undefined"
AND NOT "${INPUT_${feature}}" STREQUAL "")
if(INPUT_${feature})
set(FEATURE_${feature} ON)
else()
set(FEATURE_${feature} OFF)
endif()
set(FEATURE_${feature} "${FEATURE_${feature}}" PARENT_SCOPE)
set(FEATURE_${feature}_computed_from_input TRUE PARENT_SCOPE)
else()
set(FEATURE_${feature}_computed_from_input FALSE PARENT_SCOPE)
endif()
endfunction()
function(qt_build_internals_disable_pkg_config_if_needed)
# pkg-config should not be used by default on Darwin and Windows platforms (and QNX), as defined
# in the qtbase/configure.json. Unfortunately by the time the feature is evaluated there are
# already a few find_package() calls that try to use the FindPkgConfig module.
# Thus, we have to duplicate the condition logic here and disable pkg-config for those platforms
# by default.
# We also need to check if the pkg-config executable exists, to mirror the condition test in
# configure.json. We do that by trying to find the executable ourselves, and not delegating to
# the FindPkgConfig module because that has more unwanted side-effects.
#
# Note that on macOS, if the pkg-config feature is enabled by the user explicitly, we will also
# tell CMake to consider paths like /usr/local (Homebrew) as system paths when looking for
# packages.
# We have to do that because disabling these paths but keeping pkg-config
# enabled won't enable finding all system libraries via pkg-config alone, many libraries can
# only be found via FooConfig.cmake files which means /usr/local should be in the system prefix
# path.
set(pkg_config_enabled ON)
qt_build_internals_find_pkg_config_executable()
if(APPLE OR WIN32 OR QNX OR ANDROID OR WASM OR (NOT PKG_CONFIG_EXECUTABLE))
set(pkg_config_enabled OFF)
endif()
# Features won't have been evaluated yet if this is the first run, have to evaluate this here
qt_internal_compute_feature_value_from_possible_input(pkg_config)
# If user explicitly specified a value for the feature, honor it, even if it might break
# the build.
if(DEFINED FEATURE_pkg_config)
if(FEATURE_pkg_config)
set(pkg_config_enabled ON)
else()
set(pkg_config_enabled OFF)
endif()
endif()
set(FEATURE_pkg_config "${pkg_config_enabled}" CACHE STRING "Using pkg-config")
if(NOT pkg_config_enabled)
qt_build_internals_disable_pkg_config()
else()
unset(PKG_CONFIG_EXECUTABLE CACHE)
endif()
endfunction()
# This is a copy of the first few lines in FindPkgConfig.cmake.
function(qt_build_internals_find_pkg_config_executable)
# find pkg-config, use PKG_CONFIG if set
if((NOT PKG_CONFIG_EXECUTABLE) AND (NOT "$ENV{PKG_CONFIG}" STREQUAL ""))
set(PKG_CONFIG_EXECUTABLE "$ENV{PKG_CONFIG}" CACHE FILEPATH "pkg-config executable")
endif()
find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable")
mark_as_advanced(PKG_CONFIG_EXECUTABLE)
endfunction()
function(qt_build_internals_disable_pkg_config)
# Disable pkg-config by setting an empty executable path. There's no documented way to
# mark the package as not found, but we can force all pkg_check_modules calls to do nothing
# by setting the variable to an empty value.
set(PKG_CONFIG_EXECUTABLE "" CACHE STRING "Disabled pkg-config usage." FORCE)
endfunction()
macro(qt_build_internals_find_pkg_config)
# Find package config once before any system prefix modifications.
find_package(PkgConfig QUIET)
endmacro()
macro(qt_internal_setup_pkg_config_and_system_prefixes)
if(NOT QT_BUILD_INTERNALS_SKIP_PKG_CONFIG_ADJUSTMENT)
qt_build_internals_disable_pkg_config_if_needed()
endif()
if(NOT QT_BUILD_INTERNALS_SKIP_FIND_PKG_CONFIG)
qt_build_internals_find_pkg_config()
endif()
if(NOT QT_BUILD_INTERNALS_SKIP_SYSTEM_PREFIX_ADJUSTMENT)
qt_build_internals_set_up_system_prefixes()
endif()
endmacro()
macro(qt_internal_setup_standalone_test_when_called_as_a_find_package_component)
if ("STANDALONE_TEST" IN_LIST Qt6BuildInternals_FIND_COMPONENTS)
include(${CMAKE_CURRENT_LIST_DIR}/QtStandaloneTestTemplateProject/Main.cmake)
if (NOT PROJECT_VERSION_MAJOR)
get_property(_qt_major_version TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::Core PROPERTY INTERFACE_QT_MAJOR_VERSION)
set(PROJECT_VERSION ${Qt${_qt_major_version}Core_VERSION})
string(REPLACE "." ";" _qt_core_version_list ${PROJECT_VERSION})
list(GET _qt_core_version_list 0 PROJECT_VERSION_MAJOR)
list(GET _qt_core_version_list 1 PROJECT_VERSION_MINOR)
list(GET _qt_core_version_list 2 PROJECT_VERSION_PATCH)
endif()
endif()
endmacro()
macro(qt_internal_setup_build_internals)
qt_internal_set_qt_repo_dependencies()
qt_internal_setup_platform_support_variables()
qt_internal_setup_pkg_config_and_system_prefixes()
qt_internal_setup_standalone_test_when_called_as_a_find_package_component()
endmacro()
# Recursively reads the dependencies section from dependencies.yaml in ${repo_dir} and returns the
# list of dependencies, including transitive ones, in out_var.
#
# The returned dependencies are topologically sorted.
#
# Example output for qtdeclarative:
# qtbase;qtimageformats;qtlanguageserver;qtshadertools;qtsvg
#
function(qt_internal_read_repo_dependencies out_var repo_dir)
set(seen ${ARGN})
set(dependencies "")
set(in_dependencies_section FALSE)
set(dependencies_file "${repo_dir}/dependencies.yaml")
if(EXISTS "${dependencies_file}")
file(STRINGS "${dependencies_file}" lines)
foreach(line IN LISTS lines)
if(line MATCHES "^([^ ]+):")
if(CMAKE_MATCH_1 STREQUAL "dependencies")
set(in_dependencies_section TRUE)
else()
set(in_dependencies_section FALSE)
endif()
elseif(in_dependencies_section AND line MATCHES "^ (.+):$")
set(dependency "${CMAKE_MATCH_1}")
set(dependency_repo_dir "${repo_dir}/${dependency}")
string(REGEX MATCH "[^/]+$" dependency "${dependency}")
if(NOT dependency IN_LIST seen)
qt_internal_read_repo_dependencies(subdeps "${dependency_repo_dir}"
${seen} ${dependency})
if(dependency MATCHES "^tqtc-(.+)")
set(dependency "${CMAKE_MATCH_1}")
endif()
list(APPEND dependencies ${subdeps} ${dependency})
endif()
endif()
endforeach()
list(REMOVE_DUPLICATES dependencies)
endif()
set(${out_var} "${dependencies}" PARENT_SCOPE)
endfunction()
macro(qt_internal_set_qt_repo_dependencies)
# The top-level check needs to happen because it's possible
# to configure a top-level build with a few repos and then configure another repo
# using qt-configure-module in a separate build dir, where QT_SUPERBUILD will not
# be set anymore.
if(DEFINED QT_REPO_MODULE_VERSION AND NOT DEFINED QT_REPO_DEPENDENCIES AND NOT QT_SUPERBUILD)
qt_internal_read_repo_dependencies(QT_REPO_DEPENDENCIES "${PROJECT_SOURCE_DIR}")
endif()
endmacro()

View File

@ -14,6 +14,8 @@ function(qt_internal_get_supported_min_cmake_version_for_building_qt out_var)
set(supported_version "${QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_QT}")
# We're building qtbase so the values come from .cmake.conf.
elseif(APPLE)
set(supported_version "${QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_QT_APPLE}")
elseif(BUILD_SHARED_LIBS)
set(supported_version "${QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_BUILDING_QT_SHARED}")
else()
@ -30,7 +32,9 @@ function(qt_internal_get_supported_min_cmake_version_for_using_qt out_var)
"It should have been set by this point.")
endif()
if(BUILD_SHARED_LIBS)
if(APPLE)
set(supported_version "${QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_APPLE}")
elseif(BUILD_SHARED_LIBS)
set(supported_version "${QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_SHARED}")
else()
set(supported_version "${QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT_STATIC}")

View File

@ -38,17 +38,12 @@ if(APPLE)
endif()
# Public helpers available to all Qt packages.
include("${CMAKE_CURRENT_LIST_DIR}/QtFeature.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicAppleHelpers.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicFinalizerHelpers.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicPluginHelpers.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicTargetHelpers.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicWalkLibsHelpers.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicFindPackageHelpers.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicDependencyHelpers.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicTestHelpers.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicToolHelpers.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/QtPublicCMakeHelpers.cmake")
set(__qt_public_files_to_include
@QT_PUBLIC_FILES_TO_INCLUDE@
)
foreach(__qt_public_file_to_include IN LISTS __qt_public_files_to_include)
include("${__qt_public_file_to_include}")
endforeach()
set(QT_ADDITIONAL_PACKAGES_PREFIX_PATH "" CACHE STRING
"Additional directories where find(Qt6 ...) components are searched")
@ -133,9 +128,9 @@ foreach(module ${@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS})
${@INSTALL_CMAKE_NAMESPACE@_FIND_VERSION}
${_@INSTALL_CMAKE_NAMESPACE@_FIND_PARTS_QUIET}
PATHS
${QT_BUILD_CMAKE_PREFIX_PATH}
${_qt_cmake_dir}
${_qt_additional_packages_prefix_paths}
${QT_EXAMPLES_CMAKE_PREFIX_PATH}
${__qt_find_package_host_qt_path}
${_qt_additional_host_packages_prefix_paths}
${__qt_use_no_default_path_for_qt_packages}

View File

@ -1,2 +1,4 @@
set(QT_SUPPORTED_MIN_CMAKE_VERSION_FOR_USING_QT "@supported_min_version_for_using_qt@")
set(QT_COMPUTED_MIN_CMAKE_VERSION_FOR_USING_QT "@computed_min_version_for_using_qt@")
@QT_CONFIG_EXTRAS_CODE@

View File

@ -117,10 +117,8 @@ function(qt_internal_add_docs)
)
endif()
if(QT_SUPERBUILD)
if(QT_SUPERBUILD OR "${PROJECT_NAME}" STREQUAL "QtBase")
set(qt_install_docs_env "${QtBase_BINARY_DIR}/${INSTALL_DOCDIR}")
elseif(QT_WILL_INSTALL)
set(qt_install_docs_env "${CMAKE_INSTALL_PREFIX}/${INSTALL_DOCDIR}")
else()
set(qt_install_docs_env "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_DOCDIR}")
endif()

View File

@ -30,6 +30,7 @@ function(qt_internal_add_executable name)
endif()
_qt_internal_create_executable(${name})
qt_internal_mark_as_internal_target(${name})
if(ANDROID)
_qt_internal_android_executable_finalizer(${name})
endif()
@ -119,6 +120,7 @@ function(qt_internal_add_executable name)
qt_internal_extend_target("${name}"
${arg_NO_UNITY_BUILD}
SOURCES ${arg_SOURCES}
NO_PCH_SOURCES ${arg_NO_PCH_SOURCES}
NO_UNITY_BUILD_SOURCES ${arg_NO_UNITY_BUILD_SOURCES}
INCLUDE_DIRECTORIES ${private_includes}
DEFINES ${arg_DEFINES}
@ -369,6 +371,7 @@ function(qt_internal_add_configure_time_executable target)
set(target_binary_dir "${CMAKE_CURRENT_BINARY_DIR}/configure_time_bins")
if(arg_CONFIG)
set(CMAKE_TRY_COMPILE_CONFIGURATION "${arg_CONFIG}")
string(TOUPPER "_${arg_CONFIG}" config_suffix)
endif()
get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
@ -419,7 +422,8 @@ function(qt_internal_add_configure_time_executable target)
)
set(should_build_at_configure_time TRUE)
if(EXISTS "${target_binary_path}")
if(QT_INTERNAL_HAVE_CONFIGURE_TIME_${target} AND
EXISTS "${target_binary_path}" AND EXISTS "${timestamp_file}")
set(last_ts 0)
foreach(source IN LISTS sources)
file(TIMESTAMP "${source}" ts "%s")
@ -434,6 +438,37 @@ function(qt_internal_add_configure_time_executable target)
endif()
endif()
set(cmake_flags_arg "")
if(arg_CMAKE_FLAGS)
set(cmake_flags_arg CMAKE_FLAGS "${arg_CMAKE_FLAGS}")
endif()
qt_internal_get_enabled_languages_for_flag_manipulation(enabled_languages)
foreach(lang IN LISTS enabled_languages)
set(compiler_flags_var "CMAKE_${lang}_FLAGS")
list(APPEND cmake_flags_arg "-D${compiler_flags_var}:STRING=${${compiler_flags_var}}")
if(arg_CONFIG)
set(compiler_flags_var_config "${compiler_flags_var}${config_suffix}")
list(APPEND cmake_flags_arg
"-D${compiler_flags_var_config}:STRING=${${compiler_flags_var_config}}")
endif()
endforeach()
qt_internal_get_target_link_types_for_flag_manipulation(target_link_types)
foreach(linker_type IN LISTS target_link_types)
set(linker_flags_var "CMAKE_${linker_type}_LINKER_FLAGS")
list(APPEND cmake_flags_arg "-D${linker_flags_var}:STRING=${${linker_flags_var}}")
if(arg_CONFIG)
set(linker_flags_var_config "${linker_flags_var}${config_suffix}")
list(APPEND cmake_flags_arg
"-D${linker_flags_var_config}:STRING=${${linker_flags_var_config}}")
endif()
endforeach()
if(NOT "${QT_INTERNAL_CMAKE_FLAGS_CONFIGURE_TIME_TOOL_${target}}" STREQUAL "${cmake_flags_arg}")
set(should_build_at_configure_time TRUE)
endif()
if(should_build_at_configure_time)
foreach(arg IN LISTS multi_value_args)
string(TOLOWER "${arg}" template_arg_name)
@ -457,11 +492,12 @@ function(qt_internal_add_configure_time_executable target)
set(template "${arg_CMAKELISTS_TEMPLATE}")
endif()
set(cmake_flags_arg)
if(arg_CMAKE_FLAGS)
set(cmake_flags_arg CMAKE_FLAGS "${arg_CMAKE_FLAGS}")
endif()
configure_file("${template}" "${target_binary_dir}/CMakeLists.txt" @ONLY)
if(EXISTS "${target_binary_dir}/CMakeCache.txt")
file(REMOVE "${target_binary_dir}/CMakeCache.txt")
endif()
try_compile(result
"${target_binary_dir}"
"${target_binary_dir}"
@ -470,7 +506,12 @@ function(qt_internal_add_configure_time_executable target)
OUTPUT_VARIABLE try_compile_output
)
set(QT_INTERNAL_CMAKE_FLAGS_CONFIGURE_TIME_TOOL_${target}
"${cmake_flags_arg}" CACHE INTERNAL "")
file(WRITE "${timestamp_file}" "")
set(QT_INTERNAL_HAVE_CONFIGURE_TIME_${target} ${result} CACHE INTERNAL
"Indicates that the configure-time target ${target} was built")
if(NOT result)
message(FATAL_ERROR "Unable to build ${target}: ${try_compile_output}")
endif()

View File

@ -1,7 +1,6 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
include(QtFeatureCommon)
include(CheckCXXCompilerFlag)
function(qt_feature_module_begin)
@ -177,15 +176,20 @@ function(qt_evaluate_config_expression resultVar)
set(${resultVar} ${result} PARENT_SCOPE)
endfunction()
function(_qt_internal_get_feature_condition_keywords out_var)
set(keywords "EQUAL" "LESS" "LESS_EQUAL" "GREATER" "GREATER_EQUAL" "STREQUAL" "STRLESS"
"STRLESS_EQUAL" "STRGREATER" "STRGREATER_EQUAL" "VERSION_EQUAL" "VERSION_LESS"
"VERSION_LESS_EQUAL" "VERSION_GREATER" "VERSION_GREATER_EQUAL" "MATCHES"
"EXISTS" "COMMAND" "DEFINED" "NOT" "AND" "OR" "TARGET" "EXISTS" "IN_LIST" "(" ")")
set(${out_var} "${keywords}" PARENT_SCOPE)
endfunction()
function(_qt_internal_dump_expression_values expression_dump expression)
set(dump "")
set(skipNext FALSE)
set(isTargetExpression FALSE)
set(keywords "EQUAL" "LESS" "LESS_EQUAL" "GREATER" "GREATER_EQUAL" "STREQUAL" "STRLESS"
"STRLESS_EQUAL" "STRGREATER" "STRGREATER_EQUAL" "VERSION_EQUAL" "VERSION_LESS"
"VERSION_LESS_EQUAL" "VERSION_GREATER" "VERSION_GREATER_EQUAL" "MATCHES"
"EXISTS" "COMMAND" "DEFINED" "NOT" "AND" "OR" "TARGET" "EXISTS" "IN_LIST" "(" ")")
_qt_internal_get_feature_condition_keywords(keywords)
list(LENGTH expression length)
math(EXPR length "${length}-1")
@ -239,19 +243,44 @@ endfunction()
# ${computed} is also stored when reconfiguring and the condition does not align with the user
# provided value.
#
function(qt_feature_check_and_save_user_provided_value resultVar feature condition computed label)
function(qt_feature_check_and_save_user_provided_value
resultVar feature condition condition_expression computed label)
if (DEFINED "FEATURE_${feature}")
# Revisit new user provided value
set(user_value "${FEATURE_${feature}}")
string(TOUPPER "${user_value}" result)
string(TOUPPER "${user_value}" user_value_upper)
set(result "${user_value_upper}")
# If the build is marked as dirty and the user_value doesn't meet the new condition,
# reset it to the computed one.
# If ${feature} depends on another dirty feature, reset the ${feature} value to
# ${computed}.
get_property(dirty_build GLOBAL PROPERTY _qt_dirty_build)
if(NOT condition AND result AND dirty_build)
if(dirty_build)
_qt_internal_feature_compute_feature_dependencies(deps "${feature}")
if(deps)
get_property(dirty_features GLOBAL PROPERTY _qt_dirty_features)
foreach(dirty_feature ${dirty_features})
if(dirty_feature IN_LIST deps AND NOT "${result}" STREQUAL "${computed}")
set(result "${computed}")
message(WARNING "Reset FEATURE_${feature} value to ${result}, because it doesn't \
meet its condition after reconfiguration.")
message(WARNING
"Auto-resetting 'FEATURE_${feature}' from '${user_value_upper}' to "
"'${computed}', "
"because the dependent feature '${dirty_feature}' was marked dirty.")
# Append ${feature} as a new dirty feature.
set_property(GLOBAL APPEND PROPERTY _qt_dirty_features "${feature}")
break()
endif()
endforeach()
endif()
# If the build is marked as dirty and the feature doesn't meet its condition,
# reset its value to the computed one, which is likely OFF.
if(NOT condition AND result)
set(result "${computed}")
message(WARNING "Resetting 'FEATURE_${feature}' from '${user_value_upper}' to "
"'${computed}' because it doesn't meet its condition after reconfiguration. "
"Condition expression is: '${condition_expression}'")
endif()
endif()
set(bool_values OFF NO FALSE N ON YES TRUE Y)
@ -299,6 +328,14 @@ condition:\n ${conditionString}\nCondition values dump:\n ${conditionDump}
set(QT_KNOWN_FEATURES "${QT_KNOWN_FEATURES}" CACHE INTERNAL "" FORCE)
endmacro()
macro(_qt_internal_parse_feature_definition feature)
cmake_parse_arguments(arg
"PRIVATE;PUBLIC"
"LABEL;PURPOSE;SECTION;"
"AUTODETECT;CONDITION;ENABLE;DISABLE;EMIT_IF"
${_QT_FEATURE_DEFINITION_${feature}})
endmacro()
# The build system stores 2 CMake cache variables for each feature, to allow detecting value changes
# during subsequent reconfigurations.
@ -334,9 +371,7 @@ function(qt_evaluate_feature feature)
message(FATAL_ERROR "Attempting to evaluate feature ${feature} but its definition is missing. Either the feature does not exist or a dependency to the module that defines it is missing")
endif()
cmake_parse_arguments(arg
"PRIVATE;PUBLIC"
"LABEL;PURPOSE;SECTION;" "AUTODETECT;CONDITION;ENABLE;DISABLE;EMIT_IF" ${_QT_FEATURE_DEFINITION_${feature}})
_qt_internal_parse_feature_definition("${feature}")
if("${arg_ENABLE}" STREQUAL "")
set(arg_ENABLE OFF)
@ -374,16 +409,7 @@ function(qt_evaluate_feature feature)
qt_evaluate_config_expression(emit_if ${arg_EMIT_IF})
endif()
# If FEATURE_ is not defined trying to use INPUT_ variable to enable/disable feature.
if ((NOT DEFINED "FEATURE_${feature}") AND (DEFINED "INPUT_${feature}")
AND (NOT "${INPUT_${feature}}" STREQUAL "undefined")
AND (NOT "${INPUT_${feature}}" STREQUAL ""))
if(INPUT_${feature})
set(FEATURE_${feature} ON)
else()
set(FEATURE_${feature} OFF)
endif()
endif()
qt_internal_compute_feature_value_from_possible_input("${feature}")
# Warn about a feature which is not emitted, but the user explicitly provided a value for it.
if(NOT emit_if AND DEFINED FEATURE_${feature})
@ -401,7 +427,8 @@ function(qt_evaluate_feature feature)
# Only save the user provided value if the feature was emitted.
if(emit_if)
qt_feature_check_and_save_user_provided_value(
saved_user_value "${feature}" "${condition}" "${computed}" "${arg_LABEL}")
saved_user_value
"${feature}" "${condition}" "${arg_CONDITION}" "${computed}" "${arg_LABEL}")
else()
# Make sure the feature internal value is OFF if not emitted.
set(saved_user_value OFF)
@ -414,6 +441,60 @@ function(qt_evaluate_feature feature)
set(QT_FEATURE_LABEL_${feature} "${arg_LABEL}" CACHE INTERNAL "")
endfunction()
# Collect feature names that ${feature} depends on, by inspecting the given expression.
function(_qt_internal_feature_extract_feature_dependencies_from_expression out_var expression)
list(LENGTH expression length)
math(EXPR length "${length}-1")
if(length LESS 0)
set(${out_var} "" PARENT_SCOPE)
return()
endif()
set(deps "")
foreach(memberIdx RANGE ${length})
list(GET expression ${memberIdx} member)
if(member MATCHES "^QT_FEATURE_(.+)")
list(APPEND deps "${CMAKE_MATCH_1}")
endif()
endforeach()
set(${out_var} "${deps}" PARENT_SCOPE)
endfunction()
# Collect feature names that ${feature} depends on, based on feature names that appear
# in the ${feature}'s condition expressions.
function(_qt_internal_feature_compute_feature_dependencies out_var feature)
# Only compute the deps once per feature.
get_property(deps_computed GLOBAL PROPERTY _qt_feature_deps_computed_${feature})
if(deps_computed)
get_property(deps GLOBAL PROPERTY _qt_feature_deps_${feature})
set(${out_var} "${deps}" PARENT_SCOPE)
return()
endif()
_qt_internal_parse_feature_definition("${feature}")
set(options_to_check AUTODETECT CONDITION ENABLE DISABLE EMIT_IF)
set(deps "")
# Go through each option that takes condition expressions and collect the feature names.
foreach(option ${options_to_check})
set(option_value "${arg_${option}}")
if(option_value)
_qt_internal_feature_extract_feature_dependencies_from_expression(
option_deps "${option_value}")
if(option_deps)
list(APPEND deps ${option_deps})
endif()
endif()
endforeach()
set_property(GLOBAL PROPERTY _qt_feature_deps_computed_${feature} TRUE)
set_property(GLOBAL PROPERTY _qt_feature_deps_${feature} "${deps}")
set(${out_var} "${deps}" PARENT_SCOPE)
endfunction()
function(qt_feature_config feature config_var_name)
qt_feature_normalize_name("${feature}" feature)
cmake_parse_arguments(PARSE_ARGV 2 arg
@ -786,6 +867,61 @@ function(qt_feature_copy_global_config_features_to_core target)
endif()
endfunction()
function(qt_internal_detect_dirty_features)
# We need to clean up QT_FEATURE_*, but only once per configuration cycle
get_property(qt_feature_clean GLOBAL PROPERTY _qt_feature_clean)
if(NOT qt_feature_clean AND NOT QT_NO_FEATURE_AUTO_RESET)
message(STATUS "Checking for feature set changes")
set_property(GLOBAL PROPERTY _qt_feature_clean TRUE)
foreach(feature ${QT_KNOWN_FEATURES})
qt_internal_compute_feature_value_from_possible_input("${feature}")
if(DEFINED "FEATURE_${feature}" AND
NOT "${QT_FEATURE_${feature}}" STREQUAL "${FEATURE_${feature}}")
message(" '${feature}' was changed from ${QT_FEATURE_${feature}} "
"to ${FEATURE_${feature}}")
set(dirty_build TRUE)
set_property(GLOBAL APPEND PROPERTY _qt_dirty_features "${feature}")
# If the user changed the value of the feature directly (e.g by editing
# CMakeCache.txt), and not via its associated INPUT variable, unset the INPUT cache
# variable before it is used in feature evaluation, to ensure a stale value doesn't
# influence other feature values, especially when QT_INTERNAL_CALLED_FROM_CONFIGURE
# is TRUE and the INPUT_foo variable is not passed.
# e.g. first configure -no-gui, then manually toggle FEATURE_gui to ON in
# CMakeCache.txt, then reconfigure (with the configure script) without -no-gui.
# Without this unset(), we'd have switched FEATURE_gui to OFF again.
if(NOT FEATURE_${feature}_computed_from_input)
unset("INPUT_${feature}" CACHE)
endif()
endif()
unset("QT_FEATURE_${feature}" CACHE)
endforeach()
set(QT_KNOWN_FEATURES "" CACHE INTERNAL "" FORCE)
if(dirty_build)
set_property(GLOBAL PROPERTY _qt_dirty_build TRUE)
message(WARNING
"Due to detected feature set changes, dependent features "
"will be re-computed automatically. This might cause a lot of files to be rebuilt. "
"To disable this behavior, configure with -DQT_NO_FEATURE_AUTO_RESET=ON")
endif()
endif()
endfunction()
macro(qt_internal_compute_features_from_possible_inputs)
# Pre-calculate the developer_build feature if it's set by the user via the I
# NPUT_developer_build variable when using the configure script. When not using configure, don't
# take the INPUT variable into account, so that users can toggle the feature directly in the
# cache or via IDE.
qt_internal_compute_feature_value_from_possible_input(developer_build)
# Pre-calculate the no_prefix feature if it's set by configure via INPUT_no_prefix.
# This needs to be done before qtbase/configure.cmake is processed.
qt_internal_compute_feature_value_from_possible_input(no_prefix)
endmacro()
function(qt_config_compile_test name)
if(DEFINED "TEST_${name}")
return()

View File

@ -1,6 +1,23 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
# Sets '${var}' to a genex that extracts the target's property.
# Sets 'have_${var}' to a genex that checks that the property has a
# non-empty value.
macro(qt_internal_genex_get_property var target property)
set(${var} "$<TARGET_PROPERTY:${target},${property}>")
set(have_${var} "$<BOOL:${${var}}>")
endmacro()
# Sets '${var}' to a genex that will join the given property values
# using '${glue}' and will surround the entire output with '${prefix}'
# and '${suffix}'.
macro(qt_internal_genex_get_joined_property var target property prefix suffix glue)
qt_internal_genex_get_property("${var}" "${target}" "${property}")
set(${var}
"$<${have_${var}}:${prefix}$<JOIN:${${var}},${glue}>${suffix}>")
endmacro()
# This function generates LD version script for the target and uses it in the target linker line.
# Function has two modes dependending on the specified arguments.
# Arguments:
@ -33,9 +50,21 @@ function(qt_internal_add_linker_version_script target)
endif()
string(APPEND contents "};\n")
set(current "Qt_${PROJECT_VERSION_MAJOR}")
string(APPEND contents "${current} { *; };\n")
string(APPEND contents "${current} {\n *;")
get_target_property(target_type ${target} TYPE)
if(NOT target_type STREQUAL "INTERFACE_LIBRARY")
set(genex_prefix "\n ")
set(genex_glue "$<SEMICOLON>\n ")
set(genex_suffix "$<SEMICOLON>")
qt_internal_genex_get_joined_property(
linker_exports "${target}" _qt_extra_linker_script_exports
"${genex_prefix}" "${genex_suffix}" "${genex_glue}"
)
string(APPEND contents "${linker_exports}")
endif()
string(APPEND contents "\n};\n")
get_target_property(type ${target} TYPE)
if(NOT target_type STREQUAL "INTERFACE_LIBRARY")
set(property_genex "$<TARGET_PROPERTY:${target},_qt_extra_linker_script_content>")
set(check_genex "$<BOOL:${property_genex}>")
@ -80,6 +109,11 @@ function(qt_internal_add_link_flags_no_undefined target)
if (NOT QT_BUILD_SHARED_LIBS OR WASM)
return()
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
# ld64 defaults to -undefined,error, and in Xcode 15
# passing this option is deprecated, causing a warning.
return()
endif()
if ((GCC OR CLANG) AND NOT MSVC)
if(CLANG AND QT_FEATURE_sanitizer)
return()
@ -117,11 +151,20 @@ endfunction()
function(qt_internal_apply_gc_binaries target visibility)
set(possible_visibilities PRIVATE INTERFACE PUBLIC)
list(FIND possible_visibilities "${visibility}" known_visibility)
if (known_visibility EQUAL "-1")
if(NOT visibility IN_LIST possible_visibilities)
message(FATAL_ERROR "Visibitily setting must be one of PRIVATE, INTERFACE or PUBLIC.")
endif()
string(JOIN "" clang_or_gcc_begin
"$<$<OR:"
"$<CXX_COMPILER_ID:GNU>,"
"$<CXX_COMPILER_ID:Clang>,"
"$<CXX_COMPILER_ID:AppleClang>,"
"$<CXX_COMPILER_ID:IntelLLVM>"
">:"
)
set(clang_or_gcc_end ">")
if ((GCC OR CLANG) AND NOT WASM AND NOT UIKIT AND NOT MSVC)
if(APPLE)
set(gc_sections_flag "-Wl,-dead_strip")
@ -130,16 +173,26 @@ function(qt_internal_apply_gc_binaries target visibility)
elseif(LINUX OR BSD OR WIN32 OR ANDROID)
set(gc_sections_flag "-Wl,--gc-sections")
endif()
# Save the flag value with and without genex wrapping, so we can remove the wrapping
# when generating .pc pkgconfig files.
set_property(GLOBAL PROPERTY _qt_internal_gc_sections_without_genex "${gc_sections_flag}")
set(gc_sections_flag
"${clang_or_gcc_begin}${gc_sections_flag}${clang_or_gcc_end}")
set_property(GLOBAL PROPERTY _qt_internal_gc_sections_with_genex "${gc_sections_flag}")
endif()
if(gc_sections_flag)
target_link_options("${target}" ${visibility} "${gc_sections_flag}")
endif()
if((GCC OR CLANG) AND NOT WASM AND NOT UIKIT AND NOT MSVC)
set(split_sections_flags "-ffunction-sections" "-fdata-sections")
set(split_sections_flags
"${clang_or_gcc_begin}-ffunction-sections;-fdata-sections${clang_or_gcc_end}")
endif()
if(split_sections_flags)
target_compile_options("${target}" ${visibility} ${split_sections_flags})
target_compile_options("${target}" ${visibility} "${split_sections_flags}")
endif()
endfunction()
@ -149,13 +202,17 @@ function(qt_internal_apply_intel_cet target visibility)
endif()
set(possible_visibilities PRIVATE INTERFACE PUBLIC)
list(FIND possible_visibilities "${visibility}" known_visibility)
if (known_visibility EQUAL "-1")
if(NOT visibility IN_LIST possible_visibilities)
message(FATAL_ERROR "Visibitily setting must be one of PRIVATE, INTERFACE or PUBLIC.")
endif()
if(GCC)
set(flags "-mshstk")
string(JOIN "" flags
"$<$<OR:"
"$<CXX_COMPILER_ID:GNU>,"
"$<CXX_COMPILER_ID:Clang>,"
"$<CXX_COMPILER_ID:AppleClang>"
">:-mshstk>")
endif()
if(flags)
target_compile_options("${target}" ${visibility} "${flags}")
@ -993,6 +1050,26 @@ function(qt_internal_set_up_config_optimizations_like_in_qmake)
IN_CACHE)
endif()
# Legacy Android toolchain file adds the `-g` flag to CMAKE_<LANG>_FLAGS, as a
# result, our release build ends up containing debug symbols. To avoid that, we
# remove the flag from CMAKE_<LANGL>_FLAGS and add
# it to CMAKE_<LANG>_FLAGS_DEBUG.
#
# Note:
# The new `android.toolchain.cmake` file does not have this problem, but
# it has other issues, eg., https://github.com/android/ndk/issues/1693, so we
# cannot force it. While we do load the new toolchain, it automatically falls
# back to the legacy toolchain, ie., `android-legacy.toolchain.cmake` which
# has the problem described above.
#
# Todo:
# When the new toolchain is fixed, and it doesn't fall back to the legacy
# anymore by default, then we should be able to remove this workaround.
if(ANDROID AND ANDROID_COMPILER_FLAGS MATCHES "(^| )-g")
qt_internal_remove_compiler_flags("-g")
qt_internal_add_compiler_flags(FLAGS "-g" CONFIGS DEBUG RELWITHDEBINFO)
endif()
# Update all relevant flags in the calling scope
foreach(lang ${enabled_languages})
set(flag_var_name "CMAKE_${lang}_FLAGS")

View File

@ -82,24 +82,41 @@ function(qt_copy_framework_headers target)
set(output_dir_QPA "${output_dir}/${fw_private_module_header_dir}/qpa")
set(output_dir_RHI "${output_dir}/${fw_private_module_header_dir}/rhi")
qt_internal_module_info(module "${target}")
set(out_files)
set(out_files "")
set(in_files "")
set(copy_commands "")
foreach(type IN ITEMS PUBLIC PRIVATE QPA RHI)
set(in_files_${type} "")
set(fw_output_header_dir "${output_dir_${type}}")
foreach(hdr IN LISTS arg_${type})
get_filename_component(in_file_path ${hdr} ABSOLUTE)
get_filename_component(in_file_name ${hdr} NAME)
set(out_file_path "${fw_output_header_dir}/${in_file_name}")
add_custom_command(
OUTPUT ${out_file_path}
DEPENDS ${in_file_path}
COMMAND ${CMAKE_COMMAND} -E make_directory "${fw_output_header_dir}"
COMMAND ${CMAKE_COMMAND} -E copy "${in_file_path}" "${fw_output_header_dir}"
VERBATIM)
list(APPEND out_files ${out_file_path})
list(APPEND in_files_${type} "${in_file_path}")
endforeach()
if(in_files_${type})
list(APPEND copy_commands
COMMAND ${CMAKE_COMMAND} -E copy ${in_files_${type}} "${fw_output_header_dir}")
list(APPEND in_files ${in_files_${type}})
endif()
endforeach()
list(REMOVE_DUPLICATES out_files)
list(REMOVE_DUPLICATES in_files)
add_custom_command(
OUTPUT "${output_dir}/${fw_versioned_header_dir}" ${out_files}
DEPENDS ${in_files} ${target}_sync_headers
COMMAND
${CMAKE_COMMAND} -E copy_directory
"${module_build_interface_include_dir}/.syncqt_staging"
"${output_dir}/${fw_versioned_header_dir}"
${copy_commands}
VERBATIM
COMMENT "Copy the ${target} header files to the framework directory"
)
set_property(TARGET ${target} APPEND PROPERTY
QT_COPIED_FRAMEWORK_HEADERS "${out_files}")
endfunction()

View File

@ -182,7 +182,7 @@ function(qt_internal_add_headersclean_target module_target module_headers)
)
set(input_header_path_type ABSOLUTE)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(hcleanFLAGS -std:c++latest -Zc:__cplusplus -Za -WX -W3 -EHsc)
set(hcleanFLAGS -std:c++latest -Zc:__cplusplus -WX -W3 -EHsc)
# Because we now add `-DNOMINMAX` to `PlatformCommonInternal`.
set(hcleanUDEFS -UNOMINMAX)

View File

@ -102,7 +102,7 @@ function(qt_internal_add_global_definition definition)
set(optional_args)
set(single_value_args VALUE)
set(multi_value_args SCOPE)
cmake_parse_arguments(args
cmake_parse_arguments(arg
"${optional_args}"
"${single_value_args}"
"${multi_value_args}"
@ -209,6 +209,14 @@ function(qt_internal_apply_bitcode_flags target)
target_compile_options("${target}" INTERFACE ${bitcode_flags})
endfunction()
# Function guards linker options that are applicable for internal Qt targets only from propagating
# them to user projects.
function(qt_internal_platform_link_options target scope)
set(options ${ARGN})
set(is_internal_target_genex "$<BOOL:$<TARGET_PROPERTY:_qt_is_internal_target>>")
target_link_options(${target} ${scope} "$<${is_internal_target_genex}:${options}>")
endfunction()
# Apple deprecated the entire OpenGL API in favor of Metal, which
# we are aware of, so silence the deprecation warnings in code.
# This does not apply to user-code, which will need to silence
@ -287,7 +295,7 @@ if (MSVC)
$<$<NOT:$<CONFIG:Debug>>:-guard:cf -Gw>
)
target_link_options(PlatformCommonInternal INTERFACE
qt_internal_platform_link_options(PlatformCommonInternal INTERFACE
-DYNAMICBASE -NXCOMPAT -LARGEADDRESSAWARE
$<$<NOT:$<CONFIG:Debug>>:-OPT:REF -OPT:ICF -GUARD:CF>
)
@ -303,7 +311,7 @@ endif()
if(QT_FEATURE_intelcet)
if(MSVC)
target_link_options(PlatformCommonInternal INTERFACE
qt_internal_platform_link_options(PlatformCommonInternal INTERFACE
-CETCOMPAT
)
else()
@ -332,22 +340,23 @@ endif()
if(DEFINED QT_EXTRA_FRAMEWORKPATHS AND APPLE)
list(TRANSFORM QT_EXTRA_FRAMEWORKPATHS PREPEND "-F" OUTPUT_VARIABLE __qt_fw_flags)
target_compile_options(PlatformCommonInternal INTERFACE ${__qt_fw_flags})
target_link_options(PlatformCommonInternal INTERFACE ${__qt_fw_flags})
qt_internal_platform_link_options(PlatformCommonInternal INTERFACE ${__qt_fw_flags})
unset(__qt_fw_flags)
endif()
qt_internal_get_active_linker_flags(__qt_internal_active_linker_flags)
if(__qt_internal_active_linker_flags)
target_link_options(PlatformCommonInternal INTERFACE "${__qt_internal_active_linker_flags}")
qt_internal_platform_link_options(PlatformCommonInternal INTERFACE
"${__qt_internal_active_linker_flags}")
endif()
unset(__qt_internal_active_linker_flags)
if(QT_FEATURE_enable_gdb_index)
target_link_options(PlatformCommonInternal INTERFACE "-Wl,--gdb-index")
qt_internal_platform_link_options(PlatformCommonInternal INTERFACE "-Wl,--gdb-index")
endif()
if(QT_FEATURE_enable_new_dtags)
target_link_options(PlatformCommonInternal INTERFACE "-Wl,--enable-new-dtags")
qt_internal_platform_link_options(PlatformCommonInternal INTERFACE "-Wl,--enable-new-dtags")
endif()
function(qt_get_implicit_sse2_genex_condition out_var)

View File

@ -4,6 +4,10 @@
# This function can be used to compile java sources into a jar package.
function(qt_internal_add_jar target)
set(options)
set(oneValueArgs OUTPUT_DIR)
set(multiValueArgs INCLUDE_JARS SOURCES)
cmake_parse_arguments(arg "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(javac_target_version "${QT_ANDROID_JAVAC_TARGET}")
if (NOT javac_target_version)
@ -18,4 +22,8 @@ function(qt_internal_add_jar target)
set(CMAKE_JAVA_COMPILE_FLAGS -source "${javac_source_version}" -target "${javac_target_version}" -Xlint:unchecked -bootclasspath "${QT_ANDROID_JAR}")
add_jar(${ARGV})
foreach(f IN LISTS arg_SOURCES)
_qt_internal_expose_source_file_to_ide(${target} "${f}")
endforeach()
endfunction()

146
cmake/QtMkspecHelpers.cmake Normal file
View File

@ -0,0 +1,146 @@
# Copyright (C) 2023 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
macro(qt_internal_set_mkspecs_dir)
# Find the path to mkspecs/, depending on whether we are building as part of a standard qtbuild,
# or a module against an already installed version of qt.
if(NOT QT_MKSPECS_DIR)
if("${QT_BUILD_INTERNALS_PATH}" STREQUAL "")
get_filename_component(QT_MKSPECS_DIR "${CMAKE_CURRENT_LIST_DIR}/../mkspecs" ABSOLUTE)
else()
# We can rely on QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX being set by
# QtBuildInternalsExtra.cmake.
get_filename_component(
QT_MKSPECS_DIR
"${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_MKSPECSDIR}" ABSOLUTE)
endif()
set(QT_MKSPECS_DIR "${QT_MKSPECS_DIR}" CACHE INTERNAL "")
endif()
endmacro()
macro(qt_internal_setup_platform_definitions_and_mkspec)
# Platform define path, etc.
if(WIN32)
set(QT_DEFAULT_PLATFORM_DEFINITIONS WIN32 _ENABLE_EXTENDED_ALIGNED_STORAGE)
if(QT_64BIT)
list(APPEND QT_DEFAULT_PLATFORM_DEFINITIONS WIN64 _WIN64)
endif()
if(CLANG)
if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC" OR MSVC)
set(QT_DEFAULT_MKSPEC win32-clang-msvc)
elseif(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU" OR MINGW)
set(QT_DEFAULT_MKSPEC win32-clang-g++)
endif()
elseif(MSVC)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
set(QT_DEFAULT_MKSPEC win32-arm64-msvc)
else()
set(QT_DEFAULT_MKSPEC win32-msvc)
endif()
elseif(MINGW)
set(QT_DEFAULT_MKSPEC win32-g++)
list(APPEND QT_DEFAULT_PLATFORM_DEFINITIONS MINGW_HAS_SECURE_API=1)
endif()
elseif(LINUX)
if(GCC)
set(QT_DEFAULT_MKSPEC linux-g++)
elseif(CLANG)
set(QT_DEFAULT_MKSPEC linux-clang)
endif()
elseif(ANDROID)
if(GCC)
set(QT_DEFAULT_MKSPEC android-g++)
elseif(CLANG)
set(QT_DEFAULT_MKSPEC android-clang)
endif()
elseif(IOS)
set(QT_DEFAULT_MKSPEC macx-ios-clang)
elseif(APPLE)
set(QT_DEFAULT_MKSPEC macx-clang)
elseif(WASM)
if(WASM64)
set(QT_DEFAULT_MKSPEC wasm-emscripten-64)
else()
set(QT_DEFAULT_MKSPEC wasm-emscripten)
endif()
elseif(QNX)
# Certain POSIX defines are not set if we don't compile with -std=gnuXX
set(QT_ENABLE_CXX_EXTENSIONS ON)
list(APPEND QT_DEFAULT_PLATFORM_DEFINITIONS _FORTIFY_SOURCE=2 _REENTRANT)
set(compiler_aarch64le aarch64le)
set(compiler_armle-v7 armv7le)
set(compiler_x86-64 x86_64)
set(compiler_x86 x86)
foreach(arch aarch64le armle-v7 x86-64 x86)
if (CMAKE_CXX_COMPILER_TARGET MATCHES "${compiler_${arch}}$")
set(QT_DEFAULT_MKSPEC qnx-${arch}-qcc)
endif()
endforeach()
elseif(FREEBSD)
if(CLANG)
set(QT_DEFAULT_MKSPEC freebsd-clang)
elseif(GCC)
set(QT_DEFAULT_MKSPEC freebsd-g++)
endif()
elseif(NETBSD)
set(QT_DEFAULT_MKSPEC netbsd-g++)
elseif(OPENBSD)
set(QT_DEFAULT_MKSPEC openbsd-g++)
elseif(SOLARIS)
if(GCC)
if(QT_64BIT)
set(QT_DEFAULT_MKSPEC solaris-g++-64)
else()
set(QT_DEFAULT_MKSPEC solaris-g++)
endif()
else()
if(QT_64BIT)
set(QT_DEFAULT_MKSPEC solaris-cc-64)
else()
set(QT_DEFAULT_MKSPEC solaris-cc)
endif()
endif()
elseif(HURD)
set(QT_DEFAULT_MKSPEC hurd-g++)
endif()
if(NOT QT_QMAKE_TARGET_MKSPEC)
set(QT_QMAKE_TARGET_MKSPEC "${QT_DEFAULT_MKSPEC}" CACHE STRING "QMake target mkspec")
endif()
if(CMAKE_CROSSCOMPILING)
set(QT_QMAKE_HOST_MKSPEC "${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_QMAKE_MKSPEC}")
else()
set(QT_QMAKE_HOST_MKSPEC "${QT_QMAKE_TARGET_MKSPEC}")
endif()
if(NOT QT_QMAKE_TARGET_MKSPEC OR NOT EXISTS "${QT_MKSPECS_DIR}/${QT_QMAKE_TARGET_MKSPEC}")
if(NOT QT_QMAKE_TARGET_MKSPEC)
set(reason
"Platform is not detected. Please make sure your build environment is configured"
" properly or specify it manually using QT_QMAKE_TARGET_MKSPEC variable and one of"
" the known platforms.")
else()
set(reason "Unknown platform ${QT_QMAKE_TARGET_MKSPEC}")
endif()
file(GLOB known_platforms
LIST_DIRECTORIES true
RELATIVE "${QT_MKSPECS_DIR}"
"${QT_MKSPECS_DIR}/*"
)
list(JOIN known_platforms "\n " known_platforms)
message(FATAL_ERROR "${reason}\n"
"Known platforms:\n ${known_platforms}")
endif()
if(NOT DEFINED QT_DEFAULT_PLATFORM_DEFINITIONS)
set(QT_DEFAULT_PLATFORM_DEFINITIONS "")
endif()
set(QT_PLATFORM_DEFINITIONS ${QT_DEFAULT_PLATFORM_DEFINITIONS}
CACHE STRING "Qt platform specific pre-processor defines")
endmacro()

View File

@ -16,10 +16,10 @@ set(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED FALSE)
if(NOT @INSTALL_CMAKE_NAMESPACE@_FOUND)
find_dependency(@INSTALL_CMAKE_NAMESPACE@ @main_qt_package_version@
PATHS
${QT_BUILD_CMAKE_PREFIX_PATH}
"${CMAKE_CURRENT_LIST_DIR}/.."
"${_qt_cmake_dir}"
${_qt_additional_packages_prefix_paths}
${QT_EXAMPLES_CMAKE_PREFIX_PATH}
${__qt_use_no_default_path_for_qt_packages}
)
endif()

View File

@ -11,7 +11,8 @@ if(EXISTS ${HEADER_CHECK_EXCEPTIONS})
file(READ ${HEADER_CHECK_EXCEPTIONS} header_check_exception_list)
endif()
file(TO_CMAKE_PATH "${INPUT_HEADER_FILE}" header)
get_filename_component(header "${INPUT_HEADER_FILE}" REALPATH)
file(TO_CMAKE_PATH "${header}" header)
foreach(exception IN LISTS header_check_exception_list)
file(TO_CMAKE_PATH "${exception}" exception)
if(exception STREQUAL header)

View File

@ -38,7 +38,6 @@ macro(qt_internal_get_internal_add_module_keywords option_args single_args multi
QMAKE_MODULE_CONFIG
EXTRA_CMAKE_FILES
EXTRA_CMAKE_INCLUDES
NO_PCH_SOURCES
EXTERNAL_HEADERS
POLICIES
${__default_private_args}
@ -469,6 +468,8 @@ function(qt_internal_add_module target)
# If EXTERNAL_HEADERS_DIR is set we install the specified directory and keep the structure
# without taking into the account the CMake source tree and syncqt outputs.
if(arg_EXTERNAL_HEADERS_DIR)
set_property(TARGET ${target}
PROPERTY _qt_external_headers_dir "${arg_EXTERNAL_HEADERS_DIR}")
qt_install(DIRECTORY "${arg_EXTERNAL_HEADERS_DIR}/"
DESTINATION "${module_install_interface_include_dir}"
)
@ -487,6 +488,8 @@ function(qt_internal_add_module target)
endif()
endif()
qt_internal_library_deprecation_level(deprecation_define)
if(NOT arg_HEADER_MODULE)
qt_autogen_tools_initial_setup(${target})
endif()
@ -576,6 +579,7 @@ function(qt_internal_add_module target)
QT_DEPRECATED_WARNINGS
QT_BUILDING_QT
QT_BUILD_${module_define_infix}_LIB ### FIXME: use QT_BUILD_ADDON for Add-ons or remove if we don't have add-ons anymore
${deprecation_define}
)
list(APPEND arg_LIBRARIES Qt::PlatformModuleInternal)
endif()
@ -1235,10 +1239,13 @@ function(qt_internal_collect_module_headers out_var target)
get_target_property(target_type ${target} TYPE)
if(target_type STREQUAL "INTERFACE_LIBRARY")
set(source_dir "${CMAKE_CURRENT_SOURCE_DIR}")
set(binary_dir "${CMAKE_CURRENT_BINARY_DIR}")
else()
get_target_property(source_dir ${target} SOURCE_DIR)
get_target_property(binary_dir ${target} BINARY_DIR)
endif()
get_filename_component(source_dir "${source_dir}" ABSOLUTE)
get_filename_component(binary_dir "${binary_dir}" ABSOLUTE)
get_target_property(is_3rdparty_library ${target} _qt_module_is_3rdparty_header_library)
@ -1282,7 +1289,14 @@ function(qt_internal_collect_module_headers out_var target)
"\nCondition:\n ${condition_string}")
endif()
if(file_path MATCHES "3rdparty/.+" AND NOT is_3rdparty_library)
if(is_outside_module_source_dir)
set(base_dir "${binary_dir}")
else()
set(base_dir "${source_dir}")
endif()
file(RELATIVE_PATH file_path_rel "${base_dir}" "${file_path}")
if(file_path_rel MATCHES "3rdparty/.+" AND NOT is_3rdparty_library)
set(is_3rdparty_header TRUE)
else()
set(is_3rdparty_header FALSE)

View File

@ -51,6 +51,17 @@ function(qt_internal_generate_pkg_config_file module)
list(TRANSFORM loose_include_dirs REPLACE "${INSTALL_INCLUDEDIR}" "\${includedir}")
list(TRANSFORM loose_include_dirs REPLACE "${INSTALL_MKSPECSDIR}" "\${mkspecsdir}")
# Remove genex wrapping around gc_sections flag because we can't evaluate genexes like
# $<CXX_COMPILER_ID> in file(GENERATE). And given that .pc files don't support dynamic
# evaluation like the $<CXX_COMPILER_ID> genex, distros will be expected to patch the .pc
# files according to which compiler they intend to be used with.
get_property(gc_sections_with_genex GLOBAL PROPERTY _qt_internal_gc_sections_with_genex)
get_property(gc_sections_without_genex GLOBAL PROPERTY _qt_internal_gc_sections_without_genex)
if(loose_link_options AND gc_sections_with_genex AND gc_sections_without_genex)
string(REPLACE "${gc_sections_with_genex}" "${gc_sections_without_genex}"
loose_link_options "${loose_link_options}")
endif()
qt_internal_set_pkg_config_cpp_flags(link_options "${loose_link_options}" "")
qt_internal_set_pkg_config_cpp_flags(compile_defs "${loose_compile_defs}" -D)
qt_internal_set_pkg_config_cpp_flags(include_dirs "${loose_include_dirs}" -I)

View File

@ -185,7 +185,7 @@ define_property(TARGET
)
# Returns test execution arguments for Android targets
function(qt_internal_android_test_arguments target out_test_runner out_test_arguments)
function(qt_internal_android_test_arguments target timeout out_test_runner out_test_arguments)
set(${out_test_runner} "${QT_HOST_PATH}/${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_BINDIR}/androidtestrunner" PARENT_SCOPE)
set(deployment_tool "${QT_HOST_PATH}/${QT${PROJECT_VERSION_MAJOR}_HOST_INFO_BINDIR}/androiddeployqt")
@ -195,15 +195,18 @@ function(qt_internal_android_test_arguments target out_test_runner out_test_argu
endif()
set(target_binary_dir "$<TARGET_PROPERTY:${target},BINARY_DIR>")
if(QT_USE_TARGET_ANDROID_BUILD_DIR)
set(apk_dir "${target_binary_dir}/android-build-${target}")
else()
set(apk_dir "${target_binary_dir}/android-build")
endif()
set(${out_test_arguments}
"--path" "${apk_dir}"
"--adb" "${ANDROID_SDK_ROOT}/platform-tools/adb"
"--skip-install-root"
"--make" "${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target ${target}_make_apk"
"--apk" "${apk_dir}/${target}.apk"
"--timeout" "-1"
"--timeout" "${timeout}"
"--verbose"
PARENT_SCOPE
)

View File

@ -12,7 +12,6 @@ endfunction()
qt_set01(LINUX CMAKE_SYSTEM_NAME STREQUAL "Linux")
qt_set01(HPUX CMAKE_SYSTEM_NAME STREQUAL "HPUX")
qt_set01(ANDROID CMAKE_SYSTEM_NAME STREQUAL "Android") # FIXME: How to identify this?
qt_set01(NACL CMAKE_SYSTEM_NAME STREQUAL "NaCl") # FIXME: How to identify this?
qt_set01(INTEGRITY CMAKE_SYSTEM_NAME STREQUAL "Integrity") # FIXME: How to identify this?
qt_set01(VXWORKS CMAKE_SYSTEM_NAME STREQUAL "VxWorks") # FIXME: How to identify this?
qt_set01(QNX CMAKE_SYSTEM_NAME STREQUAL "QNX") # FIXME: How to identify this?

View File

@ -63,10 +63,6 @@ function(qt_internal_setup_public_platform_target)
# Generate a pkgconfig for Qt::Platform.
qt_internal_generate_pkg_config_file(Platform)
# Make sure Qt users use the same symbols as how we build Qt.
qt_internal_library_deprecation_level(deprecation_defines)
target_compile_definitions(Platform INTERFACE ${deprecation_defines})
endfunction()
function(qt_internal_get_platform_definition_include_dir install_interface build_interface)

View File

@ -336,6 +336,8 @@ function(qt_internal_add_plugin target)
qt_internal_extend_target("${target}"
${arg_NO_UNITY_BUILD}
SOURCES ${arg_SOURCES}
NO_PCH_SOURCES
${arg_NO_PCH_SOURCES}
NO_UNITY_BUILD_SOURCES
${arg_NO_UNITY_BUILD_SOURCES}
INCLUDE_DIRECTORIES

View File

@ -1,8 +1,6 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
include(QtPostProcessHelpers)
qt_internal_create_depends_files()
qt_generate_build_internals_extra_cmake_code()
qt_internal_create_plugins_auto_inclusion_files()

View File

@ -713,17 +713,6 @@ endif()\n")
string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS "${install_prefix_content}")
# The top-level check needs to happen inside QtBuildInternals, because it's possible
# to configure a top-level build with a few repos and then configure another repo
# using qt-configure-module in a separate build dir, where QT_SUPERBUILD will not
# be set anymore.
string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS
"
if(DEFINED QT_REPO_MODULE_VERSION AND NOT DEFINED QT_REPO_DEPENDENCIES AND NOT QT_SUPERBUILD)
qt_internal_read_repo_dependencies(QT_REPO_DEPENDENCIES \"$\{PROJECT_SOURCE_DIR}\")
endif()
")
if(DEFINED OpenGL_GL_PREFERENCE)
string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS
"
@ -848,8 +837,15 @@ function(qt_internal_generate_user_facing_tools_info)
if(NOT filename)
set(filename ${target})
endif()
set(linkname ${filename})
if(APPLE)
get_target_property(is_macos_bundle ${target} MACOSX_BUNDLE )
if(is_macos_bundle)
set(filename "${filename}.app/Contents/MacOS/${filename}")
endif()
endif()
qt_path_join(tool_target_path "${CMAKE_INSTALL_PREFIX}" "${INSTALL_BINDIR}" "${filename}")
qt_path_join(tool_link_path "${INSTALL_PUBLICBINDIR}" "${filename}${PROJECT_VERSION_MAJOR}")
qt_path_join(tool_link_path "${INSTALL_PUBLICBINDIR}" "${linkname}${PROJECT_VERSION_MAJOR}")
list(APPEND lines "${tool_target_path} ${tool_link_path}")
endforeach()
string(REPLACE ";" "\n" content "${lines}")

View File

@ -26,9 +26,14 @@ function(qt_generate_qmake_libraries_pri_content module_name output_root_dir out
set(lib_incdir "")
set(lib_libdir "")
set(lib_libs "")
set(seen_targets "")
while(lib_targets)
list(POP_BACK lib_targets lib_target)
if(TARGET ${lib_target})
if(${lib_target} IN_LIST seen_targets)
continue()
endif()
list(APPEND seen_targets ${lib_target})
get_target_property(lib_target_type ${lib_target} TYPE)
if(lib_target_type STREQUAL "INTERFACE_LIBRARY")
get_target_property(iface_libs ${lib_target} INTERFACE_LINK_LIBRARIES)

View File

@ -55,7 +55,10 @@ if("${MODULE_ROOT}" STREQUAL "")
set(qtbase_or_top_level_build TRUE)
else()
# If MODULE_ROOT is passed without drive letter, we try to add it to the path.
# The check is necessary; otherwise, `get_filename_component` returns an empty string.
if(NOT MODULE_ROOT STREQUAL ".")
get_filename_component(MODULE_ROOT "." REALPATH BASE_DIR "${MODULE_ROOT}")
endif()
set(qtbase_or_top_level_build FALSE)
endif()
set(configure_filename "configure.cmake")
@ -136,13 +139,6 @@ while(NOT "${configure_args}" STREQUAL "")
list(POP_FRONT configure_args version)
is_valid_qt_hex_version("${arg}" "${version}")
push("-DQT_DISABLE_DEPRECATED_UP_TO=${version}")
elseif(arg STREQUAL "-unity-build")
push("-DQT_UNITY_BUILD=ON")
# QT_UNITY_BUILD_BATCH_SIZE will be set to 8, CMake's default.
elseif(arg STREQUAL "-unity-build-batch-size")
list(POP_FRONT configure_args unity_build_batch_size)
is_non_empty_valid_arg("${arg}" "${unity_build_batch_size}")
push("-DQT_UNITY_BUILD_BATCH_SIZE=${unity_build_batch_size}")
elseif(arg STREQUAL "--")
# Everything after this argument will be passed to CMake verbatim.
list(APPEND cmake_args "${configure_args}")
@ -152,6 +148,41 @@ while(NOT "${configure_args}" STREQUAL "")
endif()
endwhile()
# Read the specified manually generator value from CMake command line.
# The '-cmake-generator' argument has higher priority than CMake command line.
if(NOT generator)
set(is_next_arg_generator_name FALSE)
foreach(arg IN LISTS cmake_args)
if(is_next_arg_generator_name)
set(is_next_arg_generator_name FALSE)
if(NOT arg MATCHES "^-.*")
set(generator "${arg}")
set(auto_detect_generator FALSE)
endif()
elseif(arg MATCHES "^-G(.*)")
set(generator "${CMAKE_MATCH_1}")
if(generator)
set(auto_detect_generator FALSE)
else()
set(is_next_arg_generator_name TRUE)
endif()
endif()
endforeach()
endif()
# Attempt to detect the generator type, either single or multi-config
if("${generator}" STREQUAL "Xcode"
OR "${generator}" STREQUAL "Ninja Multi-Config"
OR "${generator}" MATCHES "^Visual Studio")
set(multi_config ON)
else()
set(multi_config OFF)
endif()
# Tell the build system we are configuring via the configure script so we can act on that.
# The cache variable is unset at the end of configuration.
push("-DQT_INTERNAL_CALLED_FROM_CONFIGURE:BOOL=TRUE")
if(FRESH_REQUESTED)
push("-DQT_INTERNAL_FRESH_REQUESTED:BOOL=TRUE")
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24")
@ -343,7 +374,9 @@ function(qtConfValidateValue opt val out_var)
endforeach()
set(${out_var} FALSE PARENT_SCOPE)
qtConfAddError("Invalid value '${val}' supplied to command line option '${opt}'.")
list(JOIN valid_values " " valid_values_str)
qtConfAddError("Invalid value '${val}' supplied to command line option '${opt}'."
"\nAllowed values: ${valid_values_str}\n")
endfunction()
function(qt_commandline_mapped_enum_value opt key out_var)
@ -827,7 +860,10 @@ endfunction()
drop_input(commercial)
drop_input(confirm-license)
translate_boolean_input(precompile_header BUILD_WITH_PCH)
translate_boolean_input(unity_build QT_UNITY_BUILD)
translate_string_input(unity_build_batch_size QT_UNITY_BUILD_BATCH_SIZE)
translate_boolean_input(ccache QT_USE_CCACHE)
translate_boolean_input(vcpkg QT_USE_VCPKG)
translate_boolean_input(shared BUILD_SHARED_LIBS)
translate_boolean_input(warnings_are_errors WARNINGS_ARE_ERRORS)
translate_string_input(qt_namespace QT_NAMESPACE)
@ -877,6 +913,7 @@ endif()
drop_input(make)
drop_input(nomake)
translate_boolean_input(install-examples-sources QT_INSTALL_EXAMPLES_SOURCES)
check_qt_build_parts(nomake)
check_qt_build_parts(make)
@ -898,9 +935,9 @@ if(INPUT_force_debug_info)
endif()
list(LENGTH build_configs nr_of_build_configs)
if(nr_of_build_configs EQUAL 1)
if(nr_of_build_configs EQUAL 1 AND NOT multi_config)
push("-DCMAKE_BUILD_TYPE=${build_configs}")
elseif(nr_of_build_configs GREATER 1)
elseif(nr_of_build_configs GREATER 1 OR multi_config)
set(multi_config ON)
string(REPLACE ";" "[[;]]" escaped_build_configs "${build_configs}")
# We must not use the push macro here to avoid variable expansion.

View File

@ -283,6 +283,7 @@ function(_qt_internal_get_default_apple_bundle_identifier target out_var)
string(APPEND prefix ".${infix}")
endif()
if(CMAKE_GENERATOR STREQUAL "Xcode")
message(WARNING
"No organization bundle identifier prefix could be retrieved from Xcode preferences. \
This can lead to code signing issues due to a non-unique bundle \
@ -291,6 +292,7 @@ function(_qt_internal_get_default_apple_bundle_identifier target out_var)
MACOSX_BUNDLE_GUI_IDENTIFIER or XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER property."
)
endif()
endif()
# Escape the prefix according to rfc 1034, it's important for code-signing. If an invalid
# identifier is used, calling xcodebuild on the command line says that no provisioning profile
@ -300,7 +302,7 @@ function(_qt_internal_get_default_apple_bundle_identifier target out_var)
_qt_internal_escape_rfc_1034_identifier("${prefix}" prefix)
if(CMAKE_GENERATOR STREQUAL "Xcode")
set(identifier "${prefix}.\${PRODUCT_NAME:rfc1034identifier}")
set(identifier "${prefix}.$(PRODUCT_NAME:rfc1034identifier)")
else()
set(identifier "${prefix}.${target}")
endif()
@ -450,7 +452,7 @@ function(_qt_internal_set_apple_bundle_identifier target)
set_target_properties("${target}"
PROPERTIES
XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${bundle_id}"
MACOSX_BUNDLE_GUI_IDENTIFIER "\${PRODUCT_BUNDLE_IDENTIFIER}")
MACOSX_BUNDLE_GUI_IDENTIFIER "$(PRODUCT_BUNDLE_IDENTIFIER)")
else()
set_target_properties("${target}"
PROPERTIES
@ -524,7 +526,7 @@ function(_qt_internal_set_xcode_bundle_name target)
if(CMAKE_GENERATOR STREQUAL Xcode)
set_target_properties("${target}"
PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME "\${PRODUCT_NAME}")
MACOSX_BUNDLE_BUNDLE_NAME "$(PRODUCT_NAME)")
else()
set_target_properties("${target}"
PROPERTIES
@ -670,6 +672,217 @@ function(_qt_internal_set_ios_simulator_arch target)
"x86_64")
endfunction()
# Export Apple platform sdk and xcode version requirements to Qt6ConfigExtras.cmake.
function(_qt_internal_export_apple_sdk_and_xcode_version_requirements out_var)
if(NOT APPLE)
return()
endif()
if(IOS)
set(vars_to_assign
QT_SUPPORTED_MIN_IOS_SDK_VERSION
QT_SUPPORTED_MAX_IOS_SDK_VERSION
QT_SUPPORTED_MIN_IOS_XCODE_VERSION
)
else()
set(vars_to_assign
QT_SUPPORTED_MIN_MACOS_SDK_VERSION
QT_SUPPORTED_MAX_MACOS_SDK_VERSION
QT_SUPPORTED_MIN_MACOS_XCODE_VERSION
)
endif()
set(assignments "")
foreach(var IN LISTS vars_to_assign)
set(value "${${var}}")
list(APPEND assignments "set(${var} \"${value}\")")
endforeach()
list(JOIN assignments "\n" assignments)
set(${out_var} "${assignments}" PARENT_SCOPE)
endfunction()
function(_qt_internal_get_apple_sdk_version out_var)
if(APPLE)
if(CMAKE_SYSTEM_NAME STREQUAL iOS)
set(sdk_name "iphoneos")
else()
# Default to macOS
set(sdk_name "macosx")
endif()
set(xcrun_version_arg "--show-sdk-version")
execute_process(COMMAND /usr/bin/xcrun --sdk ${sdk_name} ${xcrun_version_arg}
OUTPUT_VARIABLE sdk_version
ERROR_VARIABLE xcrun_error)
if(NOT sdk_version)
message(FATAL_ERROR
"Can't determine darwin ${sdk_name} SDK version. Error: ${xcrun_error}")
endif()
string(STRIP "${sdk_version}" sdk_version)
set(${out_var} "${sdk_version}" PARENT_SCOPE)
endif()
endfunction()
function(_qt_internal_get_xcode_version_raw out_var)
if(APPLE)
execute_process(COMMAND /usr/bin/xcrun xcodebuild -version
OUTPUT_VARIABLE xcode_version
ERROR_VARIABLE xcrun_error)
string(REPLACE "\n" " " xcode_version "${xcode_version}")
string(STRIP "${xcode_version}" xcode_version)
set(${out_var} "${xcode_version}" PARENT_SCOPE)
endif()
endfunction()
function(_qt_internal_get_xcode_version out_var)
if(APPLE)
_qt_internal_get_xcode_version_raw(xcode_version_raw)
# The raw output is something like after the newlines are replaced with spaces:
# Xcode 14.3 Build version 14E222b
# We want only the '14.3' part. We could be more specific with the regex to match only
# digits separated by dots, but you never know how Apple might change the format.
string(REGEX REPLACE "Xcode (([^ ])+)" "\\2" xcode_version "${xcode_version_raw}")
if(xcode_version_raw MATCHES "Xcode ([^ ]+)")
set(xcode_version "${CMAKE_MATCH_1}")
else()
message(DEBUG "Failed to extract Xcode version from '${xcode_version_raw}'")
set(xcode_version "${xcode_version_raw}")
endif()
set(${out_var} "${xcode_version}" PARENT_SCOPE)
endif()
endfunction()
function(_qt_internal_get_cached_apple_sdk_version out_var)
if(QT_INTERNAL_APPLE_SDK_VERSION)
set(sdk_version "${QT_INTERNAL_APPLE_SDK_VERSION}")
else()
_qt_internal_get_apple_sdk_version(sdk_version)
set(QT_INTERNAL_APPLE_SDK_VERSION "${sdk_version}" CACHE STRING "Apple SDK version")
endif()
set(${out_var} "${sdk_version}" PARENT_SCOPE)
endfunction()
function(_qt_internal_get_cached_xcode_version out_var)
if(QT_INTERNAL_XCODE_VERSION)
set(xcode_version "${QT_INTERNAL_XCODE_VERSION}")
else()
_qt_internal_get_xcode_version(xcode_version)
set(QT_INTERNAL_XCODE_VERSION "${xcode_version}" CACHE STRING "Xcode version")
endif()
set(${out_var} "${xcode_version}" PARENT_SCOPE)
endfunction()
# Warn when the platform SDK or Xcode version are not supported.
#
# The warnings are currently only shown when building Qt, not when building user projects
# with CMake.
# The warnings ARE shown for qmake user projects.
#
# The qmake equivalent for user projects is in mkspecs/features/mac/default_post.prf.
function(_qt_internal_check_apple_sdk_and_xcode_versions)
if(NOT APPLE)
return()
endif()
if(QT_NO_APPLE_SDK_AND_XCODE_CHECK)
return()
endif()
# Only run the check once in a top-level build.
get_property(check_done GLOBAL PROPERTY _qt_internal_apple_sdk_and_xcode_check_done)
if(check_done)
return()
endif()
set_property(GLOBAL PROPERTY _qt_internal_apple_sdk_and_xcode_check_done "TRUE")
if(IOS)
set(min_sdk_version "${QT_SUPPORTED_MIN_IOS_SDK_VERSION}")
set(max_sdk_version "${QT_SUPPORTED_MAX_IOS_SDK_VERSION}")
set(min_xcode_version "${QT_SUPPORTED_MIN_IOS_XCODE_VERSION}")
else()
set(min_sdk_version "${QT_SUPPORTED_MIN_MACOS_SDK_VERSION}")
set(max_sdk_version "${QT_SUPPORTED_MAX_MACOS_SDK_VERSION}")
set(min_xcode_version "${QT_SUPPORTED_MIN_MACOS_XCODE_VERSION}")
endif()
_qt_internal_get_cached_apple_sdk_version(sdk_version)
_qt_internal_get_cached_xcode_version(xcode_version)
if(NOT max_sdk_version MATCHES "^[0-9]+$")
message(FATAL_ERROR
"Invalid max SDK version: ${max_sdk_version} "
"It should be a major version number, without minor or patch version components.")
endif()
# The default differs in different branches.
set(failed_check_should_error FALSE)
if(failed_check_should_error)
# Allow downgrading the error into a warning.
if(QT_FORCE_WARN_APPLE_SDK_AND_XCODE_CHECK)
set(message_type WARNING)
set(extra_message " Due to QT_FORCE_WARN_APPLE_SDK_AND_XCODE_CHECK being ON "
"the build will continue, but it will likely fail. Use at your own risk.")
else()
set(message_type FATAL_ERROR)
set(extra_message " You can turn this error into a warning by configuring with "
"-DQT_FORCE_WARN_APPLE_SDK_AND_XCODE_CHECK=ON, but the build will likely fail. "
"Use at your own risk.")
endif()
else()
# Allow upgrading the warning into an error.
if(QT_FORCE_FATAL_APPLE_SDK_AND_XCODE_CHECK)
set(message_type FATAL_ERROR)
set(extra_message " Erroring out due to QT_FORCE_FATAL_APPLE_SDK_AND_XCODE_CHECK "
"being ON.")
else()
set(message_type WARNING)
set(extra_message " You can turn this warning into an error by configuring with "
"-DQT_FORCE_FATAL_APPLE_SDK_AND_XCODE_CHECK=ON. ")
endif()
endif()
if(sdk_version VERSION_LESS min_sdk_version AND NOT QT_NO_APPLE_SDK_MIN_VERSION_CHECK)
message(${message_type}
"Qt requires at least version ${min_sdk_version} of the platform SDK, "
"you're building against version ${sdk_version}. Please upgrade."
${extra_message}
)
endif()
if(xcode_version VERSION_LESS min_xcode_version AND NOT QT_NO_XCODE_MIN_VERSION_CHECK)
message(${message_type}
"Qt requires at least version ${min_xcode_version} of Xcode, "
"you're building against version ${xcode_version}. Please upgrade."
${extra_message}
)
endif()
if(QT_NO_APPLE_SDK_MAX_VERSION_CHECK)
return()
endif()
# Make sure we warn only when the current version is greater than the max supported version.
math(EXPR next_after_max_sdk_version "${max_sdk_version} + 1")
if(sdk_version VERSION_GREATER_EQUAL next_after_max_sdk_version)
message(WARNING
"Qt has only been tested with version ${max_sdk_version} "
"of the platform SDK, you're using ${sdk_version}. "
"This is an unsupported configuration. You may experience build issues, "
"and by using "
"the ${sdk_version} SDK you are opting in to new features "
"that Qt has not been prepared for. "
"Please downgrade the SDK you use to build your app to version "
"${max_sdk_version}, or configure "
"with -DQT_NO_APPLE_SDK_MAX_VERSION_CHECK=ON to silence this warning."
)
endif()
endfunction()
function(_qt_internal_finalize_apple_app target)
# Shared between macOS and iOS apps

View File

@ -91,3 +91,57 @@ function(__qt_internal_prefix_paths_to_roots out_var prefix_paths)
endforeach()
set("${out_var}" "${result}" PARENT_SCOPE)
endfunction()
# This function gets all targets below this directory
#
# Multi-value Arguments:
# EXCLUDE list of target types that should be filtered from resulting list.
#
# INCLUDE list of target types that should be filtered from resulting list.
# EXCLUDE has higher priority than INCLUDE.
function(_qt_internal_collect_buildsystem_targets result dir)
cmake_parse_arguments(arg "" "" "EXCLUDE;INCLUDE" ${ARGN})
if(NOT _qt_internal_collect_buildsystem_targets_inner)
set(${result} "")
set(_qt_internal_collect_buildsystem_targets_inner TRUE)
endif()
set(forward_args "")
if(arg_EXCLUDE)
set(forward_args APPEND EXCLUDE ${arg_EXCLUDE})
endif()
if(arg_INCLUDE)
set(forward_args APPEND INCLUDE ${arg_INCLUDE})
endif()
get_property(subdirs DIRECTORY "${dir}" PROPERTY SUBDIRECTORIES)
# Make sure that we don't hit endless recursion when running qt-cmake-standalone-test on a
# in-source test dir, where the currently processed directory lists itself in its SUBDIRECTORIES
# property.
# See https://bugreports.qt.io/browse/QTBUG-119998
# and https://gitlab.kitware.com/cmake/cmake/-/issues/25489
# Do it only when QT_INTERNAL_IS_STANDALONE_TEST is set, to avoid the possible slowdown when
# processing many subdirectores when configuring all standalone tests rather than just one.
if(QT_INTERNAL_IS_STANDALONE_TEST)
list(REMOVE_ITEM subdirs "${dir}")
endif()
foreach(subdir IN LISTS subdirs)
_qt_internal_collect_buildsystem_targets(${result} "${subdir}" ${forward_args})
endforeach()
get_property(sub_targets DIRECTORY "${dir}" PROPERTY BUILDSYSTEM_TARGETS)
set(real_targets "")
if(sub_targets)
foreach(target IN LISTS sub_targets)
get_target_property(target_type ${target} TYPE)
if((NOT arg_INCLUDE OR target_type IN_LIST arg_INCLUDE) AND
(NOT arg_EXCLUDE OR (NOT target_type IN_LIST arg_EXCLUDE)))
list(APPEND real_targets ${target})
endif()
endforeach()
endif()
set(${result} ${${result}} ${real_targets} PARENT_SCOPE)
endfunction()

View File

@ -112,9 +112,9 @@ macro(_qt_internal_find_qt_dependencies target target_dep_list find_dependency_p
NAMES
${__qt_${target}_pkg_names}
PATHS
${QT_BUILD_CMAKE_PREFIX_PATH}
${${find_dependency_path_list}}
${_qt_additional_packages_prefix_paths}
${QT_EXAMPLES_CMAKE_PREFIX_PATH}
${__qt_use_no_default_path_for_qt_packages}
)
endif()

View File

@ -0,0 +1,72 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
include_guard()
# Get CMake variables that are needed to build external projects such as examples or CMake test
# projects.
#
# CMAKE_DIR_VAR: Variable name to store the path to the Qt6 CMake config module.
#
# PREFIXES_VAR: Variable name to store the prefixes that can be passed as CMAKE_PREFIX_PATH.
#
# ADDITIONAL_PACKAGES_PREFIXES_VAR: Variable name to store the prefixes that can be appended to
# QT_ADDITIONAL_PACKAGES_PREFIX_PATH.
function(_qt_internal_get_build_vars_for_external_projects)
set(no_value_options "")
set(single_value_options
CMAKE_DIR_VAR
PREFIXES_VAR
ADDITIONAL_PACKAGES_PREFIXES_VAR
)
set(multi_value_options "")
cmake_parse_arguments(PARSE_ARGV 0 arg
"${no_value_options}" "${single_value_options}" "${multi_value_options}"
)
# TODO: Fix example/test builds when using Conan / install prefixes are different for each repo.
if(QT_SUPERBUILD OR QtBase_BINARY_DIR)
# When doing a top-level build or when building qtbase,
# always use the Config file from the current build directory, even for prefix builds.
# We strive to allow building examples without installing Qt first, which means we can't
# use the install or staging Config files.
set(qt_prefixes "${QT_BUILD_DIR}")
set(qt_cmake_dir "${QT_CONFIG_BUILD_DIR}/${QT_CMAKE_EXPORT_NAMESPACE}")
set(qt_additional_packages_prefixes "")
else()
# This is a per-repo build that isn't the qtbase repo, so we know that
# qtbase was found via find_package() and Qt6_DIR must be set
set(qt_cmake_dir "${${QT_CMAKE_EXPORT_NAMESPACE}_DIR}")
# In a prefix build of a non-qtbase repo, we want to pick up the installed Config files
# for all repos except the one that is currently built. For the repo that is currently
# built, we pick up the Config files from the current repo build dir instead.
# For non-prefix builds, there's only one prefix, the main build dir.
# Both are handled by this assignment.
set(qt_prefixes "${QT_BUILD_DIR}")
# Appending to QT_ADDITIONAL_PACKAGES_PREFIX_PATH helps find Qt6 components in
# non-qtbase prefix builds because we use NO_DEFAULT_PATH in find_package calls.
# It also handles the cross-compiling scenario where we need to adjust both the root path
# and prefixes, with the prefixes containing lib/cmake. This leverages the infrastructure
# previously added for Conan.
set(qt_additional_packages_prefixes "${qt_prefixes}")
# In a prefix build, look up all repo Config files in the install prefix,
# except for the current repo, which will look in the build dir (handled above).
if(QT_WILL_INSTALL)
list(APPEND qt_prefixes "${QT6_INSTALL_PREFIX}")
endif()
endif()
if(arg_CMAKE_DIR)
set("${arg_CMAKE_DIR}" "${qt_cmake_dir}" PARENT_SCOPE)
endif()
if(arg_PREFIXES_VAR)
set("${arg_PREFIXES_VAR}" "${qt_prefixes}" PARENT_SCOPE)
endif()
if(arg_ADDITIONAL_PACKAGES_PREFIXES_VAR)
set("${arg_ADDITIONAL_PACKAGES_PREFIXES_VAR}" "${qt_additional_packages_prefixes}"
PARENT_SCOPE)
endif()
endfunction()

View File

@ -307,7 +307,17 @@ function(_qt_internal_set_up_static_runtime_library target)
set_property(TARGET ${target} PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
elseif(MINGW)
target_link_options(${target} INTERFACE "LINKER:-Bstatic")
get_target_property(target_type ${target} TYPE)
if(target_type STREQUAL "EXECUTABLE")
set(link_option PRIVATE)
else()
set(link_option INTERFACE)
endif()
if(CLANG)
target_link_options(${target} ${link_option} "LINKER:-Bstatic")
else()
target_link_options(${target} ${link_option} "-static")
endif()
endif()
endif()
endfunction()

View File

@ -30,7 +30,7 @@ function(__qt_internal_query_emsdk_version emroot_path is_fatal out_var)
set(EXECUTE_COMMANDPATH "$ENV{EMSDK}/${emroot_path}/emcc")
endif()
file(TO_NATIVE_PATH "${EXECUTE_COMMANDPATH}" EXECUTE_COMMAND)
file(TO_CMAKE_PATH "${EXECUTE_COMMANDPATH}" EXECUTE_COMMAND)
execute_process(COMMAND ${EXECUTE_COMMAND} --version
OUTPUT_VARIABLE emOutput
OUTPUT_STRIP_TRAILING_WHITESPACE
@ -53,7 +53,7 @@ endfunction()
function(__qt_internal_get_emcc_recommended_version out_var)
# This version of Qt needs this version of emscripten.
set(QT_EMCC_RECOMMENDED_VERSION "3.1.25")
set(QT_EMCC_RECOMMENDED_VERSION "3.1.37")
set(${out_var} "${QT_EMCC_RECOMMENDED_VERSION}" PARENT_SCOPE)
endfunction()
@ -81,12 +81,16 @@ function(__qt_internal_get_qt_build_emsdk_version out_var)
endif()
if(EXISTS "${WASM_BUILD_DIR}/src/corelib/global/qconfig.h")
file(READ "${WASM_BUILD_DIR}/src/corelib/global/qconfig.h" ver)
else()
elseif(EXISTS "${WASM_BUILD_DIR}/include/QtCore/qconfig.h")
file(READ "${WASM_BUILD_DIR}/include/QtCore/qconfig.h" ver)
else()
message("qconfig.h not found, unable to determine Qt build Emscripten version")
endif()
if (ver)
string(REGEX MATCH "#define QT_EMCC_VERSION.\"[0-9]+\\.[0-9]+\\.[0-9]+\"" emOutput ${ver})
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" build_emcc_version "${emOutput}")
set(${out_var} "${build_emcc_version}" PARENT_SCOPE)
endif()
endfunction()
function(_qt_test_emscripten_version)

View File

@ -6,7 +6,7 @@
function(qt_internal_get_relative_rpath_base_token out_var)
if(APPLE)
set(rpath_rel_base "@loader_path")
elseif(LINUX OR SOLARIS OR FREEBSD OR HURD)
elseif(LINUX OR SOLARIS OR FREEBSD OR HURD OR OPENBSD)
set(rpath_rel_base "$ORIGIN")
else()
set(rpath_rel_base "NO_KNOWN_RPATH_REL_BASE")
@ -192,6 +192,33 @@ function(qt_apply_rpaths)
endif()
endfunction()
macro(qt_internal_set_default_rpath_settings)
# the default RPATH to be used when installing, but only if it's not a system directory
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
"${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBDIR}" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(_default_install_rpath "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBDIR}")
endif("${isSystemDir}" STREQUAL "-1")
# The default rpath settings for installed targets is empty.
# The rpaths will instead be computed for each target separately using qt_apply_rpaths().
# Additional rpaths can be passed via QT_EXTRA_RPATHS.
# By default this will include $ORIGIN / @loader_path, so the installation is relocatable.
# Bottom line: No need to pass anything to CMAKE_INSTALL_RPATH.
set(CMAKE_INSTALL_RPATH "" CACHE STRING "RPATH for installed binaries")
# By default, don't embed auto-determined RPATHs pointing to directories
# outside of the build tree, into the installed binaries.
# This ended up adding rpaths like ${CMAKE_INSTALL_PREFIX}/lib (or /Users/qt/work/install/lib
# into the official libraries created by the CI) into the non-qtbase libraries, plugins, etc.
#
# It should not be necessary, given that qt_apply_rpaths() already adds the necessary rpaths,
# either relocatable ones or absolute ones, depending on what the platform supports.
if(NOT QT_NO_DISABLE_CMAKE_INSTALL_RPATH_USE_LINK_PATH)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
endif()
endmacro()
# Overrides the CMAKE_STAGING_PREFIX in a subdirectory scope, to stop CMake from rewriting build
# rpaths to point into the original staging prefix, and thus breaking running executables from
# the build directory.

View File

@ -1,8 +1,6 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
include(CMakeFindBinUtils)
if(CMAKE_VERSION VERSION_LESS 3.17.0)
set(CMAKE_CURRENT_FUNCTION_LIST_DIR ${CMAKE_CURRENT_LIST_DIR})
endif()
@ -201,7 +199,11 @@ endfunction()
# Enable separate debug information for the given target
function(qt_enable_separate_debug_info target installDestination)
set(flags QT_EXECUTABLE)
if(APPLE)
set(options DSYM_OUTPUT_DIR)
else()
set(options)
endif()
set(multiopts ADDITIONAL_INSTALL_ARGS)
cmake_parse_arguments(arg "${flags}" "${options}" "${multiopts}" ${ARGN})
@ -248,12 +250,20 @@ function(qt_enable_separate_debug_info target installDestination)
get_target_property(is_framework ${target} FRAMEWORK)
if(is_framework)
qt_internal_get_framework_info(fw ${target})
set(debug_info_bundle_dir "$<TARGET_BUNDLE_DIR:${target}>.${debug_info_suffix}")
set(BUNDLE_ID ${fw_name})
else()
set(debug_info_bundle_dir "$<TARGET_FILE:${target}>.${debug_info_suffix}")
set(BUNDLE_ID ${target})
endif()
if (NOT "x${arg_DSYM_OUTPUT_DIR}" STREQUAL "x")
set(debug_info_bundle_dir "${arg_DSYM_OUTPUT_DIR}/${target}")
elseif(is_framework)
set(debug_info_bundle_dir "$<TARGET_BUNDLE_DIR:${target}>")
else()
set(debug_info_bundle_dir "$<TARGET_FILE:${target}>")
endif()
set(debug_info_bundle_dir "${debug_info_bundle_dir}.${debug_info_suffix}")
set(debug_info_contents_dir "${debug_info_bundle_dir}/Contents")
set(debug_info_target_dir "${debug_info_contents_dir}/Resources/DWARF")
configure_file(

View File

@ -1,386 +1,6 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
## Set a default build type if none was specified
# Set the QT_IS_BUILDING_QT variable so we can verify whether we are building
# Qt from source
set(QT_BUILDING_QT TRUE CACHE
TYPE STRING "When this is present and set to true, it signals that we are building Qt from source.")
# Pre-calculate the developer_build feature if it's set by the user via INPUT_developer_build
if(NOT FEATURE_developer_build AND INPUT_developer_build
AND NOT "${INPUT_developer_build}" STREQUAL "undefined")
set(FEATURE_developer_build ON)
endif()
# Pre-calculate the no_prefix feature if it's set by configure via INPUT_no_prefix.
# This needs to be done before qtbase/configure.cmake is processed.
if(NOT FEATURE_no_prefix AND INPUT_no_prefix
AND NOT "${INPUT_no_prefix}" STREQUAL "undefined")
set(FEATURE_no_prefix ON)
endif()
set(_default_build_type "Release")
if(FEATURE_developer_build)
set(_default_build_type "Debug")
endif()
function(qt_internal_set_message_log_level out_var)
# Decide whether output should be verbose or not.
# Default to verbose (--log-level=STATUS) in a developer-build and
# non-verbose (--log-level=NOTICE) otherwise.
# If a custom CMAKE_MESSAGE_LOG_LEVEL was specified, it takes priority.
# Passing an explicit --log-level=Foo has the highest priority.
if(NOT CMAKE_MESSAGE_LOG_LEVEL)
if(FEATURE_developer_build OR QT_FEATURE_developer_build)
set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")
else()
set(CMAKE_MESSAGE_LOG_LEVEL "NOTICE")
endif()
set(${out_var} "${CMAKE_MESSAGE_LOG_LEVEL}" PARENT_SCOPE)
endif()
endfunction()
qt_internal_set_message_log_level(CMAKE_MESSAGE_LOG_LEVEL)
# Reset content of extra build internal vars for each inclusion of QtSetup.
unset(QT_EXTRA_BUILD_INTERNALS_VARS)
# Save the global property in a variable to make it available to feature conditions.
get_property(QT_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${_default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${_default_build_type}" CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE
PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo") # Set the possible values for cmake-gui.
elseif(CMAKE_CONFIGURATION_TYPES)
message(STATUS "Building for multiple configurations: ${CMAKE_CONFIGURATION_TYPES}.")
message(STATUS "Main configuration is: ${QT_MULTI_CONFIG_FIRST_CONFIG}.")
if(CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE)
message(STATUS
"Default build configuration set to '${CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE}'.")
endif()
if(CMAKE_GENERATOR STREQUAL "Ninja")
message(FATAL_ERROR
"It's not possible to build multiple configurations with the single config Ninja "
"generator. Consider configuring with -G\"Ninja Multi-Config\" instead of -GNinja."
)
endif()
else()
message(STATUS "CMAKE_BUILD_TYPE was set to: '${CMAKE_BUILD_TYPE}'")
endif()
# Append a config-specific postfix to library names to ensure distinct names
# in a multi-config build.
# e.g. lib/libQt6DBus_relwithdebinfo.6.3.0.dylib
# Don't apply the postfix to the first encountered release-like config, so we have at least one
# config without a postifx.
if(QT_GENERATOR_IS_MULTI_CONFIG AND CMAKE_CONFIGURATION_TYPES)
set(__qt_setup_release_configs Release RelWithDebInfo MinSizeRel)
set(__qt_setup_found_first_release_config FALSE)
foreach(__qt_setup_config_type IN LISTS CMAKE_CONFIGURATION_TYPES)
# Skip assigning postfix for the first release-like config.
if(NOT __qt_setup_found_first_release_config
AND __qt_setup_config_type IN_LIST __qt_setup_release_configs)
set(__qt_setup_found_first_release_config TRUE)
continue()
endif()
string(TOLOWER "${__qt_setup_config_type}" __qt_setup_config_type_lower)
string(TOUPPER "${__qt_setup_config_type}" __qt_setup_config_type_upper)
set(CMAKE_${__qt_setup_config_type_upper}_POSTFIX "_${__qt_setup_config_type_lower}")
if(APPLE)
set(CMAKE_FRAMEWORK_MULTI_CONFIG_POSTFIX_${__qt_setup_config_type_upper}
"_${__qt_setup_config_type_lower}")
endif()
endforeach()
endif()
# Override the generic debug postfixes above with custom debug postfixes (even in a single config
# build) to follow the conventions we had since Qt 5.
# e.g. lib/libQt6DBus_debug.6.3.0.dylib
if(WIN32)
if(MINGW)
# On MinGW we don't have "d" suffix for debug libraries like on Linux,
# unless we're building debug and release libraries in one go.
if(QT_GENERATOR_IS_MULTI_CONFIG)
set(CMAKE_DEBUG_POSTFIX "d")
endif()
else()
set(CMAKE_DEBUG_POSTFIX "d")
endif()
elseif(APPLE)
set(CMAKE_DEBUG_POSTFIX "_debug")
set(CMAKE_FRAMEWORK_MULTI_CONFIG_POSTFIX_DEBUG "_debug")
endif()
## Position independent code:
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Does the linker support position independent code?
include(CheckPIESupported)
check_pie_supported()
# Do not relink dependent libraries when no header has changed:
set(CMAKE_LINK_DEPENDS_NO_SHARED ON)
# Detect non-prefix builds: either when the qtbase install prefix is set to the binary dir
# or when a developer build is explicitly enabled and no install prefix (or staging prefix)
# is specified.
# This detection only happens when building qtbase, and later is propagated via the generated
# QtBuildInternalsExtra.cmake file.
if (PROJECT_NAME STREQUAL "QtBase" AND NOT QT_BUILD_STANDALONE_TESTS)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
# Handle both FEATURE_ and QT_FEATURE_ cases when they are specified on the command line
# explicitly. It's possible for one to be set, but not the other, because
# qtbase/configure.cmake is not processed by this point.
if((FEATURE_developer_build
OR QT_FEATURE_developer_build
OR FEATURE_no_prefix
OR QT_FEATURE_no_prefix
)
AND NOT CMAKE_STAGING_PREFIX)
# Handle non-prefix builds by setting the CMake install prefix to point to qtbase's
# build dir. While building another repo (like qtsvg) the CMAKE_PREFIX_PATH should be
# set on the command line to point to the qtbase build dir.
set(__qt_default_prefix "${QtBase_BINARY_DIR}")
else()
if(CMAKE_HOST_WIN32)
set(__qt_default_prefix "C:/Qt/")
else()
set(__qt_default_prefix "/usr/local/")
endif()
string(APPEND __qt_default_prefix
"Qt-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
endif()
set(CMAKE_INSTALL_PREFIX ${__qt_default_prefix} CACHE PATH
"Install path prefix, prepended onto install directories." FORCE)
unset(__qt_default_prefix)
endif()
if(CMAKE_STAGING_PREFIX)
set(__qt_prefix "${CMAKE_STAGING_PREFIX}")
else()
set(__qt_prefix "${CMAKE_INSTALL_PREFIX}")
endif()
if(__qt_prefix STREQUAL QtBase_BINARY_DIR)
set(__qt_will_install_value OFF)
else()
set(__qt_will_install_value ON)
endif()
set(QT_WILL_INSTALL ${__qt_will_install_value} CACHE BOOL
"Boolean indicating if doing a Qt prefix build (vs non-prefix build)." FORCE)
unset(__qt_prefix)
unset(__qt_will_install_value)
endif()
# Specify the QT_SOURCE_TREE only when building qtbase. Needed by some tests when the tests are
# built as part of the project, and not standalone. For standalone tests, the value is set in
# QtBuildInternalsExtra.cmake.
if(PROJECT_NAME STREQUAL "QtBase")
set(QT_SOURCE_TREE "${QtBase_SOURCE_DIR}" CACHE PATH
"A path to the source tree of the previously configured QtBase project." FORCE)
endif()
# QT_INTERNAL_CONFIGURE_FROM_IDE is set to TRUE for the following known IDE applications:
# - Qt Creator, detected by QTC_RUN environment variable
# - CLion, detected by CLION_IDE environment variable
# - Visual Studio Code, detected by VSCODE_CLI environment variable
if("$ENV{QTC_RUN}" OR "$ENV{CLION_IDE}" OR "$ENV{VSCODE_CLI}")
set(QT_INTERNAL_CONFIGURE_FROM_IDE TRUE CACHE INTERNAL "Configuring Qt Project from IDE")
else()
set(QT_INTERNAL_CONFIGURE_FROM_IDE FALSE CACHE INTERNAL "Configuring Qt Project from IDE")
endif()
if(FEATURE_developer_build)
if(DEFINED QT_CMAKE_EXPORT_COMPILE_COMMANDS)
set(CMAKE_EXPORT_COMPILE_COMMANDS ${QT_CMAKE_EXPORT_COMPILE_COMMANDS})
else()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
endif()
set(_qt_build_tests_default ON)
set(__build_benchmarks ON)
# Tests are not built by default with qmake for iOS and friends, and thus the overall build
# tends to fail. Disable them by default when targeting uikit.
if(UIKIT OR ANDROID)
set(_qt_build_tests_default OFF)
endif()
# Disable benchmarks for single configuration generators which do not build
# with release configuration.
if (CMAKE_BUILD_TYPE AND CMAKE_BUILD_TYPE STREQUAL Debug)
set(__build_benchmarks OFF)
endif()
else()
set(_qt_build_tests_default OFF)
set(__build_benchmarks OFF)
endif()
# Build Benchmarks
option(QT_BUILD_BENCHMARKS "Build Qt Benchmarks" ${__build_benchmarks})
if(QT_BUILD_BENCHMARKS)
set(_qt_build_tests_default ON)
endif()
## Set up testing
option(QT_BUILD_TESTS "Build the testing tree." ${_qt_build_tests_default})
unset(_qt_build_tests_default)
option(QT_BUILD_TESTS_BY_DEFAULT "Should tests be built as part of the default 'all' target." ON)
if(QT_BUILD_STANDALONE_TESTS)
# BuildInternals might have set it to OFF on initial configuration. So force it to ON when
# building standalone tests.
set(QT_BUILD_TESTS ON CACHE BOOL "Build the testing tree." FORCE)
# Also force the tests to be built as part of the default build target.
set(QT_BUILD_TESTS_BY_DEFAULT ON CACHE BOOL
"Should tests be built as part of the default 'all' target." FORCE)
endif()
set(BUILD_TESTING ${QT_BUILD_TESTS} CACHE INTERNAL "")
if (WASM)
set(_qt_batch_tests ON)
else()
set(_qt_batch_tests OFF)
endif()
if(DEFINED INPUT_batch_tests)
if (${INPUT_batch_tests})
set(_qt_batch_tests ON)
else()
set(_qt_batch_tests OFF)
endif()
endif()
option(QT_BUILD_TESTS_BATCHED "Link all tests into a single binary." ${_qt_batch_tests})
if(QT_BUILD_TESTS AND QT_BUILD_TESTS_BATCHED AND CMAKE_VERSION VERSION_LESS "3.19")
message(FATAL_ERROR
"Test batching requires at least CMake 3.19, due to requiring per-source "
"TARGET_DIRECTORY assignments and DEFER calls.")
endif()
# QT_BUILD_TOOLS_WHEN_CROSSCOMPILING -> QT_FORCE_BUILD_TOOLS
# pre-6.4 compatibility flag (remove sometime in the future)
if(CMAKE_CROSSCOMPILING AND QT_BUILD_TOOLS_WHEN_CROSSCOMPILING)
message(WARNING "QT_BUILD_TOOLS_WHEN_CROSSCOMPILING is deprecated. "
"Please use QT_FORCE_BUILD_TOOLS instead.")
set(QT_FORCE_BUILD_TOOLS TRUE CACHE INTERNAL "" FORCE)
endif()
# When cross-building, we don't build tools by default. Sometimes this also covers Qt apps as well.
# Like in qttools/assistant/assistant.pro, load(qt_app), which is guarded by a qtNomakeTools() call.
set(_qt_build_tools_by_default_default ON)
if(CMAKE_CROSSCOMPILING AND NOT QT_FORCE_BUILD_TOOLS)
set(_qt_build_tools_by_default_default OFF)
endif()
option(QT_BUILD_TOOLS_BY_DEFAULT "Should tools be built as part of the default 'all' target."
"${_qt_build_tools_by_default_default}")
unset(_qt_build_tools_by_default_default)
include(CTest)
enable_testing()
option(QT_BUILD_EXAMPLES "Build Qt examples" OFF)
option(QT_BUILD_EXAMPLES_BY_DEFAULT "Should examples be built as part of the default 'all' target." ON)
# FIXME: Support prefix builds as well QTBUG-96232
if(QT_WILL_INSTALL)
set(_qt_build_examples_as_external OFF)
else()
set(_qt_build_examples_as_external ON)
endif()
option(QT_BUILD_EXAMPLES_AS_EXTERNAL "Should examples be built as ExternalProjects."
${_qt_build_examples_as_external})
unset(_qt_build_examples_as_external)
option(QT_BUILD_MANUAL_TESTS "Build Qt manual tests" OFF)
if(WASM)
option(QT_BUILD_MINIMAL_STATIC_TESTS "Build minimal subset of tests for static Qt builds" ON)
else()
option(QT_BUILD_MINIMAL_STATIC_TESTS "Build minimal subset of tests for static Qt builds" OFF)
endif()
option(QT_BUILD_MINIMAL_ANDROID_MULTI_ABI_TESTS
"Build minimal subset of tests for Android multi-ABI Qt builds" OFF)
## Path used to find host tools, either when cross-compiling or just when using the tools from
## a different host build.
set(QT_HOST_PATH "$ENV{QT_HOST_PATH}" CACHE PATH
"Installed Qt host directory path, used for cross compiling.")
## Android platform settings
if(ANDROID)
include(QtPlatformAndroid)
endif()
## qt_add_module and co.:
# Any new code should go into QtBuildHelpers.cmake or other appropriate files and then called in
# qt_internal_setup_build_and_global_variables().
include(QtBuild)
## Qt Feature support:
include(QtBuildInformation)
include(QtFeature)
## Compiler optimization flags:
include(QtCompilerOptimization)
## Compiler flags:
include(QtCompilerFlags)
qt_set_language_standards()
option(QT_USE_CCACHE "Enable the use of ccache")
if(QT_USE_CCACHE)
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
set(CMAKE_OBJC_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
set(CMAKE_OBJCXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
else()
message(FATAL_ERROR "Ccache use was requested, but the program was not found.")
endif()
endif()
option(QT_UNITY_BUILD "Enable unity (jumbo) build")
set(QT_UNITY_BUILD_BATCH_SIZE "32" CACHE STRING "Unity build batch size")
if(QT_UNITY_BUILD)
set(CMAKE_UNITY_BUILD ON)
set(CMAKE_UNITY_BUILD_BATCH_SIZE "${QT_UNITY_BUILD_BATCH_SIZE}")
endif()
option(QT_ALLOW_SYMLINK_IN_PATHS "Allows symlinks in paths." OFF)
# We need to clean up QT_FEATURE_*, but only once per configuration cycle
get_property(qt_feature_clean GLOBAL PROPERTY _qt_feature_clean)
if(NOT qt_feature_clean)
message(STATUS "Check for feature set changes")
set_property(GLOBAL PROPERTY _qt_feature_clean TRUE)
foreach(feature ${QT_KNOWN_FEATURES})
if(DEFINED "FEATURE_${feature}" AND
NOT "${QT_FEATURE_${feature}}" STREQUAL "${FEATURE_${feature}}")
message(" '${feature}' is changed from ${QT_FEATURE_${feature}} \
to ${FEATURE_${feature}}")
set(dirty_build TRUE)
endif()
unset("QT_FEATURE_${feature}" CACHE)
endforeach()
set(QT_KNOWN_FEATURES "" CACHE INTERNAL "" FORCE)
if(dirty_build)
set_property(GLOBAL PROPERTY _qt_dirty_build TRUE)
message(WARNING "Re-configuring in existing build folder. \
Some features will be re-evaluated automatically.")
endif()
endif()
if(NOT QT_BUILD_EXAMPLES)
# Disable deployment setup to avoid warnings about missing patchelf with CMake < 3.21.
set(QT_SKIP_SETUP_DEPLOYMENT ON)
endif()
option(QT_ALLOW_DOWNLOAD "Allows files to be downloaded when building Qt." OFF)

View File

@ -2,4 +2,4 @@
# bypassing the Qt6 Config file, aka find_package(Qt6SpecificFoo) repated x times. But it's not
# critical.
find_package(@INSTALL_CMAKE_NAMESPACE@ @main_qt_package_version@
REQUIRED COMPONENTS @QT_REPO_KNOWN_MODULES_STRING@)
COMPONENTS @QT_REPO_KNOWN_MODULES_STRING@)

View File

@ -61,13 +61,6 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
set(is_framework FALSE)
if(NOT is_interface_lib)
get_target_property(is_framework ${target} FRAMEWORK)
if(is_framework)
qt_internal_get_framework_info(fw ${target})
get_target_property(fw_output_base_dir ${target} LIBRARY_OUTPUT_DIRECTORY)
set(framework_args "-framework"
"-frameworkIncludeDir" "${fw_output_base_dir}/${fw_versioned_header_dir}"
)
endif()
endif()
qt_internal_get_qt_all_known_modules(known_modules)
@ -151,13 +144,27 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
-headers ${module_headers}
-stagingDir "${syncqt_staging_dir}"
-knownModules ${known_modules}
${framework_args}
${version_script_args}
)
list(JOIN syncqt_args "\n" syncqt_args_string)
set(syncqt_args_rsp "${binary_dir_real}/${target}_syncqt_args")
qt_configure_file(OUTPUT "${syncqt_args_rsp}" CONTENT "${syncqt_args_string}")
get_target_property(external_headers_dir ${target} _qt_external_headers_dir)
if(external_headers_dir)
if(NOT IS_ABSOLUTE "${external_headers_dir}")
get_filename_component(external_headers_dir "${external_headers_dir}" ABSOLUTE)
endif()
if(EXISTS "${external_headers_dir}")
set(external_headers_dir_copy_cmd
COMMAND
${CMAKE_COMMAND}
-E copy_directory
"${external_headers_dir}"
"${module_build_interface_include_dir}"
)
endif()
endif()
add_custom_command(
OUTPUT
${syncqt_outputs}
@ -165,6 +172,7 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
${QT_CMAKE_EXPORT_NAMESPACE}::syncqt
"@${syncqt_args_rsp}"
${build_time_syncqt_arguments}
${external_headers_dir_copy_cmd}
COMMAND
${CMAKE_COMMAND} -E touch "${syncqt_timestamp}"
DEPENDS
@ -176,7 +184,14 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
"Running syncqt.cpp for module: ${module}"
VERBATIM
)
set(add_sync_headers_to_all "")
if(is_interface_lib)
set(add_sync_headers_to_all ALL)
endif()
add_custom_target(${target}_sync_headers
${add_sync_headers_to_all}
DEPENDS
${syncqt_outputs}
)
@ -184,6 +199,9 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
set_target_properties(${target}
PROPERTIES _qt_internal_sync_headers_target ${target}_sync_headers)
if(is_3rd_party_library)
add_dependencies(thirdparty_sync_headers ${target}_sync_headers)
endif()
# This target is required when building docs, to make all header files and their aliases
# available for qdoc.
# ${target}_sync_headers is added as dependency to make sure that
@ -196,6 +214,7 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
COMMAND
${QT_CMAKE_EXPORT_NAMESPACE}::syncqt
"@${syncqt_all_args_rsp}"
${external_headers_dir_copy_cmd}
DEPENDS
${module_headers}
${syncqt_all_args_rsp}
@ -231,7 +250,7 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
# Run sync Qt first time at configure step to make all header files available for the code model
# of IDEs.
get_property(synced_modules GLOBAL PROPERTY _qt_synced_modules)
if(NOT "${module}" IN_LIST synced_modules)
if(NOT "${module}" IN_LIST synced_modules AND QT_SYNC_HEADERS_AT_CONFIGURE_TIME)
message(STATUS "Running syncqt.cpp for module: ${module}")
get_target_property(syncqt_location ${QT_CMAKE_EXPORT_NAMESPACE}::syncqt LOCATION)
execute_process(

View File

@ -16,6 +16,8 @@
# Custom compilation flags.
# EXTRA_LINKER_SCRIPT_CONTENT
# Extra content that should be appended to a target linker script. Applicable for ld only.
# EXTRA_LINKER_SCRIPT_EXPORTS
# Extra content that should be added to export section of the linker script.
# NO_PCH_SOURCES
# Skip the specified source files by PRECOMPILE_HEADERS feature.
function(qt_internal_extend_target target)
@ -51,7 +53,7 @@ function(qt_internal_extend_target target)
CONDITION
CONDITION_INDEPENDENT_SOURCES
COMPILE_FLAGS
NO_PCH_SOURCES
EXTRA_LINKER_SCRIPT_EXPORTS
)
cmake_parse_arguments(PARSE_ARGV 1 arg
@ -119,6 +121,10 @@ function(qt_internal_extend_target target)
# heuristic way of building the dependency tree between the _sync_headers targets of
# different Qt modules.
if(TARGET "${lib}")
get_target_property(is_private ${lib} _qt_is_private_module)
if(is_private)
get_target_property(lib ${lib} _qt_public_module_target_name)
endif()
set(out_genex "$<TARGET_PROPERTY:${lib},_qt_internal_sync_headers_target>")
set_property(TARGET ${target}
APPEND PROPERTY _qt_internal_sync_headers_deps "${out_genex}")
@ -257,6 +263,219 @@ function(qt_internal_extend_target target)
set_target_properties(${target} PROPERTIES
_qt_extra_linker_script_content "${arg_EXTRA_LINKER_SCRIPT_CONTENT}")
endif()
if(arg_EXTRA_LINKER_SCRIPT_EXPORTS)
set_target_properties(${target} PROPERTIES
_qt_extra_linker_script_exports "${arg_EXTRA_LINKER_SCRIPT_EXPORTS}")
endif()
endfunction()
# Given CMAKE_CONFIG and ALL_CMAKE_CONFIGS, determines if a directory suffix needs to be appended
# to each destination, and sets the computed install target destination arguments in OUT_VAR.
# Defaults used for each of the destination types, and can be configured per destination type.
function(qt_get_install_target_default_args)
cmake_parse_arguments(PARSE_ARGV 0 arg
""
"OUT_VAR;CMAKE_CONFIG;RUNTIME;LIBRARY;ARCHIVE;INCLUDES;BUNDLE"
"ALL_CMAKE_CONFIGS")
_qt_internal_validate_all_args_are_parsed(arg)
if(NOT arg_CMAKE_CONFIG)
message(FATAL_ERROR "No value given for CMAKE_CONFIG.")
endif()
if(NOT arg_ALL_CMAKE_CONFIGS)
message(FATAL_ERROR "No value given for ALL_CMAKE_CONFIGS.")
endif()
list(LENGTH arg_ALL_CMAKE_CONFIGS all_configs_count)
list(GET arg_ALL_CMAKE_CONFIGS 0 first_config)
set(suffix "")
if(all_configs_count GREATER 1 AND NOT arg_CMAKE_CONFIG STREQUAL first_config)
set(suffix "/${arg_CMAKE_CONFIG}")
endif()
set(runtime "${INSTALL_BINDIR}")
if(arg_RUNTIME)
set(runtime "${arg_RUNTIME}")
endif()
set(library "${INSTALL_LIBDIR}")
if(arg_LIBRARY)
set(library "${arg_LIBRARY}")
endif()
set(archive "${INSTALL_LIBDIR}")
if(arg_ARCHIVE)
set(archive "${arg_ARCHIVE}")
endif()
set(includes "${INSTALL_INCLUDEDIR}")
if(arg_INCLUDES)
set(includes "${arg_INCLUDES}")
endif()
set(bundle "${INSTALL_BINDIR}")
if(arg_BUNDLE)
set(bundle "${arg_BUNDLE}")
endif()
set(args
RUNTIME DESTINATION "${runtime}${suffix}"
LIBRARY DESTINATION "${library}${suffix}"
ARCHIVE DESTINATION "${archive}${suffix}" COMPONENT Devel
BUNDLE DESTINATION "${bundle}${suffix}"
INCLUDES DESTINATION "${includes}${suffix}")
set(${arg_OUT_VAR} "${args}" PARENT_SCOPE)
endfunction()
macro(qt_internal_setup_default_target_function_options)
set(__default_private_args
SOURCES
LIBRARIES
INCLUDE_DIRECTORIES
SYSTEM_INCLUDE_DIRECTORIES
DEFINES
DBUS_ADAPTOR_BASENAME
DBUS_ADAPTOR_FLAGS
DBUS_ADAPTOR_SOURCES
DBUS_INTERFACE_BASENAME
DBUS_INTERFACE_FLAGS
DBUS_INTERFACE_SOURCES
FEATURE_DEPENDENCIES
COMPILE_OPTIONS
LINK_OPTIONS
MOC_OPTIONS
DISABLE_AUTOGEN_TOOLS
ENABLE_AUTOGEN_TOOLS
PLUGIN_TYPES
NO_PCH_SOURCES
NO_UNITY_BUILD_SOURCES
)
set(__default_public_args
PUBLIC_LIBRARIES
PUBLIC_INCLUDE_DIRECTORIES
PUBLIC_DEFINES
PUBLIC_COMPILE_OPTIONS
PUBLIC_LINK_OPTIONS
)
set(__default_private_module_args
PRIVATE_MODULE_INTERFACE
)
set(__default_target_info_args
TARGET_VERSION
TARGET_PRODUCT
TARGET_DESCRIPTION
TARGET_COMPANY
TARGET_COPYRIGHT
)
# Collection of arguments so they can be shared across qt_internal_add_executable
# and qt_internal_add_test_helper.
set(__qt_internal_add_executable_optional_args
GUI
NO_INSTALL
EXCEPTIONS
DELAY_RC
DELAY_TARGET_INFO
QT_APP
NO_UNITY_BUILD
)
set(__qt_internal_add_executable_single_args
CORE_LIBRARY
OUTPUT_DIRECTORY
INSTALL_DIRECTORY
VERSION
${__default_target_info_args}
)
set(__qt_internal_add_executable_multi_args
${__default_private_args}
${__default_public_args}
)
endmacro()
# Append a config-specific postfix to library names to ensure distinct names
# in a multi-config build.
# e.g. lib/libQt6DBus_relwithdebinfo.6.3.0.dylib
# Don't apply the postfix to the first encountered release-like config, so we have at least one
# config without a postifx.
# If postfixes are set by user warn about potential issues.
function(qt_internal_setup_cmake_config_postfix)
# Collect configuration that require postfix in Qt library names.
if(QT_GENERATOR_IS_MULTI_CONFIG)
set(postfix_configurations ${CMAKE_CONFIGURATION_TYPES})
else()
set(postfix_configurations ${CMAKE_BUILD_TYPE})
# Set the default postfix to empty by default for single-config builds.
string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type_lower)
set(default_cmake_${build_type_lower}_postfix "")
endif()
# Override the generic debug postfixes above with custom debug postfixes (even in a single
# config build) to follow the conventions we had since Qt 5.
# e.g. lib/libQt6DBus_debug.6.3.0.dylib
if(WIN32)
if(MINGW)
# On MinGW we don't have "d" suffix for debug libraries like on Linux,
# unless we're building debug and release libraries in one go.
if(QT_GENERATOR_IS_MULTI_CONFIG)
set(default_cmake_debug_postfix "d")
endif()
else()
set(default_cmake_debug_postfix "d")
endif()
elseif(APPLE)
set(default_cmake_debug_postfix "_debug")
endif()
set(custom_postfix_vars "")
set(release_configs Release RelWithDebInfo MinSizeRel)
set(found_first_release_config FALSE)
foreach(config_type IN LISTS postfix_configurations)
string(TOLOWER "${config_type}" config_type_lower)
string(TOUPPER "${config_type}" config_type_upper)
set(postfix_var CMAKE_${config_type_upper}_POSTFIX)
# Skip assigning postfix for the first release-like config.
if(NOT found_first_release_config
AND config_type IN_LIST release_configs)
set(found_first_release_config TRUE)
if(NOT "${${postfix_var}}" STREQUAL "")
list(APPEND custom_postfix_vars ${postfix_var})
endif()
continue()
endif()
# Check if the default postfix is set, use '_<config_type_lower>' otherwise.
set(default_postfix_var
default_cmake_${config_type_lower}_postfix)
if(NOT DEFINED ${default_postfix_var})
set(${default_postfix_var}
"_${config_type_lower}")
endif()
# If postfix is set by user avoid changing it, but save postfix variable that has
# a non-default value for further warning.
if("${${postfix_var}}" STREQUAL "")
set(${postfix_var} "${${default_postfix_var}}" PARENT_SCOPE)
elseif(NOT "${${postfix_var}}" STREQUAL "${${default_postfix_var}}")
list(APPEND custom_postfix_vars ${postfix_var})
endif()
# Adjust framework postfixes accordingly
if(APPLE)
set(CMAKE_FRAMEWORK_MULTI_CONFIG_POSTFIX_${config_type_upper}
"${${postfix_var}}" PARENT_SCOPE)
endif()
endforeach()
if(custom_postfix_vars)
list(REMOVE_DUPLICATES custom_postfix_vars)
list(JOIN custom_postfix_vars ", " postfix_vars_string)
message(WARNING "You are using custom library postfixes: '${postfix_vars_string}' which are"
" considered experimental and are not officially supported by Qt."
" Expect unforeseen issues and user projects built with qmake to be broken."
)
endif()
endfunction()
function(qt_is_imported_target target out_var)
@ -589,9 +808,8 @@ endif()
endif()
# INTERFACE libraries don't have IMPORTED_LOCATION-like properties.
# OBJECT libraries have properties like IMPORTED_OBJECTS instead.
# Skip the rest of the processing for those.
if(target_type STREQUAL "INTERFACE_LIBRARY" OR target_type STREQUAL "OBJECT_LIBRARY")
if(target_type STREQUAL "INTERFACE_LIBRARY")
continue()
endif()
@ -649,6 +867,9 @@ endif()\n")
set(write_implib FALSE)
set(write_soname FALSE)
set(write_objects FALSE)
set(write_location TRUE)
if(target_type STREQUAL "SHARED_LIBRARY")
if(WIN32)
set(write_implib TRUE)
@ -657,24 +878,41 @@ endif()\n")
else()
set(write_soname TRUE)
endif()
elseif(target_type STREQUAL "OBJECT_LIBRARY")
set(write_objects TRUE)
set(write_location FALSE)
endif()
if(NOT "${uc_release_cfg}" STREQUAL "")
if(write_location)
string(APPEND content "get_target_property(_qt_imported_location ${full_target} IMPORTED_LOCATION_${uc_release_cfg})\n")
endif()
if(write_implib)
string(APPEND content "get_target_property(_qt_imported_implib ${full_target} IMPORTED_IMPLIB_${uc_release_cfg})\n")
endif()
if(write_soname)
string(APPEND content "get_target_property(_qt_imported_soname ${full_target} IMPORTED_SONAME_${uc_release_cfg})\n")
endif()
if(write_objects)
string(APPEND content "get_target_property(_qt_imported_objects ${full_target} IMPORTED_OBJECTS_${uc_release_cfg})\n")
# We generate CLR props as well, because that's what CMake generates for object
# libraries with CMake 3.27. They are usually empty strings though, aka "".
string(APPEND content "get_target_property(_qt_imported_clr ${full_target} IMPORTED_COMMON_LANGUAGE_RUNTIME_${uc_release_cfg})\n")
endif()
endif()
if(write_location)
string(APPEND content "get_target_property(_qt_imported_location_default ${full_target} IMPORTED_LOCATION_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
endif()
if(write_implib)
string(APPEND content "get_target_property(_qt_imported_implib_default ${full_target} IMPORTED_IMPLIB_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
endif()
if(write_soname)
string(APPEND content "get_target_property(_qt_imported_soname_default ${full_target} IMPORTED_SONAME_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
endif()
if(write_objects)
string(APPEND content "get_target_property(_qt_imported_objects_default ${full_target} IMPORTED_OBJECTS_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
string(APPEND content "get_target_property(_qt_imported_clr_default ${full_target} IMPORTED_COMMON_LANGUAGE_RUNTIME_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n")
endif()
foreach(config ${configurations_to_export} "")
string(TOUPPER "${config}" ucconfig)
if("${config}" STREQUAL "")
@ -689,10 +927,12 @@ endif()\n")
set_property(TARGET ${full_target} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${ucconfig})
")
endif()
if(write_location)
string(APPEND content "
if(_qt_imported_location${var_suffix})
set_property(TARGET ${full_target} PROPERTY IMPORTED_LOCATION${property_suffix} \"$\{_qt_imported_location${var_suffix}}\")
endif()")
endif()
if(write_implib)
string(APPEND content "
if(_qt_imported_implib${var_suffix})
@ -703,6 +943,16 @@ endif()")
string(APPEND content "
if(_qt_imported_soname${var_suffix})
set_property(TARGET ${full_target} PROPERTY IMPORTED_SONAME${property_suffix} \"$\{_qt_imported_soname${var_suffix}}\")
endif()")
endif()
if(write_objects)
string(APPEND content "
if(_qt_imported_objects${var_suffix})
set_property(TARGET ${full_target} PROPERTY IMPORTED_OBJECTS${property_suffix} \"$\{_qt_imported_objects${var_suffix}}\")
endif()")
string(APPEND content "
if(_qt_imported_clr${var_suffix})
set_property(TARGET ${full_target} PROPERTY IMPORTED_COMMON_LANGUAGE_RUNTIME${property_suffix} \"$\{_qt_imported_clr${var_suffix}}\")
endif()")
endif()
string(APPEND content "\n")
@ -715,6 +965,10 @@ unset(_qt_imported_location)
unset(_qt_imported_location_default)
unset(_qt_imported_soname)
unset(_qt_imported_soname_default)
unset(_qt_imported_objects)
unset(_qt_imported_objects_default)
unset(_qt_imported_clr)
unset(_qt_imported_clr_default)
unset(_qt_imported_configs)")
endif()
@ -1021,6 +1275,15 @@ endfunction()
# Needed to allow selectively applying certain flags via PlatformXInternal targets.
function(qt_internal_mark_as_internal_library target)
set_target_properties(${target} PROPERTIES _qt_is_internal_library TRUE)
qt_internal_mark_as_internal_target(${target})
endfunction()
# Marks a target with a property that it was built using the internal Qt API (qt_internal_*) as
# opposed to it being a user project library or executable(qt_add_*, etc).
#
# Needed to allow selectively applying certain flags via PlatformXInternal targets.
function(qt_internal_mark_as_internal_target target)
set_target_properties(${target} PROPERTIES _qt_is_internal_target TRUE)
endfunction()
# Marks a target with a property to skip it adding it as a dependency when building examples as

View File

@ -214,6 +214,7 @@ function(qt_internal_get_test_arg_definitions optional_args single_value_args mu
MANUAL
NO_BATCH
NO_INSTALL
BUNDLE_ANDROID_OPENSSL_LIBS
PARENT_SCOPE
)
set(${single_value_args}
@ -579,7 +580,28 @@ function(qt_internal_add_test name)
endif()
if (ANDROID)
qt_internal_android_test_arguments("${name}" test_executable extra_test_args)
# Pass 95% of the timeout to allow the test runner time to do any cleanup
# before being killed.
set(percentage "95")
qt_internal_get_android_test_timeout("${arg_TIMEOUT}" "${percentage}" android_timeout)
if(arg_BUNDLE_ANDROID_OPENSSL_LIBS)
if(NOT OPENSSL_ROOT_DIR)
message(WARNING "The argument BUNDLE_ANDROID_OPENSSL_LIBS is set "
"but OPENSSL_ROOT_DIR parameter is not set.")
else()
if(EXISTS "${OPENSSL_ROOT_DIR}/${CMAKE_ANDROID_ARCH_ABI}/libcrypto_3.so")
set_property(TARGET ${name} APPEND PROPERTY QT_ANDROID_EXTRA_LIBS
"${OPENSSL_ROOT_DIR}/${CMAKE_ANDROID_ARCH_ABI}/libcrypto_3.so"
"${OPENSSL_ROOT_DIR}/${CMAKE_ANDROID_ARCH_ABI}/libssl_3.so")
else()
message(STATUS "Test should bundle OpenSSL libraries but they are not found."
" This is fine if OpenSSL was built statically.")
endif()
endif()
endif()
qt_internal_android_test_arguments(
"${name}" "${android_timeout}" test_executable extra_test_args)
set(test_working_dir "${CMAKE_CURRENT_BINARY_DIR}")
elseif(QNX)
set(test_working_dir "")
@ -602,10 +624,13 @@ function(qt_internal_add_test name)
list(APPEND extra_test_args "--browser_args=\"--password-store=basic\"")
list(APPEND extra_test_args "--kill_exit")
# We always want to enable asyncify for tests, as some of them use exec
# Tests may require asyncify if they use exec(). Enable asyncify for
# batched tests since this is the configuration used on the CI system.
# Optimize for size (-Os), since asyncify tends to make the resulting
# binary very large
if(batch_current_test)
target_link_options("${name}" PRIVATE "SHELL:-s ASYNCIFY" "-Os")
endif()
# This tells cmake to run the tests with this script, since wasm files can't be
# executed directly
@ -670,6 +695,14 @@ function(qt_internal_add_test name)
set_tests_properties(${testname} PROPERTIES TIMEOUT ${arg_TIMEOUT})
endif()
if(ANDROID AND NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
# Set timeout signal and some time for androidtestrunner to do cleanup
set_tests_properties(${testname} PROPERTIES
TIMEOUT_SIGNAL_NAME "SIGINT"
TIMEOUT_SIGNAL_GRACE_PERIOD 10.0
)
endif()
# Add a ${target}/check makefile target, to more easily test one test.
set(test_config_options "")
@ -769,6 +802,35 @@ function(qt_internal_add_test name)
qt_internal_add_test_finalizers("${name}")
endfunction()
# Given an optional test timeout value (specified via qt_internal_add_test's TIMEOUT option)
# returns a percentage of the final timeout to be passed to the androidtestrunner executable.
#
# When the optional timeout is empty, default to cmake's defaults for getting the timeout.
function(qt_internal_get_android_test_timeout input_timeout percentage output_timeout_var)
set(actual_timeout "${input_timeout}")
if(NOT actual_timeout)
# we have coin ci timeout set use that to avoid having the emulator killed
# so we can at least get some logs from the android test runner.
set(coin_timeout $ENV{COIN_COMMAND_OUTPUT_TIMEOUT})
if(coin_timeout)
set(actual_timeout "${coin_timeout}")
elseif(DART_TESTING_TIMEOUT)
# Related: https://gitlab.kitware.com/cmake/cmake/-/issues/20450
set(actual_timeout "${DART_TESTING_TIMEOUT}")
elseif(CTEST_TEST_TIMEOUT)
set(actual_timeout "${CTEST_TEST_TIMEOUT}")
else()
# Default DART_TESTING_TIMEOUT is 25 minutes, specified in seconds
# https://github.com/Kitware/CMake/blob/master/Modules/CTest.cmake#L167C16-L167C16
set(actual_timeout "1500")
endif()
endif()
math(EXPR calculated_timeout "${actual_timeout} * ${percentage} / 100")
set(${output_timeout_var} "${calculated_timeout}" PARENT_SCOPE)
endfunction()
# This function adds test with specified NAME and wraps given test COMMAND with standalone cmake
# script.
#

View File

@ -18,7 +18,10 @@
# TRY_RUN
# On Windows, it creates a helper batch script that tests whether the tool can be executed
# successfully or not. If not, build halts and an error will be show, with tips on what
# might be cause, and how to fix it.
# might be cause, and how to fix it. TRY_RUN is disabled when cross-compiling.
# TRY_RUN_FLAGS
# Command line flags that are going to be passed to the tool for testing its correctness.
# If no flags were given, we default to `-v`.
#
# One-value Arguments:
# EXTRA_CMAKE_FILES
@ -52,6 +55,7 @@ function(qt_internal_add_tool target_name)
TOOLS_TARGET
INSTALL_DIR
CORE_LIBRARY
TRY_RUN_FLAGS
${__default_target_info_args})
set(multi_value_keywords
EXTRA_CMAKE_FILES
@ -110,6 +114,7 @@ function(qt_internal_add_tool target_name)
NO_INSTALL
${arg_NO_UNITY_BUILD}
SOURCES ${arg_SOURCES}
NO_PCH_SOURCES ${arg_NO_PCH_SOURCES}
NO_UNITY_BUILD_SOURCES ${arg_NO_UNITY_BUILD_SOURCES}
INCLUDE_DIRECTORIES
${arg_INCLUDE_DIRECTORIES}
@ -229,15 +234,18 @@ function(qt_internal_add_tool target_name)
qt_internal_apply_staging_prefix_build_rpath_workaround()
endif()
if(arg_TRY_RUN AND WIN32)
_qt_internal_add_try_run_post_build(${target_name})
if(arg_TRY_RUN AND WIN32 AND NOT CMAKE_CROSSCOMPILING)
if(NOT arg_TRY_RUN_FLAGS)
set(arg_TRY_RUN_FLAGS "-v")
endif()
_qt_internal_add_try_run_post_build("${target_name}" "${arg_TRY_RUN_FLAGS}")
endif()
qt_enable_separate_debug_info(${target_name} "${install_dir}" QT_EXECUTABLE)
qt_internal_install_pdb_files(${target_name} "${install_dir}")
endfunction()
function(_qt_internal_add_try_run_post_build target)
function(_qt_internal_add_try_run_post_build target try_run_flags)
qt_internal_get_upper_case_main_cmake_configuration(main_cmake_configuration)
get_target_property(target_out_dir ${target}
RUNTIME_OUTPUT_DIRECTORY_${main_cmake_configuration})
@ -251,7 +259,7 @@ function(_qt_internal_add_try_run_post_build target)
qt_configure_file(OUTPUT "${try_run_scripts_path}"
CONTENT "@echo off
${target_out_dir}/${target}.exe -h > nul 2>&1
${target_out_dir}/${target}.exe ${try_run_flags} > nul 2>&1
if \"%errorlevel%\" == \"-1073741515\" (
echo
@ -271,7 +279,8 @@ echo. > ${target_bin_dir}/${target}_try_run_passed"
DEPENDS
${target}
COMMAND
cmd /c ${try_run_scripts_path}
${CMAKE_COMMAND} -E env QT_COMMAND_LINE_PARSER_NO_GUI_MESSAGE_BOXES=1
${try_run_scripts_path}
COMMENT
"Testing ${target} by trying to run it."
VERBATIM
@ -340,7 +349,7 @@ function(qt_export_tools module_name)
string(REGEX REPLACE "_native$" "" tool_name ${tool_name})
endif()
set(extra_cmake_statements "${extra_cmake_statements}
if (NOT QT_NO_CREATE_TARGETS)
if(NOT QT_NO_CREATE_TARGETS AND ${INSTALL_CMAKE_NAMESPACE}${target}_FOUND)
__qt_internal_promote_target_to_global(${INSTALL_CMAKE_NAMESPACE}::${tool_name})
endif()
")

View File

@ -131,10 +131,12 @@ set(__qt_chainload_toolchain_file \"\${__qt_initially_configured_toolchain_file}
list(APPEND init_platform "
set(__qt_initial_c_compiler \"${CMAKE_C_COMPILER}\")
set(__qt_initial_cxx_compiler \"${CMAKE_CXX_COMPILER}\")
if(NOT DEFINED CMAKE_C_COMPILER AND EXISTS \"\${__qt_initial_c_compiler}\")
if(QT_USE_ORIGINAL_COMPILER AND NOT DEFINED CMAKE_C_COMPILER
AND EXISTS \"\${__qt_initial_c_compiler}\")
set(CMAKE_C_COMPILER \"\${__qt_initial_c_compiler}\" CACHE STRING \"\")
endif()
if(NOT DEFINED CMAKE_CXX_COMPILER AND EXISTS \"\${__qt_initial_cxx_compiler}\")
if(QT_USE_ORIGINAL_COMPILER AND NOT DEFINED CMAKE_CXX_COMPILER
AND EXISTS \"\${__qt_initial_cxx_compiler}\")
set(CMAKE_CXX_COMPILER \"\${__qt_initial_cxx_compiler}\" CACHE STRING \"\")
endif()")
endif()

View File

@ -53,15 +53,16 @@ function(qt_internal_create_wrapper_scripts)
qt_install(PROGRAMS "${QT_BUILD_DIR}/${INSTALL_BINDIR}/qt-cmake-create.bat"
DESTINATION "${INSTALL_BINDIR}")
endif()
# Provide a private convenience wrapper with options which should not be propagated via the
# Provide a private convenience wrapper with options that should not be propagated via the
# public qt-cmake wrapper e.g. CMAKE_GENERATOR.
# These options can not be set in a toolchain file, but only on the command line.
# These options should not be in the public wrapper, because a consumer of Qt might want to
# build their CMake app with the Unix Makefiles generator, while Qt should be built with the
# Ninja generator.
# The private wrapper is more conveient for building Qt itself, because a developer doesn't need
# to specify the same options for each qt module built.
set(__qt_cmake_extra "-G\"${CMAKE_GENERATOR}\"")
# Ninja generator. In a similar vein, we do want to use the same compiler for all Qt modules,
# but not for user applications.
# The private wrapper is more convenient for building Qt itself, because a developer doesn't
# need to specify the same options for each qt module built.
set(__qt_cmake_extra "-G\"${CMAKE_GENERATOR}\" -DQT_USE_ORIGINAL_COMPILER=ON")
if(generate_unix)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/bin/qt-cmake.in"
"${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/qt-cmake-private" @ONLY
@ -202,6 +203,22 @@ function(qt_internal_create_wrapper_scripts)
elseif(CMAKE_BUILD_TYPE)
set(__qt_configured_configs "${CMAKE_BUILD_TYPE}")
endif()
if(
# Skip stripping pure debug builds so it's easier to debug issues in CI VMs.
(NOT QT_FEATURE_debug_and_release
AND QT_FEATURE_debug
AND NOT QT_FEATURE_separate_debug_info)
# Skip stripping on MSVC because ${CMAKE_STRIP} might contain a MinGW strip binary
# and the breaks the linker version flag embedded in the binary and causes Qt Creator
# to mis-identify the Kit ABI.
OR MSVC
)
set(__qt_skip_strip_installed_artifacts TRUE)
else()
set(__qt_skip_strip_installed_artifacts FALSE)
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/bin/${__qt_cmake_install_script_name}.in"
"${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/${__qt_cmake_install_script_name}" @ONLY)
qt_install(FILES "${QT_BUILD_DIR}/${INSTALL_LIBEXECDIR}/${__qt_cmake_install_script_name}"
@ -209,6 +226,7 @@ function(qt_internal_create_wrapper_scripts)
qt_internal_create_qt_configure_tests_wrapper_script()
qt_internal_install_android_helper_scripts()
qt_internal_create_qt_configure_redo_script()
endfunction()
function(qt_internal_create_qt_configure_tests_wrapper_script)
@ -231,7 +249,7 @@ function(qt_internal_create_qt_configure_tests_wrapper_script)
# The script takes a path to the repo for which the standalone tests will be configured.
set(script_name "qt-internal-configure-tests")
set(script_passed_args "-DQT_BUILD_STANDALONE_TESTS=ON")
set(script_passed_args "-DQT_BUILD_STANDALONE_TESTS=ON -DQT_USE_ORIGINAL_COMPILER=ON")
file(RELATIVE_PATH relative_path_from_libexec_dir_to_bin_dir
${__qt_libexec_dir_absolute}
@ -262,3 +280,41 @@ function(qt_internal_install_android_helper_scripts)
qt_copy_or_install(PROGRAMS "${CMAKE_CURRENT_SOURCE_DIR}/util/android/android_emulator_launcher.sh"
DESTINATION "${destination}")
endfunction()
# Create a shell wrapper script to reconfigure Qt with the original configure arguments and
# any additional ones passed.
#
# Removes CMakeCache.txt and friends, either manually, or using CMake's --fresh.
#
# The script is created in the root of the build dir and is called config.redo
# It has the same contents as the 'config.status' script we created in qt 5.
function(qt_internal_create_qt_configure_redo_script)
set(input_script_name "qt-internal-config.redo")
set(input_script_path "${CMAKE_CURRENT_SOURCE_DIR}/libexec/${input_script_name}")
# We don't use QT_BUILD_DIR because we want the file in the root of the build dir in a top-level
# build.
set(output_script_name "config.redo")
set(output_path "${CMAKE_BINARY_DIR}/${output_script_name}")
if(QT_SUPERBUILD)
set(configure_script_path "${Qt_SOURCE_DIR}")
else()
set(configure_script_path "${QtBase_SOURCE_DIR}")
endif()
string(APPEND configure_script_path "/configure")
# Used in the file contents.
file(TO_NATIVE_PATH "${configure_script_path}" configure_path)
if(CMAKE_HOST_UNIX)
string(APPEND input_script_path ".in")
set(newline_style "LF")
else()
string(APPEND input_script_path ".bat.in")
string(APPEND output_path ".bat")
set(newline_style "CRLF")
endif()
configure_file("${input_script_path}" "${output_path}" @ONLY NEWLINE_STYLE ${newline_style})
endfunction()

View File

@ -19,8 +19,15 @@ cmake_minimum_required(VERSION 3.16)
# Read arguments from IN_FILE and separate them.
file(READ "${IN_FILE}" raw_args)
# To catch cases where the path ends with an `\`, e.g., `-prefix "C:\Path\"`
string(REPLACE "\\\"" "\"" raw_args "${raw_args}")
string(REPLACE ";" "[[;]]" raw_args "${raw_args}")
separate_arguments(args NATIVE_COMMAND "${raw_args}")
string(REPLACE "\;" ";" args "${args}")
string(REPLACE "[[;]]" "\;" args "${args}")
if(DEFINED REDO_FILE)
file(READ "${REDO_FILE}" raw_redo_args)
separate_arguments(redo_args NATIVE_COMMAND "${raw_redo_args}")
@ -65,7 +72,6 @@ if(DEFINED REDO_FILE)
else()
list(APPEND args "${redo_args}")
endif()
endif()
# Skip arguments if requested

View File

@ -77,6 +77,7 @@ The following table describes the mapping of configure options to CMake argument
| -unity-build-batch-size <int> | -DQT_UNITY_BUILD_BATCH_SIZE=<int> | |
| -warnings-are-errors | -DWARNINGS_ARE_ERRORS=ON | |
| -no-pkg-config | -DFEATURE_pkg_config=OFF | |
| -no-vcpkg | -DQT_USE_VCPKG=OFF | |
| -D <string> | -DQT_EXTRA_DEFINES=<string1>;<string2> | |
| -I <string> | -DQT_EXTRA_INCLUDEPATHS=<string1>;<string2> | |
| -L <string> | -DQT_EXTRA_LIBDIRS=<string1>;<string2> | |
@ -102,6 +103,7 @@ The following table describes the mapping of configure options to CMake argument
| | | build them separately, after configuration. |
| -nomake <part> | -DQT_BUILD_TESTS=OFF | A way to turn off tools explicitly is missing. |
| | -DQT_BUILD_EXAMPLES=OFF | |
| -install-examples-sources | -DQT_INSTALL_EXAMPLES_SOURCES=ON | |
| -no-gui | -DFEATURE_gui=OFF | |
| -no-widgets | -DFEATURE_widgets=OFF | |
| -no-dbus | -DFEATURE_dbus=OFF | |
@ -159,8 +161,8 @@ The following table describes the mapping of configure options to CMake argument
| -xkbcommon | -DFEATURE_xkbcommon=ON | |
| -gif | -DFEATURE_gif=ON | |
| -ico | -DFEATURE_ico=ON | |
| -libpng | -DFEATURE_libpng=ON | |
| -libjpeg | -DFEATURE_libjpeg=ON | |
| -libpng | -DFEATURE_png=ON | |
| -libjpeg | -DFEATURE_jpeg=ON | |
| -sql-<driver> | -DFEATURE_sql_<driver>=ON | |
| -sqlite [qt/system] | -DFEATURE_system_sqlite=OFF/ON | |
| -disable-deprecated-up-to <hex_version> | -DQT_DISABLE_DEPRECATED_UP_TO=<hex_version> | |

View File

@ -19,22 +19,22 @@
#endif
#if !defined(QT_BUILD_@module_define_infix@_LIB) && !defined(QT_STATIC)
/* outside library inline decl + defi */
/* outside library -> inline decl + defi */
/* static builds treat everything as part of the library, so they never inline */
# define QT_@module_define_infix@_INLINE_SINCE(major, minor) inline
# define QT_@module_define_infix@_INLINE_IMPL_SINCE(major, minor) 1
#elif defined(QT_@module_define_infix@_BUILD_REMOVED_API)
/* inside library, inside removed_api.cpp:
* keep deprecated API non-inline decl;
* remove deprecated API inline decl;
* keep deprecated API -> non-inline decl;
* remove deprecated API -> inline decl;
* definition is always available */
# define QT_@module_define_infix@_INLINE_SINCE(major, minor) \
QT_IF_DEPRECATED_SINCE(major, minor, inline, /* not inline */)
# define QT_@module_define_infix@_INLINE_IMPL_SINCE(major, minor) 1
#else
/* inside library, outside removed_api.cpp:
* keep deprecated API non-inline decl, no defi;
* remove deprecated API inline decl, defi */
* keep deprecated API -> non-inline decl, no defi;
* remove deprecated API -> inline decl, defi */
# define QT_@module_define_infix@_INLINE_SINCE(major, minor) \
QT_IF_DEPRECATED_SINCE(major, minor, inline, /* not inline */)
# define QT_@module_define_infix@_INLINE_IMPL_SINCE(major, minor) \

View File

@ -13,6 +13,11 @@ instructions:
variableValue: "{{.Env.COMMON_TEST_CMAKE_ARGS}}"
- !include "{{qt/qtbase}}/cmake_build_and_upload_test_artifacts.yaml"
disable_if:
condition: property
condition: or
conditions:
- condition: property
property: features
contains_value: DisableTests
- condition: property
property: features
contains_value: DoNotBuildTests

View File

@ -34,6 +34,11 @@ instructions:
variableValue: "{{.Env.COMMON_TARGET_TEST_CMAKE_ARGS}}"
- !include "{{qt/qtbase}}/cmake_build_and_upload_test_artifacts.yaml"
disable_if:
condition: property
condition: or
conditions:
- condition: property
property: features
contains_value: DisableTests
- condition: property
property: features
contains_value: DoNotBuildTests

View File

@ -61,6 +61,11 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
@ -73,6 +78,11 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
@ -123,6 +133,11 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
@ -135,6 +150,11 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]

View File

@ -47,6 +47,11 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
@ -59,6 +64,11 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
@ -124,6 +134,11 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
@ -136,6 +151,11 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]

View File

@ -41,6 +41,11 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
@ -53,6 +58,11 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]

View File

@ -51,9 +51,21 @@ instructions:
condition: property
property: host.os
equals_value: Windows
- type: EnvironmentVariable
variableName: CTEST_ARGS
variableValue: "-V"
# Keep the testrun quiet for ASAN testruns, since there are FAILs happening all over the place
disable_if:
condition: property
property: features
contains_value: UseAddressSanitizer
# Always print the output from a failing test, even when ctest is not in verbose mode
- type: EnvironmentVariable
variableName: CTEST_OUTPUT_ON_FAILURE
variableValue: "1"
- type: AppendToEnvironmentVariable
variableName: CTEST_ARGS
variableValue: " --stop-on-failure"
@ -61,12 +73,22 @@ instructions:
condition: property
property: features
contains_value: AbortTestingOnFirstFailure
# Enable CTest's JUnit XML summary only for recent versions
- type: AppendToEnvironmentVariable
variableName: CTEST_ARGS
variableValue: " --output-junit {{.Env.COIN_CTEST_RESULTSDIR}}{{.Env.CI_PATH_SEP}}test_summary.ctest_junit_xml"
enable_if:
condition: runtime
env_var: CMAKE_MIN_SUPPORTED_BIN_PATH
equals_value: null
- type: ExecuteCommand
command: "{{.Env.TESTS_ENV_PREFIX}} ctest {{.Env.CTEST_ARGS}}"
executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
ignoreExitCode: false
maxTimeInSeconds: 10800
maxTimeBetweenOutput: 900
maxTimeBetweenOutput: "{{.Env.COIN_COMMAND_OUTPUT_TIMEOUT}}"
userMessageOnFailure: >
Failed to run tests.

View File

@ -32,6 +32,28 @@ instructions:
condition: runtime
env_var: COIN_SKIP_DEBIAN
contains_value: "MISSING_DEBIAN_INST"
- type: ChangeDirectory
directory: "qt6-{{.Env.TESTED_MODULE_PLAIN_COIN}}"
disable_if:
condition: runtime
env_var: COIN_SKIP_DEBIAN
contains_value: "MISSING_DEBIAN_INST"
- type: ExecuteCommand
command: "git checkout {{.Env.DEBIAN_RULES_REF}}"
maxTimeInSeconds: 900
maxTimeBetweenOutput: 900
userMessageOnFailure: "Failed to checkout debian rules branch"
disable_if:
condition: or
conditions:
- condition: runtime
env_var: DEBIAN_RULES_REF
equals_value: null
- condition: runtime
env_var: COIN_SKIP_DEBIAN
contains_value: "MISSING_DEBIAN_INST"
- type: ChangeDirectory
directory: "{{.AgentWorkingDir}}"
- type: ExecuteCommand
command: "wget -q {{.CoinDownloadURL}}/{{.Env.MODULE_SOURCES_RELATIVE_STORAGE_PATH}}"
maxTimeInSeconds: 900
@ -81,15 +103,16 @@ instructions:
contains_value: "MISSING_DEBIAN_INST"
- type: ExecuteCommand
command: ["sbuild",
"--build-dep-resolver=aptitude",
"--build-dep-resolver=apt",
"-sAd", "tqtc-focal",
"-c", "{{.Env.COIN_SBUILD_CHROOT}}",
"--build-dir", "output/debian_packages",
"--extra-repository={{.Env.COIN_EXTRA_DEBIAN_REPO}}",
"--extra-package={{.Env.COIN_EXTRA_DEBIAN_PACKAGES}}",
"--extra-package={{.AgentWorkingDir}}/debian_packages/",
"--extra-package={{.AgentWorkingDir}}/output/debian_packages/",
"qt-{{.Env.QT_REPO_MODULE_VERSION}}-{{.Env.TESTED_MODULE_PLAIN_COIN}}-src_{{.Env.QT_REPO_MODULE_VERSION}}-1.dsc"]
maxTimeInSeconds: 18000
maxTimeBetweenOutput: 1800
maxTimeBetweenOutput: 18000
userMessageOnFailure: "Failed build debian packages"
disable_if:
condition: runtime

View File

@ -8,16 +8,26 @@ instructions:
variableName: COIN_SBUILD_CHROOT
variableValue: "stable-arm64-sbuild"
enable_if:
condition: property
condition: and
conditions:
- condition: runtime
env_var: COIN_SBUILD_CHROOT
equals_value: null
- condition: property
property: target.arch
equals_value: AARCH64
- type: EnvironmentVariable
variableName: COIN_SBUILD_CHROOT
variableValue: "stable-amd64-sbuild"
disable_if:
condition: property
enable_if:
condition: and
conditions:
- condition: runtime
env_var: COIN_SBUILD_CHROOT
equals_value: null
- condition: property
property: target.arch
equals_value: AARCH64
equals_value: X86_64
- type: EnvironmentVariable
variableName: COIN_SBUILD_DISTRO
variableValue: "arm64-focal"
@ -39,36 +49,9 @@ instructions:
enable_if:
condition: or
conditions:
- condition: runtime
env_var: TESTED_MODULE_COIN
equals_value: "qtquick3dphysics"
- condition: runtime
env_var: TESTED_MODULE_COIN
equals_value: "qtquickeffectmaker"
- condition: runtime
env_var: TESTED_MODULE_COIN
equals_value: "qtspeech"
- condition: runtime
env_var: TESTED_MODULE_COIN
equals_value: "qtlocation"
- condition: runtime
env_var: TESTED_MODULE_COIN
equals_value: "qthttpserver"
- condition: runtime
env_var: TESTED_MODULE_COIN
equals_value: "qtactiveqt"
- condition: runtime
env_var: TESTED_MODULE_COIN
equals_value: "qtcoap"
- condition: runtime
env_var: TESTED_MODULE_COIN
equals_value: "qtmqtt"
- condition: runtime
env_var: TESTED_MODULE_COIN
equals_value: "qtopcua"
- condition: runtime
env_var: TESTED_MODULE_COIN
equals_value: "qtgrpc"
- condition: runtime
env_var: TESTED_MODULE_COIN
equals_value: "qtqa"

View File

@ -123,9 +123,26 @@ instructions:
variableName: TARGET_ARCHITECTURE
variableValue: x64_arm64
enable_if:
condition: property
condition: and
conditions:
- condition: property
property: target.arch
equals_value: ARM64
- condition: property
property: host.arch
equals_value: X86_64
- type: EnvironmentVariable
variableName: TARGET_ARCHITECTURE
variableValue: arm64
enable_if:
condition: and
conditions:
- condition: property
property: target.arch
in_values: ["AARCH64", "ARM64"]
- condition: property
property: host
equals_property: target
- type: EnvironmentVariable
# HACK. Overwrite TARGET_ARCHITECTURE as we do not use standard MSVC cross
# compilation targets here. The target architecture will be detected by Qt.
@ -305,6 +322,14 @@ instructions:
condition: property
property: target.osVersion
in_values: [QEMU]
# This fixes an issue where binfmts is sometimes disabled on the test VMs
- type: ExecuteCommand
command: sudo update-binfmts --enable
userMessageOnFailure: "Failed to enable binfmts"
enable_if:
condition: property
property: target.osVersion
equals_value: QEMU
# Windows on Arm, cross-compilation with MSVC
- type: Group
@ -579,3 +604,18 @@ instructions:
condition: property
property: host.os
equals_value: Windows
- type: EnvironmentVariable
variableName: COIN_COMMAND_OUTPUT_TIMEOUT
variableValue: "900"
disable_if:
condition: property
property: features
contains_value: UseAddressSanitizer
- type: EnvironmentVariable
variableName: COIN_COMMAND_OUTPUT_TIMEOUT
variableValue: "10800"
enable_if:
condition: property
property: features
contains_value: UseAddressSanitizer

View File

@ -1,300 +0,0 @@
# Copyright (C) 2021 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
from conans import ConanFile, tools
from conans.errors import ConanInvalidConfiguration
import os
import re
import shutil
from functools import lru_cache
from pathlib import Path
from typing import Dict, Union
class QtConanError(Exception):
pass
def add_cmake_prefix_path(conan_file: ConanFile, dep: str) -> None:
if dep not in conan_file.deps_cpp_info.deps:
raise QtConanError("Unable to find dependency: {0}".format(dep))
dep_cpp_info = conan_file.deps_cpp_info[dep]
cmake_args_str = str(conan_file.options.get_safe("cmake_args_qtbase", default=""))
formatted_cmake_args_str = conan_file._shared.append_cmake_arg(
cmake_args_str, "CMAKE_PREFIX_PATH", dep_cpp_info.rootpath
)
print("Adjusted cmake args for qtbase build: {0}".format(formatted_cmake_args_str))
setattr(conan_file.options, "cmake_args_qtbase", formatted_cmake_args_str)
def _build_qtbase(conan_file: ConanFile):
# we call the Qt's configure(.bat) directly
script = Path("configure.bat") if tools.os_info.is_windows else Path("configure")
configure = Path(conan_file.build_folder).joinpath(script).resolve(strict=True)
if conan_file.options.get_safe("icu", default=False):
# we need to tell Qt build system where to find the ICU
add_cmake_prefix_path(conan_file, dep="icu")
# convert the Conan options to Qt configure(.bat) arguments
parser = conan_file._qt_option_parser
qt_configure_options = parser.convert_conan_options_to_qt_options(conan_file.options)
cmd = " ".join(
[str(configure), " ".join(qt_configure_options), "-prefix", conan_file.package_folder]
)
cmake_args = parser.get_cmake_args_for_configure(conan_file.options)
if cmake_args:
cmd += " -- {0}".format(" ".join(cmake_args))
conan_file.output.info("Calling: {0}".format(cmd))
conan_file.run(cmd)
cmd = " ".join(["cmake", "--build", ".", "--parallel"])
conan_file.output.info("Calling: {0}".format(cmd))
conan_file.run(cmd)
@lru_cache(maxsize=8)
def _parse_qt_version_by_key(key: str) -> str:
with open(Path(__file__).parent.resolve() / ".cmake.conf") as f:
m = re.search(fr'{key} .*"(.*)"', f.read())
return m.group(1) if m else ""
def _get_qt_minor_version() -> str:
return ".".join(_parse_qt_version_by_key("QT_REPO_MODULE_VERSION").split(".")[:2])
class QtBase(ConanFile):
name = "qtbase"
license = "LGPL-3.0, GPL-2.0+, Commercial Qt License Agreement"
author = "The Qt Company <https://www.qt.io/contact-us>"
url = "https://code.qt.io/cgit/qt/qtbase.git"
description = "Qt6 core framework libraries and tools."
topics = ("qt", "qt6")
settings = "os", "compiler", "arch", "build_type"
_qt_option_parser = None
options = None
default_options = None
exports_sources = "*", "!conan*.*"
# use commit ID as the RREV (recipe revision)
revision_mode = "scm"
python_requires = "qt-conan-common/{0}@qt/everywhere".format(_get_qt_minor_version())
short_paths = True
_shared = None
def init(self):
self._shared = self.python_requires["qt-conan-common"].module
self._qt_option_parser = self._shared.QtOptionParser(Path(__file__).parent.resolve())
self.options = self._qt_option_parser.get_qt_conan_options()
self.default_options = self._qt_option_parser.get_default_qt_conan_options()
def set_version(self):
# Executed during "conan export" i.e. in source tree
_ver = _parse_qt_version_by_key("QT_REPO_MODULE_VERSION")
_prerelease = _parse_qt_version_by_key("QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT")
self.version = _ver + "-" + _prerelease if _prerelease else _ver
def export(self):
self.copy("configure_options.json")
self.copy("configure_features.txt")
self.copy(".cmake.conf")
conf = self._shared.qt_sw_versions_config_folder() / self._shared.qt_sw_versions_config_name()
if not conf.exists():
# If using "conan export" outside Qt CI provisioned machines
print("Warning: Couldn't find '{0}'. 3rd party dependencies skipped.".format(conf))
else:
shutil.copy2(conf, self.export_folder)
def requirements(self):
# list of tuples, (package_name, fallback version)
optional_requirements = [("icu", "56.1")]
for req_name, req_ver_fallback in optional_requirements:
if self.options.get_safe(req_name, default=False) == True:
# Note! If this conan package is being "conan export"ed outside Qt CI and the
# sw versions .ini file is not present then it will fall-back to default version
ver = self._shared.parse_qt_sw_pkg_dependency(
config_folder=Path(self.recipe_folder),
package_name=req_name,
target_os=str(self.settings.os),
)
if not ver:
print(
"Warning: Using fallback version '{0}' for: {1}".format(
req_name, req_ver_fallback
)
)
ver = req_ver_fallback
requirement = "{0}/{1}@qt/everywhere".format(req_name, ver)
print("Setting 3rd party package requirement: {0}".format(requirement))
self.requires(requirement)
def _resolve_qt_host_path(self) -> Union[str, None]:
"""
Attempt to resolve QT_HOST_PATH.
When cross-building the user needs to pass 'qt_host_path' which is transformed to
QT_HOST_PATH later on. Resolve the exact path if possible.
Returns:
string: The resolved QT_HOST_PATH or None if unable to determine it.
"""
_host_p = self.options.get_safe("qt_host_path")
if _host_p:
return str(Path(os.path.expandvars(str(_host_p))).expanduser().resolve(strict=True))
else:
print("Warning: 'qt_host_path' option was not given in cross-build context")
return None
def configure(self):
if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "8":
raise ConanInvalidConfiguration("Qt6 does not support GCC before 8")
def _set_default_if_not_set(option_name: str, option_value: bool) -> None:
# let it fail if option name does not exist, it means the recipe is not up to date
if self.options.get_safe(option_name) in [None, "None"]:
setattr(self.options, option_name, option_value)
def _set_build_type(build_type: str) -> None:
if self.settings.build_type != build_type:
msg = (
"The build_type '{0}' changed to '{1}'. Please check your Settings and "
"Options. The used Qt options enforce '{2}' as a build_type. ".format(
self.settings.build_type, build_type, build_type
)
)
raise QtConanError(msg)
self.settings.build_type = build_type
def _check_mutually_exclusive_options(options: Dict[str, bool]) -> None:
if list(options.values()).count(True) > 1:
raise QtConanError(
"These Qt options are mutually exclusive: {0}"
". Choose only one of them and try again.".format(list(options.keys()))
)
default_options = ["shared", "gui", "widgets", "accessibility", "system_proxies", "ico"]
if self.settings.os == "Macos":
default_options.append("framework")
for item in default_options:
_set_default_if_not_set(item, True)
release = self.options.get_safe("release", default=False)
debug = self.options.get_safe("debug", default=False)
debug_and_release = self.options.get_safe("debug_and_release", default=False)
force_debug_info = self.options.get_safe("force_debug_info", default=False)
optimize_size = self.options.get_safe("optimize_size", default=False)
# these options are mutually exclusive options so do a sanity check
_check_mutually_exclusive_options(
{"release": release, "debug": debug, "debug_and_release": debug_and_release}
)
# Prioritize Qt's configure options over Settings.build_type
if debug_and_release == True:
# Qt build system will build both debug and release binaries
if force_debug_info == True:
_set_build_type("RelWithDebInfo")
else:
_set_build_type("Release")
elif release == True:
_check_mutually_exclusive_options(
{"force_debug_info": force_debug_info, "optimize_size": optimize_size}
)
if force_debug_info == True:
_set_build_type("RelWithDebInfo")
elif optimize_size == True:
_set_build_type("MinSizeRel")
else:
_set_build_type("Release")
elif debug == True:
_set_build_type("Debug")
else:
# As a fallback set the build type for Qt configure based on the 'build_type'
# defined in the conan build settings
build_type = self.settings.get_safe("build_type")
if build_type in [None, "None"]:
# set default that mirror the configure(.bat) default values
self.options.release = True
self.settings.build_type = "Release"
elif build_type == "Release":
self.options.release = True
elif build_type == "Debug":
self.options.debug = True
elif build_type == "RelWithDebInfo":
self.options.release = True
self.options.force_debug_info = True
elif build_type == "MinSizeRel":
self.options.release = True
self.options.optimize_size = True
else:
raise QtConanError("Unknown build_type: {0}".format(self.settings.build_type))
if self.settings.os == "Android":
if self.options.get_safe("android_sdk_version") == None:
cmake_args_qtbase = str(self.options.get_safe("cmake_args_qtbase"))
sdk_ver = self._shared.parse_android_sdk_version(cmake_args_qtbase)
if sdk_ver:
print("'android_sdk_version' not given. Deduced version: {0}".format(sdk_ver))
self.options.android_sdk_version = sdk_ver
else:
# TODO, for now we have no clean means to query the Android SDK version from
# Qt build system so we just exclude the "android_sdk" from the package_id.
print("Can't deduce 'android_sdk_version'. Excluding it from 'package_id'")
delattr(self.info.options, "android_sdk_version")
if self.options.get_safe("android_ndk_version") == None:
ndk_ver = str(self.options.get_safe("android_ndk"))
ndk_ver = self._shared.parse_android_ndk_version(Path(ndk_ver, strict=True))
print("'android_ndk_version' not given. Deduced version: {0}".format(ndk_ver))
self.options.android_ndk_version = ndk_ver
def build(self):
self._shared.build_env_wrap(self, _build_qtbase)
def package(self):
self._shared.call_install(self)
def package_info(self):
self._shared.package_info(self)
if tools.cross_building(conanfile=self):
qt_host_path = self._resolve_qt_host_path()
if qt_host_path:
self.env_info.QT_HOST_PATH.append(qt_host_path)
def package_id(self):
# https://docs.conan.io/en/latest/creating_packages/define_abi_compatibility.html
# The package_revision_mode() is too strict for Qt CI. This mode includes artifacts
# checksum in package_id which is problematic in Qt CI re-runs (re-run flaky
# build) which contain different build timestamps (cmake) which end up in library
# files -> different package_id.
self.info.requires.recipe_revision_mode()
# Enable 'qt-conan-common' updates on client side with $conan install .. --update
self.info.python_requires.recipe_revision_mode()
# Remove those configure(.bat) options which should not affect package_id.
# These point to local file system paths and in order to re-use pre-built
# binaries (by Qt CI) by others these should not affect the 'package_id'
# as those probably differ on each machine
rm_list = [
"sdk",
"qpa",
"translationsdir",
"headersclean",
"qt_host_path",
"android_sdk",
"android_ndk",
]
for item in rm_list:
if item in self.info.options:
delattr(self.info.options, item)
# filter also those cmake options that should not end up in the package_id
if hasattr(self.info.options, "cmake_args_qtbase"):
_filter = self._shared.filter_cmake_args_for_package_id
self.info.options.cmake_args_qtbase = _filter(self.info.options.cmake_args_qtbase)
def deploy(self):
self.copy("*") # copy from current package
self.copy_deps("*") # copy from dependencies

View File

@ -64,10 +64,13 @@ Build options:
-cmake-file-api ...... Let CMake store build metadata for loading the build
into an IDE. [no; yes if -developer-build]
-no-guess-compiler ... Do not guess the compiler from the target mkspec.
-release ............. Build Qt with debugging turned off [yes]
-debug ............... Build Qt with debugging turned on [no]
-debug-and-release ... Build two versions of Qt, with and without
debugging turned on [yes] (Apple and Windows only)
-release ............. Build Qt with optimizations and without debug
symbols [yes]
Note that -developer-build implies -debug unless
-release is also explicitly specified
-debug ............... Build Qt without optimizations and with debug symbols
[no]
-debug-and-release ... Build two versions of Qt in one build tree [no]
-optimize-debug ...... Enable debug-friendly optimizations in debug builds
[auto] (Not supported with MSVC or Clang toolchains)
-optimize-size ....... Optimize release builds for size instead of speed [no]
@ -80,7 +83,8 @@ Build options:
sections. [auto for static builds, otherwise no]
-force-asserts ....... Enable Q_ASSERT even in release builds [no]
-developer-build ..... Compile and link Qt for developing Qt itself
(exports for auto-tests, extra checks, etc.) [no]
(exports for auto-tests, extra checks, implies
-no-prefix, etc.) [no]
-shared .............. Build shared Qt libraries [yes] (no for UIKit)
-static .............. Build static Qt libraries [no] (yes for UIKit)
@ -159,6 +163,8 @@ Build environment:
-pkg-config .......... Use pkg-config [auto] (Unix only)
-vcpkg ............... Use vcpkg [yes]
-D <string> .......... Pass additional preprocessor define
-I <string> .......... Pass additional include path
-L <string> .......... Pass additional library path
@ -196,6 +202,9 @@ Component selection:
[default: libs and examples, also tools if not
cross-building, also tests if -developer-build]
-nomake <part> ....... Exclude <part> from the list of parts to be built.
-install-examples-sources Installs examples source code into the Qt prefix
Only possible when -make examples is also passed
[no]
-gui ................. Build the Qt GUI module and dependencies [yes]
-widgets ............. Build the Qt Widgets module and dependencies [yes]
-no-dbus ............. Do not build the Qt D-Bus module

4
configure vendored
View File

@ -136,7 +136,7 @@ determineOptFilePath "$@"
optfilepath=${outpathPrefix}/config.opt
opttmpfilepath=${outpathPrefix}/config.opt.in
redofilepath=${outpathPrefix}/config.redo
redofilepath=${outpathPrefix}/config.redo.last
redotmpfilepath=${outpathPrefix}/config.redo.in
fresh_requested_arg=
@ -163,6 +163,6 @@ if [ -n "$CFG_TOPLEVEL" ]; then
cd ..
fi
cmake "-DOPTFILE=${optfilepath}" ${top_level_arg} ${fresh_requested_arg} -P "${relpath}/cmake/QtProcessConfigureArgs.cmake"
exec cmake "-DOPTFILE=${optfilepath}" ${top_level_arg} ${fresh_requested_arg} -P "${relpath}/cmake/QtProcessConfigureArgs.cmake"
IFS=$SAVED_IFS

View File

@ -79,7 +79,7 @@ cd "%TOPQTDIR%"
rem Write config.opt if we're not currently -redo'ing
set OPT_FILE_PATH=%TOPQTDIR%\config.opt
set OPT_TMP_FILE_PATH=%TOPQTDIR%\config.opt.in
set REDO_FILE_PATH=%TOPQTDIR%\config.redo
set REDO_FILE_PATH=%TOPQTDIR%\config.redo.last
set REDO_TMP_FILE_PATH=%TOPQTDIR%\config.redo.in
set FRESH_REQUESTED_ARG=
if not defined redoing (

View File

@ -18,10 +18,15 @@ if(TARGET ZLIB::ZLIB)
set_property(TARGET ZLIB::ZLIB PROPERTY IMPORTED_GLOBAL TRUE)
endif()
# Look for Threads in the same scope as OpenSSL package, because OpenSSL sometimes depends on
# Threads (for static OpenSSL builds) and we want to promote the target to global in the same
# directory scope.
qt_find_package(Threads PROVIDED_TARGETS Threads::Threads)
qt_find_package(WrapOpenSSLHeaders PROVIDED_TARGETS WrapOpenSSLHeaders::WrapOpenSSLHeaders MODULE_NAME core)
# openssl_headers
# OPENSSL_VERSION_MAJOR is not defined for OpenSSL 1.1.1
qt_config_compile_test(opensslv11_headers
LABEL "opensslv11_headers"
LIBRARIES
WrapOpenSSLHeaders::WrapOpenSSLHeaders
CODE
@ -46,6 +51,7 @@ qt_find_package(WrapOpenSSL PROVIDED_TARGETS WrapOpenSSL::WrapOpenSSL MODULE_NAM
# openssl
# OPENSSL_VERSION_MAJOR is not defined for OpenSSL 1.1.1
qt_config_compile_test(opensslv11
LABEL "opensslv11"
LIBRARIES
WrapOpenSSL::WrapOpenSSL
CODE
@ -70,6 +76,7 @@ SSL_free(SSL_new(0));
# opensslv30
# openssl_headers
qt_config_compile_test(opensslv30_headers
LABEL "opensslv30_headers"
LIBRARIES
WrapOpenSSLHeaders::WrapOpenSSLHeaders
CODE
@ -87,6 +94,7 @@ int main(void)
}
")
qt_config_compile_test(opensslv30
LABEL "opensslv30"
LIBRARIES
WrapOpenSSL::WrapOpenSSL
CODE
@ -285,11 +293,13 @@ int main(void)
"# FIXME: qmake: ['TEMPLATE = lib', 'CONFIG += dll bsymbolic_functions', 'isEmpty(QMAKE_LFLAGS_BSYMBOLIC_FUNC): error("Nope")']
)
if(NOT MSVC AND NOT APPLE)
qt_config_compile_test("separate_debug_info"
LABEL "separate debug information support"
PROJECT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/config.tests/separate_debug_info"
)
endif()
# signaling_nan
qt_config_compile_test(signaling_nan
LABEL "Signaling NaN for doubles"
@ -487,7 +497,7 @@ qt_feature("developer-build" PRIVATE
LABEL "Developer build"
AUTODETECT OFF
)
qt_feature("no-prefix" PRIVATE
qt_feature("no-prefix"
LABEL "No prefix build"
AUTODETECT NOT QT_WILL_INSTALL
CONDITION NOT QT_WILL_INSTALL
@ -519,7 +529,7 @@ qt_feature_config("force_debug_info" QMAKE_PRIVATE_CONFIG)
qt_feature("separate_debug_info" PUBLIC
LABEL "Split off debug information"
AUTODETECT OFF
CONDITION ( QT_FEATURE_shared ) AND ( QT_FEATURE_debug OR QT_FEATURE_debug_and_release OR QT_FEATURE_force_debug_info ) AND ( APPLE OR TEST_separate_debug_info )
CONDITION ( QT_FEATURE_shared ) AND ( QT_FEATURE_debug OR QT_FEATURE_debug_and_release OR QT_FEATURE_force_debug_info ) AND ( MSVC OR APPLE OR TEST_separate_debug_info )
)
qt_feature_config("separate_debug_info" QMAKE_PUBLIC_QT_CONFIG)
qt_feature("appstore-compliant" PUBLIC
@ -964,16 +974,24 @@ qt_feature_config("gui" QMAKE_PUBLIC_QT_CONFIG
NEGATE)
qt_feature("network" PRIVATE
LABEL "Qt Network"
SECTION "Module"
PURPOSE "Provides the Qt Network module."
)
qt_feature("printsupport" PRIVATE
LABEL "Qt PrintSupport"
CONDITION QT_FEATURE_widgets
SECTION "Module"
PURPOSE "Provides the Qt PrintSupport module."
)
qt_feature("sql" PRIVATE
LABEL "Qt Sql"
SECTION "Module"
PURPOSE "Provides the Sql module."
)
qt_feature("testlib" PRIVATE
LABEL "Qt Testlib"
SECTION "Module"
PURPOSE "Provides the Qt Testlib module."
)
qt_feature("widgets" PRIVATE
LABEL "Qt Widgets"
@ -985,6 +1003,8 @@ qt_feature_config("widgets" QMAKE_PUBLIC_QT_CONFIG
NEGATE)
qt_feature("xml" PRIVATE
LABEL "Qt Xml"
SECTION "Module"
PURPOSE "Provides the Qt Xml module."
)
qt_feature("libudev" PRIVATE
LABEL "udev"
@ -1067,6 +1087,18 @@ qt_configure_add_summary_entry(
ARGS "ccache"
CONDITION UNIX
)
qt_configure_add_summary_entry(
TYPE "message" ARGS "Unity Build" MESSAGE "yes" CONDITION QT_UNITY_BUILD
)
qt_configure_add_summary_entry(
TYPE "message" ARGS "Unity Build" MESSAGE "no" CONDITION NOT QT_UNITY_BUILD
)
qt_configure_add_summary_entry(
TYPE "message"
ARGS "Unity Build Batch Size"
MESSAGE "${QT_UNITY_BUILD_BATCH_SIZE}"
CONDITION QT_UNITY_BUILD
)
qt_configure_add_summary_entry(
TYPE "firstAvailableFeature"
ARGS "use_bfd_linker use_gold_linker use_lld_linker use_mold_linker"
@ -1124,6 +1156,13 @@ qt_configure_add_summary_entry(ARGS "sanitize_fuzzer_no_link")
qt_configure_add_summary_entry(ARGS "sanitize_undefined")
qt_configure_end_summary_section() # end of "Sanitizers" section
qt_configure_add_summary_build_parts("Build parts")
if(QT_INSTALL_EXAMPLES_SOURCES)
set(_examples_sources_entry_message "yes")
else()
set(_examples_sources_entry_message "no")
endif()
qt_configure_add_summary_entry(ARGS "Install examples sources" TYPE "message"
MESSAGE "${_examples_sources_entry_message}")
qt_configure_add_summary_entry(
ARGS "appstore-compliant"
CONDITION APPLE OR ANDROID OR WIN32
@ -1143,6 +1182,14 @@ qt_configure_add_summary_entry(ARGS "xml")
qt_configure_end_summary_section() # end of "Qt modules and options" section
qt_configure_add_summary_section(NAME "Support enabled for")
qt_configure_add_summary_entry(ARGS "pkg-config")
if(QT_USE_VCPKG AND (DEFINED ENV{VCPKG_ROOT} OR VCPKG_TARGET_TRIPLET))
set(_vcpkg_entry_message "yes")
else()
set(_vcpkg_entry_message "no")
endif()
qt_configure_add_summary_entry(ARGS "Using vcpkg" TYPE "message" MESSAGE "${_vcpkg_entry_message}")
qt_configure_add_summary_entry(ARGS "libudev")
qt_configure_add_summary_entry(ARGS "openssl")
qt_configure_add_summary_entry(ARGS "openssl-linked")
@ -1237,3 +1284,11 @@ qt_extra_definition("QT_VERSION_PATCH" ${PROJECT_VERSION_PATCH} PUBLIC)
qt_extra_definition("QT_COPYRIGHT" \"${QT_COPYRIGHT}\" PRIVATE)
qt_extra_definition("QT_COPYRIGHT_YEAR" \"${QT_COPYRIGHT_YEAR}\" PRIVATE)
qt_configure_add_report_entry(
TYPE WARNING
MESSAGE "QT_ALLOW_SYMLINK_IN_PATHS is enabled. This is not recommended, and it may lead to unexpected issues.
E.g., When building QtWebEngine, enabling this option may result in build issues in certain platforms.
See https://bugreports.qt.io/browse/QTBUG-59769."
CONDITION QT_ALLOW_SYMLINK_IN_PATHS
)

View File

@ -7,7 +7,7 @@
qt_path_join(doc_install_dir ${QT_INSTALL_DIR} ${INSTALL_DOCDIR})
foreach(dir global config)
qt_copy_or_install(DIRECTORY ${dir} DESTINATION ${doc_install_dir})
if(QT_SUPERBUILD)
if(QT_SUPERBUILD OR "${PROJECT_NAME}" STREQUAL "QtBase")
qt_path_join(destination ${QtBase_BINARY_DIR} ${INSTALL_DOCDIR})
file(COPY ${dir} DESTINATION ${destination})
endif()

View File

@ -3,7 +3,7 @@
dita.metadata.default.author = Qt Project
dita.metadata.default.permissions = all
dita.metadata.default.publisher = Qt Project
dita.metadata.default.copyryear = 2023
dita.metadata.default.copyryear = 2024
dita.metadata.default.copyrholder = The Qt Company Ltd
dita.metadata.default.audience = programmer
@ -29,6 +29,5 @@ url = https://doc.qt.io/qt
defines += qt6
# Uncomment the following two lines to generate documentation marked as \internal
# alias.internal = disable
# macro.internal.HTML = "<span style="color:red">[internal]</span>"
# Require Qt modules to define qhp.projects
qhp = true

View File

@ -78,7 +78,7 @@ HTML.footer += \
" <ul id=\"menu-footer-submenu\" class=\"right clearfix\"><li id=\"menu-item-1795\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-1795\"><a title=\"Sign into your account.\" href=\"https://account.qt.io/login\">Sign In</a></li>\n" \
" <li id=\"menu-item-10375\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-10375\"><a href=\"mailto:feedback@theqtcompany.com?Subject=Feedback%20about%20doc.qt.io%20site\">Feedback</a></li>\n" \
" <li id=\"menu-item-1494\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1494\"><a href=\"http://qt.io/contact-us/\">Contact us</a></li>\n" \
" <li id=\"menu-item-4472\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-4472\"><a href=\"http://qt.io/about-us/\">© 2023 The Qt Company</a></li>\n" \
" <li id=\"menu-item-4472\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-4472\"><a href=\"http://qt.io/about-us/\">© 2024 The Qt Company</a></li>\n" \
" </ul>\n" \
"</div>\n" \
"</div>\n" \

View File

@ -8,13 +8,13 @@ HTML.footer = \
"</div>\n" \
"<div class=\"footer\">\n" \
" <p>\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2023 The Qt Company Ltd.\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2024 <span translate=\"no\">The Qt Company Ltd.</span>\n" \
" Documentation contributions included herein are the copyrights of\n" \
" their respective owners.<br/>" \
" The documentation provided herein is licensed under the terms of the" \
" <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU Free Documentation" \
" License version 1.3</a> as published by the Free Software Foundation.<br/>" \
" Qt and respective logos are <a href=\"https://doc.qt.io/qt/trademarks.html\">" \
" trademarks</a> of The Qt Company Ltd. in Finland and/or other countries\n" \
" License version 1.3</a> as published by the <span translate=\"no\">Free Software Foundation</span>.<br/>" \
" <span translate=\"no\">Qt</span> and respective logos are <a href=\"https://doc.qt.io/qt/trademarks.html\">" \
" trademarks</a> of <span translate=\"no\">The Qt Company Ltd.</span> in Finland and/or other countries\n" \
" worldwide. All other trademarks are property of their respective owners. </p>\n" \
"</div>\n" \

View File

@ -12,7 +12,7 @@
//! [findExecutable]
Finds the executable named \a executableName in the specified
\a paths, or the system paths if paths is empty.
\a paths, or the system paths if \a paths is empty.
On most operating systems the system path is determined by the
\c PATH environment variable. The directories where to search for
@ -21,8 +21,8 @@
twice, once with paths set and once with paths empty.
Symlinks are not resolved in order to preserve behavior for the
case of executables whose behavior depends on the name they are
invoked with
.
invoked with.
\note On Windows, the usual executable extensions (from the PATHEXT
environment variable) are automatically appended. For example, the
findExecutable("foo") call finds \c foo.exe or \c foo.bat if
@ -31,8 +31,8 @@
Returns the absolute file path to the executable, or an empty
string if not found.
If the given \n executableName is an absolute path pointing to
an executable its clean path is returned.
If the given \a executableName is an absolute path pointing to
an executable, its clean path is returned.
//! [findExecutable]

View File

@ -56,6 +56,19 @@ macro.endqdoc.HTML = "*/"
macro.borderedimage = "\\div {class=\"border\"} \\image \1\n\\enddiv"
macro.examplecategory = "\\meta category {\1}\n\\ingroup category \1"
macro.QDS = "Qt Design Studio"
macro.QDV = "Qt Design Viewer"
macro.QB = "Qt Bridge"
macro.QBPS = "Qt Bridge for Adobe Photoshop"
macro.QBXD = "Qt Bridge for Adobe XD"
macro.QBSK = "Qt Bridge for Sketch"
macro.QBF = "Qt Bridge for Figma"
macro.QMCU = "Qt for MCUs"
macro.QUL = "Qt Quick Ultralite"
macro.QtAA = "Qt for Android Automotive"
macro.QOI = "Qt Online Installer"
macro.QMT = "Qt Maintenance Tool"
macro.beginfloatleft.HTML = "<div style=\"float: left; margin-right: 2em\">"
macro.beginfloatright.HTML = "<div style=\"float: right; margin-left: 2em\">"
macro.endfloat.HTML = "</div>"
@ -111,3 +124,9 @@ macro.cmakepropertywebassemblyonly = "\\note This property is used only if targe
macro.cmakepropertyiosonly = "\\note This property is used only if targeting iOS."
macro.cmakevariableiosonly = "\\note This variable is used only if targeting iOS."
macro.qtpolicydeprecatedbehavior = "\\note The \\c{OLD} behavior of a policy is deprecated, and may be removed in the future."
#Appends the tech preview link to the brief sentence and adds to tech_preview
#group.
#Must be placed directly under a \brief command
macro.techpreview = "(Technical preview)\n\n\\meta status {Technical preview}\n\\ingroup tech_preview\n"

View File

@ -91,7 +91,6 @@ manifestmeta.android.names = "Qt3D/Qt 3D: Basic Shapes C++ Example" \
"QtQuickControls/Qt Quick Controls - Flat Style" \
"QtQuickControls/Qt Quick Controls - Gallery" \
"QtQuickControls/Qt Quick Controls - Imagine Style Example: Automotive" \
"QtQuickControls/Qt Quick Controls - Imagine Style Example: Music Player" \
"QtQuickControls/Qt Quick Controls - Text Editor" \
"QtQuickControls/Qt Quick Controls - Wearable Demo" \
"QtQuickDialogs/*" \
@ -109,7 +108,7 @@ manifestmeta.android.tags = android
manifestmeta.ios.names = "QtCore/Contiguous Cache Example" \
"QtCore/Mandelbrot Example" \
"QtCore/Queued Custom Type Example" \
"QtCore/Queued Custom Type" \
"QtGui/OpenGL Window Example" \
"QtGui/Raster Window Example" \
"QtNetwork/Network Chat Example" \
@ -153,7 +152,6 @@ manifestmeta.ios.names = "QtCore/Contiguous Cache Example" \
"QtWidgets/Border Layout Example" \
"QtWidgets/Flow Layout Example" \
"QtWidgets/Basic Drawing Example" \
"QtWidgets/Concentric Circles Example" \
"QtWidgets/Font Sampler Example" \
"QtWidgets/Gradients" \
"QtWidgets/Image Composition Example" \
@ -202,10 +200,9 @@ manifestmeta.ios.tags = ios
manifestmeta.thumbnail.attributes = "imageUrl:qthelp\://org.qt-project.qtdoc.$QT_VERSION_TAG/qtdoc/images/qt-codesample.png"
manifestmeta.thumbnail.names = "QtCore/Contiguous Cache Example" \
"QtCore/Custom Type Example" \
"QtCore/JSON Save Game Example" \
"QtCore/Semaphores Example" \
"QtCore/Wait Conditions Example" \
"QtCore/Saving and Loading a Game" \
"QtCore/Producer and Consumer using Semaphores" \
"QtCore/Producer and Consumer using Wait Conditions" \
"QtConcurrent/Word Count" \
"QtGui/Raster Window Example" \
"QtNetwork/Network Download*" \

View File

@ -5,7 +5,7 @@
HTML.footer = \
" </div>\n" \
" <p class=\"copy-notice\">\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2023 The Qt Company Ltd.\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2024 The Qt Company Ltd.\n" \
" Documentation contributions included herein are the copyrights of\n" \
" their respective owners. " \
" The documentation provided herein is licensed under the terms of the" \

View File

@ -574,7 +574,6 @@ ol.I > li {
.qmlextra {
padding-left: 5px;
float: right;
color: #254117;
}
.rightAlign {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Some files were not shown because too many files have changed in this diff Show More