Compare commits

...

1026 Commits
dev ... 6.6.0

Author SHA1 Message Date
Orkun Tokdemir
33f5e985e4 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
```

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>
(cherry picked from commit 5c9e77298583d9955c139765783e403314799f42)
2023-09-30 13:55:04 +00:00
Simo Fält
ce09de5809 CI: Fix resolving dependencies with Debian packages
Pick-to: dev 6.6
Change-Id: Ia057c34318daff2d63237d523803a4231a621da1
Reviewed-by: Toni Saario <toni.saario@qt.io>
2023-09-29 04:38:17 +00:00
Kai Köhne
ccd827be0a Move Calendar Widget Example to UI Components category
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>
(cherry picked from commit c66b3afc5afaf5904ff8cbd6c7d93242f7a55be5)
2023-09-27 17:44:32 +00:00
Giuseppe D'Angelo
2561158bc6 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
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6c504f2519e1180dbcfd77d5bb08b0db9742eeaa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 11aa3b13b3edb3c8731ad45b8e475c6037ffce97)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-25 12:04:42 +00:00
Tor Arne Vestbø
2f9c7ca99a 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.

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>
(cherry picked from commit 269903a5db40c2eeb7b7b2d5d1f98a119486e7c9)
2023-09-23 10:14:26 +00:00
Thiago Macieira
7ea0adfc3c 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.

Change-Id: Idd5e1bb52be047d7b4fffffd1750b547013cb336
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 9edb835904a7fa856e482464a7258019d5766333)
(cherry picked from commit 271d38b0ef6d9e77f7e242bf3081e0571662ae1c)
2023-09-22 23:04:50 -07:00
Thiago Macieira
b40c61c8eb 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.

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>
(cherry picked from commit 608b08f4d57369378b1a101b78a46202bd17c11a)
2023-09-22 23:04:45 -07:00
Kai Köhne
0523b06055 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
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>
(cherry picked from commit f5056133a35e15ea2d57beed2e015f8bf802cdfc)
2023-09-23 06:04:40 +00:00
Volker Hilsheimer
3277497b4e 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
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>
(cherry picked from commit ae8e356c5152cc62aef55edf50e41125c500cf44)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-23 06:04:36 +00:00
Nicholas Bennett
d958b85dac Docs: Update Links to Android Notifier Example
Added to the list of important links on the Android Platform home page.

Task-number: QTBUG-116780
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>
(cherry picked from commit 67a4f257b81d57dcb048ae0f0757d5f8702642bc)
2023-09-22 06:20:02 +00:00
Simo Fält
798175930e CI: Enable changing chroot in platform config for Debian packaging
Allows us to change the target distro through platform configuration
yaml file.

Pick-to: 6.6 dev
Task-number: QTBUG-117120
Change-Id: Ie6e99e4b25198e27491e6191f57d77dbbe3c4eed
Reviewed-by: Toni Saario <toni.saario@qt.io>
2023-09-21 08:16:42 +00:00
Allan Sandfeld Jensen
f041e662c9 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.

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>
(cherry picked from commit 224d4ad279ab37e99dc6194a2232e9f72ded6225)
2023-09-21 03:09:48 +00:00
Eskil Abrahamsen Blomfeldt
1ed82ab778 Upgrade Harfbuzz to version 8.2.0
Task-number: QTBUG-117136
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>
(cherry picked from commit 5a6d960018c1aac70c46ef1f9481b19ce01734df)
2023-09-21 03:09:35 +00:00
Marc Mutz
a7f4a61211 Update public suffix list
Version 1a4824549b093abc3077205ae5386ed57f73806d, fetched on
2023-09-20.

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>
(cherry picked from commit 99aa3d5ad1e6434edb8ef0a46975cef2fd62e4cb)
2023-09-21 03:09:30 +00:00
Marc Mutz
096a112259 [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.

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>
(cherry picked from commit 8e14e13c16249f5dd4f25e8d681498e393241493)
2023-09-20 07:03:32 +00:00
Andy Shaw
f504186992 SQLite: Update SQLite to v3.43.1
[ChangeLog][Third-Party Code] Updated SQLite to v3.43.1

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>
(cherry picked from commit 406ad89a3b97ab654b1ce833634eee167b954433)
2023-09-19 09:45:50 +00:00
Laszlo Agocs
1048b43ef9 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.

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>
(cherry picked from commit 69c0ca3174e2484a241dcfbeb786084eca3c57e5)
2023-09-19 04:59:26 +00:00
Eskil Abrahamsen Blomfeldt
6378d98e01 Upgrade to Freetype 2.13.2
Task-number: QTBUG-117135
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>
(cherry picked from commit b2e888dc812762df9054e982929a894a1fab8a52)
2023-09-19 04:59:03 +00:00
Joerg Bornemann
9b5c3d3104 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.

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>
(cherry picked from commit 5c9fa4ca4a88a83c8fab84ce22f68af9c0a6a893)
2023-09-18 12:59:57 +00:00
Tor Arne Vestbø
478c80fd07 qmake: Bump supported macOS SDK version to 14 (Sonoma)
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>
(cherry picked from commit ea4f2e854697be8333382b8d7a9e43db1ac0d431)
2023-09-18 12:59:52 +00:00
Thiago Macieira
93a3deb973 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
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>
(cherry picked from commit ef5f2322a767d84d31dc67d0be9a751054cf8b19)
2023-09-18 12:59:46 +00:00
Thiago Macieira
0641d4e5a7 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.

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>
(cherry picked from commit a5a1231d527a259d0dac9dc62e04a284fe183d51)
2023-09-18 12:59:42 +00:00
Alexey Edelev
60d41595f6 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.

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>
(cherry picked from commit 38f03c87193194dcb7aff1eb9c1fd63820839c0f)
2023-09-18 12:59:38 +00:00
Arno Rehn
34eaba13b8 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
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>
(cherry picked from commit a2792bac1a6077460f288a2b918449011f8c89d6)
2023-09-18 12:59:32 +00:00
Eskil Abrahamsen Blomfeldt
a66a3983f2 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
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>
(cherry picked from commit d0ed5db78160ce7c16d9fffef79aa11a7783e34e)
2023-09-15 13:23:29 +00:00
Marc Mutz
e8514f771d 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.

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>
(cherry picked from commit 321dcd1d1d0fdd627160e882c471529baa6cafa7)
2023-09-15 09:44:00 +00:00
Marc Mutz
a1a5e12ef9 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.

Change-Id: I1483f3af2ccec6038e1c780649f9ffe413bb59ef
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 104a0a9ecdb18d65e4d9075d87e8860c6c9d8335)
(cherry picked from commit 09bf722590ca6d1482b6605e1dffaaadd863e125)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-09-15 09:43:53 +00:00
Rym Bouabid
5866056a97 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
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>
(cherry picked from commit e9d400b4aae39519d11db95904800e0e36721188)
2023-09-15 06:03:47 +00:00
Rym Bouabid
20966dc53f 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
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>
(cherry picked from commit f67e649e9b47122c0cbe6bc03d82dfbca8a5949c)
2023-09-15 06:03:44 +00:00
Nicholas Bennett
5f30d04ccd 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
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-14 11:51:17 +00:00
Marc Mutz
6aba1ac852 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.

Change-Id: I44af8282399c78f6e74a8268af53bad64407ca34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 32f66f7008ce8fff1a8cdc5219978d1a61d4684c)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 297aa6d751fbbb034f14eb376fcbbdca358cc593)
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-09-14 11:51:12 +00:00
Marc Mutz
4dc4bf6cf1 Document q(u)int128 and QT_SUPPORTS_INT128
[ChangeLog][QtCore] Added qint128 and quint128 typedefs on platforms
that support them.

Fixes: QTBUG-116925
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>
(cherry picked from commit 66d10dc25369bfb03fb526ada97394b8af114039)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-14 11:51:09 +00:00
Eskil Abrahamsen Blomfeldt
9ac3eab056 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
Change-Id: I498478785dcd5ece954151f01f1a017828d6b8b8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit 6ab362a7eaddd6b2e867c9de6dbb04b7f760d005)
(cherry picked from commit 8055247fc0426d64e24d9d21a4ea5b984afa61fe)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2023-09-14 04:37:58 +00:00
Mårten Nordheim
bb4e6d908f 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
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>
(cherry picked from commit d4a6c81081db24812a043c44d0d3d683b53e7d80)
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
2023-09-13 21:24:23 +00: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
2120 changed files with 57022 additions and 42171 deletions

View File

@ -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

1
.gitignore vendored
View File

@ -333,3 +333,4 @@ CTestTestfile.cmake
cmake_install.cmake
*_autogen
tst_*.xml
CMakeUserPresets.json

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

@ -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()
find_package(PkgConfig QUIET)
pkg_check_modules(PC_Mimer QUIET mimctrl)
if(NOT DEFINED MimerSQL_ROOT)
find_package(PkgConfig QUIET)
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

@ -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

@ -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

@ -8,6 +8,9 @@
# Make sure to not run detection when building standalone tests, because the detection was already
# done when initially configuring qtbase.
# This needs to be here because QtAutoDetect loads before any other modules
option(QT_USE_VCPKG "Enable the use of vcpkg" ON)
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)
@ -161,7 +164,7 @@ function(qt_auto_detect_android)
endfunction()
function(qt_auto_detect_vcpkg)
if(DEFINED ENV{VCPKG_ROOT})
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)
@ -174,8 +177,8 @@ function(qt_auto_detect_vcpkg)
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 "")
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)
@ -241,7 +244,15 @@ function(qt_auto_detect_ios)
endfunction()
function(qt_auto_detect_cmake_config)
if(CMAKE_CONFIGURATION_TYPES)
# 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)
@ -478,6 +489,12 @@ function(qt_auto_detect_integrity)
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()
# Let CMake load our custom platform modules.
# CMake-provided platform modules take precedence.
if(NOT QT_AVOID_CUSTOM_PLATFORM_MODULES)
@ -497,3 +514,4 @@ qt_auto_detect_wasm()
qt_auto_detect_win32_arm()
qt_auto_detect_linux_x86()
qt_auto_detect_integrity()
qt_auto_detect_cmake_build_type()

View File

@ -216,6 +216,7 @@ qt_copy_or_install(FILES
cmake/QtAndroidHelpers.cmake
cmake/QtAppHelpers.cmake
cmake/QtAutogenHelpers.cmake
cmake/QtBaseTopLevelHelpers.cmake
cmake/QtBuild.cmake
cmake/QtBuildInformation.cmake
cmake/QtCMakeHelpers.cmake
@ -375,6 +376,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 +390,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,85 @@
# 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)
# TODO: Remove this variable once the top-level calls this function and
# qt_internal_qt_configure_end is not called in qt_print_build_instructions anymore.
set(__qt6_top_level_after_project_called TRUE)
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

@ -281,7 +281,7 @@ 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)
if(QT_64BIT)
list(APPEND QT_DEFAULT_PLATFORM_DEFINITIONS WIN64 _WIN64)
endif()
@ -467,6 +467,7 @@ set(__default_private_args
DISABLE_AUTOGEN_TOOLS
ENABLE_AUTOGEN_TOOLS
PLUGIN_TYPES
NO_PCH_SOURCES
NO_UNITY_BUILD_SOURCES
)
set(__default_public_args

View File

@ -111,6 +111,13 @@ from the build directory")
if(QT_SUPERBUILD)
qt_internal_save_previously_visited_packages()
endif()
# TODO: Abuse qt_print_build_instructions being called as the last command in a top-level build.
# Instead we should call this explicitly at the end of the top-level project.
# TODO: Remove this once the top-level calls qt_internal_top_level_setup_after_project
if(QT_SUPERBUILD AND NOT __qt6_top_level_after_project_called)
qt_internal_qt_configure_end()
endif()
endfunction()
function(qt_configure_print_summary_helper summary_reports force_show)

View File

@ -105,6 +105,30 @@ endif()
# build.
include(QtPlatformSupport)
# Set FEATURE_${feature} if INPUT_${feature} is set in certain circumstances.
#
# 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)
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
@ -131,15 +155,7 @@ function(qt_build_internals_disable_pkg_config_if_needed)
endif()
# Features won't have been evaluated yet if this is the first run, have to evaluate this here
if ((NOT DEFINED "FEATURE_pkg_config") AND (DEFINED "INPUT_pkg_config")
AND (NOT "${INPUT_pkg_config}" STREQUAL "undefined")
AND (NOT "${INPUT_pkg_config}" STREQUAL ""))
if(INPUT_pkg_config)
set(FEATURE_pkg_config ON)
else()
set(FEATURE_pkg_config OFF)
endif()
endif()
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.
@ -328,24 +344,19 @@ function(qt_build_internals_add_toplevel_targets)
endfunction()
macro(qt_enable_cmake_languages)
include(CheckLanguage)
set(__qt_required_language_list C CXX)
set(__qt_optional_language_list )
set(__qt_platform_required_language_list )
# https://gitlab.kitware.com/cmake/cmake/-/issues/20545
if(APPLE)
list(APPEND __qt_optional_language_list OBJC OBJCXX)
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_optional_language_list})
check_language(${__qt_lang})
if(CMAKE_${__qt_lang}_COMPILER)
enable_language(${__qt_lang})
endif()
foreach(__qt_lang ${__qt_platform_required_language_list})
enable_language(${__qt_lang})
endforeach()
# The qtbase call is handled in qtbase/CMakeLists.txt.
@ -454,6 +465,12 @@ macro(qt_build_repo_begin)
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
@ -589,9 +606,27 @@ macro(qt_build_repo_end)
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)
# Clean up stale feature input values.
qt_internal_clean_feature_inputs()
endfunction()
macro(qt_build_repo)
qt_build_repo_begin(${ARGN})
@ -999,19 +1034,118 @@ 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)
if(NOT QT_IS_EXTERNAL_EXAMPLES_BUILD)
qt_internal_add_example_in_tree(${ARGV})
else()
qt_internal_add_example_external_project(${ARGV})
# 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)
file(RELATIVE_PATH example_rel_path
"${QT_EXAMPLE_BASE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/${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
@ -1025,15 +1159,8 @@ 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.
# 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(CMAKE_INSTALL_PREFIX "${qt_example_install_prefix}/${example_rel_path}")
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.
@ -1043,7 +1170,7 @@ unset(CMAKE_INSTALL_PREFIX)
# 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} ${ARGN})
add_subdirectory(${subdir})
endfunction()
function(qt_internal_add_example_external_project subdir)
@ -1053,33 +1180,6 @@ function(qt_internal_add_example_external_project subdir)
cmake_parse_arguments(PARSE_ARGV 1 arg "${options}" "${singleOpts}" "${multiOpts}")
file(RELATIVE_PATH example_rel_path
"${QT_EXAMPLE_BASE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/${subdir}")
if(NOT arg_NAME)
set(arg_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(arg_NAME MATCHES "/")
string(REPLACE "/" ";" exploded_path "${arg_NAME}")
list(POP_BACK exploded_path last_dir)
if(NOT last_dir)
message(FATAL_ERROR "Example subdirectory must have a name.")
else()
set(arg_NAME "${last_dir}")
endif()
endif()
endif()
# Likely a clash with an example subdir ExternalProject custom target of the same name.
if(TARGET "${arg_NAME}")
string(SHA1 rel_path_hash "${example_rel_path}")
string(SUBSTRING "${rel_path_hash}" 0 4 short_hash)
set(arg_NAME "${arg_NAME}-${short_hash}")
endif()
# TODO: Fix example 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,
@ -1300,15 +1400,7 @@ function(qt_internal_add_example_external_project subdir)
# example_source_dir, use _qt_internal_override_example_install_dir_to_dot to ensure
# INSTALL_EXAMPLEDIR does not interfere.
# 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(example_install_prefix "${qt_example_install_prefix}/${example_rel_path}")
qt_internal_get_example_install_path(example_install_path "${subdir}")
set(ep_binary_dir "${CMAKE_CURRENT_BINARY_DIR}/${subdir}")
@ -1323,7 +1415,7 @@ function(qt_internal_add_example_external_project 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_prefix}"
INSTALL_DIR "${example_install_path}"
INSTALL_COMMAND ""
${build_command}
TEST_COMMAND ""
@ -1377,6 +1469,54 @@ execute_process(
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()
if ("STANDALONE_TEST" IN_LIST Qt6BuildInternals_FIND_COMPONENTS)
include(${CMAKE_CURRENT_LIST_DIR}/QtStandaloneTestTemplateProject/Main.cmake)
if (NOT PROJECT_VERSION_MAJOR)
@ -1442,12 +1582,6 @@ function(qt_internal_get_filename_path_mode out_var)
set(mode REALPATH)
if(APPLE AND QT_ALLOW_SYMLINK_IN_PATHS)
set(mode ABSOLUTE)
message(WARNING
"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."
)
endif()
set(${out_var} ${mode} PARENT_SCOPE)
endfunction()

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

@ -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

@ -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,7 @@ function(qt_internal_add_configure_time_executable target)
)
set(should_build_at_configure_time TRUE)
if(EXISTS "${target_binary_path}")
if(EXISTS "${target_binary_path}" AND EXISTS "${timestamp_file}")
set(last_ts 0)
foreach(source IN LISTS sources)
file(TIMESTAMP "${source}" ts "%s")
@ -462,6 +465,29 @@ function(qt_internal_add_configure_time_executable target)
set(cmake_flags_arg CMAKE_FLAGS "${arg_CMAKE_FLAGS}")
endif()
configure_file("${template}" "${target_binary_dir}/CMakeLists.txt" @ONLY)
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()
try_compile(result
"${target_binary_dir}"
"${target_binary_dir}"

View File

@ -177,15 +177,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 +244,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)
set(result "${computed}")
message(WARNING "Reset FEATURE_${feature} value to ${result}, because it doesn't \
meet its condition after reconfiguration.")
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
"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 +329,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 +372,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 +410,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 +428,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 +442,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 +868,49 @@ 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}")
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()
function(qt_internal_clean_feature_inputs)
foreach(feature IN LISTS QT_KNOWN_FEATURES)
# Unset the INPUT_foo cache variables after they were used in feature evaluation, to
# ensure stale values don't influence features upon reconfiguration 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.
unset(INPUT_${feature} CACHE)
endforeach()
endfunction()
function(qt_config_compile_test name)
if(DEFINED "TEST_${name}")
return()

View File

@ -80,6 +80,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 +122,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 +144,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 +173,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 +1021,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

@ -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()

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

@ -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

@ -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.
get_filename_component(MODULE_ROOT "." REALPATH BASE_DIR "${MODULE_ROOT}")
# 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")
@ -827,7 +858,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 +911,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 +933,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,13 +283,15 @@ function(_qt_internal_get_default_apple_bundle_identifier target out_var)
string(APPEND prefix ".${infix}")
endif()
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 \
identifier. Please set up an organization prefix by creating a new project within \
Xcode, or consider providing a custom bundle identifier by specifying the \
MACOSX_BUNDLE_GUI_IDENTIFIER or XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER property."
)
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 \
identifier. Please set up an organization prefix by creating a new project within \
Xcode, or consider providing a custom bundle identifier by specifying the \
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
@ -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

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

@ -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()
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)
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")

View File

@ -201,7 +201,11 @@ endfunction()
# Enable separate debug information for the given target
function(qt_enable_separate_debug_info target installDestination)
set(flags QT_EXECUTABLE)
set(options)
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 +252,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

@ -5,21 +5,17 @@
# 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.")
set(QT_BUILDING_QT TRUE CACHE BOOL
"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 developer_build feature if it's set by the user via the INPUT_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.
if(NOT FEATURE_no_prefix AND INPUT_no_prefix
AND NOT "${INPUT_no_prefix}" STREQUAL "undefined")
set(FEATURE_no_prefix ON)
endif()
qt_internal_compute_feature_value_from_possible_input(no_prefix)
set(_default_build_type "Release")
if(FEATURE_developer_build)
@ -49,7 +45,20 @@ 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)
# 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
@ -193,6 +202,8 @@ else()
set(QT_INTERNAL_CONFIGURE_FROM_IDE FALSE CACHE INTERNAL "Configuring Qt Project from IDE")
endif()
set(_qt_sync_headers_at_configure_time_default ${QT_INTERNAL_CONFIGURE_FROM_IDE})
if(FEATURE_developer_build)
if(DEFINED QT_CMAKE_EXPORT_COMPILE_COMMANDS)
set(CMAKE_EXPORT_COMPILE_COMMANDS ${QT_CMAKE_EXPORT_COMPILE_COMMANDS})
@ -213,11 +224,26 @@ if(FEATURE_developer_build)
if (CMAKE_BUILD_TYPE AND CMAKE_BUILD_TYPE STREQUAL Debug)
set(__build_benchmarks OFF)
endif()
# 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)
else()
set(_qt_build_tests_default OFF)
set(__build_benchmarks OFF)
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()
# Build Benchmarks
option(QT_BUILD_BENCHMARKS "Build Qt Benchmarks" ${__build_benchmarks})
if(QT_BUILD_BENCHMARKS)
@ -285,6 +311,9 @@ 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)
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)
@ -354,29 +383,7 @@ 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()
qt_internal_detect_dirty_features()
if(NOT QT_BUILD_EXAMPLES)
# Disable deployment setup to avoid warnings about missing patchelf with CMake < 3.21.

View File

@ -158,6 +158,21 @@ function(qt_internal_target_sync_headers target module_headers module_headers_ge
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 +180,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 +192,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 +207,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 +222,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 +258,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

@ -51,7 +51,6 @@ function(qt_internal_extend_target target)
CONDITION
CONDITION_INDEPENDENT_SOURCES
COMPILE_FLAGS
NO_PCH_SOURCES
)
cmake_parse_arguments(PARSE_ARGV 1 arg
@ -119,6 +118,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}")
@ -1021,6 +1024,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,6 +580,21 @@ function(qt_internal_add_test name)
endif()
if (ANDROID)
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}" test_executable extra_test_args)
set(test_working_dir "${CMAKE_CURRENT_BINARY_DIR}")
elseif(QNX)
@ -602,10 +618,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
target_link_options("${name}" PRIVATE "SHELL:-s ASYNCIFY" "-Os")
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

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

@ -129,14 +129,14 @@ set(__qt_chainload_toolchain_file \"\${__qt_initially_configured_toolchain_file}
endif()
if(__qt_embed_toolchain_compilers)
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}\")
set(CMAKE_C_COMPILER \"\${__qt_initial_c_compiler}\" CACHE STRING \"\")
endif()
if(NOT DEFINED CMAKE_CXX_COMPILER AND EXISTS \"\${__qt_initial_cxx_compiler}\")
set(CMAKE_CXX_COMPILER \"\${__qt_initial_cxx_compiler}\" CACHE STRING \"\")
endif()")
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}\")
set(CMAKE_C_COMPILER \"\${__qt_initial_c_compiler}\" CACHE STRING \"\")
endif()
if(NOT DEFINED CMAKE_CXX_COMPILER AND EXISTS \"\${__qt_initial_cxx_compiler}\")
set(CMAKE_CXX_COMPILER \"\${__qt_initial_cxx_compiler}\" CACHE STRING \"\")
endif()")
endif()
unset(init_additional_used_variables)

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 | |

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
property: features
contains_value: DisableTests
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
property: features
contains_value: DisableTests
condition: or
conditions:
- condition: property
property: features
contains_value: DisableTests
- condition: property
property: features
contains_value: DoNotBuildTests

View File

@ -61,9 +61,14 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- type: EnvironmentVariable
variableName: COIN_CMAKE_INSTALL_LIBEXEC_DIR
variableValue: "{{.InstallDir}}{{.Env.CI_PATH_SEP}}host{{.Env.CI_PATH_SEP}}bin"
@ -73,9 +78,14 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- !include "{{qt/qtbase}}/call_host_install.yaml"
- type: EnvironmentVariable
variableName: DESTDIR
@ -123,9 +133,14 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- type: EnvironmentVariable
variableName: COIN_CMAKE_INSTALL_LIBEXEC_DIR
variableValue: "{{.InstallDir}}{{.Env.CI_PATH_SEP}}target{{.Env.CI_PATH_SEP}}bin"
@ -135,9 +150,14 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- !include "{{qt/qtbase}}/call_target_install.yaml"
- type: EnvironmentVariable
variableName: DESTDIR

View File

@ -47,9 +47,14 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- type: EnvironmentVariable
variableName: COIN_CMAKE_BUILD_LIBEXEC_DIR
variableValue: "{{.BuildDir}}{{.Env.CI_PATH_SEP}}bin"
@ -59,9 +64,14 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- !include "{{qt/qtbase}}/call_host_install.yaml"
- type: EnvironmentVariable
variableName: DESTDIR
@ -124,9 +134,14 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- type: EnvironmentVariable
variableName: COIN_CMAKE_BUILD_LIBEXEC_DIR
variableValue: "{{.Env.COIN_CMAKE_BUILD_DIR}}{{.Env.CI_PATH_SEP}}bin"
@ -136,9 +151,14 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- !include "{{qt/qtbase}}/call_target_install.yaml"
- type: EnvironmentVariable
variableName: DESTDIR

View File

@ -41,9 +41,14 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- type: EnvironmentVariable
variableName: COIN_CMAKE_BUILD_LIBEXEC_DIR
variableValue: "{{.Env.COIN_CMAKE_BUILD_DIR}}{{.Env.CI_PATH_SEP}}bin"
@ -53,9 +58,14 @@ instructions:
- condition: property
property: host.os
equals_value: Windows
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- condition: and
conditions:
- condition: property
property: target.os
not_equals_value: QNX
- condition: property
property: target.osVersion
not_in_values: [WebAssembly, Android_ANY]
- !include "{{qt/qtbase}}/call_host_install.yaml"
- type: EnvironmentVariable
variableName: DESTDIR

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
property: target.arch
equals_value: AARCH64
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
property: target.arch
equals_value: AARCH64
enable_if:
condition: and
conditions:
- condition: runtime
env_var: COIN_SBUILD_CHROOT
equals_value: null
- condition: property
property: target.arch
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

@ -305,6 +305,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

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

View File

@ -22,6 +22,7 @@ qt_find_package(WrapOpenSSLHeaders PROVIDED_TARGETS WrapOpenSSLHeaders::WrapOpen
# 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 +47,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 +72,7 @@ SSL_free(SSL_new(0));
# opensslv30
# openssl_headers
qt_config_compile_test(opensslv30_headers
LABEL "opensslv30_headers"
LIBRARIES
WrapOpenSSLHeaders::WrapOpenSSLHeaders
CODE
@ -87,6 +90,7 @@ int main(void)
}
")
qt_config_compile_test(opensslv30
LABEL "opensslv30"
LIBRARIES
WrapOpenSSL::WrapOpenSSL
CODE
@ -285,11 +289,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()
qt_config_compile_test("separate_debug_info"
LABEL "separate debug information support"
PROJECT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/config.tests/separate_debug_info"
)
# signaling_nan
qt_config_compile_test(signaling_nan
LABEL "Signaling NaN for doubles"
@ -487,7 +493,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 +525,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
@ -1067,6 +1073,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 +1142,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 +1168,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 +1270,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

@ -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

@ -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/*" \

View File

@ -5,7 +5,6 @@ qt_examples_build_begin(EXTERNAL_BUILD)
add_subdirectory(corelib)
add_subdirectory(embedded)
add_subdirectory(qpa)
if(TARGET Qt6::DBus)
add_subdirectory(dbus)
endif()

View File

@ -6,9 +6,6 @@ add_subdirectory(mimetypes)
add_subdirectory(serialization)
add_subdirectory(tools)
add_subdirectory(platform)
if(QT_FEATURE_permissions)
add_subdirectory(permissions)
endif()
if(QT_FEATURE_thread)
add_subdirectory(threads)
endif()

View File

@ -1,2 +1,25 @@
qt_internal_add_example(bindablesubscription)
qt_internal_add_example(subscription)
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(bindableproperties LANGUAGES CXX)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/bindableproperties")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_standard_project_setup()
add_subdirectory(shared)
add_subdirectory(subscription)
add_subdirectory(bindablesubscription)
install(TARGETS subscription bindablesubscription
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)

View File

@ -1,50 +1,15 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(bindablesubscription LANGUAGES CXX)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/bindableproperties/bindablesubscription")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_standard_project_setup()
qt_add_executable(bindablesubscription
../shared/subscriptionwindow.cpp ../shared/subscriptionwindow.h ../shared/subscriptionwindow.ui
main.cpp
bindablesubscription.cpp bindablesubscription.h
bindableuser.cpp bindableuser.h
bindablesubscription.cpp
bindablesubscription.h
bindableuser.cpp
bindableuser.h
)
target_link_libraries(bindablesubscription PRIVATE
Qt6::Core
Qt6::Gui
Qt6::Widgets
bindableproperties_shared
)
# Resources:
set(countries_resource_files
"../shared/finland.png"
"../shared/germany.png"
"../shared/norway.png"
)
qt_add_resources(bindablesubscription "countries"
PREFIX
"/"
BASE
"../shared"
FILES
${countries_resource_files}
)
install(TARGETS bindablesubscription
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)

View File

@ -38,8 +38,7 @@ double BindableSubscription::calculateDiscount() const
case Yearly:
return 0.6;
}
Q_ASSERT(false);
return -1;
Q_UNREACHABLE_RETURN(-1);
}
int BindableSubscription::basePrice() const

View File

@ -11,6 +11,10 @@
#include <QPushButton>
#include <QRadioButton>
#include <QSpinBox>
#include <QProperty>
#include <QString>
#include <QDateTimeEdit>
#include <QBindable>
int main(int argc, char *argv[])
{
@ -19,6 +23,8 @@ int main(int argc, char *argv[])
BindableSubscription subscription(&user);
SubscriptionWindow w;
// clazy:excludeall=lambda-in-connect
// when subscription is out of scope so is window
// Initialize subscription data
QRadioButton *monthly = w.findChild<QRadioButton *>("btnMonthly");
@ -49,9 +55,8 @@ int main(int argc, char *argv[])
});
QSpinBox *ageSpinBox = w.findChild<QSpinBox *>("ageSpinBox");
QObject::connect(ageSpinBox, &QSpinBox::valueChanged, [&](int value) {
user.setAge(value);
});
QBindable<int> ageBindable(ageSpinBox, "value");
user.bindableAge().setBinding([ageBindable](){ return ageBindable.value();});
QLabel *priceDisplay = w.findChild<QLabel *>("priceDisplay");

View File

@ -0,0 +1,23 @@
# Copyright (C) 2023 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
add_library(bindableproperties_shared STATIC
subscriptionwindow.cpp
subscriptionwindow.h
subscriptionwindow.ui
)
target_link_libraries(bindableproperties_shared PUBLIC
Qt6::Core
Qt6::Gui
Qt6::Widgets
)
qt_add_resources(bindableproperties_shared "countries"
PREFIX
"/"
FILES
"finland.png"
"germany.png"
"norway.png"
)

View File

@ -1,50 +1,12 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(subscription LANGUAGES CXX)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/bindableproperties/subscription")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_standard_project_setup()
qt_add_executable(subscription
../shared/subscriptionwindow.cpp ../shared/subscriptionwindow.h ../shared/subscriptionwindow.ui
main.cpp
subscription.cpp subscription.h
user.cpp user.h
)
target_link_libraries(subscription PRIVATE
Qt6::Core
Qt6::Gui
Qt6::Widgets
)
# Resources:
set(countries_resource_files
"../shared/finland.png"
"../shared/germany.png"
"../shared/norway.png"
)
qt_add_resources(subscription "countries"
PREFIX
"/"
BASE
"../shared"
FILES
${countries_resource_files}
)
install(TARGETS subscription
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
bindableproperties_shared
)

View File

@ -6,6 +6,7 @@
\example platform/androidnotifier
\examplecategory {Mobile}
\brief Demonstrates calling Java code from Qt in an Android application.
\ingroup androidplatform
\image androidnotifier.png

View File

@ -1,11 +1,10 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_example(cbordump)
qt_internal_add_example(convert)
qt_internal_add_example(savegame)
if(TARGET Qt6::Network AND TARGET Qt6::Widgets)
qt_internal_add_example(rsslisting)
if(NOT ANDROID)
qt_internal_add_example(cbordump)
qt_internal_add_example(convert)
qt_internal_add_example(savegame)
endif()
if(TARGET Qt6::Widgets)
qt_internal_add_example(streambookmarks)

View File

@ -4,6 +4,10 @@
cmake_minimum_required(VERSION 3.16)
project(cbordump LANGUAGES CXX)
if (ANDROID)
message(FATAL_ERROR "This project cannot be built on Android.")
endif()
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()

View File

@ -165,7 +165,7 @@ def main(argv, speak):
struct CborTagDescription
{{
QCborTag tag;
const char *description; // with space and parentheses
const char *description; // with space and parentheses
}};
// {title}

View File

@ -3,7 +3,7 @@
/*!
\example serialization/cbordump
\examplecategory {Input/Output}
\examplecategory {Data Processing & I/O}
\meta tag {network}
\title Parsing and displaying CBOR data

View File

@ -14,6 +14,8 @@
#include <stdarg.h>
#include <stdio.h>
using namespace Qt::StringLiterals;
/*
* To regenerate:
* curl -O https://www.iana.org/assignments/cbor-tags/cbor-tags.xml
@ -27,7 +29,7 @@
struct CborTagDescription
{
QCborTag tag;
const char *description; // with space and parentheses
const char *description; // with space and parentheses
};
// Concise Binary Object Representation (CBOR) Tags
@ -131,22 +133,18 @@ static const CborTagDescription tagDescriptions[] = {
enum {
// See RFC 7049 section 2.
SmallValueBitLength = 5,
SmallValueMask = (1 << SmallValueBitLength) - 1, /* 0x1f */
Value8Bit = 24,
Value16Bit = 25,
Value32Bit = 26,
Value64Bit = 27
SmallValueBitLength = 5,
SmallValueMask = (1 << SmallValueBitLength) - 1, /* 0x1f */
Value8Bit = 24,
Value16Bit = 25,
Value32Bit = 26,
Value64Bit = 27
};
//! [0]
struct CborDumper
{
enum DumpOption {
ShowCompact = 0x01,
ShowWidthIndicators = 0x02,
ShowAnnotated = 0x04
};
enum DumpOption { ShowCompact = 0x01, ShowWidthIndicators = 0x02, ShowAnnotated = 0x04 };
Q_DECLARE_FLAGS(DumpOptions, DumpOption)
CborDumper(QFile *f, DumpOptions opts_);
@ -183,8 +181,7 @@ static int cborNumberSize(quint64 value)
return normalSize;
}
CborDumper::CborDumper(QFile *f, DumpOptions opts_)
: opts(opts_)
CborDumper::CborDumper(QFile *f, DumpOptions opts_) : opts(opts_)
{
// try to mmap the file, this is faster
char *ptr = reinterpret_cast<char *>(f->map(0, f->size(), QFile::MapPrivateOption));
@ -231,7 +228,8 @@ QCborError CborDumper::dump()
return err;
}
template <typename T> static inline bool canConvertTo(double v)
template<typename T>
static inline bool canConvertTo(double v)
{
using TypeInfo = std::numeric_limits<T>;
// The [conv.fpint] (7.10 Floating-integral conversions) section of the
@ -252,31 +250,32 @@ template <typename T> static inline bool canConvertTo(double v)
return v == floor(v);
}
static QString fpToString(double v, const char *suffix)
static QString fpToString(double v, QLatin1StringView suffix = ""_L1)
{
if (qIsInf(v))
return v < 0 ? QStringLiteral("-inf") : QStringLiteral("inf");
return v < 0 ? "-inf"_L1 : "inf"_L1;
if (qIsNaN(v))
return QStringLiteral("nan");
return "nan"_L1;
if (canConvertTo<qint64>(v))
return QString::number(qint64(v)) + ".0" + suffix;
return QString::number(qint64(v)) + ".0"_L1 + suffix;
if (canConvertTo<quint64>(v))
return QString::number(quint64(v)) + ".0" + suffix;
return QString::number(quint64(v)) + ".0"_L1 + suffix;
QString s = QString::number(v, 'g', QLocale::FloatingPointShortest);
if (!s.contains('.') && !s.contains('e'))
s += '.';
s += suffix;
if (!s.contains(u'.') && !s.contains(u'e'))
s += u'.';
if (suffix.size())
s += suffix;
return s;
};
void CborDumper::dumpOne(int nestingLevel)
{
QString indent(1, QLatin1Char(' '));
QString indent(1, u' ');
QString indented = indent;
if (!opts.testFlag(ShowCompact)) {
indent = QLatin1Char('\n') + QString(4 * nestingLevel, QLatin1Char(' '));
indented = QLatin1Char('\n') + QString(4 + 4 * nestingLevel, QLatin1Char(' '));
indent = u'\n' + QString(4 * nestingLevel, u' ');
indented = u'\n' + QString(4 + 4 * nestingLevel, u' ');
}
switch (reader.type()) {
@ -316,7 +315,7 @@ void CborDumper::dumpOne(int nestingLevel)
printStringWidthIndicator(r.data.size());
r = reader.readByteArray();
comma = QLatin1Char(',') + indented;
comma = u',' + indented;
}
} else {
auto r = reader.readString();
@ -325,7 +324,7 @@ void CborDumper::dumpOne(int nestingLevel)
printStringWidthIndicator(r.data.toUtf8().size());
r = reader.readString();
comma = QLatin1Char(',') + indented;
comma = u',' + indented;
}
}
@ -381,7 +380,7 @@ void CborDumper::dumpOne(int nestingLevel)
if (reader.next()) {
printWidthIndicator(quint64(tag));
printf("(");
dumpOne(nestingLevel); // same level!
dumpOne(nestingLevel); // same level!
printf(")");
}
@ -413,15 +412,15 @@ void CborDumper::dumpOne(int nestingLevel)
break;
case QCborStreamReader::Float16:
printf("%s", qPrintable(fpToString(reader.toFloat16(), "f16")));
printf("%s", qPrintable(fpToString(reader.toFloat16(), "f16"_L1)));
reader.next();
break;
case QCborStreamReader::Float:
printf("%s", qPrintable(fpToString(reader.toFloat(), "f")));
printf("%s", qPrintable(fpToString(reader.toFloat(), "f"_L1)));
reader.next();
break;
case QCborStreamReader::Double:
printf("%s", qPrintable(fpToString(reader.toDouble(), "")));
printf("%s", qPrintable(fpToString(reader.toDouble())));
reader.next();
break;
case QCborStreamReader::Invalid:
@ -474,7 +473,7 @@ void CborDumper::dumpOneDetailed(int nestingLevel)
};
auto printFp = [=](const char *descr, double d) {
QString s = fpToString(d, "");
QString s = fpToString(d);
if (s.size() <= 6)
return print(descr, "%s", qPrintable(s));
return print(descr, "%a", d);
@ -489,7 +488,7 @@ void CborDumper::dumpOneDetailed(int nestingLevel)
qsizetype size = reader.currentStringChunkSize();
if (size < 0)
return; // error
return; // error
if (size >= ChunkSizeLimit) {
fprintf(stderr, "String length too big, %lli\n", qint64(size));
exit(EXIT_FAILURE);
@ -534,7 +533,7 @@ void CborDumper::dumpOneDetailed(int nestingLevel)
printf(" %s%s", indent.constData(), section.toHex(' ').constData());
// print the decode
QByteArray spaces(width > 0 ? width - section.size() * 3 + 1: 0, ' ');
QByteArray spaces(width > 0 ? width - section.size() * 3 + 1 : 0, ' ');
printf("%s # \"", spaces.constData());
auto ptr = reinterpret_cast<const uchar *>(section.constData());
for (int j = 0; j < section.size(); ++j)
@ -546,7 +545,7 @@ void CborDumper::dumpOneDetailed(int nestingLevel)
// get the next chunk
size = reader.currentStringChunkSize();
if (size < 0)
return; // error
return; // error
if (size >= ChunkSizeLimit) {
fprintf(stderr, "String length too big, %lli\n", qint64(size));
exit(EXIT_FAILURE);
@ -685,7 +684,9 @@ void CborDumper::printByteArray(const QByteArray &ba)
break;
case quint8(QCborKnownTags::ExpectedBase64url):
printf("b64'%s'", ba.toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals).constData());
printf("b64'%s'",
ba.toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals)
.constData());
break;
}
}
@ -726,23 +727,20 @@ int main(int argc, char *argv[])
setlocale(LC_ALL, "C");
QCommandLineParser parser;
parser.setApplicationDescription(QStringLiteral("CBOR Dumper tool"));
parser.setApplicationDescription("CBOR Dumper tool"_L1);
parser.addHelpOption();
QCommandLineOption compact({QStringLiteral("c"), QStringLiteral("compact")},
QStringLiteral("Use compact form (no line breaks)"));
QCommandLineOption compact({"c"_L1, "compact"_L1}, "Use compact form (no line breaks)"_L1);
parser.addOption(compact);
QCommandLineOption showIndicators({QStringLiteral("i"), QStringLiteral("indicators")},
QStringLiteral("Show indicators for width of lengths and integrals"));
QCommandLineOption showIndicators({ "i"_L1, "indicators"_L1 },
"Show indicators for width of lengths and integrals"_L1);
parser.addOption(showIndicators);
QCommandLineOption verbose({QStringLiteral("a"), QStringLiteral("annotated")},
QStringLiteral("Show bytes and annotated decoding"));
QCommandLineOption verbose({"a"_L1, "annotated"_L1}, "Show bytes and annotated decoding"_L1);
parser.addOption(verbose);
parser.addPositionalArgument(QStringLiteral("[source]"),
QStringLiteral("CBOR file to read from"));
parser.addPositionalArgument("[source]"_L1, "CBOR file to read from"_L1);
parser.process(app);

View File

@ -4,6 +4,10 @@
cmake_minimum_required(VERSION 3.16)
project(convert LANGUAGES CXX)
if (ANDROID)
message(FATAL_ERROR "This project cannot be built on Android.")
endif()
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@ -18,6 +22,7 @@ qt_add_executable(convert
cborconverter.cpp cborconverter.h
converter.h
datastreamconverter.cpp datastreamconverter.h
debugtextdumper.cpp debugtextdumper.h
jsonconverter.cpp jsonconverter.h
main.cpp
nullconverter.cpp nullconverter.h

View File

@ -3,19 +3,21 @@
#include "cborconverter.h"
#include <QCborArray>
#include <QCborMap>
#include <QCborStreamReader>
#include <QCborStreamWriter>
#include <QCborMap>
#include <QCborArray>
#include <QCborValue>
#include <QDataStream>
#include <QFloat16>
#include <QFile>
#include <QFloat16>
#include <QMetaType>
#include <QTextStream>
#include <stdio.h>
using namespace Qt::StringLiterals;
static CborConverter cborConverter;
static CborDiagnosticDumper cborDiagnosticDumper;
@ -118,33 +120,33 @@ static QCborValue convertFromVariant(const QVariant &v, TrimFloatingPoint fpTrim
}
//! [1]
QString CborDiagnosticDumper::name()
QString CborDiagnosticDumper::name() const
{
return QStringLiteral("cbor-dump");
return "cbor-dump"_L1;
}
Converter::Direction CborDiagnosticDumper::directions()
Converter::Directions CborDiagnosticDumper::directions() const
{
return Out;
return Direction::Out;
}
Converter::Options CborDiagnosticDumper::outputOptions()
Converter::Options CborDiagnosticDumper::outputOptions() const
{
return SupportsArbitraryMapKeys;
}
const char *CborDiagnosticDumper::optionsHelp()
const char *CborDiagnosticDumper::optionsHelp() const
{
return diagnosticHelp;
}
bool CborDiagnosticDumper::probeFile(QIODevice *f)
bool CborDiagnosticDumper::probeFile(QIODevice *f) const
{
Q_UNUSED(f);
return false;
}
QVariant CborDiagnosticDumper::loadFile(QIODevice *f, Converter *&outputConverter)
QVariant CborDiagnosticDumper::loadFile(QIODevice *f, const Converter *&outputConverter) const
{
Q_UNREACHABLE();
Q_UNUSED(f);
@ -152,7 +154,8 @@ QVariant CborDiagnosticDumper::loadFile(QIODevice *f, Converter *&outputConverte
return QVariant();
}
void CborDiagnosticDumper::saveFile(QIODevice *f, const QVariant &contents, const QStringList &options)
void CborDiagnosticDumper::saveFile(QIODevice *f, const QVariant &contents,
const QStringList &options) const
{
QCborValue::DiagnosticNotationOptions opts = QCborValue::LineWrapped;
for (const QString &s : options) {
@ -181,8 +184,7 @@ void CborDiagnosticDumper::saveFile(QIODevice *f, const QVariant &contents, cons
}
QTextStream out(f);
out << convertFromVariant(contents, Double).toDiagnosticNotation(opts)
<< Qt::endl;
out << convertFromVariant(contents, Double).toDiagnosticNotation(opts) << Qt::endl;
}
CborConverter::CborConverter()
@ -190,37 +192,37 @@ CborConverter::CborConverter()
qRegisterMetaType<QCborTag>();
}
QString CborConverter::name()
QString CborConverter::name() const
{
return "cbor";
}
Converter::Direction CborConverter::directions()
Converter::Directions CborConverter::directions() const
{
return InOut;
return Direction::InOut;
}
Converter::Options CborConverter::outputOptions()
Converter::Options CborConverter::outputOptions() const
{
return SupportsArbitraryMapKeys;
}
const char *CborConverter::optionsHelp()
const char *CborConverter::optionsHelp() const
{
return cborOptionHelp;
}
bool CborConverter::probeFile(QIODevice *f)
bool CborConverter::probeFile(QIODevice *f) const
{
if (QFile *file = qobject_cast<QFile *>(f)) {
if (file->fileName().endsWith(QLatin1String(".cbor")))
if (file->fileName().endsWith(".cbor"_L1))
return true;
}
return f->isReadable() && f->peek(3) == QByteArray("\xd9\xd9\xf7", 3);
}
//! [2]
QVariant CborConverter::loadFile(QIODevice *f, Converter *&outputConverter)
QVariant CborConverter::loadFile(QIODevice *f, const Converter *&outputConverter) const
{
const char *ptr = nullptr;
if (auto file = qobject_cast<QFile *>(f))
@ -256,7 +258,7 @@ QVariant CborConverter::loadFile(QIODevice *f, Converter *&outputConverter)
}
//! [2]
//! [3]
void CborConverter::saveFile(QIODevice *f, const QVariant &contents, const QStringList &options)
void CborConverter::saveFile(QIODevice *f, const QVariant &contents, const QStringList &options) const
{
//! [3]
bool useSignature = true;
@ -318,8 +320,9 @@ void CborConverter::saveFile(QIODevice *f, const QVariant &contents, const QStri
exit(EXIT_FAILURE);
}
//! [4]
QCborValue v = convertFromVariant(contents,
useFloat16 == Always ? Float16 : useFloat == Always ? Float : Double);
QCborValue v =
convertFromVariant(contents,
useFloat16 == Always ? Float16 : useFloat == Always ? Float : Double);
QCborStreamWriter writer(f);
if (useSignature)
writer.append(QCborKnownTags::Signature);

View File

@ -10,13 +10,14 @@ class CborDiagnosticDumper : public Converter
{
// Converter interface
public:
QString name() override;
Direction directions() override;
Options outputOptions() override;
const char *optionsHelp() override;
bool probeFile(QIODevice *f) override;
QVariant loadFile(QIODevice *f, Converter *&outputConverter) override;
void saveFile(QIODevice *f, const QVariant &contents, const QStringList &options) override;
QString name() const override;
Directions directions() const override;
Options outputOptions() const override;
const char *optionsHelp() const override;
bool probeFile(QIODevice *f) const override;
QVariant loadFile(QIODevice *f, const Converter *&outputConverter) const override;
void saveFile(QIODevice *f, const QVariant &contents,
const QStringList &options) const override;
};
class CborConverter : public Converter
@ -26,13 +27,14 @@ public:
// Converter interface
public:
QString name() override;
Direction directions() override;
Options outputOptions() override;
const char *optionsHelp() override;
bool probeFile(QIODevice *f) override;
QVariant loadFile(QIODevice *f, Converter *&outputConverter) override;
void saveFile(QIODevice *f, const QVariant &contents, const QStringList &options) override;
QString name() const override;
Directions directions() const override;
Options outputOptions() const override;
const char *optionsHelp() const override;
bool probeFile(QIODevice *f) const override;
QVariant loadFile(QIODevice *f, const Converter *&outputConverter) const override;
void saveFile(QIODevice *f, const QVariant &contents,
const QStringList &options) const override;
};
#endif // CBORCONVERTER_H

View File

@ -12,17 +12,19 @@ INSTALLS += target
SOURCES += main.cpp \
cborconverter.cpp \
jsonconverter.cpp \
datastreamconverter.cpp \
debugtextdumper.cpp \
jsonconverter.cpp \
nullconverter.cpp \
textconverter.cpp \
xmlconverter.cpp \
nullconverter.cpp
xmlconverter.cpp
HEADERS += \
converter.h \
cborconverter.h \
jsonconverter.h \
datastreamconverter.h \
debugtextdumper.h \
jsonconverter.h \
nullconverter.h \
textconverter.h \
xmlconverter.h \
nullconverter.h
xmlconverter.h

View File

@ -5,10 +5,10 @@
#define CONVERTER_H
#include <QIODevice>
#include <QList>
#include <QPair>
#include <QVariant>
#include <QVariantMap>
#include <QList>
class VariantOrderedMap : public QList<QPair<QVariant, QVariant>>
{
@ -32,26 +32,25 @@ protected:
public:
static Converter *null;
enum Direction {
In = 1, Out = 2, InOut = 3
};
enum class Direction { In = 1, Out = 2, InOut = In | Out };
Q_DECLARE_FLAGS(Directions, Direction)
enum Option {
SupportsArbitraryMapKeys = 0x01
};
enum Option { SupportsArbitraryMapKeys = 0x01 };
Q_DECLARE_FLAGS(Options, Option)
virtual ~Converter() = 0;
virtual QString name() = 0;
virtual Direction directions() = 0;
virtual Options outputOptions() = 0;
virtual const char *optionsHelp() = 0;
virtual bool probeFile(QIODevice *f) = 0;
virtual QVariant loadFile(QIODevice *f, Converter *&outputConverter) = 0;
virtual void saveFile(QIODevice *f, const QVariant &contents, const QStringList &options) = 0;
virtual QString name() const = 0;
virtual Directions directions() const = 0;
virtual Options outputOptions() const = 0;
virtual const char *optionsHelp() const = 0;
virtual bool probeFile(QIODevice *f) const = 0;
virtual QVariant loadFile(QIODevice *f, const Converter *&outputConverter) const = 0;
virtual void saveFile(QIODevice *f, const QVariant &contents,
const QStringList &options) const = 0;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(Converter::Directions)
Q_DECLARE_OPERATORS_FOR_FLAGS(Converter::Options)
#endif // CONVERTER_H

View File

@ -2,20 +2,21 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "datastreamconverter.h"
#include "debugtextdumper.h"
#include <QDataStream>
#include <QDebug>
#include <QTextStream>
using namespace Qt::StringLiterals;
static const char dataStreamOptionHelp[] =
"byteorder=host|big|little Byte order to use.\n"
"version=<n> QDataStream version (default: Qt 5.0).\n"
"version=<n> QDataStream version (default: Qt 6.0).\n"
;
static const char signature[] = "qds";
static DataStreamDumper dataStreamDumper;
static DataStreamConverter DataStreamConverter;
static DataStreamConverter dataStreamConverter;
static DebugTextDumper debugTextDumper;
QDataStream &operator<<(QDataStream &ds, const VariantOrderedMap &map)
{
@ -42,123 +43,43 @@ QDataStream &operator>>(QDataStream &ds, VariantOrderedMap &map)
return ds;
}
static QString dumpVariant(const QVariant &v, const QString &indent = QLatin1String("\n"))
{
QString result;
QString indented = indent + QLatin1String(" ");
int type = v.userType();
if (type == qMetaTypeId<VariantOrderedMap>() || type == QMetaType::QVariantMap) {
const auto map = (type == QMetaType::QVariantMap) ?
VariantOrderedMap(v.toMap()) : qvariant_cast<VariantOrderedMap>(v);
result = QLatin1String("Map {");
for (const auto &pair : map) {
result += indented + dumpVariant(pair.first, indented);
result.chop(1); // remove comma
result += QLatin1String(" => ") + dumpVariant(pair.second, indented);
}
result.chop(1); // remove comma
result += indent + QLatin1String("},");
} else if (type == QMetaType::QVariantList) {
const QVariantList list = v.toList();
result = QLatin1String("List [");
for (const auto &item : list)
result += indented + dumpVariant(item, indented);
result.chop(1); // remove comma
result += indent + QLatin1String("],");
} else {
QDebug debug(&result);
debug.nospace() << v << ',';
}
return result;
}
QString DataStreamDumper::name()
{
return QStringLiteral("datastream-dump");
}
Converter::Direction DataStreamDumper::directions()
{
return Out;
}
Converter::Options DataStreamDumper::outputOptions()
{
return SupportsArbitraryMapKeys;
}
const char *DataStreamDumper::optionsHelp()
{
return nullptr;
}
bool DataStreamDumper::probeFile(QIODevice *f)
{
Q_UNUSED(f);
return false;
}
QVariant DataStreamDumper::loadFile(QIODevice *f, Converter *&outputConverter)
{
Q_UNREACHABLE();
Q_UNUSED(f);
Q_UNUSED(outputConverter);
return QVariant();
}
void DataStreamDumper::saveFile(QIODevice *f, const QVariant &contents, const QStringList &options)
{
Q_UNUSED(options);
QString s = dumpVariant(contents);
s[s.size() - 1] = QLatin1Char('\n'); // replace the comma with newline
QTextStream out(f);
out << s;
}
DataStreamConverter::DataStreamConverter()
{
qRegisterMetaType<VariantOrderedMap>();
}
QString DataStreamConverter::name()
QString DataStreamConverter::name() const
{
return QStringLiteral("datastream");
return "datastream"_L1;
}
Converter::Direction DataStreamConverter::directions()
Converter::Directions DataStreamConverter::directions() const
{
return InOut;
return Direction::InOut;
}
Converter::Options DataStreamConverter::outputOptions()
Converter::Options DataStreamConverter::outputOptions() const
{
return SupportsArbitraryMapKeys;
}
const char *DataStreamConverter::optionsHelp()
const char *DataStreamConverter::optionsHelp() const
{
return dataStreamOptionHelp;
}
bool DataStreamConverter::probeFile(QIODevice *f)
bool DataStreamConverter::probeFile(QIODevice *f) const
{
return f->isReadable() && f->peek(sizeof(signature) - 1) == signature;
}
QVariant DataStreamConverter::loadFile(QIODevice *f, Converter *&outputConverter)
QVariant DataStreamConverter::loadFile(QIODevice *f, const Converter *&outputConverter) const
{
if (!outputConverter)
outputConverter = &dataStreamDumper;
outputConverter = &debugTextDumper;
char c;
if (f->read(sizeof(signature) -1) != signature ||
!f->getChar(&c) || (c != 'l' && c != 'B')) {
if (f->read(sizeof(signature) - 1) != signature || !f->getChar(&c) || (c != 'l' && c != 'B')) {
fprintf(stderr, "Could not load QDataStream file: invalid signature.\n");
exit(EXIT_FAILURE);
}
@ -175,9 +96,10 @@ QVariant DataStreamConverter::loadFile(QIODevice *f, Converter *&outputConverter
return result;
}
void DataStreamConverter::saveFile(QIODevice *f, const QVariant &contents, const QStringList &options)
void DataStreamConverter::saveFile(QIODevice *f, const QVariant &contents,
const QStringList &options) const
{
QDataStream::Version version = QDataStream::Qt_5_0;
QDataStream::Version version = QDataStream::Qt_6_0;
auto order = QDataStream::ByteOrder(QSysInfo::ByteOrder);
for (const QString &option : options) {
const QStringList pair = option.split('=');
@ -213,7 +135,7 @@ void DataStreamConverter::saveFile(QIODevice *f, const QVariant &contents, const
exit(EXIT_FAILURE);
}
char c = order == QDataStream::LittleEndian ? 'l' : 'B';
char c = order == QDataStream::LittleEndian ? 'l' : 'B';
f->write(signature);
f->write(&c, 1);

View File

@ -6,19 +6,6 @@
#include "converter.h"
class DataStreamDumper : public Converter
{
// Converter interface
public:
QString name() override;
Direction directions() override;
Options outputOptions() override;
const char *optionsHelp() override;
bool probeFile(QIODevice *f) override;
QVariant loadFile(QIODevice *f, Converter *&outputConverter) override;
void saveFile(QIODevice *f, const QVariant &contents, const QStringList &options) override;
};
class DataStreamConverter : public Converter
{
public:
@ -26,13 +13,14 @@ public:
// Converter interface
public:
QString name() override;
Direction directions() override;
Options outputOptions() override;
const char *optionsHelp() override;
bool probeFile(QIODevice *f) override;
QVariant loadFile(QIODevice *f, Converter *&outputConverter) override;
void saveFile(QIODevice *f, const QVariant &contents, const QStringList &options) override;
QString name() const override;
Directions directions() const override;
Options outputOptions() const override;
const char *optionsHelp() const override;
bool probeFile(QIODevice *f) const override;
QVariant loadFile(QIODevice *f, const Converter *&outputConverter) const override;
void saveFile(QIODevice *f, const QVariant &contents,
const QStringList &options) const override;
};
#endif // DATASTREAMCONVERTER_H

View File

@ -0,0 +1,89 @@
// Copyright (C) 2018 Intel Corporation.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "debugtextdumper.h"
#include <QDebug>
#include <QTextStream>
using namespace Qt::StringLiterals;
// Static instance is declared in datastreamconverter.cpp, since it uses it.
static QString dumpVariant(const QVariant &v, const QString &indent = "\n"_L1)
{
QString result;
QString indented = indent + " "_L1;
int type = v.userType();
if (type == qMetaTypeId<VariantOrderedMap>() || type == QMetaType::QVariantMap) {
const auto map = (type == QMetaType::QVariantMap) ? VariantOrderedMap(v.toMap())
: qvariant_cast<VariantOrderedMap>(v);
result = "Map {"_L1;
for (const auto &pair : map) {
result += indented + dumpVariant(pair.first, indented);
result.chop(1); // remove comma
result += " => "_L1 + dumpVariant(pair.second, indented);
}
result.chop(1); // remove comma
result += indent + "},"_L1;
} else if (type == QMetaType::QVariantList) {
const QVariantList list = v.toList();
result = "List ["_L1;
for (const auto &item : list)
result += indented + dumpVariant(item, indented);
result.chop(1); // remove comma
result += indent + "],"_L1;
} else {
QDebug debug(&result);
debug.nospace() << v << ',';
}
return result;
}
QString DebugTextDumper::name() const
{
return "debugtext-dump"_L1;
}
Converter::Directions DebugTextDumper::directions() const
{
return Direction::Out;
}
Converter::Options DebugTextDumper::outputOptions() const
{
return SupportsArbitraryMapKeys;
}
const char *DebugTextDumper::optionsHelp() const
{
return nullptr;
}
bool DebugTextDumper::probeFile(QIODevice *f) const
{
Q_UNUSED(f);
return false;
}
QVariant DebugTextDumper::loadFile(QIODevice *f, const Converter *&outputConverter) const
{
Q_UNREACHABLE();
Q_UNUSED(f);
Q_UNUSED(outputConverter);
return QVariant();
}
void DebugTextDumper::saveFile(QIODevice *f, const QVariant &contents,
const QStringList &options) const
{
Q_UNUSED(options);
QString s = dumpVariant(contents);
s[s.size() - 1] = u'\n'; // replace the comma with newline
QTextStream out(f);
out << s;
}

View File

@ -0,0 +1,23 @@
// Copyright (C) 2018 Intel Corporation.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef DEBUGTEXTDUMPER_H
#define DEBUGTEXTDUMPER_H
#include "converter.h"
class DebugTextDumper : public Converter
{
// Converter interface
public:
QString name() const override;
Directions directions() const override;
Options outputOptions() const override;
const char *optionsHelp() const override;
bool probeFile(QIODevice *f) const override;
QVariant loadFile(QIODevice *f, const Converter *&outputConverter) const override;
void saveFile(QIODevice *f, const QVariant &contents,
const QStringList &options) const override;
};
#endif // DEBUGTEXTDUMPER_H

View File

@ -3,7 +3,7 @@
/*!
\example serialization/convert
\examplecategory {Input/Output}
\examplecategory {Data Processing & I/O}
\meta tag {network}
\title Convert Example
@ -60,7 +60,7 @@
\section1 The DataStreamConverter Class
The DataStreamConverter class is used to serialize to and from the
QDataStream format. There is also the DataStreamDumper class for outputting
QDataStream format. There is also the DebugTextDumper class for outputting
the data lossless in a non-standardized human readable format.
\section1 The JsonConverter Class

View File

@ -9,10 +9,11 @@
#include <QJsonObject>
#include <QJsonValue>
using namespace Qt::StringLiterals;
static JsonConverter jsonConverter;
static const char jsonOptionHelp[] =
"compact=no|yes Use compact JSON form.\n";
static const char jsonOptionHelp[] = "compact=no|yes Use compact JSON form.\n";
static QJsonDocument convertFromVariant(const QVariant &v)
{
@ -24,34 +25,30 @@ static QJsonDocument convertFromVariant(const QVariant &v)
return doc;
}
JsonConverter::JsonConverter()
QString JsonConverter::name() const
{
return "json"_L1;
}
QString JsonConverter::name()
Converter::Directions JsonConverter::directions() const
{
return "json";
return Direction::InOut;
}
Converter::Direction JsonConverter::directions()
{
return InOut;
}
Converter::Options JsonConverter::outputOptions()
Converter::Options JsonConverter::outputOptions() const
{
return {};
}
const char *JsonConverter::optionsHelp()
const char *JsonConverter::optionsHelp() const
{
return jsonOptionHelp;
}
bool JsonConverter::probeFile(QIODevice *f)
bool JsonConverter::probeFile(QIODevice *f) const
{
if (QFile *file = qobject_cast<QFile *>(f)) {
if (file->fileName().endsWith(QLatin1String(".json")))
if (file->fileName().endsWith(".json"_L1))
return true;
}
@ -62,7 +59,7 @@ bool JsonConverter::probeFile(QIODevice *f)
return false;
}
QVariant JsonConverter::loadFile(QIODevice *f, Converter *&outputConverter)
QVariant JsonConverter::loadFile(QIODevice *f, const Converter *&outputConverter) const
{
if (!outputConverter)
outputConverter = this;
@ -87,13 +84,14 @@ QVariant JsonConverter::loadFile(QIODevice *f, Converter *&outputConverter)
return doc.toVariant();
}
void JsonConverter::saveFile(QIODevice *f, const QVariant &contents, const QStringList &options)
void JsonConverter::saveFile(QIODevice *f, const QVariant &contents,
const QStringList &options) const
{
QJsonDocument::JsonFormat format = QJsonDocument::Indented;
for (const QString &s : options) {
if (s == QLatin1String("compact=no")) {
if (s == "compact=no"_L1) {
format = QJsonDocument::Indented;
} else if (s == QLatin1String("compact=yes")) {
} else if (s == "compact=yes"_L1) {
format = QJsonDocument::Compact;
} else {
fprintf(stderr, "Unknown option '%s' to JSON output. Valid options are:\n%s",

View File

@ -8,18 +8,16 @@
class JsonConverter : public Converter
{
public:
JsonConverter();
// Converter interface
public:
QString name() override;
Direction directions() override;
Options outputOptions() override;
const char *optionsHelp() override;
bool probeFile(QIODevice *f) override;
QVariant loadFile(QIODevice *f, Converter *&outputConverter) override;
void saveFile(QIODevice *f, const QVariant &contents, const QStringList &options) override;
QString name() const override;
Directions directions() const override;
Options outputOptions() const override;
const char *optionsHelp() const override;
bool probeFile(QIODevice *f) const override;
QVariant loadFile(QIODevice *f, const Converter *&outputConverter) const override;
void saveFile(QIODevice *f, const QVariant &contents,
const QStringList &options) const override;
};
#endif // JSONCONVERTER_H

View File

@ -11,12 +11,14 @@
#include <stdio.h>
static QList<Converter *> *availableConverters;
using namespace Qt::StringLiterals;
static QList<const Converter *> *availableConverters;
Converter::Converter()
{
if (!availableConverters)
availableConverters = new QList<Converter *>;
availableConverters = new QList<const Converter *>;
availableConverters->append(this);
}
@ -31,64 +33,68 @@ int main(int argc, char *argv[])
QStringList inputFormats;
QStringList outputFormats;
for (Converter *conv : std::as_const(*availableConverters)) {
for (const Converter *conv : std::as_const(*availableConverters)) {
auto direction = conv->directions();
QString name = conv->name();
if (direction & Converter::In)
if (direction.testFlag(Converter::Direction::In))
inputFormats << name;
if (direction & Converter::Out)
if (direction.testFlag(Converter::Direction::Out))
outputFormats << name;
}
inputFormats.sort();
outputFormats.sort();
inputFormats.prepend("auto");
outputFormats.prepend("auto");
inputFormats.prepend("auto"_L1);
outputFormats.prepend("auto"_L1);
QCommandLineParser parser;
parser.setApplicationDescription(QStringLiteral("Qt file format conversion tool"));
parser.setApplicationDescription("Qt file format conversion tool"_L1);
parser.addHelpOption();
QCommandLineOption inputFormatOption(QStringList{"I", "input-format"});
inputFormatOption.setDescription(QLatin1String("Select the input format for the input file. Available formats: ") +
inputFormats.join(", "));
inputFormatOption.setValueName("format");
QCommandLineOption inputFormatOption(QStringList{ "I"_L1, "input-format"_L1 });
inputFormatOption.setDescription(
"Select the input format for the input file. Available formats: "_L1
+ inputFormats.join(", "_L1));
inputFormatOption.setValueName("format"_L1);
inputFormatOption.setDefaultValue(inputFormats.constFirst());
parser.addOption(inputFormatOption);
QCommandLineOption outputFormatOption(QStringList{"O", "output-format"});
outputFormatOption.setDescription(QLatin1String("Select the output format for the output file. Available formats: ") +
outputFormats.join(", "));
outputFormatOption.setValueName("format");
QCommandLineOption outputFormatOption(QStringList{ "O"_L1, "output-format"_L1 });
outputFormatOption.setDescription(
"Select the output format for the output file. Available formats: "_L1
+ outputFormats.join(", "_L1));
outputFormatOption.setValueName("format"_L1);
outputFormatOption.setDefaultValue(outputFormats.constFirst());
parser.addOption(outputFormatOption);
QCommandLineOption optionOption(QStringList{"o", "option"});
optionOption.setDescription(QStringLiteral("Format-specific options. Use --format-options to find out what options are available."));
optionOption.setValueName("options...");
QCommandLineOption optionOption(QStringList{ "o"_L1, "option"_L1 });
optionOption.setDescription(
"Format-specific options. Use --format-options to find out what options are available."_L1);
optionOption.setValueName("options..."_L1);
optionOption.setDefaultValues({});
parser.addOption(optionOption);
QCommandLineOption formatOptionsOption("format-options");
formatOptionsOption.setDescription(QStringLiteral("Prints the list of valid options for --option for the converter format <format>."));
formatOptionsOption.setValueName("format");
QCommandLineOption formatOptionsOption("format-options"_L1);
formatOptionsOption.setDescription(
"Prints the list of valid options for --option for the converter format <format>."_L1);
formatOptionsOption.setValueName("format"_L1);
parser.addOption(formatOptionsOption);
parser.addPositionalArgument(QStringLiteral("[source]"),
QStringLiteral("File to read from (stdin if none)"));
parser.addPositionalArgument(QStringLiteral("[destination]"),
QStringLiteral("File to write to (stdout if none)"));
parser.addPositionalArgument("[source]"_L1, "File to read from (stdin if none)"_L1);
parser.addPositionalArgument("[destination]"_L1, "File to write to (stdout if none)"_L1);
parser.process(app);
if (parser.isSet(formatOptionsOption)) {
QString format = parser.value(formatOptionsOption);
for (Converter *conv : std::as_const(*availableConverters)) {
for (const Converter *conv : std::as_const(*availableConverters)) {
if (conv->name() == format) {
const char *help = conv->optionsHelp();
if (help)
printf("The following options are available for format '%s':\n\n%s", qPrintable(format), help);
else
if (help) {
printf("The following options are available for format '%s':\n\n%s",
qPrintable(format), help);
} else {
printf("Format '%s' supports no options.\n", qPrintable(format));
}
return EXIT_SUCCESS;
}
}
@ -97,10 +103,10 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
Converter *inconv = nullptr;
const Converter *inconv = nullptr;
QString format = parser.value(inputFormatOption);
if (format != "auto") {
for (Converter *conv : std::as_const(*availableConverters)) {
if (format != "auto"_L1) {
for (const Converter *conv : std::as_const(*availableConverters)) {
if (conv->name() == format) {
inconv = conv;
break;
@ -113,10 +119,10 @@ int main(int argc, char *argv[])
}
}
Converter *outconv = nullptr;
const Converter *outconv = nullptr;
format = parser.value(outputFormatOption);
if (format != "auto") {
for (Converter *conv : std::as_const(*availableConverters)) {
if (format != "auto"_L1) {
for (const Converter *conv : std::as_const(*availableConverters)) {
if (conv->name() == format) {
outconv = conv;
break;
@ -155,8 +161,9 @@ int main(int argc, char *argv[])
if (!inconv) {
// probe the input to find a file format
for (Converter *conv : std::as_const(*availableConverters)) {
if (conv->directions() & Converter::In && conv->probeFile(&input)) {
for (const Converter *conv : std::as_const(*availableConverters)) {
if (conv->directions().testFlag(Converter::Direction::In)
&& conv->probeFile(&input)) {
inconv = conv;
break;
}
@ -170,8 +177,9 @@ int main(int argc, char *argv[])
if (!outconv) {
// probe the output to find a file format
for (Converter *conv : std::as_const(*availableConverters)) {
if (conv->directions() & Converter::Out && conv->probeFile(&output)) {
for (const Converter *conv : std::as_const(*availableConverters)) {
if (conv->directions().testFlag(Converter::Direction::Out)
&& conv->probeFile(&output)) {
outconv = conv;
break;
}

View File

@ -3,36 +3,38 @@
#include "nullconverter.h"
using namespace Qt::StringLiterals;
static NullConverter nullConverter;
Converter* Converter::null = &nullConverter;
Converter *Converter::null = &nullConverter;
QString NullConverter::name()
QString NullConverter::name() const
{
return QLatin1String("null");
return "null"_L1;
}
Converter::Direction NullConverter::directions()
Converter::Directions NullConverter::directions() const
{
return Out;
return Direction::Out;
}
Converter::Options NullConverter::outputOptions()
Converter::Options NullConverter::outputOptions() const
{
return SupportsArbitraryMapKeys;
}
const char *NullConverter::optionsHelp()
const char *NullConverter::optionsHelp() const
{
return nullptr;
}
bool NullConverter::probeFile(QIODevice *f)
bool NullConverter::probeFile(QIODevice *f) const
{
Q_UNUSED(f);
return false;
}
QVariant NullConverter::loadFile(QIODevice *f, Converter *&outputConverter)
QVariant NullConverter::loadFile(QIODevice *f, const Converter *&outputConverter) const
{
Q_UNUSED(f);
Q_UNUSED(outputConverter);
@ -40,10 +42,12 @@ QVariant NullConverter::loadFile(QIODevice *f, Converter *&outputConverter)
return QVariant();
}
void NullConverter::saveFile(QIODevice *f, const QVariant &contents, const QStringList &options)
void NullConverter::saveFile(QIODevice *f, const QVariant &contents,
const QStringList &options) const
{
if (!options.isEmpty()) {
fprintf(stderr, "Unknown option '%s' to null output. This format has no options.\n", qPrintable(options.first()));
fprintf(stderr, "Unknown option '%s' to null output. This format has no options.\n",
qPrintable(options.first()));
exit(EXIT_FAILURE);
}

View File

@ -10,13 +10,14 @@ class NullConverter : public Converter
{
// Converter interface
public:
QString name() override;
Direction directions() override;
Options outputOptions() override;
const char *optionsHelp() override;
bool probeFile(QIODevice *f) override;
QVariant loadFile(QIODevice *f, Converter *&outputConverter) override;
void saveFile(QIODevice *f, const QVariant &contents, const QStringList &options) override;
QString name() const override;
Directions directions() const override;
Options outputOptions() const override;
const char *optionsHelp() const override;
bool probeFile(QIODevice *f) const override;
QVariant loadFile(QIODevice *f, const Converter *&outputConverter) const override;
void saveFile(QIODevice *f, const QVariant &contents,
const QStringList &options) const override;
};
#endif // NULLCONVERTER_H

View File

@ -6,6 +6,8 @@
#include <QFile>
#include <QTextStream>
using namespace Qt::StringLiterals;
static void dumpVariant(QTextStream &out, const QVariant &v)
{
switch (v.userType()) {
@ -42,67 +44,62 @@ static void dumpVariant(QTextStream &out, const QVariant &v)
}
}
QString TextConverter::name()
QString TextConverter::name() const
{
return QStringLiteral("text");
return "text"_L1;
}
Converter::Direction TextConverter::directions()
Converter::Directions TextConverter::directions() const
{
return InOut;
return Direction::InOut;
}
Converter::Options TextConverter::outputOptions()
Converter::Options TextConverter::outputOptions() const
{
return {};
}
const char *TextConverter::optionsHelp()
const char *TextConverter::optionsHelp() const
{
return nullptr;
}
bool TextConverter::probeFile(QIODevice *f)
bool TextConverter::probeFile(QIODevice *f) const
{
if (QFile *file = qobject_cast<QFile *>(f))
return file->fileName().endsWith(QLatin1String(".txt"));
return file->fileName().endsWith(".txt"_L1);
return false;
}
QVariant TextConverter::loadFile(QIODevice *f, Converter *&outputConverter)
QVariant TextConverter::loadFile(QIODevice *f, const Converter *&outputConverter) const
{
if (!outputConverter)
outputConverter = this;
QVariantList list;
QTextStream in(f);
QString line ;
QString line;
while (!in.atEnd()) {
in.readLineInto(&line);
bool ok;
qint64 v = line.toLongLong(&ok);
if (ok) {
if (qint64 v = line.toLongLong(&ok); ok)
list.append(v);
continue;
}
double d = line.toDouble(&ok);
if (ok) {
else if (double d = line.toDouble(&ok); ok)
list.append(d);
continue;
}
list.append(line);
else
list.append(line);
}
return list;
}
void TextConverter::saveFile(QIODevice *f, const QVariant &contents, const QStringList &options)
void TextConverter::saveFile(QIODevice *f, const QVariant &contents,
const QStringList &options) const
{
if (!options.isEmpty()) {
fprintf(stderr, "Unknown option '%s' to text output. This format has no options.\n", qPrintable(options.first()));
fprintf(stderr, "Unknown option '%s' to text output. This format has no options.\n",
qPrintable(options.first()));
exit(EXIT_FAILURE);
}

View File

@ -8,16 +8,16 @@
class TextConverter : public Converter
{
// Converter interface
public:
QString name() override;
Direction directions() override;
Options outputOptions() override;
const char *optionsHelp() override;
bool probeFile(QIODevice *f) override;
QVariant loadFile(QIODevice *f, Converter *&outputConverter) override;
void saveFile(QIODevice *f, const QVariant &contents, const QStringList &options) override;
QString name() const override;
Directions directions() const override;
Options outputOptions() const override;
const char *optionsHelp() const override;
bool probeFile(QIODevice *f) const override;
QVariant loadFile(QIODevice *f, const Converter *&outputConverter) const override;
void saveFile(QIODevice *f, const QVariant &contents,
const QStringList &options) const override;
};
#endif // TEXTCONVERTER_H

View File

@ -13,8 +13,9 @@
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
static const char xmlOptionHelp[] =
"compact=no|yes Use compact XML form.\n";
using namespace Qt::StringLiterals;
static const char xmlOptionHelp[] = "compact=no|yes Use compact XML form.\n";
static XmlConverter xmlConverter;
@ -23,7 +24,7 @@ static QVariant variantFromXml(QXmlStreamReader &xml, Converter::Options options
static QVariantList listFromXml(QXmlStreamReader &xml, Converter::Options options)
{
QVariantList list;
while (!xml.atEnd() && !(xml.isEndElement() && xml.name() == QLatin1String("list"))) {
while (!xml.atEnd() && !(xml.isEndElement() && xml.name() == "list"_L1)) {
xml.readNext();
switch (xml.tokenType()) {
case QXmlStreamReader::StartElement:
@ -47,8 +48,7 @@ static QVariantList listFromXml(QXmlStreamReader &xml, Converter::Options option
break;
}
fprintf(stderr, "%lld:%lld: Invalid XML %s '%s'.\n",
xml.lineNumber(), xml.columnNumber(),
fprintf(stderr, "%lld:%lld: Invalid XML %s '%s'.\n", xml.lineNumber(), xml.columnNumber(),
qPrintable(xml.tokenString()), qPrintable(xml.name().toString()));
exit(EXIT_FAILURE);
}
@ -57,10 +57,11 @@ static QVariantList listFromXml(QXmlStreamReader &xml, Converter::Options option
return list;
}
static VariantOrderedMap::value_type mapEntryFromXml(QXmlStreamReader &xml, Converter::Options options)
static VariantOrderedMap::value_type mapEntryFromXml(QXmlStreamReader &xml,
Converter::Options options)
{
QVariant key, value;
while (!xml.atEnd() && !(xml.isEndElement() && xml.name() == QLatin1String("entry"))) {
while (!xml.atEnd() && !(xml.isEndElement() && xml.name() == "entry"_L1)) {
xml.readNext();
switch (xml.tokenType()) {
case QXmlStreamReader::StartElement:
@ -89,8 +90,7 @@ static VariantOrderedMap::value_type mapEntryFromXml(QXmlStreamReader &xml, Conv
break;
}
fprintf(stderr, "%lld:%lld: Invalid XML %s '%s'.\n",
xml.lineNumber(), xml.columnNumber(),
fprintf(stderr, "%lld:%lld: Invalid XML %s '%s'.\n", xml.lineNumber(), xml.columnNumber(),
qPrintable(xml.tokenString()), qPrintable(xml.name().toString()));
exit(EXIT_FAILURE);
}
@ -103,11 +103,11 @@ static QVariant mapFromXml(QXmlStreamReader &xml, Converter::Options options)
QVariantMap map1;
VariantOrderedMap map2;
while (!xml.atEnd() && !(xml.isEndElement() && xml.name() == QLatin1String("map"))) {
while (!xml.atEnd() && !(xml.isEndElement() && xml.name() == "map"_L1)) {
xml.readNext();
switch (xml.tokenType()) {
case QXmlStreamReader::StartElement:
if (xml.name() == QLatin1String("entry")) {
if (xml.name() == "entry"_L1) {
auto pair = mapEntryFromXml(xml, options);
if (options & Converter::SupportsArbitraryMapKeys)
map2.append(pair);
@ -134,8 +134,7 @@ static QVariant mapFromXml(QXmlStreamReader &xml, Converter::Options options)
break;
}
fprintf(stderr, "%lld:%lld: Invalid XML %s '%s'.\n",
xml.lineNumber(), xml.columnNumber(),
fprintf(stderr, "%lld:%lld: Invalid XML %s '%s'.\n", xml.lineNumber(), xml.columnNumber(),
qPrintable(xml.tokenString()), qPrintable(xml.name().toString()));
exit(EXIT_FAILURE);
}
@ -149,18 +148,18 @@ static QVariant mapFromXml(QXmlStreamReader &xml, Converter::Options options)
static QVariant variantFromXml(QXmlStreamReader &xml, Converter::Options options)
{
QStringView name = xml.name();
if (name == QLatin1String("list"))
if (name == "list"_L1)
return listFromXml(xml, options);
if (name == QLatin1String("map"))
if (name == "map"_L1)
return mapFromXml(xml, options);
if (name != QLatin1String("value")) {
if (name != "value"_L1) {
fprintf(stderr, "%lld:%lld: Invalid XML key '%s'.\n",
xml.lineNumber(), xml.columnNumber(), qPrintable(name.toString()));
exit(EXIT_FAILURE);
}
QXmlStreamAttributes attrs = xml.attributes();
QStringView type = attrs.value(QLatin1String("type"));
QStringView type = attrs.value("type"_L1);
forever {
xml.readNext();
@ -169,8 +168,7 @@ static QVariant variantFromXml(QXmlStreamReader &xml, Converter::Options options
if (xml.isCDATA() || xml.isCharacters() || xml.isEndElement())
break;
fprintf(stderr, "%lld:%lld: Invalid XML %s '%s'.\n",
xml.lineNumber(), xml.columnNumber(),
fprintf(stderr, "%lld:%lld: Invalid XML %s '%s'.\n", xml.lineNumber(), xml.columnNumber(),
qPrintable(xml.tokenString()), qPrintable(name.toString()));
exit(EXIT_FAILURE);
}
@ -180,45 +178,45 @@ static QVariant variantFromXml(QXmlStreamReader &xml, Converter::Options options
text = text.trimmed();
QVariant result;
bool ok;
if (type.isEmpty()) {
// ok
} else if (type == QLatin1String("number")) {
} else if (type == "number"_L1) {
// try integer first
bool ok;
qint64 v = text.toLongLong(&ok);
if (ok) {
result = v;
} else {
// let's see floating point
double d = text.toDouble(&ok);
result = d;
if (!ok) {
fprintf(stderr, "%lld:%lld: Invalid XML: could not interpret '%s' as a number.\n",
xml.lineNumber(), xml.columnNumber(), qPrintable(text.toString()));
exit(EXIT_FAILURE);
}
result = d;
}
} else if (type == QLatin1String("bytes")) {
} else if (type == "bytes"_L1) {
QByteArray data = text.toLatin1();
QStringView encoding = attrs.value("encoding");
if (encoding == QLatin1String("base64url")) {
if (encoding == "base64url"_L1) {
result = QByteArray::fromBase64(data, QByteArray::Base64UrlEncoding);
} else if (encoding == QLatin1String("hex")) {
} else if (encoding == "hex"_L1) {
result = QByteArray::fromHex(data);
} else if (encoding.isEmpty() || encoding == QLatin1String("base64")) {
} else if (encoding.isEmpty() || encoding == "base64"_L1) {
result = QByteArray::fromBase64(data);
} else {
fprintf(stderr, "%lld:%lld: Invalid XML: unknown encoding '%s' for bytes.\n",
xml.lineNumber(), xml.columnNumber(), qPrintable(encoding.toString()));
exit(EXIT_FAILURE);
}
} else if (type == QLatin1String("string")) {
} else if (type == "string"_L1) {
result = text.toString();
} else if (type == QLatin1String("null")) {
} else if (type == "null"_L1) {
result = QVariant::fromValue(nullptr);
} else if (type == QLatin1String("CBOR simple type")) {
} else if (type == "CBOR simple type"_L1) {
result = QVariant::fromValue(QCborSimpleType(text.toShort()));
} else if (type == QLatin1String("bits")) {
} else if (type == "bits"_L1) {
QBitArray ba;
ba.resize(text.size());
qsizetype n = 0;
@ -238,13 +236,13 @@ static QVariant variantFromXml(QXmlStreamReader &xml, Converter::Options options
result = ba;
} else {
int id = QMetaType::UnknownType;
if (type == QLatin1String("datetime"))
if (type == "datetime"_L1)
id = QMetaType::QDateTime;
else if (type == QLatin1String("url"))
else if (type == "url"_L1)
id = QMetaType::QUrl;
else if (type == QLatin1String("uuid"))
else if (type == "uuid"_L1)
id = QMetaType::QUuid;
else if (type == QLatin1String("regex"))
else if (type == "regex"_L1)
id = QMetaType::QRegularExpression;
else
id = QMetaType::fromName(type.toLatin1()).id();
@ -267,8 +265,7 @@ static QVariant variantFromXml(QXmlStreamReader &xml, Converter::Options options
} while (xml.isComment() || xml.isWhitespace());
if (!xml.isEndElement()) {
fprintf(stderr, "%lld:%lld: Invalid XML %s '%s'.\n",
xml.lineNumber(), xml.columnNumber(),
fprintf(stderr, "%lld:%lld: Invalid XML %s '%s'.\n", xml.lineNumber(), xml.columnNumber(),
qPrintable(xml.tokenString()), qPrintable(name.toString()));
exit(EXIT_FAILURE);
}
@ -287,9 +284,9 @@ static void variantToXml(QXmlStreamWriter &xml, const QVariant &v)
variantToXml(xml, v);
xml.writeEndElement();
} else if (type == QMetaType::QVariantMap || type == qMetaTypeId<VariantOrderedMap>()) {
const VariantOrderedMap map = (type == QMetaType::QVariantMap) ?
VariantOrderedMap(v.toMap()) :
qvariant_cast<VariantOrderedMap>(v);
const VariantOrderedMap map = (type == QMetaType::QVariantMap)
? VariantOrderedMap(v.toMap())
: qvariant_cast<VariantOrderedMap>(v);
xml.writeStartElement("map");
for (const auto &pair : map) {
@ -301,7 +298,7 @@ static void variantToXml(QXmlStreamWriter &xml, const QVariant &v)
xml.writeEndElement();
} else {
xml.writeStartElement("value");
QString typeString = QStringLiteral("type");
QString typeString = "type"_L1;
switch (type) {
case QMetaType::Short:
case QMetaType::UShort:
@ -399,37 +396,37 @@ static void variantToXml(QXmlStreamWriter &xml, const QVariant &v)
}
}
QString XmlConverter::name()
QString XmlConverter::name() const
{
return QStringLiteral("xml");
return "xml"_L1;
}
Converter::Direction XmlConverter::directions()
Converter::Directions XmlConverter::directions() const
{
return InOut;
return Direction::InOut;
}
Converter::Options XmlConverter::outputOptions()
Converter::Options XmlConverter::outputOptions() const
{
return SupportsArbitraryMapKeys;
}
const char *XmlConverter::optionsHelp()
const char *XmlConverter::optionsHelp() const
{
return xmlOptionHelp;
}
bool XmlConverter::probeFile(QIODevice *f)
bool XmlConverter::probeFile(QIODevice *f) const
{
if (QFile *file = qobject_cast<QFile *>(f)) {
if (file->fileName().endsWith(QLatin1String(".xml")))
if (file->fileName().endsWith(".xml"_L1))
return true;
}
return f->isReadable() && f->peek(5) == "<?xml";
}
QVariant XmlConverter::loadFile(QIODevice *f, Converter *&outputConverter)
QVariant XmlConverter::loadFile(QIODevice *f, const Converter *&outputConverter) const
{
if (!outputConverter)
outputConverter = this;
@ -445,13 +442,14 @@ QVariant XmlConverter::loadFile(QIODevice *f, Converter *&outputConverter)
return v;
}
void XmlConverter::saveFile(QIODevice *f, const QVariant &contents, const QStringList &options)
void XmlConverter::saveFile(QIODevice *f, const QVariant &contents,
const QStringList &options) const
{
bool compact = false;
for (const QString &s : options) {
if (s == QLatin1String("compact=no")) {
if (s == "compact=no"_L1) {
compact = false;
} else if (s == QLatin1String("compact=yes")) {
} else if (s == "compact=yes"_L1) {
compact = true;
} else {
fprintf(stderr, "Unknown option '%s' to XML output. Valid options are:\n%s",

View File

@ -10,13 +10,14 @@ class XmlConverter : public Converter
{
// Converter interface
public:
QString name() override;
Direction directions() override;
Options outputOptions() override;
const char *optionsHelp() override;
bool probeFile(QIODevice *f) override;
QVariant loadFile(QIODevice *f, Converter *&outputConverter) override;
void saveFile(QIODevice *f, const QVariant &contents, const QStringList &options) override;
QString name() const override;
Directions directions() const override;
Options outputOptions() const override;
const char *optionsHelp() const override;
bool probeFile(QIODevice *f) const override;
QVariant loadFile(QIODevice *f, const Converter *&outputConverter) const override;
void saveFile(QIODevice *f, const QVariant &contents,
const QStringList &options) const override;
};
#endif // XMLCONVERTER_H

View File

@ -4,6 +4,10 @@
cmake_minimum_required(VERSION 3.16)
project(savegame LANGUAGES CXX)
if (ANDROID)
message(FATAL_ERROR "This project cannot be built on Android.")
endif()
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()

View File

@ -6,15 +6,10 @@
#include <QMetaEnum>
#include <QTextStream>
Character::Character()
= default;
Character::Character() = default;
Character::Character(const QString &name,
int level,
Character::ClassType classType) :
mName(name),
mLevel(level),
mClassType(classType)
Character::Character(const QString &name, int level, Character::ClassType classType)
: mName(name), mLevel(level), mClassType(classType)
{
}

View File

@ -16,9 +16,7 @@ class Character
Q_GADGET
public:
enum ClassType {
Warrior, Mage, Archer
};
enum ClassType { Warrior, Mage, Archer };
Q_ENUM(ClassType)
Character();
@ -37,6 +35,7 @@ public:
QJsonObject toJson() const;
void print(QTextStream &s, int indentation = 0) const;
private:
QString mName;
int mLevel = 0;

View File

@ -3,7 +3,7 @@
/*!
\example serialization/savegame
\examplecategory {Input/Output}
\examplecategory {Data Processing & I/O}
\title JSON Save Game Example
\brief The JSON Save Game example demonstrates how to save and load a

View File

@ -11,6 +11,8 @@
#include <QRandomGenerator>
#include <QTextStream>
using namespace Qt::StringLiterals;
Character Game::player() const
{
return mPlayer;
@ -25,37 +27,32 @@ QList<Level> Game::levels() const
void Game::newGame()
{
mPlayer = Character();
mPlayer.setName(QStringLiteral("Hero"));
mPlayer.setName("Hero"_L1);
mPlayer.setClassType(Character::Archer);
mPlayer.setLevel(QRandomGenerator::global()->bounded(15, 21));
mLevels.clear();
mLevels.reserve(2);
Level village(QStringLiteral("Village"));
Level village("Village"_L1);
QList<Character> villageNpcs;
villageNpcs.reserve(2);
villageNpcs.append(Character(QStringLiteral("Barry the Blacksmith"),
QRandomGenerator::global()->bounded(8, 11),
Character::Warrior));
villageNpcs.append(Character(QStringLiteral("Terry the Trader"),
QRandomGenerator::global()->bounded(6, 8),
Character::Warrior));
villageNpcs.append(Character("Barry the Blacksmith"_L1,
QRandomGenerator::global()->bounded(8, 11), Character::Warrior));
villageNpcs.append(Character("Terry the Trader"_L1,
QRandomGenerator::global()->bounded(6, 8), Character::Warrior));
village.setNpcs(villageNpcs);
mLevels.append(village);
Level dungeon(QStringLiteral("Dungeon"));
Level dungeon("Dungeon"_L1);
QList<Character> dungeonNpcs;
dungeonNpcs.reserve(3);
dungeonNpcs.append(Character(QStringLiteral("Eric the Evil"),
QRandomGenerator::global()->bounded(18, 26),
Character::Mage));
dungeonNpcs.append(Character(QStringLiteral("Eric's Left Minion"),
QRandomGenerator::global()->bounded(5, 7),
Character::Warrior));
dungeonNpcs.append(Character(QStringLiteral("Eric's Right Minion"),
QRandomGenerator::global()->bounded(4, 9),
Character::Warrior));
dungeonNpcs.append(Character("Eric the Evil"_L1,
QRandomGenerator::global()->bounded(18, 26), Character::Mage));
dungeonNpcs.append(Character("Eric's Left Minion"_L1,
QRandomGenerator::global()->bounded(5, 7), Character::Warrior));
dungeonNpcs.append(Character("Eric's Right Minion"_L1,
QRandomGenerator::global()->bounded(4, 9), Character::Warrior));
dungeon.setNpcs(dungeonNpcs);
mLevels.append(dungeon);
}
@ -64,9 +61,7 @@ void Game::newGame()
//! [loadGame]
bool Game::loadGame(Game::SaveFormat saveFormat)
{
QFile loadFile(saveFormat == Json
? QStringLiteral("save.json")
: QStringLiteral("save.dat"));
QFile loadFile(saveFormat == Json ? "save.json"_L1 : "save.dat"_L1);
if (!loadFile.open(QIODevice::ReadOnly)) {
qWarning("Couldn't open save file.");
@ -76,15 +71,13 @@ bool Game::loadGame(Game::SaveFormat saveFormat)
QByteArray saveData = loadFile.readAll();
QJsonDocument loadDoc(saveFormat == Json
? QJsonDocument::fromJson(saveData)
: QJsonDocument(QCborValue::fromCbor(saveData).toMap().toJsonObject()));
? QJsonDocument::fromJson(saveData)
: QJsonDocument(QCborValue::fromCbor(saveData).toMap().toJsonObject()));
read(loadDoc.object());
QTextStream(stdout) << "Loaded save for "
<< loadDoc["player"]["name"].toString()
<< " using "
<< (saveFormat != Json ? "CBOR" : "JSON") << "...\n";
QTextStream(stdout) << "Loaded save for " << loadDoc["player"]["name"].toString()
<< " using " << (saveFormat != Json ? "CBOR" : "JSON") << "...\n";
return true;
}
//! [loadGame]
@ -92,9 +85,7 @@ bool Game::loadGame(Game::SaveFormat saveFormat)
//! [saveGame]
bool Game::saveGame(Game::SaveFormat saveFormat) const
{
QFile saveFile(saveFormat == Json
? QStringLiteral("save.json")
: QStringLiteral("save.dat"));
QFile saveFile(saveFormat == Json ? "save.json"_L1 : "save.dat"_L1);
if (!saveFile.open(QIODevice::WriteOnly)) {
qWarning("Couldn't open save file.");
@ -102,9 +93,8 @@ bool Game::saveGame(Game::SaveFormat saveFormat) const
}
QJsonObject gameObject = toJson();
saveFile.write(saveFormat == Json
? QJsonDocument(gameObject).toJson()
: QCborValue::fromJsonValue(gameObject).toCbor());
saveFile.write(saveFormat == Json ? QJsonDocument(gameObject).toJson()
: QCborValue::fromJsonValue(gameObject).toCbor());
return true;
}

View File

@ -16,9 +16,7 @@ QT_FORWARD_DECLARE_CLASS(QTextStream)
class Game
{
public:
enum SaveFormat {
Json, Binary
};
enum SaveFormat { Json, Binary };
Character player() const;
QList<Level> levels() const;
@ -31,6 +29,7 @@ public:
QJsonObject toJson() const;
void print(QTextStream &s, int indentation = 0) const;
private:
Character mPlayer;
QList<Level> mLevels;

View File

@ -6,9 +6,7 @@
#include <QJsonArray>
#include <QTextStream>
Level::Level(const QString &name) : mName(name)
{
}
Level::Level(const QString &name) : mName(name) { }
QString Level::name() const
{
@ -61,8 +59,7 @@ void Level::print(QTextStream &s, int indentation) const
{
const QString indent(indentation * 2, ' ');
s << indent << "Name:\t" << mName << "\n"
<< indent << "NPCs:\n";
s << indent << "Name:\t" << mName << "\n" << indent << "NPCs:\n";
for (const Character &character : mNpcs)
character.print(s, indentation + 1);
}

View File

@ -27,6 +27,7 @@ public:
QJsonObject toJson() const;
void print(QTextStream &s, int indentation = 0) const;
private:
QString mName;
QList<Character> mNpcs;

View File

@ -6,6 +6,4 @@ SUBDIRS = \
qtHaveModule(widgets) {
SUBDIRS += streambookmarks
qtHaveModule(network): SUBDIRS += \
rsslisting
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Some files were not shown because too many files have changed in this diff Show More